Java 类com.sun.jna.platform.win32.WinBase 实例源码

项目:IO    文件:DeviceManager.java   
private long getDiskSize(Disk disk) {
    long result = -1l;
    Kernel32 kernel32 = Kernel32.INSTANCE;
    HANDLE diskHandle = kernel32.CreateFile(disk.path, WinNT.GENERIC_READ, WinNT.FILE_SHARE_READ, null,
            WinNT.OPEN_EXISTING, WinNT.FILE_ATTRIBUTE_NORMAL, null);
    if (WinBase.INVALID_HANDLE_VALUE.equals(diskHandle)) {
        return result;
    }
    try {
        Memory output = new Memory(Native.getNativeSize(LARGE_INTEGER.class));
        IntByReference lpBytes = new IntByReference();
        boolean success = kernel32.DeviceIoControl(diskHandle,
                WinioctlUtil.CTL_CODE(Winioctl.FILE_DEVICE_DISK, 0x17, Winioctl.METHOD_BUFFERED,
                        Winioctl.FILE_READ_ACCESS),
                null, 0, output, Native.getNativeSize(LARGE_INTEGER.class), lpBytes, null);
        // TODO: Check success?
        result = output.getLong(0);
    }
    finally {
        Kernel32Util.closeHandle(diskHandle);
    }
    return result;
}
项目:yajsw    文件:WindowsXPSystemInformation.java   
private void calc()
{
    if (System.currentTimeMillis() - _lastCall < 500)
        return;
    WinBase.MEMORYSTATUSEX lpBuffer = new WinBase.MEMORYSTATUSEX();
    lpBuffer.dwLength = new DWORD(lpBuffer.size());
    if (Kernel32.INSTANCE.GlobalMemoryStatusEx(lpBuffer))
    {
        lpBuffer.read();
        _freeRAM = lpBuffer.ullAvailPhys.longValue();
        _totalRAM = lpBuffer.ullTotalPhys.longValue();
        _lastCall = System.currentTimeMillis();
    }
    else
    {
        if (_logger != null)
            _logger.severe("ERROR: could not read free/total RAM");
        else
            System.out.println("ERROR: could not read free/total RAM");
    }

}
项目:trezor-ssh-agent    文件:SSHAgent.java   
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);
}
项目:intellij-ce-playground    文件:NativeFileManager.java   
public boolean terminate() {
  Kernel32.HANDLE process = Kernel32.INSTANCE.OpenProcess(WinNT.PROCESS_TERMINATE | WinNT.SYNCHRONIZE, false, pid);
  if (process.getPointer() == null) {
    Runner.logger.warn("Unable to find process " + name + "(" + pid + ")");
    return false;
  } else {
    Kernel32.INSTANCE.TerminateProcess(process, 1);
    int wait = Kernel32.INSTANCE.WaitForSingleObject(process, 1000);
    if (wait != WinBase.WAIT_OBJECT_0) {
      Runner.logger.warn("Timed out while waiting for process " + name + "(" + pid + ") to end");
      return false;
    }
    Kernel32.INSTANCE.CloseHandle(process);
    return true;
  }
}
项目:mmf4j    文件:MemoryMapWindows.java   
@Override
protected void _truncateFile(long size) throws IOException {
    // TODO Handle lp of size
    int resSFP = MMFKernel32.INSTANCE.SetFilePointer(file, size, Pointer.NULL, 1);
    if (WinBase.INVALID_SET_FILE_POINTER == resSFP) {
        throw new IOException("INVALID_SET_FILE_POINTER: " + Kernel32.INSTANCE.GetLastError());
    }

    Kernel32.INSTANCE.CloseHandle(mapping);
    mapping = null;

    boolean resSEOF = MMFKernel32.INSTANCE.SetEndOfFile(file);
    if (!resSEOF) {
        throw new IOException(
            "Unable to SetEndOfFile: " + getLastErrorAsString());
    }
}
项目:jpexs-decompiler    文件:Win32ProcessTools.java   
public static List<MEMORY_BASIC_INFORMATION> getPageRanges(WinNT.HANDLE hOtherProcess) {
    List<MEMORY_BASIC_INFORMATION> ret = new ArrayList<>();
    MEMORY_BASIC_INFORMATION mbi;
    WinBase.SYSTEM_INFO si = new WinBase.SYSTEM_INFO();
    Kernel32.INSTANCE.GetSystemInfo(si);
    Pointer lpMem = si.lpMinimumApplicationAddress;
    while (pointerToAddress(lpMem) < pointerToAddress(si.lpMaximumApplicationAddress)) {
        mbi = new MEMORY_BASIC_INFORMATION();
        BaseTSD.SIZE_T t = Kernel32.INSTANCE.VirtualQueryEx(hOtherProcess, lpMem, mbi, new BaseTSD.SIZE_T(mbi.size()));
        if (t.longValue() == 0) {
            Logger.getLogger(Win32ProcessTools.class.getName()).log(Level.SEVERE, "Cannot get page ranges. Last error:" + Kernel32.INSTANCE.GetLastError());
            break;
        }
        ret.add(mbi);
        lpMem = new Pointer(pointerToAddress(mbi.baseAddress) + mbi.regionSize.longValue());
    }
    return ret;
}
项目:pty4j    文件:CygwinPtyProcess.java   
public CygwinPtyProcess(String[] command, Map<String, String> environment, String workingDirectory, File logFile, boolean console)
  throws IOException {
  String pipePrefix = String.format("\\\\.\\pipe\\cygwinpty-%d-%d-", KERNEL32.GetCurrentProcessId(), processCounter.getAndIncrement());
  String inPipeName = pipePrefix + "in";
  String outPipeName = pipePrefix + "out";
  String errPipeName = pipePrefix + "err";

  myInputHandle = KERNEL32.CreateNamedPipeA(inPipeName, PIPE_ACCESS_OUTBOUND | WinNT.FILE_FLAG_OVERLAPPED, 0, 1, 0, 0, 0, null);
  myOutputHandle = KERNEL32.CreateNamedPipeA(outPipeName, PIPE_ACCESS_INBOUND | WinNT.FILE_FLAG_OVERLAPPED, 0, 1, 0, 0, 0, null);
  myErrorHandle =
    console ? KERNEL32.CreateNamedPipeA(errPipeName, PIPE_ACCESS_INBOUND | WinNT.FILE_FLAG_OVERLAPPED, 0, 1, 0, 0, 0, null) : null;

  if (myInputHandle == WinBase.INVALID_HANDLE_VALUE ||
      myOutputHandle == WinBase.INVALID_HANDLE_VALUE ||
      myErrorHandle == WinBase.INVALID_HANDLE_VALUE) {
    closeHandles();
    throw new IOException("Unable to create a named pipe");
  }

  myInputPipe = new NamedPipe(myInputHandle, false);
  myOutputPipe = new NamedPipe(myOutputHandle, false);
  myErrorPipe = myErrorHandle != null ? new NamedPipe(myErrorHandle, false) : null;

  myProcess = startProcess(inPipeName, outPipeName, errPipeName, workingDirectory, command, environment, logFile, console);
}
项目:yajsw    文件:Registry.java   
/**
 * Get all sub keys of a key.
 * 
 * @param rootKey
 *            root key
 * @param parent
 *            key name
 * @return array with all sub key names
 */
public static String[] getSubKeys(REGISTRY_ROOT_KEY rootKey, String parent)
{
    Advapi32 advapi32;
    HKEY handle = null;
    int dwIndex;
    char[] lpName;
    IntByReference lpcName;
    WinBase.FILETIME lpftLastWriteTime;
    TreeSet<String> subKeys = new TreeSet<String>();

    advapi32 = Advapi32.INSTANCE;
    handle = openKey(rootKey, parent, WinNT.KEY_READ);
    lpName = new char[256];
    lpcName = new IntByReference(256);
    lpftLastWriteTime = new WinNT.FILETIME();

    if (handle != null)
    {
        dwIndex = 0;

        while (advapi32.RegEnumKeyEx(handle, dwIndex, lpName, lpcName, null, null, null, lpftLastWriteTime) == WINERROR.ERROR_SUCCESS)
        {
            subKeys.add(new String(lpName, 0, lpcName.getValue()));
            lpcName.setValue(256);
            dwIndex++;
        }
        advapi32.RegCloseKey(handle);
    }

    return (subKeys.toArray(new String[]
    {}));
}
项目:gw2route    文件:GPS.java   
public GPS(CefBrowser pBrowser, Option pOptions)
{
    this.sharedFile = Kernel32.INSTANCE.CreateFileMapping(
            WinBase.INVALID_HANDLE_VALUE, null, WinNT.PAGE_EXECUTE_READWRITE, 0, MEM_MAP_SIZE, MEM_MAP_NAME);
    this.sharedMemory = Kernel32.INSTANCE.MapViewOfFile(
            this.sharedFile, WinNT.SECTION_MAP_READ, 0, 0, MEM_MAP_SIZE);

    this.TheBrowser = pBrowser;
    this.TheOptions = pOptions;
}
项目:Flashtool    文件:JKernel32.java   
public static boolean openDevice() throws IOException {
       /* Kernel32RW.GENERIC_READ | Kernel32RW.GENERIC_WRITE not used in dwDesiredAccess field for system devices such a keyboard or mouse */
       int shareMode = WinNT.FILE_SHARE_READ | WinNT.FILE_SHARE_WRITE;
       int Access = WinNT.GENERIC_WRITE | WinNT.GENERIC_READ;
    HandleToDevice = Kernel32.INSTANCE.CreateFile(
               Devices.getConnectedDeviceWin32().getDevPath(), 
               Access, 
               shareMode, 
               null, 
               WinNT.OPEN_EXISTING, 
               0,//WinNT.FILE_FLAG_OVERLAPPED, 
               (WinNT.HANDLE)null);
    if (HandleToDevice == WinBase.INVALID_HANDLE_VALUE) throw new IOException(getLastError());
    return true;
}
项目:Flashtool    文件:JKernel32.java   
public static boolean openDeviceAsync() throws IOException {
       /* Kernel32RW.GENERIC_READ | Kernel32RW.GENERIC_WRITE not used in dwDesiredAccess field for system devices such a keyboard or mouse */
       int shareMode = WinNT.FILE_SHARE_READ | WinNT.FILE_SHARE_WRITE;
       int Access = WinNT.GENERIC_WRITE | WinNT.GENERIC_READ;
    HandleToDevice = Kernel32.INSTANCE.CreateFile(
               Devices.getConnectedDeviceWin32().getDevPath(), 
               Access, 
               shareMode, 
               null, 
               WinNT.OPEN_EXISTING, 
               WinNT.FILE_FLAG_OVERLAPPED, 
               (WinNT.HANDLE)null);
    if (HandleToDevice == WinBase.INVALID_HANDLE_VALUE) throw new IOException(getLastError());
    return true;
}
项目:Flashtool    文件:JKernel32.java   
public static WinNT.HANDLE createEvent() throws IOException {
    WinNT.HANDLE hevent = kernel32.CreateEvent(null, false, false, null);
    int res = kernel32.GetLastError();
    if (hevent == WinBase.INVALID_HANDLE_VALUE || res!=0)
            throw new IOException(JKernel32.getLastError());
    return hevent;
}
项目:Flashtool    文件:JKernel32.java   
public static boolean closeDevice() {
    boolean result = true;

    if (HandleToDevice != WinBase.INVALID_HANDLE_VALUE) {
        result = kernel32.CloseHandle(HandleToDevice);
    }
    HandleToDevice = WinBase.INVALID_HANDLE_VALUE;
    return result;
}
项目:buck    文件:WindowsNamedPipeLibrary.java   
WinNT.HANDLE CreateFile(
String lpFileName,
int dwDesiredAccess,
int dwShareMode,
WinBase.SECURITY_ATTRIBUTES lpSecurityAttributes,
int dwCreationDisposition,
int dwFlagsAndAttributes,
WinNT.HANDLE hTemplateFile);
项目:proactive-component-monitoring    文件:WindowsProcess.java   
private void internalWaitFor(final int timeoutInMillis) throws InterruptedException {
    final int res = Kernel32.INSTANCE.WaitForSingleObject(this.handle, timeoutInMillis);
    if (res < 0 || res == WinBase.WAIT_FAILED) {
        win32ErrorRuntime("WaitForSingleObject");
    }

    // Check for interruption
    if (Thread.interrupted()) {
        throw new InterruptedException();
    }
}
项目:proactive-component-monitoring    文件:WindowsProcess.java   
/**
 * Returns the exit value for the subprocess.
 *
 * @return  the exit value of the subprocess represented by this 
 *          <code>WindowsProcess</code> object. by convention, the value 
 *          <code>0</code> indicates normal termination.
 * @exception  IllegalThreadStateException  if the subprocess represented 
 *             by this <code>WindowsProcess</code> object has not yet terminated.
 */
public int exitValue() {
    final IntByReference exitCodeRef = new IntByReference();
    // Retrieves the termination status of the specified process        
    boolean success = Kernel32.INSTANCE.GetExitCodeProcess(this.handle, exitCodeRef);
    if (!success) {
        win32ErrorRuntime("GetExitCodeProcess");
    }
    // As said in msdn an application should not use STILL_ACTIVE (259) as an error code    
    int exitCode = exitCodeRef.getValue();
    if (exitCode == WinBase.STILL_ACTIVE) {
        throw new IllegalThreadStateException("process has not exited");
    }
    return exitCode;
}
项目:pty4j    文件:WinPty.java   
WinNT.HANDLE CreateNamedPipeA(String lpName,
int dwOpenMode,
int dwPipeMode,
int nMaxInstances,
int nOutBufferSize,
int nInBufferSize,
int nDefaultTimeout,
WinBase.SECURITY_ATTRIBUTES securityAttributes);
项目:pty4j    文件:CygwinPtyProcess.java   
private static void waitForPipe(WinNT.HANDLE handle) throws IOException {
  WinNT.HANDLE connectEvent = KERNEL32.CreateEventA(null, true, false, null);

  WinBase.OVERLAPPED povl = new WinBase.OVERLAPPED();
  povl.hEvent = connectEvent;

  boolean success = KERNEL32.ConnectNamedPipe(handle, povl);
  if (!success) {
    switch (KERNEL32.GetLastError()) {
      case WinError.ERROR_PIPE_CONNECTED:
        success = true;
        break;
      case WinError.ERROR_IO_PENDING:
        if (KERNEL32.WaitForSingleObject(connectEvent, CONNECT_PIPE_TIMEOUT) != WinBase.WAIT_OBJECT_0) {
          KERNEL32.CancelIo(handle);

          success = false;
        }
        else {
          success = true;
        }

        break;
    }
  }

  KERNEL32.CloseHandle(connectEvent);

  if (!success) throw new IOException("Cannot connect to a named pipe");
}
项目:Flashtool    文件:SetupApi.java   
public SP_DRVINFO_DATA() {
    DriverDate = new WinBase.FILETIME();
}
项目:buck    文件:WindowsNamedPipeLibrary.java   
WinNT.HANDLE CreateEvent(
WinBase.SECURITY_ATTRIBUTES lpEventAttributes,
boolean bManualReset,
boolean bInitialState,
String lpName);
项目:buck    文件:WindowsNamedPipe.java   
private static WinBase.OVERLAPPED createOverlapped(WinNT.HANDLE event) {
  WinBase.OVERLAPPED olap = new WinBase.OVERLAPPED();
  olap.hEvent = event;
  olap.write();
  return olap;
}
项目:proactive-component-monitoring    文件:WindowsProcess.java   
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);
    }
}
项目:yajsw    文件:Advapi32.java   
/**
 * The RegQueryInfoKey function retrieves information about the specified
 * registry key.
 *
 * @param hKey
 *            A handle to an open key. The key must have been opened with
 *            the KEY_QUERY_VALUE access right.
 * @param lpClass
 *            A pointer to a buffer that receives the null-terminated class
 *            string of the key. This parameter can be ignored. This
 *            parameter can be NULL.
 * @param lpcClass
 *            A pointer to a variable that specifies the size of the buffer
 *            pointed to by the lpClass parameter, in characters.
 * @param lpReserved
 *            Reserved; must be NULL.
 * @param lpcSubKeys
 *            A pointer to a variable that receives the number of subkeys
 *            that are contained by the specified key. This parameter can be
 *            NULL.
 * @param lpcMaxSubKeyLen
 *            A pointer to a variable that receives the size of the key's
 *            subkey with the longest name, in characters, not including the
 *            terminating null character. This parameter can be NULL.
 * @param lpcMaxClassLen
 *            A pointer to a variable that receives the size of the longest
 *            string that specifies a subkey class, in characters. The count
 *            returned does not include the terminating null character. This
 *            parameter can be NULL.
 * @param lpcValues
 *            A pointer to a variable that receives the number of values
 *            that are associated with the key. This parameter can be NULL.
 * @param lpcMaxValueNameLen
 *            A pointer to a variable that receives the size of the key's
 *            longest value name, in characters. The size does not include
 *            the terminating null character. This parameter can be NULL.
 * @param lpcMaxValueLen
 *            A pointer to a variable that receives the size of the longest
 *            data component among the key's values, in bytes. This
 *            parameter can be NULL.
 * @param lpcbSecurityDescriptor
 *            A pointer to a variable that receives the size of the key's
 *            security descriptor, in bytes. This parameter can be NULL.
 * @param lpftLastWriteTime
 *            A pointer to a FILETIME structure that receives the last write
 *            time. This parameter can be NULL.
 * @return If the function succeeds, the return value is ERROR_SUCCESS. If
 *         the function fails, the return value is a nonzero error code
 *         defined in Winerror.h.
 */
public int RegQueryInfoKey(HKEY hKey, char[] lpClass,
        IntByReference lpcClass, IntByReference lpReserved,
        IntByReference lpcSubKeys, IntByReference lpcMaxSubKeyLen,
        IntByReference lpcMaxClassLen, IntByReference lpcValues,
        IntByReference lpcMaxValueNameLen, IntByReference lpcMaxValueLen,
        IntByReference lpcbSecurityDescriptor,
        WinBase.FILETIME lpftLastWriteTime);
项目:yajsw    文件:Advapi32.java   
/**
 * Creates a new process and its primary thread. The new process runs in the
 * security context of the user represented by the specified token.
 *
 * Typically, the process that calls the CreateProcessAsUser function must
 * have the SE_INCREASE_QUOTA_NAME privilege and may require the
 * SE_ASSIGNPRIMARYTOKEN_NAME privilege if the token is not assignable. If
 * this function fails with ERROR_PRIVILEGE_NOT_HELD (1314), use the
 * CreateProcessWithLogonW function instead. CreateProcessWithLogonW
 * requires no special privileges, but the specified user account must be
 * allowed to log on interactively. Generally, it is best to use
 * CreateProcessWithLogonW to create a process with alternate credentials.
 *
 * @param hToken
 *            A handle to the primary token that represents a user.
 * @param lpApplicationName
 *            The name of the module to be executed.
 * @param lpCommandLine
 *            The command line to be executed.
 * @param lpProcessAttributes
 *            A pointer to a SECURITY_ATTRIBUTES structure that specifies a
 *            security descriptor for the new process object and determines
 *            whether child processes can inherit the returned handle to the
 *            process.
 * @param lpThreadAttributes
 *            A pointer to a SECURITY_ATTRIBUTES structure that specifies a
 *            security descriptor for the new thread object and determines
 *            whether child processes can inherit the returned handle to the
 *            thread.
 * @param bInheritHandles
 *            If this parameter is TRUE, each inheritable handle in the
 *            calling process is inherited by the new process. If the
 *            parameter is FALSE, the handles are not inherited. Note that
 *            inherited handles have the same value and access rights as the
 *            original handles.
 * @param dwCreationFlags
 *            The flags that control the priority class and the creation of
 *            the process. For a list of values, see Process Creation Flags.
 * @param lpEnvironment
 *            A pointer to an environment block for the new process. If this
 *            parameter is NULL, the new process uses the environment of the
 *            calling process.
 *
 *            An environment block consists of a null-terminated block of
 *            null-terminated strings. Each string is in the following form:
 *            name=value\0
 * @param lpCurrentDirectory
 *            The full path to the current directory for the process. The
 *            string can also specify a UNC path.
 * @param lpStartupInfo
 *            A pointer to a STARTUPINFO or STARTUPINFOEX structure.
 * @param lpProcessInformation
 *            A pointer to a PROCESS_INFORMATION structure that receives
 *            identification information about the new process.
 * @return If the function succeeds, the return value is nonzero. If the
 *         function fails, the return value is zero. To get extended error
 *         information, call GetLastError.
 */
public boolean CreateProcessAsUser(HANDLE hToken, String lpApplicationName,
        String lpCommandLine, SECURITY_ATTRIBUTES lpProcessAttributes,
        SECURITY_ATTRIBUTES lpThreadAttributes, boolean bInheritHandles,
        int dwCreationFlags, String lpEnvironment,
        String lpCurrentDirectory, WinBase.STARTUPINFO lpStartupInfo,
        WinBase.PROCESS_INFORMATION lpProcessInformation);
项目:yajsw    文件:Advapi32.java   
/**
 * 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);
项目:yajsw    文件:Advapi32.java   
/**
 * The RegEnumKeyEx function enumerates subkeys of the specified open
 * registry key. The function retrieves information about one subkey each
 * time it is called.
 *
 * @param hKey
 *            Handle to an open key. The key must have been opened with the
 *            KEY_ENUMERATE_SUB_KEYS access right.
 * @param dwIndex
 *            Index of the subkey to retrieve. This parameter should be zero
 *            for the first call to the RegEnumKeyEx function and then
 *            incremented for subsequent calls. Because subkeys are not
 *            ordered, any new subkey will have an arbitrary index. This
 *            means that the function may return subkeys in any order.
 * @param lpName
 *            Pointer to a buffer that receives the name of the subkey,
 *            including the terminating null character. The function copies
 *            only the name of the subkey, not the full key hierarchy, to
 *            the buffer.
 * @param lpcName
 *            Pointer to a variable that specifies the size of the buffer
 *            specified by the lpName parameter, in TCHARs. This size should
 *            include the terminating null character. When the function
 *            returns, the variable pointed to by lpcName contains the
 *            number of characters stored in the buffer. The count returned
 *            does not include the terminating null character.
 * @param reserved
 *            Reserved; must be NULL.
 * @param lpClass
 *            Pointer to a buffer that receives the null-terminated class
 *            string of the enumerated subkey. This parameter can be NULL.
 * @param lpcClass
 *            Pointer to a variable that specifies the size of the buffer
 *            specified by the lpClass parameter, in TCHARs. The size should
 *            include the terminating null character. When the function
 *            returns, lpcClass contains the number of characters stored in
 *            the buffer. The count returned does not include the
 *            terminating null character. This parameter can be NULL only if
 *            lpClass is NULL.
 * @param lpftLastWriteTime
 *            Pointer to a variable that receives the time at which the
 *            enumerated subkey was last written.
 * @return If the function succeeds, the return value is ERROR_SUCCESS. If
 *         the function fails, the return value is a nonzero error code
 *         defined in Winerror.h.
 */
public int RegEnumKeyEx(HKEY hKey, int dwIndex, char[] lpName,
        IntByReference lpcName, IntByReference reserved, char[] lpClass,
        IntByReference lpcClass, WinBase.FILETIME lpftLastWriteTime);
项目:proactive-component-monitoring    文件:WindowsProcess.java   
/**
 * BOOL WINAPI CreateProcessWithLogonW( __in LPCWSTR lpUsername,
 * __in_opt LPCWSTR lpDomain, __in LPCWSTR lpPassword, __in DWORD
 * dwLogonFlags, __in_opt LPCWSTR lpApplicationName, __inout_opt LPWSTR
 * lpCommandLine, __in DWORD dwCreationFlags, __in_opt LPVOID
 * lpEnvironment, __in_opt LPCWSTR lpCurrentDirectory, __in
 * LPSTARTUPINFOW lpStartupInfo, __out LPPROCESS_INFORMATION
 * lpProcessInfo );
 */
boolean CreateProcessWithLogonW(String lpUsername, String lpDomain, String lpPassword,
        int dwLogonFlags, String lpApplicationName, String lpCommandLine, int dwCreationFlags,
        String lpEnvironment, String lpCurrentDirectory, WinBase.STARTUPINFO lpStartupInfo,
        WinBase.PROCESS_INFORMATION lpProcessInfo);
项目:KiTTY2    文件:Kernel32.java   
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);
项目:pty4j    文件:WinPty.java   
boolean ConnectNamedPipe(WinNT.HANDLE hNamedPipe, WinBase.OVERLAPPED overlapped);
项目:pty4j    文件:WinPty.java   
WinNT.HANDLE CreateEventA(WinBase.SECURITY_ATTRIBUTES lpEventAttributes, boolean bManualReset, boolean bInitialState, String lpName);