当前位置: 首页>>代码示例>>Java>>正文


Java WinBase.SECURITY_ATTRIBUTES属性代码示例

本文整理汇总了Java中com.sun.jna.platform.win32.WinBase.SECURITY_ATTRIBUTES属性的典型用法代码示例。如果您正苦于以下问题:Java WinBase.SECURITY_ATTRIBUTES属性的具体用法?Java WinBase.SECURITY_ATTRIBUTES怎么用?Java WinBase.SECURITY_ATTRIBUTES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.jna.platform.win32.WinBase的用法示例。


在下文中一共展示了WinBase.SECURITY_ATTRIBUTES属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processMessage

private LRESULT processMessage(HWND hwnd, WPARAM wParam, LPARAM lParam) {
    WinBase.SECURITY_ATTRIBUTES psa = null;
    String mapname = readFileNameFromInput(lParam);
    sharedFile
            = libK.CreateFileMapping(WinBase.INVALID_HANDLE_VALUE,
                    psa,
                    WinNT.PAGE_READWRITE,
                    0,
                    8192, // AGENT_MAX_MSGLEN
                    mapname);

    sharedMemory
            = Kernel32.INSTANCE.MapViewOfFile(sharedFile,
                    WinNT.SECTION_MAP_WRITE,
                    0, 0, 0);

    int ret = answerIfDevicePresent(sharedMemory);
    disconnectFromSharedMemory();

    return new LRESULT(ret);
}
 
开发者ID:martin-lizner,项目名称:trezor-ssh-agent,代码行数:21,代码来源:SSHAgent.java

示例2: CreateFile

WinNT.HANDLE CreateFile(
String lpFileName,
int dwDesiredAccess,
int dwShareMode,
WinBase.SECURITY_ATTRIBUTES lpSecurityAttributes,
int dwCreationDisposition,
int dwFlagsAndAttributes,
WinNT.HANDLE hTemplateFile);
 
开发者ID:facebook,项目名称:buck,代码行数:8,代码来源:WindowsNamedPipeLibrary.java

示例3: startWithLogon

public void startWithLogon(final String cmd[] // can be null 
) throws IOException {
    // Merge the command array into a single string
    final String lpCommandLine = this.internalMergeCommand(cmd);

    try {

        // Fill the security attributes
        final WinBase.SECURITY_ATTRIBUTES sa = new WinBase.SECURITY_ATTRIBUTES();
        sa.lpSecurityDescriptor = null;
        sa.bInheritHandle = true;// true otherwise streams are not piped		
        sa.write();

        // Create pipes
        if (!(Kernel32.INSTANCE.CreatePipe(this.inRead, this.inWrite, sa, 0) &&
            Kernel32.INSTANCE.CreatePipe(this.outRead, this.outWrite, sa, 0) && Kernel32.INSTANCE
                .CreatePipe(this.errRead, this.errWrite, sa, 0))) {
            throw win32ErrorIOException("CreatePipe");
        }

        final WinBase.STARTUPINFO si = new WinBase.STARTUPINFO();
        si.dwFlags = WinBase.STARTF_USESHOWWINDOW | WinBase.STARTF_USESTDHANDLES;
        si.hStdInput = this.inRead.getValue();
        si.hStdOutput = this.outWrite.getValue();
        si.hStdError = this.errWrite.getValue();
        si.wShowWindow = new WinDef.WORD(0); // SW_HIDE
        si.write();

        final WinBase.PROCESS_INFORMATION pi = new WinBase.PROCESS_INFORMATION();

        /////////////////////////////////////////////////////////////////////////////////////
        // CreateProcessWithLogonW cannot be used since its parent process is svchost.exe and
        // it breaks away from ProActive Agent job object.
        /////////////////////////////////////////////////////////////////////////////////////

        boolean result = MyAdvapi.INSTANCE.CreateProcessWithLogonW(
        /* String */this.user, this.domain, this.password,
        /* int */MyAdvapi.LOGON_WITH_PROFILE, // load user profile
                /* String */null, // The name of the module to be executed
                /* String */lpCommandLine, // The command line to be executed 
                /* int */WinBase.CREATE_NO_WINDOW | WinBase.CREATE_UNICODE_ENVIRONMENT, // creation flags
                /* String */null, // the new process uses an environment created from the profile of the user
                /* String */null, // the new process has the same current drive and directory as the calling process
                /* WinBase.STARTUPINFO */si, // pointer to STARTUPINFO or STARTUPINFOEX structure
                /* WinBase.PROCESS_INFORMATION */pi); // pointer to PROCESS_FORMATION structure

        if (!result) {
            throw win32ErrorIOException("CreateProcessWithLogon");
        }

        Kernel32.INSTANCE.CloseHandle(pi.hThread);
        this.pid = pi.dwProcessId.intValue();
        this.handle = pi.hProcess;

        // Connect java-side streams
        this.internalConnectStreams();
    } catch (Exception ex) {
        // Clean up the parent's side of the pipes in case of failure only
        closeSafely(this.inWrite);
        closeSafely(this.outRead);
        closeSafely(this.errRead);

        // If rethrow the internal IOException 
        if (ex instanceof IOException) {
            throw (IOException) ex;
        } else {
            throw new IOException(ex);
        }
    } finally {
        // Always clean up the child's side of the pipes
        closeSafely(this.inRead);
        closeSafely(this.outWrite);
        closeSafely(this.errWrite);
    }
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:75,代码来源:WindowsProcess.java

示例4: CreateNamedPipeA

WinNT.HANDLE CreateNamedPipeA(String lpName,
int dwOpenMode,
int dwPipeMode,
int nMaxInstances,
int nOutBufferSize,
int nInBufferSize,
int nDefaultTimeout,
WinBase.SECURITY_ATTRIBUTES securityAttributes);
 
开发者ID:traff,项目名称:pty4j,代码行数:8,代码来源:WinPty.java

示例5: CreateEvent

WinNT.HANDLE CreateEvent(
WinBase.SECURITY_ATTRIBUTES lpEventAttributes,
boolean bManualReset,
boolean bInitialState,
String lpName);
 
开发者ID:facebook,项目名称:buck,代码行数:5,代码来源:WindowsNamedPipeLibrary.java

示例6: DuplicateTokenEx

/**
 * The DuplicateTokenEx function creates a new access token that duplicates
 * an existing token. This function can create either a primary token or an
 * impersonation token.
 *
 * @param hExistingToken
 *            A handle to an access token opened with TOKEN_DUPLICATE
 *            access.
 * @param dwDesiredAccess
 *            Specifies the requested access rights for the new token.
 * @param lpTokenAttributes
 *            A pointer to a SECURITY_ATTRIBUTES structure that specifies a
 *            security descriptor for the new token and determines whether
 *            child processes can inherit the token.
 * @param ImpersonationLevel
 *            Specifies a value from the SECURITY_IMPERSONATION_LEVEL
 *            enumeration that indicates the impersonation level of the new
 *            token.
 * @param TokenType
 *            Specifies one of the following values from the TOKEN_TYPE
 *            enumeration.
 * @param phNewToken
 *            A pointer to a HANDLE variable that receives the new token.
 * @return If the function succeeds, the function returns a nonzero value.
 *         If the function fails, it returns zero. To get extended error
 *         information, call GetLastError.
 */
public boolean DuplicateTokenEx(HANDLE hExistingToken, int dwDesiredAccess,
		WinBase.SECURITY_ATTRIBUTES lpTokenAttributes,
		int ImpersonationLevel, int TokenType, HANDLEByReference phNewToken);
 
开发者ID:yajsw,项目名称:yajsw,代码行数:30,代码来源:Advapi32.java

示例7: CreateProcess

public boolean CreateProcess(String lpApplicationName, String lpCommandLine, WinBase.SECURITY_ATTRIBUTES lpProcessAttributes, WinBase.SECURITY_ATTRIBUTES lpThreadAttributes, WinDef.BOOL bInheritHandles, WinDef.DWORD dwCreationFlags, Pointer lpEnvironment, String lpCurrentDirectory, WinBase.STARTUPINFO lpStartupInfo, WinBase.PROCESS_INFORMATION lpProcessInformation); 
开发者ID:vanjadardic,项目名称:KiTTY2,代码行数:1,代码来源:Kernel32.java

示例8: CreateEventA

WinNT.HANDLE CreateEventA(WinBase.SECURITY_ATTRIBUTES lpEventAttributes, boolean bManualReset, boolean bInitialState, String lpName); 
开发者ID:traff,项目名称:pty4j,代码行数:1,代码来源:WinPty.java


注:本文中的com.sun.jna.platform.win32.WinBase.SECURITY_ATTRIBUTES属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。