Skip navigation links
JNA API 5.6.0
com.sun.jna.platform.win32

Interface Kernel32

    • Field Detail

      • INSTANCE

        static final Kernel32 INSTANCE
        The instance.
      • LOAD_LIBRARY_AS_DATAFILE

        static final int LOAD_LIBRARY_AS_DATAFILE
        LOAD_LIBRARY_AS_DATAFILE
        0x00000002
        If this value is used, the system maps the file into the calling process's virtual address space as if it were a data file.
        Nothing is done to execute or prepare to execute the mapped file.
        Therefore, you cannot call functions like GetModuleFileName , GetModuleHandle or GetProcAddress with this DLL. Using this value causes writes to read-only memory to raise an access violation.
        Use this flag when you want to load a DLL only to extract messages or resources from it.
        This value can be used with LOAD_LIBRARY_AS_IMAGE_RESOURCE. For more information, see Remarks.
        See Also:
        Constant Field Values
    • Method Detail

      • ReadFile

        boolean ReadFile(WinNT.HANDLE hFile,
                         byte[] lpBuffer,
                         int nNumberOfBytesToRead,
                         IntByReference lpNumberOfBytesRead,
                         WinBase.OVERLAPPED lpOverlapped)
        Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This function is designed for both synchronous and asynchronous operations. For a similar function designed solely for asynchronous operation, see ReadFileEx
        Parameters:
        hFile - A handle to the device (for example, a file, file stream, physical disk, volume, console buffer, tape drive, socket, communications resource, mailslot, or pipe).
        lpBuffer - A pointer to the buffer that receives the data read from a file or device.
        nNumberOfBytesToRead - The maximum number of bytes to be read.
        lpNumberOfBytesRead - A pointer to the variable that receives the number of bytes read when using a synchronous hFile parameter
        lpOverlapped - A pointer to an OVERLAPPED structure is required if the hFile parameter was opened with FILE_FLAG_OVERLAPPED, otherwise it can be NULL.
        Returns:
        If the function succeeds, the return value is nonzero (TRUE). If the function fails, or is completing asynchronously, the return value is zero (FALSE). To get extended error information, call the GetLastError function. Note The GetLastError code ERROR_IO_PENDING is not a failure; it designates the read operation is pending completion asynchronously. For more information, see Remarks.
      • LocalFree

        Pointer LocalFree(Pointer hMem)
        Frees the specified local memory object and invalidates its handle.
        Parameters:
        hMem - A handle to the local memory object. If the hMem parameter is NULL, LocalFree ignores the parameter and returns NULL.
        Returns:
        If the function succeeds, the return value is NULL. If the function fails, the return value is equal to a handle to the local memory object. To get extended error information, call GetLastError.
        See Also:
        LocalFree
      • GlobalFree

        Pointer GlobalFree(Pointer hGlobal)
        Frees the specified global memory object and invalidates its handle.
        Parameters:
        hGlobal - A handle to the global memory object.
        Returns:
        If the function succeeds, the return value is NULL If the function fails, the return value is equal to a handle to the global memory object. To get extended error information, call GetLastError.
        See Also:
        GlobalFree
      • GetModuleHandle

        WinDef.HMODULE GetModuleHandle(java.lang.String name)
        The GetModuleHandle function retrieves a module handle for the specified module if the file has been mapped into the address space of the calling process.
        Parameters:
        name - Pointer to a null-terminated string that contains the name of the module (either a .dll or .exe file).
        Returns:
        If the function succeeds, the return value is a handle to the specified module. If the function fails, the return value is NULL. To get extended error information, call GetLastError.
      • GetSystemTime

        void GetSystemTime(WinBase.SYSTEMTIME lpSystemTime)
        The GetSystemTime function retrieves the current system date and time. The system time is expressed in Coordinated Universal Time (UTC).
        Parameters:
        lpSystemTime - Pointer to a WinBase.SYSTEMTIME structure to receive the current system date and time.
        See Also:
        GetSystemTime documentation
      • SetSystemTime

        boolean SetSystemTime(WinBase.SYSTEMTIME lpSystemTime)
        The SetSystemTime function modifies the current system date and time. The system time is expressed in Coordinated Universal Time (UTC).
        Parameters:
        lpSystemTime - Pointer to a WinBase.SYSTEMTIME structure holding the new system date and time. Note: The wDayOfWeek member of the SYSTEMTIME structure is ignored.
        Returns:
        true if the function succeeds, false otherwise. If the function fails, call GetLastError() to get extended error information.
        See Also:
        SetSystemTime documentation
      • SetLocalTime

        boolean SetLocalTime(WinBase.SYSTEMTIME lpSystemTime)
        Sets the current local time and date
        Parameters:
        lpSystemTime - Pointer to a WinBase.SYSTEMTIME structure holding the new system date and time. Note: The wDayOfWeek member of the SYSTEMTIME structure is ignored.
        Returns:
        true if the function succeeds, false otherwise. If the function fails, call GetLastError() to get extended error information.
        See Also:
        SetLocalTime documentation
      • GetSystemTimes

        boolean GetSystemTimes(WinBase.FILETIME lpIdleTime,
                               WinBase.FILETIME lpKernelTime,
                               WinBase.FILETIME lpUserTime)
        Retrieves system timing information. On a multiprocessor system, the values returned are the sum of the designated times across all processors.
        Parameters:
        lpIdleTime - A pointer to a WinBase.FILETIME structure that receives the amount of time that the system has been idle.
        lpKernelTime - A pointer to a WinBase.FILETIME structure that receives the amount of time that the system has spent executing in Kernel mode (including all threads in all processes, on all processors). This time value also includes the amount of time the system has been idle.
        lpUserTime - A pointer to a WinBase.FILETIME structure that receives the amount of time that the system has spent executing in User mode (including all threads in all processes, on all processors).
        Returns:
        true if the function succeeds, false otherwise. If the function fails, call GetLastError() to get extended error information.
        See Also:
        GetSystemTimes documentation
      • GetTickCount

        int GetTickCount()
        The GetTickCount function retrieves the number of milliseconds that have elapsed since the system was started, up to 49.7 days.
        Returns:
        Number of milliseconds that have elapsed since the system was started.
      • GetTickCount64

        long GetTickCount64()
        The GetTickCount64 function retrieves the number of milliseconds that have elapsed since the system was started.
        Returns:
        Number of milliseconds that have elapsed since the system was started.
      • GetCurrentThreadId

        int GetCurrentThreadId()
        The GetCurrentThreadId function retrieves the thread identifier of the calling thread.
        Returns:
        The return value is the thread identifier of the calling thread.
      • GetCurrentThread

        WinNT.HANDLE GetCurrentThread()
        The GetCurrentThread function retrieves a pseudo handle for the current thread.
        Returns:
        The return value is a pseudo handle for the current thread.
      • GetCurrentProcessId

        int GetCurrentProcessId()
        This function returns the process identifier of the calling process.
        Returns:
        The return value is the process identifier of the calling process.
      • GetCurrentProcess

        WinNT.HANDLE GetCurrentProcess()
        This function returns a pseudohandle for the current process.
        Returns:
        The return value is a pseudohandle to the current process.
      • GetProcessId

        int GetProcessId(WinNT.HANDLE process)
        The GetProcessId function retrieves the process identifier of the specified process.
        Parameters:
        process - Handle to the process. The handle must have the PROCESS_QUERY_INFORMATION access right.
        Returns:
        If the function succeeds, the return value is the process identifier of the specified process. If the function fails, the return value is zero. To get extended error information, call GetLastError.
      • GetProcessVersion

        int GetProcessVersion(int processId)
        The GetProcessVersion function retrieves the major and minor version numbers of the system on which the specified process expects to run.
        Parameters:
        processId - Process identifier of the process of interest. A value of zero specifies the calling process.
        Returns:
        If the function succeeds, the return value is the version of the system on which the process expects to run. The high word of the return value contains the major version number. The low word of the return value contains the minor version number. If the function fails, the return value is zero. To get extended error information, call GetLastError. The function fails if ProcessId is an invalid value.
      • GetProcessAffinityMask

        boolean GetProcessAffinityMask(WinNT.HANDLE hProcess,
                                       BaseTSD.ULONG_PTRByReference lpProcessAffinityMask,
                                       BaseTSD.ULONG_PTRByReference lpSystemAffinityMask)
        Retrieves the process affinity mask for the specified process and the system affinity mask for the system.
        Parameters:
        hProcess - A handle to the process whose affinity mask is desired.

        This handle must have the WinNT.PROCESS_QUERY_INFORMATION or WinNT.PROCESS_QUERY_LIMITED_INFORMATION access right.

        lpProcessAffinityMask - A pointer to a variable that receives the affinity mask for the specified process.
        lpSystemAffinityMask - A pointer to a variable that receives the affinity mask for the system.
        Returns:
        If the function succeeds, returns true and the function sets the variables pointed to by lpProcessAffinityMask and lpSystemAffinityMask to the appropriate affinity masks.

        On a system with more than 64 processors, if the threads of the calling process are in a single processor group, the function sets the variables pointed to by lpProcessAffinityMask and lpSystemAffinityMask to the process affinity mask and the processor mask of active logical processors for that group. If the calling process contains threads in multiple groups, the function returns zero for both affinity masks.

        If the function fails, the return value is false, and the values of the variables pointed to by lpProcessAffinityMask and lpSystemAffinityMask are undefined. To get extended error information, call GetLastError().

      • SetProcessAffinityMask

        boolean SetProcessAffinityMask(WinNT.HANDLE hProcess,
                                       BaseTSD.ULONG_PTR dwProcessAffinityMask)
        Sets a processor affinity mask for the threads of the specified process.
        Parameters:
        hProcess - A handle to the process whose affinity mask is to be set. This handle must have the WinNT.PROCESS_SET_INFORMATION access right.
        dwProcessAffinityMask - The affinity mask for the threads of the process.

        On a system with more than 64 processors, the affinity mask must specify processors in a single processor group.

        Returns:
        If the function succeeds, the return value is true.

        If the function fails, the return value is false. To get extended error information, call GetLastError().

        If the process affinity mask requests a processor that is not configured in the system, the last error code is WinError.ERROR_INVALID_PARAMETER.

        On a system with more than 64 processors, if the calling process contains threads in more than one processor group, the last error code is WinError.ERROR_INVALID_PARAMETER.

      • GetExitCodeProcess

        boolean GetExitCodeProcess(WinNT.HANDLE hProcess,
                                   IntByReference lpExitCode)
        Retrieves the termination status of the specified process.
        Parameters:
        hProcess - A handle to the process.
        lpExitCode - A pointer to a variable to receive the process termination status.
        Returns:
        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.
      • TerminateProcess

        boolean TerminateProcess(WinNT.HANDLE hProcess,
                                 int uExitCode)
        Terminates the specified process and all of its threads.
        Parameters:
        hProcess - A handle to the process to be terminated.
        uExitCode - The exit code to be used by the process and threads terminated as a result of this call.
        Returns:
        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.
      • GetLastError

        int GetLastError()
        The GetLastError function retrieves the calling thread's last-error code value. The last-error code is maintained on a per-thread basis. Multiple threads do not overwrite each other's last-error code.
        Returns:
        The return value is the calling thread's last-error code value.
      • SetLastError

        void SetLastError(int dwErrCode)
        The SetLastError function sets the last-error code for the calling thread.
        Parameters:
        dwErrCode - Last-error code for the thread.
      • GetDriveType

        int GetDriveType(java.lang.String lpRootPathName)
        Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
        Parameters:
        lpRootPathName - Pointer to a null-terminated string that specifies the root directory of the disk to return information about. A trailing backslash is required. If this parameter is NULL, the function uses the root of the current directory.
        Returns:
        The return value specifies the type of drive.
        See Also:
        GetDriveType
      • FormatMessage

        int FormatMessage(int dwFlags,
                          Pointer lpSource,
                          int dwMessageId,
                          int dwLanguageId,
                          PointerByReference lpBuffer,
                          int nSize,
                          Pointer va_list)
        The FormatMessage function formats a message string. The function requires a message definition as input. The message definition can come from a buffer passed into the function. It can come from a message table resource in an already-loaded module. Or the caller can ask the function to search the system's message table resource(s) for the message definition. The function finds the message definition in a message table resource based on a message identifier and a language identifier. The function copies the formatted message text to an output buffer, processing any embedded insert sequences if requested.
        Parameters:
        dwFlags - Formatting options, and how to interpret the lpSource parameter. The low-order byte of dwFlags specifies how the function handles line breaks in the output buffer. The low-order byte can also specify the maximum width of a formatted output line.

        This version of the function assumes FORMAT_MESSAGE_ALLOCATE_BUFFER is set.

        lpSource - Location of the message definition.
        dwMessageId - Message identifier for the requested message.
        dwLanguageId - Language identifier for the requested message.
        lpBuffer - Pointer to a pointer that receives the allocated buffer in which the null-terminated string that specifies the formatted message is written.
        nSize - This parameter specifies the minimum number of TCHARs to allocate for an output buffer.
        va_list - Pointer to an array of values that are used as insert values in the formatted message.
        Returns:
        If the function succeeds, the return value is the number of TCHARs stored in the output buffer, excluding the terminating null character. If the function fails, the return value is zero. To get extended error information, call GetLastError.
      • CreateFile

        WinNT.HANDLE CreateFile(java.lang.String lpFileName,
                                int dwDesiredAccess,
                                int dwShareMode,
                                WinBase.SECURITY_ATTRIBUTES lpSecurityAttributes,
                                int dwCreationDisposition,
                                int dwFlagsAndAttributes,
                                WinNT.HANDLE hTemplateFile)
        The CreateFile function creates or opens a file, file stream, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe. The function returns a handle that can be used to access an object.
        Parameters:
        lpFileName - A pointer to a null-terminated string that specifies the name of an object to create or open.
        dwDesiredAccess - The access to the object, which can be read, write, or both.
        dwShareMode - The sharing mode of an object, which can be read, write, both, or none.
        lpSecurityAttributes - A pointer to a SECURITY_ATTRIBUTES structure that determines whether or not the returned handle can be inherited by child processes. If lpSecurityAttributes is NULL, the handle cannot be inherited.
        dwCreationDisposition - An action to take on files that exist and do not exist.
        dwFlagsAndAttributes - The file attributes and flags.
        hTemplateFile - Handle to a template file with the GENERIC_READ access right. The template file supplies file attributes and extended attributes for the file that is being created. This parameter can be NULL.
        Returns:
        If the function succeeds, the return value is an open handle to a specified file. If a specified file exists before the function call and dwCreationDisposition is CREATE_ALWAYS or OPEN_ALWAYS, a call to GetLastError returns ERROR_ALREADY_EXISTS, even when the function succeeds. If a file does not exist before the call, GetLastError returns 0 (zero). If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.
      • CopyFile

        boolean CopyFile(java.lang.String lpExistingFileName,
                         java.lang.String lpNewFileName,
                         boolean bFailIfExists)
        Copies an existing file to a new file.
        Parameters:
        lpExistingFileName - The name of an existing file. The name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, prepend "\\?\" to the path. For more information, see Naming a File. If lpExistingFileName does not exist, CopyFile fails, and GetLastError returns ERROR_FILE_NOT_FOUND.
        lpNewFileName - The name of the new file. The name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, prepend "\\?\" to the path. For more information, see Naming a File.
        bFailIfExists - If this parameter is TRUE and the new file specified by lpNewFileName already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
        Returns:
        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.
      • MoveFile

        boolean MoveFile(java.lang.String lpExistingFileName,
                         java.lang.String lpNewFileName)
        Moves an existing file or a directory, including its children.
        Parameters:
        lpExistingFileName - The current name of the file or directory on the local computer. The name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, prepend "\\?\" to the path. For more information, see Naming a File.
        lpNewFileName - The new name for the file or directory. The new name must not already exist. A new file may be on a different file system or drive. A new directory must be on the same drive. The name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, prepend "\\?\" to the path. For more information, see Naming a File.
        Returns:
        true, if successful 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.
      • MoveFileEx

        boolean MoveFileEx(java.lang.String lpExistingFileName,
                           java.lang.String lpNewFileName,
                           WinDef.DWORD dwFlags)
        Moves an existing file or directory, including its children, with various move options.
        Parameters:
        lpExistingFileName - The current name of the file or directory on the local computer. If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT, the file cannot exist on a remote share, because delayed operations are performed before the network is available. The name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, prepend "\\?\" to the path. For more information, see Naming a File Windows 2000: If you prepend the file name with "\\?\", you cannot also specify the MOVEFILE_DELAY_UNTIL_REBOOT flag for dwFlags.
        lpNewFileName - The new name of the file or directory on the local computer. When moving a file, the destination can be on a different file system or volume. If the destination is on another drive, you must set the MOVEFILE_COPY_ALLOWED flag in dwFlags. When moving a directory, the destination must be on the same drive. If dwFlags specifies MOVEFILE_DELAY_UNTIL_REBOOT and lpNewFileName is NULL, MoveFileEx registers the lpExistingFileName file to be deleted when the system restarts. If lpExistingFileName refers to a directory, the system removes the directory at restart only if the directory is empty.
        dwFlags - This parameter can be one or more of the following values.
        Returns:
        true, if successful 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.
      • CreateDirectory

        boolean CreateDirectory(java.lang.String lpPathName,
                                WinBase.SECURITY_ATTRIBUTES lpSecurityAttributes)
        The CreateDirectory function creates a new directory. If the underlying file system supports security on files and directories, the function applies a specified security descriptor to the new directory.
        Parameters:
        lpPathName - Pointer to a null-terminated string that specifies the path of the directory to be created.
        lpSecurityAttributes - Pointer to a SECURITY_ATTRIBUTES structure. The lpSecurityDescriptor member of the structure specifies a security descriptor for the new directory. If lpSecurityAttributes is NULL, the directory gets a default security descriptor.
        Returns:
        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.
      • CreateIoCompletionPort

        WinNT.HANDLE CreateIoCompletionPort(WinNT.HANDLE FileHandle,
                                            WinNT.HANDLE ExistingCompletionPort,
                                            Pointer CompletionKey,
                                            int NumberOfConcurrentThreads)
        Creates an input/output (I/O) completion port and associates it with a specified file handle, or creates an I/O completion port that is not yet associated with a file handle, allowing association at a later time.
        Parameters:
        FileHandle - An open file handle or INVALID_HANDLE_VALUE.
        ExistingCompletionPort - A handle to an existing I/O completion port or NULL.
        CompletionKey - The per-handle user-defined completion key that is included in every I/O completion packet for the specified file handle.
        NumberOfConcurrentThreads - The maximum number of threads that the operating system can allow to concurrently process I/O completion packets for the I/O completion port.
        Returns:
        If the function succeeds, the return value is the handle to an I/O completion port: If the ExistingCompletionPort parameter was NULL, the return value is a new handle. If the ExistingCompletionPort parameter was a valid I/O completion port handle, the return value is that same handle. If the FileHandle parameter was a valid handle, that file handle is now associated with the returned I/O completion port. If the function fails, the return value is NULL. To get extended error information, call the GetLastError function.
      • GetQueuedCompletionStatus

        boolean GetQueuedCompletionStatus(WinNT.HANDLE CompletionPort,
                                          IntByReference lpNumberOfBytes,
                                          BaseTSD.ULONG_PTRByReference lpCompletionKey,
                                          PointerByReference lpOverlapped,
                                          int dwMilliseconds)
        Attempts to dequeue an I/O completion packet from the specified I/O completion port. If there is no completion packet queued, the function waits for a pending I/O operation associated with the completion port to complete.
        Parameters:
        CompletionPort - A handle to the completion port.
        lpNumberOfBytes - A pointer to a variable that receives the number of bytes transferred during an I/O operation that has completed.
        lpCompletionKey - A pointer to a variable that receives the completion key value associated with the file handle whose I/O operation has completed.
        lpOverlapped - A pointer to a variable that receives the address of the OVERLAPPED structure that was specified when the completed I/O operation was started.
        dwMilliseconds - The number of milliseconds that the caller is willing to wait for a completion packet to appear at the completion port.
        Returns:
        Returns nonzero (TRUE) if successful or zero (FALSE) otherwise.
      • PostQueuedCompletionStatus

        boolean PostQueuedCompletionStatus(WinNT.HANDLE CompletionPort,
                                           int dwNumberOfBytesTransferred,
                                           Pointer dwCompletionKey,
                                           WinBase.OVERLAPPED lpOverlapped)
        Posts an I/O completion packet to an I/O completion port.
        Parameters:
        CompletionPort - A handle to an I/O completion port to which the I/O completion packet is to be posted.
        dwNumberOfBytesTransferred - The value to be returned through the lpNumberOfBytesTransferred parameter of the GetQueuedCompletionStatus function.
        dwCompletionKey - The value to be returned through the lpCompletionKey parameter of the GetQueuedCompletionStatus function.
        lpOverlapped - The value to be returned through the lpOverlapped parameter of the GetQueuedCompletionStatus function.
        Returns:
        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 .
      • WaitForSingleObject

        int WaitForSingleObject(WinNT.HANDLE hHandle,
                                int dwMilliseconds)
        Waits until the specified object is in the signaled state or the time-out interval elapses. To enter an alertable wait state, use the WaitForSingleObjectEx function. To wait for multiple objects, use the WaitForMultipleObjects.
        Parameters:
        hHandle - A handle to the object. For a list of the object types whose handles can be specified, see the following Remarks section. If this handle is closed while the wait is still pending, the function's behavior is undefined. The handle must have the SYNCHRONIZE access right. For more information, see Standard Access Rights.
        dwMilliseconds - The time-out interval, in milliseconds. If a nonzero value is specified, the function waits until the object is signaled or the interval elapses. If dwMilliseconds is zero, the function does not enter a wait state if the object is not signaled; it always returns immediately. If dwMilliseconds is INFINITE, the function will return only when the object is signaled.
        Returns:
        If the function succeeds, the return value indicates the event that caused the function to return.
      • WaitForMultipleObjects

        int WaitForMultipleObjects(int nCount,
                                   WinNT.HANDLE[] hHandle,
                                   boolean bWaitAll,
                                   int dwMilliseconds)
        Waits until one or all of the specified objects are in the signaled state or the time-out interval elapses. To enter an alertable wait state, use the WaitForMultipleObjectsEx function.
        Parameters:
        nCount - The number of object handles in the array pointed to by lpHandles. The maximum number of object handles is MAXIMUM_WAIT_OBJECTS.
        hHandle - An array of object handles. For a list of the object types whose handles can be specified, see the following Remarks section. The array can contain handles to objects of different types. It may not contain multiple copies of the same handle. If one of these handles is closed while the wait is still pending, the function's behavior is undefined. The handles must have the SYNCHRONIZE access right. For more information, see Standard Access Rights.
        bWaitAll - If this parameter is TRUE, the function returns when the state of all objects in the lpHandles array is signaled. If FALSE, the function returns when the state of any one of the objects is set to signaled. In the latter case, the return value indicates the object whose state caused the function to return.
        dwMilliseconds - The time-out interval, in milliseconds. If a nonzero value is specified, the function waits until the specified objects are signaled or the interval elapses. If dwMilliseconds is zero, the function does not enter a wait state if the specified objects are not signaled; it always returns immediately. If dwMilliseconds is INFINITE, the function will return only when the specified objects are signaled.
        Returns:
        If the function succeeds, the return value indicates the event that caused the function to return.
      • DuplicateHandle

        boolean DuplicateHandle(WinNT.HANDLE hSourceProcessHandle,
                                WinNT.HANDLE hSourceHandle,
                                WinNT.HANDLE hTargetProcessHandle,
                                WinNT.HANDLEByReference lpTargetHandle,
                                int dwDesiredAccess,
                                boolean bInheritHandle,
                                int dwOptions)
        The DuplicateHandle function duplicates an object handle.
        Parameters:
        hSourceProcessHandle - Handle to the process with the handle to duplicate. The handle must have the PROCESS_DUP_HANDLE access right.
        hSourceHandle - Handle to duplicate. This is an open object handle that is valid in the context of the source process.
        hTargetProcessHandle - Handle to the process that is to receive the duplicated handle. The handle must have the PROCESS_DUP_HANDLE access right.
        lpTargetHandle - Pointer to a variable that receives the duplicate handle. This handle value is valid in the context of the target process. If hSourceHandle is a pseudo handle returned by GetCurrentProcess or GetCurrentThread, DuplicateHandle converts it to a real handle to a process or thread, respectively.
        dwDesiredAccess - Access requested for the new handle.
        bInheritHandle - Indicates whether the handle is inheritable.
        dwOptions - Optional actions.
        Returns:
        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.
      • CloseHandle

        boolean CloseHandle(WinNT.HANDLE hObject)
        Closes an open object handle.
        Parameters:
        hObject - Handle to an open object. This parameter can be a pseudo handle or INVALID_HANDLE_VALUE.
        Returns:
        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.
        See Also:
        CloseHandle
      • ReadDirectoryChangesW

        boolean ReadDirectoryChangesW(WinNT.HANDLE directory,
                                      WinNT.FILE_NOTIFY_INFORMATION info,
                                      int length,
                                      boolean watchSubtree,
                                      int notifyFilter,
                                      IntByReference bytesReturned,
                                      WinBase.OVERLAPPED overlapped,
                                      WinNT.OVERLAPPED_COMPLETION_ROUTINE completionRoutine)
        Retrieves information that describes the changes within the specified directory. The function does not report changes to the specified directory itself. Note: there's no ReadDirectoryChangesA.
        Parameters:
        directory - A handle to the directory to be monitored. This directory must be opened with the FILE_LIST_DIRECTORY access right.
        info - A pointer to the DWORD-aligned formatted buffer in which the read results are to be returned.
        length - The size of the buffer that is pointed to by the lpBuffer parameter, in bytes.
        watchSubtree - If this parameter is TRUE, the function monitors the directory tree rooted at the specified directory. If this parameter is FALSE, the function monitors only the directory specified by the hDirectory parameter.
        notifyFilter - The filter criteria that the function checks to determine if the wait operation has completed.
        bytesReturned - For synchronous calls, this parameter receives the number of bytes transferred into the lpBuffer parameter. For asynchronous calls, this parameter is undefined. You must use an asynchronous notification technique to retrieve the number of bytes transferred.
        overlapped - A pointer to an OVERLAPPED structure that supplies data to be used during asynchronous operation. Otherwise, this value is NULL. The Offset and OffsetHigh members of this structure are not used.
        completionRoutine - A pointer to a completion routine to be called when the operation has been completed or canceled and the calling thread is in an alertable wait state.
        Returns:
        If the function succeeds, the return value is nonzero. For synchronous calls, this means that the operation succeeded. For asynchronous calls, this indicates that the operation was successfully queued. If the function fails, the return value is zero. To get extended error information, call GetLastError. If the network redirector or the target file system does not support this operation, the function fails with ERROR_INVALID_FUNCTION.
      • GetShortPathName

        int GetShortPathName(java.lang.String lpszLongPath,
                             char[] lpdzShortPath,
                             int cchBuffer)
        Retrieves the short path form of the specified path.
        Parameters:
        lpszLongPath - The path string.
        lpdzShortPath - A pointer to a buffer to receive the null-terminated short form of the path that lpszLongPath specifies.
        cchBuffer - The size of the buffer that lpszShortPath points to, in TCHARs.
        Returns:
        If the function succeeds, the return value is the length, in TCHARs, of the string that is copied to lpszShortPath, not including the terminating null character. If the lpszShortPath buffer is too small to contain the path, the return value is the size of the buffer, in TCHARs, that is required to hold the path and the terminating null character. If the function fails for any other reason, the return value is zero. To get extended error information, call GetLastError.
      • LocalAlloc

        Pointer LocalAlloc(int uFlags,
                           int uBytes)
        The LocalAlloc function allocates the specified number of bytes from the heap. Windows memory management does not provide a separate local heap and global heap.
        Parameters:
        uFlags - Memory allocation attributes. The default is the LMEM_FIXED value.
        uBytes - Number of bytes to allocate. If this parameter is zero and the uFlags parameter specifies LMEM_MOVEABLE, the function returns a handle to a memory object that is marked as discarded.
        Returns:
        If the function succeeds, the return value is a handle to the newly allocated memory object. If the function fails, the return value is NULL. To get extended error information, call GetLastError.
      • WriteFile

        boolean WriteFile(WinNT.HANDLE hFile,
                          byte[] lpBuffer,
                          int nNumberOfBytesToWrite,
                          IntByReference lpNumberOfBytesWritten,
                          WinBase.OVERLAPPED lpOverlapped)
        Writes data to the specified file or input/output (I/O) device.
        Parameters:
        hFile - A handle to the file or I/O device (for example, a file, file stream, physical disk, volume, console buffer, tape drive, socket, communications resource, mailslot, or pipe).
        lpBuffer - A pointer to the buffer containing the data to be written to the file or device.
        nNumberOfBytesToWrite - The number of bytes to be written to the file or device.
        lpNumberOfBytesWritten - A pointer to the variable that receives the number of bytes written when using a synchronous hFile parameter.
        lpOverlapped - A pointer to an OVERLAPPED structure is required if the hFile parameter was opened with FILE_FLAG_OVERLAPPED, otherwise this parameter can be NULL.
        Returns:
        If the function succeeds, the return value is nonzero (TRUE). If the function fails, or is completing asynchronously, the return value is zero (FALSE). To get extended error information, call the GetLastError function.
      • FlushFileBuffers

        boolean FlushFileBuffers(WinNT.HANDLE hFile)
        Flushes the buffers of a specified file and causes all buffered data to be written to a file.
        Parameters:
        hFile - A handle to the open file. If a handle to a communications device, the function only flushes the transmit buffer. If a handle to the server end of a named pipe, the function does not return until the client has read all buffered data from the pipe.
        Returns:
        true if successful, false otherwise. To get extended error information, call GetLastError().
        See Also:
        FlushFileBuffers documentation
      • CreateEvent

        WinNT.HANDLE CreateEvent(WinBase.SECURITY_ATTRIBUTES lpEventAttributes,
                                 boolean bManualReset,
                                 boolean bInitialState,
                                 java.lang.String lpName)
        Creates or opens a named or unnamed event object.
        Parameters:
        lpEventAttributes - A pointer to a SECURITY_ATTRIBUTES structure. If this parameter is NULL, the handle cannot be inherited by child processes.
        bManualReset - If this parameter is TRUE, the function creates a manual-reset event object, which requires the use of the ResetEvent function to set the event state to nonsignaled. If this parameter is FALSE, the function creates an auto-reset event object, and system automatically resets the event state to nonsignaled after a single waiting thread has been released.
        bInitialState - If this parameter is TRUE, the initial state of the event object is signaled; otherwise, it is nonsignaled.
        lpName - The name of the event object. The name is limited to MAX_PATH characters. Name comparison is case sensitive.
        Returns:
        If the function succeeds, the return value is a handle to the event object. If the named event object existed before the function call, the function returns a handle to the existing object and GetLastError returns ERROR_ALREADY_EXISTS. If the function fails, the return value is NULL. To get extended error information, call GetLastError.
      • OpenEvent

        WinNT.HANDLE OpenEvent(int dwDesiredAccess,
                               boolean bInheritHandle,
                               java.lang.String lpName)
        Opens an existing named event object.
        Parameters:
        dwDesiredAccess - The access to the event object. The function fails if the security descriptor of the specified object does not permit the requested access for the calling process. For a list of access rights, see Synchronization Object Security and Access Rights.
        bInheritHandle - If this value is TRUE, processes created by this process will inherit the handle. Otherwise, the processes do not inherit this handle.
        lpName - The name of the event to be opened. Name comparisons are case sensitive.

        This function can open objects in a private namespace. For more information, see Object Namespaces.

        Terminal Services: The name can have a "Global" or "Local" prefix to explicitly open an object in the global or session namespace. The remainder of the name can contain any character except the backslash character (). For more information, see Kernel Object Namespaces.

        Note Fast user switching is implemented using Terminal Services sessions. The first user to log on uses session 0, the next user to log on uses session 1, and so on. Kernel object names must follow the guidelines outlined for Terminal Services so that applications can support multiple users.

        Returns:
        If the function succeeds, the return value is a handle to the event object.

        If the function fails, the return value is NULL. To get extended error information, call GetLastError().

      • SetEvent

        boolean SetEvent(WinNT.HANDLE hEvent)
        Sets the specified event object to the signaled state.
        Parameters:
        hEvent - A handle to the event object. The CreateEvent or OpenEvent function returns this handle.
        Returns:
        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.
      • ResetEvent

        boolean ResetEvent(WinNT.HANDLE hEvent)
        Resets (to non-signaled state) the specified event object.
        Parameters:
        hEvent - A handle to the event object
        Returns:
        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.
      • PulseEvent

        boolean PulseEvent(WinNT.HANDLE hEvent)
        Sets the specified event object to the signaled state and then resets it to the nonsignaled state after releasing the appropriate number of waiting threads.
        Parameters:
        hEvent - A handle to the event object. The CreateEvent or OpenEvent function returns this handle.
        Returns:
        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.
      • CreateFileMapping

        WinNT.HANDLE CreateFileMapping(WinNT.HANDLE hFile,
                                       WinBase.SECURITY_ATTRIBUTES lpAttributes,
                                       int flProtect,
                                       int dwMaximumSizeHigh,
                                       int dwMaximumSizeLow,
                                       java.lang.String lpName)
        Creates or opens a named or unnamed file mapping object for a specified file.
        Parameters:
        hFile - A handle to the file from which to create a file mapping object.
        lpAttributes - A pointer to a SECURITY_ATTRIBUTES structure that determines whether a returned handle can be inherited by child processes. The lpSecurityDescriptor member of the SECURITY_ATTRIBUTES structure specifies a security descriptor for a new file mapping object.
        flProtect - Specifies the page protection of the file mapping object. All mapped views of the object must be compatible with this protection.
        dwMaximumSizeHigh - The high-order DWORD of the maximum size of the file mapping object.
        dwMaximumSizeLow - The low-order DWORD of the maximum size of the file mapping object.
        lpName - The name of the file mapping object.
        Returns:
        If the function succeeds, the return value is a handle to the newly created file mapping object. If the object exists before the function call, the function returns a handle to the existing object (with its current size, not the specified size), and GetLastError returns ERROR_ALREADY_EXISTS. If the function fails, the return value is NULL. To get extended error information, call GetLastError.
      • MapViewOfFile

        Pointer MapViewOfFile(WinNT.HANDLE hFileMappingObject,
                              int dwDesiredAccess,
                              int dwFileOffsetHigh,
                              int dwFileOffsetLow,
                              int dwNumberOfBytesToMap)
        Maps a view of a file mapping into the address space of a calling process.
        Parameters:
        hFileMappingObject - A handle to a file mapping object. The CreateFileMapping and OpenFileMapping functions return this handle.
        dwDesiredAccess - The type of access to a file mapping object, which determines the protection of the pages.
        dwFileOffsetHigh - A high-order DWORD of the file offset where the view begins.
        dwFileOffsetLow - A low-order DWORD of the file offset where the view is to begin.
        dwNumberOfBytesToMap - The number of bytes of a file mapping to map to the view.
        Returns:
        If the function succeeds, the return value is the starting address of the mapped view. If the function fails, the return value is NULL. To get extended error information, call GetLastError.
      • UnmapViewOfFile

        boolean UnmapViewOfFile(Pointer lpBaseAddress)
        Unmaps a mapped view of a file from the calling process's address space.
        Parameters:
        lpBaseAddress - A pointer to the base address of the mapped view of a file that is to be unmapped.
        Returns:
        If the function succeeds, the return value is the starting address of the mapped view. If the function fails, the return value is NULL. To get extended error information, call GetLastError.
      • GetComputerName

        boolean GetComputerName(char[] buffer,
                                IntByReference lpnSize)
        Retrieves only the NetBIOS name of the local computer.
        Parameters:
        buffer - A pointer to a buffer that receives the computer name or the cluster virtual server name. The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.
        lpnSize - On input, specifies the size of the buffer, in TCHARs. On output, the number of TCHARs copied to the destination buffer, not including the terminating null character. If the buffer is too small, the function fails and GetLastError returns ERROR_BUFFER_OVERFLOW. The lpnSize parameter specifies the size of the buffer required, including the terminating null character.
        Returns:
        If the function succeeds, the return value is a nonzero value. If the function fails, the return value is zero. To get extended error information, call GetLastError.
      • GetComputerNameEx

        boolean GetComputerNameEx(int nameType,
                                  char[] buffer,
                                  IntByReference lpnSize)
        Retrieves a NetBIOS or DNS name associated with the local computer, according to the nameType enumeration value
        Parameters:
        nameType - An enumeration value specifying the type of name to be retrieved - this parameter is a value from the COMPUTER_NAME_FORMAT in the WinBase definitions
        buffer - A pointer to a buffer that receives the computer name or the cluster virtual server name. The length of the name may be greater than MAX_COMPUTERNAME_LENGTH characters because DNS allows longer names. To ensure that this buffer is large enough, set this parameter to NULL and use the required buffer size returned in the lpnSize parameter.
        lpnSize - On input, specifies the size of the buffer, in TCHARs. On output, the number of TCHARs copied to the destination buffer, not including the terminating null character. If the buffer is too small, the function fails and GetLastError returns ERROR_BUFFER_OVERFLOW. The lpnSize parameter specifies the size of the buffer required, including the terminating null character.
        Returns:
        If the function succeeds, the return value is a nonzero value. If the function fails, the return value is zero. To get extended error information, call GetLastError.
      • OpenThread

        WinNT.HANDLE OpenThread(int dwDesiredAccess,
                                boolean bInheritHandle,
                                int dwThreadId)
        The OpenThread function opens an existing thread object.
        Parameters:
        dwDesiredAccess - Access to the thread object. This access right is checked against any security descriptor for the thread.
        bInheritHandle - If this parameter is TRUE, the new process inherits the handle. If the parameter is FALSE, the handle is not inherited.
        dwThreadId - Identifier of the thread to be opened.
        Returns:
        If the function succeeds, the return value is an open handle to the specified process. If the function fails, the return value is NULL. To get extended error information, call GetLastError.
      • CreateProcess

        boolean CreateProcess(java.lang.String lpApplicationName,
                              java.lang.String lpCommandLine,
                              WinBase.SECURITY_ATTRIBUTES lpProcessAttributes,
                              WinBase.SECURITY_ATTRIBUTES lpThreadAttributes,
                              boolean bInheritHandles,
                              WinDef.DWORD dwCreationFlags,
                              Pointer lpEnvironment,
                              java.lang.String lpCurrentDirectory,
                              WinBase.STARTUPINFO lpStartupInfo,
                              WinBase.PROCESS_INFORMATION lpProcessInformation)
        Creates a new process and its primary thread. The new process runs in the security context of the calling process.
        Parameters:
        lpApplicationName - The name of the module to be executed.
        lpCommandLine - The command line to be executed.
        lpProcessAttributes - A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle to the new process object can be inherited by child processes. If lpProcessAttributes is NULL, the handle cannot be inherited.
        lpThreadAttributes - A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle to the new thread object can be inherited by child processes. If lpThreadAttributes is NULL, the handle cannot be inherited.
        bInheritHandles - If this parameter 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.
        dwCreationFlags - The flags that control the priority class and the creation of the process.
        lpEnvironment - A pointer to the environment block for the new process. If this parameter is NULL, the new process uses the environment of the calling process.
        lpCurrentDirectory - The full path to the current directory for the process.
        lpStartupInfo - A pointer to a STARTUPINFO or STARTUPINFOEX structure.
        lpProcessInformation - A pointer to a PROCESS_INFORMATION structure that receives identification information about the new process.
        Returns:
        If the function succeeds, the return value is nonzero.
      • CreateProcessW

        boolean CreateProcessW(java.lang.String lpApplicationName,
                               char[] lpCommandLine,
                               WinBase.SECURITY_ATTRIBUTES lpProcessAttributes,
                               WinBase.SECURITY_ATTRIBUTES lpThreadAttributes,
                               boolean bInheritHandles,
                               WinDef.DWORD dwCreationFlags,
                               Pointer lpEnvironment,
                               java.lang.String lpCurrentDirectory,
                               WinBase.STARTUPINFO lpStartupInfo,
                               WinBase.PROCESS_INFORMATION lpProcessInformation)
        Creates a new process and its primary thread. The new process runs in the security context of the calling process.
        Parameters:
        lpApplicationName - The name of the module to be executed.
        lpCommandLine - The command line to be executed. The maximum length of this string is 32,768 characters, including the Unicode terminating null character. If lpApplicationName is NULL, the module name portion of lpCommandLine is limited to MAX_PATH characters.

        The Unicode version of this function, CreateProcessW(java.lang.String, char[], com.sun.jna.platform.win32.WinBase.SECURITY_ATTRIBUTES, com.sun.jna.platform.win32.WinBase.SECURITY_ATTRIBUTES, boolean, com.sun.jna.platform.win32.WinDef.DWORD, com.sun.jna.Pointer, java.lang.String, com.sun.jna.platform.win32.WinBase.STARTUPINFO, com.sun.jna.platform.win32.WinBase.PROCESS_INFORMATION), can modify the contents of this string. Therefore, this parameter cannot be a pointer to read-only memory (such as a const variable or a literal string). If this parameter is a constant string, the function may cause an access violation.

        The lpCommandLine parameter can be NULL. In that case, the function uses the string pointed to by lpApplicationName as the command line.

        If both lpApplicationName and lpCommandLine are non-NULL, the null-terminated string pointed to by lpApplicationName specifies the module to execute, and the null-terminated string pointed to by lpCommandLine specifies the command line. The new process can use GetCommandLine to retrieve the entire command line. Console processes written in C can use the argc and argv arguments to parse the command line. Because argv[0] is the module name, C programmers generally repeat the module name as the first token in the command line.

        If lpApplicationName is NULL, the first white space-delimited token of the command line specifies the module name. If you are using a long file name that contains a space, use quoted strings to indicate where the file name ends and the arguments begin (see the explanation for the lpApplicationName parameter). If the file name does not contain an extension, .exe is appended. Therefore, if the file name extension is .com, this parameter must include the .com extension. If the file name ends in a period (.) with no extension, or if the file name contains a path, .exe is not appended. If the file name does not contain a directory path, the system searches for the executable file in the following sequence:
        • The directory from which the application loaded.
        • The current directory for the parent process.
        • The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
        • The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
        • The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
        • The directories that are listed in the PATH environment variable. Note that this function does not search the per-application path specified by the App Paths registry key. To include this per-application path in the search sequence, use the ShellExecute function.
        The system adds a terminating null character to the command-line string to separate the file name from the arguments. This divides the original string into two strings for internal processing.
        lpProcessAttributes - A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle to the new process object can be inherited by child processes. If lpProcessAttributes is NULL, the handle cannot be inherited.
        lpThreadAttributes - A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle to the new thread object can be inherited by child processes. If lpThreadAttributes is NULL, the handle cannot be inherited.
        bInheritHandles - If this parameter 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.
        dwCreationFlags - The flags that control the priority class and the creation of the process.
        lpEnvironment - A pointer to the environment block for the new process. If this parameter is NULL, the new process uses the environment of the calling process.
        lpCurrentDirectory - The full path to the current directory for the process.
        lpStartupInfo - A pointer to a STARTUPINFO or STARTUPINFOEX structure.
        lpProcessInformation - A pointer to a PROCESS_INFORMATION structure that receives identification information about the new process.
        Returns:
        If the function succeeds, the return value is nonzero.
      • OpenProcess

        WinNT.HANDLE OpenProcess(int fdwAccess,
                                 boolean fInherit,
                                 int IDProcess)
        This function returns a handle to an existing process object.
        Parameters:
        fdwAccess - The access to the process object. This access right is checked against the security descriptor for the process. This parameter can be one or more of the process access rights.

        If the caller has enabled the SeDebugPrivilege privilege, the requested access is granted regardless of the contents of the security descriptor.

        fInherit - If this value is TRUE, processes created by this process will inherit the handle. Otherwise, the processes do not inherit this handle.
        IDProcess - Specifies the process identifier of the process to open.
        Returns:
        An open handle to the specified process indicates success. NULL indicates failure. To get extended error information, call GetLastError.
      • QueryFullProcessImageName

        boolean QueryFullProcessImageName(WinNT.HANDLE hProcess,
                                          int dwFlags,
                                          char[] lpExeName,
                                          IntByReference lpdwSize)
        This function retrieves the full path of the executable file of a given process.
        Parameters:
        hProcess - Handle for the running process
        dwFlags - 0 - The name should use the Win32 path format. 1(WinNT.PROCESS_NAME_NATIVE) - The name should use the native system path format.
        lpExeName - pre-allocated character buffer for the returned path
        lpdwSize - input: the size of the allocated buffer output: the length of the returned path in characters
        Returns:
        true if successful false if not. To get extended error information, call GetLastError.
      • GetTempPath

        WinDef.DWORD GetTempPath(WinDef.DWORD nBufferLength,
                                 char[] buffer)
        The GetTempPath function retrieves the path of the directory designated for temporary files.
        Parameters:
        nBufferLength - Size of the string buffer identified by lpBuffer, in TCHARs.
        buffer - Pointer to a string buffer that receives the null-terminated string specifying the temporary file path. The returned string ends with a backslash, for example, C:\TEMP\.
        Returns:
        If the function succeeds, the return value is the length, in TCHARs, of the string copied to lpBuffer, not including the terminating null character. If the return value is greater than nBufferLength, the return value is the length, in TCHARs, of the buffer required to hold the path. If the function fails, the return value is zero. To get extended error information, call GetLastError.
      • GetVersion

        WinDef.DWORD GetVersion()
        The GetVersion function returns the current version number of the operating system.
        Returns:
        If the function succeeds, the return value includes the major and minor version numbers of the operating system in the low order word, and information about the operating system platform in the high order word.
      • GetVersionEx

        boolean GetVersionEx(WinNT.OSVERSIONINFO lpVersionInfo)
        The GetVersionEx function obtains extended information about the version of the operating system that is currently running.
        Parameters:
        lpVersionInfo - Pointer to an OSVERSIONINFO data structure that the function fills with operating system version information.
        Returns:
        If the function succeeds, the return value is a nonzero value. If the function fails, the return value is zero. To get extended error information, call GetLastError. The function fails if you specify an invalid value for the dwOSVersionInfoSize member of the OSVERSIONINFO or OSVERSIONINFOEX structure.
      • GetVersionEx

        boolean GetVersionEx(WinNT.OSVERSIONINFOEX lpVersionInfo)
        The GetVersionEx function obtains extended information about the version of the operating system that is currently running.
        Parameters:
        lpVersionInfo - Pointer to an OSVERSIONINFOEX data structure that the function fills with operating system version information.
        Returns:
        If the function succeeds, the return value is a nonzero value. If the function fails, the return value is zero. To get extended error information, call GetLastError. The function fails if you specify an invalid value for the dwOSVersionInfoSize member of the OSVERSIONINFO or OSVERSIONINFOEX structure.
      • VerifyVersionInfoW

        boolean VerifyVersionInfoW(WinNT.OSVERSIONINFOEX lpVersionInformation,
                                   int dwTypeMask,
                                   long dwlConditionMask)
        Compares a set of operating system version requirements to the corresponding values for the currently running version of the system. This function is subject to manifest-based behavior.
        Parameters:
        lpVersionInformation - A pointer to an WinNT.OSVERSIONINFOEX structure containing the operating system version requirements to compare. The dwTypeMask parameter indicates the members of this structure that contain information to compare.

        You must set the dwOSVersionInfoSize member of this structure to sizeof(OSVERSIONINFOEX). You must also specify valid data for the members indicated by dwTypeMask. The function ignores structure members for which the corresponding dwTypeMask bit is not set.

        dwTypeMask - A mask that indicates the members of the WinNT.OSVERSIONINFOEX structure to be tested.
        dwlConditionMask - The type of comparison to be used for each lpVersionInfo member being compared. To build this value, call the VerSetConditionMask(long, int, byte) function once for each WinNT.OSVERSIONINFOEX member being compared.
        Returns:
        If the currently running operating system satisfies the specified requirements, the return value is a nonzero value.

        If the current system does not satisfy the requirements, the return value is zero and GetLastError() returns WinError.ERROR_OLD_WIN_VERSION.

        If the function fails, the return value is zero and GetLastError() returns an error code other than WinError.ERROR_OLD_WIN_VERSION.

      • GetSystemInfo

        void GetSystemInfo(WinBase.SYSTEM_INFO lpSystemInfo)
        The GetSystemInfo function returns information about the current system.
        Parameters:
        lpSystemInfo - Pointer to a SYSTEM_INFO structure that receives the information.
      • GetNativeSystemInfo

        void GetNativeSystemInfo(WinBase.SYSTEM_INFO lpSystemInfo)
        The GetNativeSystemInfo function retrieves information about the current system to an application running under WOW64. If the function is called from a 64-bit application, it is equivalent to the GetSystemInfo function.
        Parameters:
        lpSystemInfo - Pointer to a SYSTEM_INFO structure that receives the information.
      • IsWow64Process

        boolean IsWow64Process(WinNT.HANDLE hProcess,
                               IntByReference Wow64Process)
        The IsWow64Process function determines whether the specified process is running under WOW64.
        Parameters:
        hProcess - Handle to a process.
        Wow64Process - Pointer to a value that is set to TRUE if the process is running under WOW64. Otherwise, the value is set to FALSE.
        Returns:
        If the function succeeds, the return value is a nonzero value. If the function fails, the return value is zero. To get extended error information, call GetLastError.
      • GlobalMemoryStatusEx

        boolean GlobalMemoryStatusEx(WinBase.MEMORYSTATUSEX lpBuffer)
        Retrieves information about the system's current usage of both physical and virtual memory.
        Parameters:
        lpBuffer - A pointer to a MEMORYSTATUSEX structure that receives information about current memory availability.
        Returns:
        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.
      • GetFileInformationByHandleEx

        boolean GetFileInformationByHandleEx(WinNT.HANDLE hFile,
                                             int FileInformationClass,
                                             Pointer lpFileInformation,
                                             WinDef.DWORD dwBufferSize)
        Retrieves file information for the specified file. To set file information using a file handle, see SetFileInformationByHandle.
        Parameters:
        hFile - A handle to the file that contains the information to be retrieved.
        FileInformationClass - A FILE_INFO_BY_HANDLE_CLASS enumeration value that specifies the type of information to be retrieved.
        lpFileInformation - A pointer to the buffer that receives the requested file information. The structure that is returned corresponds to the class that is specified by FileInformationClass.
        dwBufferSize - The size of the lpFileInformation buffer, in bytes.
        Returns:
        If the function succeeds, the return value is nonzero and file information data is contained in the buffer pointed to by the lpFileInformation parameter. If the function fails, the return value is zero. To get extended error information, call GetLastError.
      • SetFileInformationByHandle

        boolean SetFileInformationByHandle(WinNT.HANDLE hFile,
                                           int FileInformationClass,
                                           Pointer lpFileInformation,
                                           WinDef.DWORD dwBufferSize)
        Sets the file information for the specified file. To retrieve file information using a file handle, see GetFileInformationByHandleEx.
        Parameters:
        hFile - A handle to the file for which to change information. This handle must be opened with the appropriate permissions for the requested change. This handle should not be a pipe handle.
        FileInformationClass - A FILE_INFO_BY_HANDLE_CLASS enumeration value that specifies the type of information to be changed. Valid values are FILE_BASIC_INFO, FILE_RENAME_INFO, FILE_DISPOSITION_INFO, FILE_ALLOCATION_INFO, FILE_END_OF_FILE_INFO, and FILE_IO_PRIORITY_HINT_INFO
        lpFileInformation - A pointer to the buffer that contains the information to change for the specified file information class. The structure that this parameter points to corresponds to the class that is specified by FileInformationClass.
        dwBufferSize - The size of the lpFileInformation buffer, in bytes.
        Returns:
        Returns nonzero if successful or zero otherwise. To get extended error information, call GetLastError.
      • GetFileTime

        boolean GetFileTime(WinNT.HANDLE hFile,
                            WinBase.FILETIME lpCreationTime,
                            WinBase.FILETIME lpLastAccessTime,
                            WinBase.FILETIME lpLastWriteTime)
        Retrieves the date and time that a file or directory was created, last accessed, and last modified.
        Parameters:
        hFile - A handle to the file or directory for which dates and times are to be retrieved. The handle must have been created using the CreateFile function with the GENERIC_READ access right.
        lpCreationTime - A pointer to a FILETIME structure to receive the date and time the file or directory was created. This parameter can be NULL if the application does not require this information.
        lpLastAccessTime - A pointer to a FILETIME structure to receive the date and time the file or directory was last accessed. The last access time includes the last time the file or directory was written to, read from, or, in the case of executable files, run. This parameter can be NULL if the application does not require this information.
        lpLastWriteTime - A pointer to a FILETIME structure to receive the date and time the file or directory was last written to, truncated, or overwritten (for example, with WriteFile or SetEndOfFile). This date and time is not updated when file attributes or security descriptors are changed. This parameter can be NULL if the application does not require this information.
        Returns:
        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.
      • SetFileTime

        int SetFileTime(WinNT.HANDLE hFile,
                        WinBase.FILETIME lpCreationTime,
                        WinBase.FILETIME lpLastAccessTime,
                        WinBase.FILETIME lpLastWriteTime)
        Sets the date and time that the specified file or directory was created, last accessed, or last modified.
        Parameters:
        hFile - A handle to the file or directory. The handle must have been created using the CreateFile function with the FILE_WRITE_ATTRIBUTES access right. For more information, see File Security and Access Rights.
        lpCreationTime - A pointer to a FILETIME structure that contains the new creation date and time for the file or directory. This parameter can be NULL if the application does not need to change this information.
        lpLastAccessTime - A pointer to a FILETIME structure that contains the new last access date and time for the file or directory. The last access time includes the last time the file or directory was written to, read from, or (in the case of executable files) run. This parameter can be NULL if the application does not need to change this information. To preserve the existing last access time for a file even after accessing a file, call SetFileTime immediately after opening the file handle with this parameter's FILETIME structure members initialized to 0xFFFFFFFF.
        lpLastWriteTime - A pointer to a FILETIME structure that contains the new last modified date and time for the file or directory. This parameter can be NULL if the application does not need to change this information.
        Returns:
        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.
      • SetFileAttributes

        boolean SetFileAttributes(java.lang.String lpFileName,
                                  WinDef.DWORD dwFileAttributes)
        Sets the attributes for a file or directory.
        Parameters:
        lpFileName - The name of the file whose attributes are to be set. The name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, prepend "\\?\" to the path.
        dwFileAttributes - The file attributes to set for the file. This parameter can be one or more values, combined using the bitwise-OR operator. However, all other values override FILE_ATTRIBUTE_NORMAL.
        Returns:
        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.
      • GetLogicalDriveStrings

        WinDef.DWORD GetLogicalDriveStrings(WinDef.DWORD nBufferLength,
                                            char[] lpBuffer)
        The GetLogicalDriveStrings function fills a buffer with strings that specify valid drives in the system.
        Parameters:
        nBufferLength - Maximum size of the buffer pointed to by lpBuffer, in TCHARs. This size does not include the terminating null character. If this parameter is zero, lpBuffer is not used.
        lpBuffer - Pointer to a buffer that receives a series of null-terminated strings, one for each valid drive in the system, plus with an additional null character. Each string is a device name.
        Returns:
        If the function succeeds, the return value is the length, in characters, of the strings copied to the buffer, not including the terminating null character. Note that an ANSI-ASCII null character uses one byte, but a Unicode null character uses two bytes. If the buffer is not large enough, the return value is greater than nBufferLength. It is the size of the buffer required to hold the drive strings. If the function fails, the return value is zero. To get extended error information, use the GetLastError function.
      • GetDiskFreeSpace

        boolean GetDiskFreeSpace(java.lang.String lpRootPathName,
                                 WinDef.DWORDByReference lpSectorsPerCluster,
                                 WinDef.DWORDByReference lpBytesPerSector,
                                 WinDef.DWORDByReference lpNumberOfFreeClusters,
                                 WinDef.DWORDByReference lpTotalNumberOfClusters)
        Retrieves information about the specified disk, including the amount of free space on the disk
        Parameters:
        lpRootPathName - The root directory of the disk for which information is to be returned. If this parameter is NULL, the function uses the root of the current disk. If this parameter is a UNC name, it must include a trailing backslash (for example, "\\MyServer\MyShare\"). Furthermore, a drive specification must have a trailing backslash (for example, "C:\"). The calling application must have FILE_LIST_DIRECTORY access rights for this directory.
        lpSectorsPerCluster - A variable that receives the number of sectors per cluster.
        lpBytesPerSector - A variable that receives the number of bytes per sector.
        lpNumberOfFreeClusters - A variable that receives the total number of free clusters on the disk that are available to the user who is associated with the calling thread. If per-user disk quotas are in use, this value may be less than the total number of free clusters on the disk.
        lpTotalNumberOfClusters - A variable that receives the total number of clusters on the disk that are available to the user who is associated with the calling thread. If per-user disk quotas are in use, this value may be less than the total number of clusters on the disk.
        Returns:
        true if the function succeeds - to get extended error information, call GetLastError().
        See Also:
        GetDiskFreeSpace
      • GetDiskFreeSpaceEx

        boolean GetDiskFreeSpaceEx(java.lang.String lpDirectoryName,
                                   WinNT.LARGE_INTEGER lpFreeBytesAvailable,
                                   WinNT.LARGE_INTEGER lpTotalNumberOfBytes,
                                   WinNT.LARGE_INTEGER lpTotalNumberOfFreeBytes)
        The GetDiskFreeSpaceEx function retrieves information about the amount of space that is available on a disk volume, which is the total amount of space, the total amount of free space, and the total amount of free space available to the user that is associated with the calling thread.
        Parameters:
        lpDirectoryName - A string that specifies a directory on a disk. If this parameter is NULL, the function uses the root of the current disk. If this parameter is a UNC name, it must include a trailing backslash, for example, \\MyServer\MyShare\. This parameter does not have to specify the root directory on a disk. The function accepts any directory on a disk.
        lpFreeBytesAvailable - A pointer to a variable that receives the total number of free bytes on a disk that are available to the user who is associated with the calling thread. This parameter can be NULL.
        lpTotalNumberOfBytes - A pointer to a variable that receives the total number of bytes on a disk that are available to the user who is associated with the calling thread. This parameter can be NULL.
        lpTotalNumberOfFreeBytes - A pointer to a variable that receives the total number of free bytes on a disk. This parameter can be NULL.
        Returns:
        true if the function succeeds - to get extended error information, call GetLastError().
        See Also:
        GetDiskFreeSpaceEx
      • DeleteFile

        boolean DeleteFile(java.lang.String filename)
        Deletes an existing file.
        Parameters:
        filename - The name of the file to be deleted.
        Returns:
        If the function succeeds, the return value is nonzero. If the function fails, the return value is zero (0). To get extended error information, call GetLastError.
      • CreatePipe

        boolean CreatePipe(WinNT.HANDLEByReference hReadPipe,
                           WinNT.HANDLEByReference hWritePipe,
                           WinBase.SECURITY_ATTRIBUTES lpPipeAttributes,
                           int nSize)
        Creates an anonymous pipe, and returns handles to the read and write ends of the pipe.
        Parameters:
        hReadPipe - A pointer to a variable that receives the read handle for the pipe.
        hWritePipe - A pointer to a variable that receives the write handle for the pipe.
        lpPipeAttributes - A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes.
        nSize - The size of the buffer for the pipe, in bytes.
        Returns:
        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.
      • CallNamedPipe

        boolean CallNamedPipe(java.lang.String lpNamedPipeName,
                              byte[] lpInBuffer,
                              int nInBufferSize,
                              byte[] lpOutBuffer,
                              int nOutBufferSize,
                              IntByReference lpBytesRead,
                              int nTimeOut)
        Connects to a message-type pipe (and waits if an instance of the pipe is not available), writes to and reads from the pipe, and then closes the pipe.
        Parameters:
        lpNamedPipeName - The pipe name.
        lpInBuffer - The data to be written to the pipe.
        nInBufferSize - The size of the write buffer, in bytes.
        lpOutBuffer - The buffer that receives the data read from the pipe.
        nOutBufferSize - The size of the read buffer, in bytes.
        lpBytesRead - A variable that receives the number of bytes read from the pipe.
        nTimeOut - The number of milliseconds to wait for the named pipe to be available.
        Returns:
        true if successful, false otherwise. To get extended error information, call GetLastError().
        See Also:
        CallNamedPipe documentation
      • ConnectNamedPipe

        boolean ConnectNamedPipe(WinNT.HANDLE hNamedPipe,
                                 WinBase.OVERLAPPED lpOverlapped)
        Enables a named pipe server process to wait for a client process to connect to an instance of a named pipe
        Parameters:
        hNamedPipe - A handle to the server end of a named pipe instance.
        lpOverlapped - A pointer to an WinBase.OVERLAPPED structure.
        Returns:

        If the operation is synchronous, does not return until the operation has completed. If the function succeeds, the return value is true. If the function fails, the return value is false. To get extended error information, call GetLastError().

        If the operation is asynchronous, returns immediately. If the operation is still pending, the return value is false and GetLastError() returns WinError.ERROR_IO_PENDING.

        If a client connects before the function is called, the function returns false and GetLastError() returns WinError.ERROR_PIPE_CONNECTED.

        See Also:
        ConnectNamedPipe documentation
      • CreateNamedPipe

        WinNT.HANDLE CreateNamedPipe(java.lang.String lpName,
                                     int dwOpenMode,
                                     int dwPipeMode,
                                     int nMaxInstances,
                                     int nOutBufferSize,
                                     int nInBufferSize,
                                     int nDefaultTimeOut,
                                     WinBase.SECURITY_ATTRIBUTES lpSecurityAttributes)
        Parameters:
        lpName - The unique pipe name. This string must have the following form:

        \\.\pipe\pipename

        The pipename part of the name can include any character other than a backslash, including numbers and special characters. The entire pipe name string can be up to MAX_PIPE_NAME_LENGTH characters long. Pipe names are not case sensitive.

        dwOpenMode - The open mode. The function fails if specifies anything other than 0 or the allowed flags
        dwPipeMode - The pipe mode. The function fails if specifies anything other than 0 or the allowed flags
        nMaxInstances - The maximum number of instances that can be created for this pipe. Acceptable values are in the range 1 through WinBase.PIPE_UNLIMITED_INSTANCES
        nOutBufferSize - The number of bytes to reserve for the output buffer.
        nInBufferSize - The number of bytes to reserve for the input buffer.
        nDefaultTimeOut - The default time-out value, in milliseconds. A value of zero will result in a default time-out of 50 milliseconds
        lpSecurityAttributes - A pointer to a WinBase.SECURITY_ATTRIBUTES structure that specifies a security descriptor for the new named pipe. If null the named pipe gets a default security descriptor and the handle cannot be inherited.
        Returns:
        If the function succeeds, the return value is a handle to the server end of a named pipe instance. If the function fails, the return value is WinBase.INVALID_HANDLE_VALUE. To get extended error information, call GetLastError().
        See Also:
        CreateNamedPipe documentation
      • DisconnectNamedPipe

        boolean DisconnectNamedPipe(WinNT.HANDLE hNamedPipe)
        Disconnects the server end of a named pipe instance from a client process.
        Parameters:
        hNamedPipe - A handle to an instance of a named pipe.
        Returns:
        true if successful, false otherwise. To get extended error information, call GetLastError().
        See Also:
        DisconnectNamedPipe documentation
      • GetNamedPipeClientComputerName

        boolean GetNamedPipeClientComputerName(WinNT.HANDLE Pipe,
                                               char[] ClientComputerName,
                                               int ClientComputerNameLength)
        Retrieves the client computer name for the specified named pipe.
        Parameters:
        Pipe - A handle to an instance of a named pipe.
        ClientComputerName - The buffer to receive the computer name. Note: use Native.toString(char[]) to convert it to a String
        ClientComputerNameLength - The size of the ClientComputerName buffer, in bytes.
        Returns:
        true if successful, false otherwise. To get extended error information, call GetLastError().
        See Also:
        GetNamedPipeClientComputerName documentation
      • GetNamedPipeHandleState

        boolean GetNamedPipeHandleState(WinNT.HANDLE hNamedPipe,
                                        IntByReference lpState,
                                        IntByReference lpCurInstances,
                                        IntByReference lpMaxCollectionCount,
                                        IntByReference lpCollectDataTimeout,
                                        char[] lpUserName,
                                        int nMaxUserNameSize)
        Retrieves information about a specified named pipe.
        Parameters:
        hNamedPipe - A handle to the named pipe for which information is wanted.
        lpState - A pointer to a variable that indicates the current state of the handle. This parameter can be null if this information is not needed.
        lpCurInstances - A pointer to a variable that receives the number of current pipe instances. This parameter can be null if this information is not needed.
        lpMaxCollectionCount - A pointer to a variable that receives the maximum number of bytes to be collected on the client's computer before transmission to the server. This parameter can be null if this information is not needed.
        lpCollectDataTimeout - A pointer to a variable that receives the maximum time, in milliseconds, that can pass before a remote named pipe transfers information over the network. This parameter can be null if this information is not needed.
        lpUserName - A buffer that receives the user name string associated with the client application. This parameter can be null if this information is not needed.
        nMaxUserNameSize - The size of the buffer specified by the lpUserName parameter. This parameter is ignored if lpUserName is null.
        Returns:
        true if successful, false otherwise. To get extended error information, call GetLastError().
        See Also:
        GetNamedPipeHandleState documentation
      • GetNamedPipeInfo

        boolean GetNamedPipeInfo(WinNT.HANDLE hNamedPipe,
                                 IntByReference lpFlags,
                                 IntByReference lpOutBufferSize,
                                 IntByReference lpInBufferSize,
                                 IntByReference lpMaxInstances)
        Retrieves information about the specified named pipe.
        Parameters:
        hNamedPipe - A handle to the named pipe instance.
        lpFlags - A pointer to a variable that receives the type of the named pipe. This parameter can be null if this information is not needed.
        lpOutBufferSize - A pointer to a variable that receives the size of the buffer for outgoing data, in bytes. This parameter can be null if this information is not needed.
        lpInBufferSize - A pointer to a variable that receives the size of the buffer for incoming data, in bytes. This parameter can be null if this information is not needed.
        lpMaxInstances - A pointer to a variable that receives the maximum number of pipe instances that can be created. This parameter can be null if this information is not needed.
        Returns:
        true if successful, false otherwise. To get extended error information, call GetLastError().
        See Also:
        GetNamedPipeInfo documentation
      • PeekNamedPipe

        boolean PeekNamedPipe(WinNT.HANDLE hNamedPipe,
                              byte[] lpBuffer,
                              int nBufferSize,
                              IntByReference lpBytesRead,
                              IntByReference lpTotalBytesAvail,
                              IntByReference lpBytesLeftThisMessage)
        Copies data from a named or anonymous pipe into a buffer without removing it from the pipe.
        Parameters:
        hNamedPipe - A handle to the pipe.
        lpBuffer - A buffer that receives data read from the pipe. This parameter can be null if no data is to be read.
        nBufferSize - The size of the buffer specified by the lpBuffer parameter, in bytes. This parameter is ignored if lpBuffer is null.
        lpBytesRead - A variable that receives the number of bytes read from the pipe. This parameter can be null if no data is to be read.
        lpTotalBytesAvail - A variable that receives the total number of bytes available to be read from the pipe. This parameter can be null if no data is to be read.
        lpBytesLeftThisMessage - A variable that receives the number of bytes remaining in this message. This parameter can be null if no data is to be read.
        Returns:
        true if successful, false otherwise. To get extended error information, call GetLastError().
        See Also:
        PeekNamedPipe documentation
      • SetNamedPipeHandleState

        boolean SetNamedPipeHandleState(WinNT.HANDLE hNamedPipe,
                                        IntByReference lpMode,
                                        IntByReference lpMaxCollectionCount,
                                        IntByReference lpCollectDataTimeout)
        Sets the read mode and the blocking mode of the specified named pipe.
        Parameters:
        hNamedPipe - A handle to the named pipe instance.
        lpMode - The new pipe mode. The mode is a combination of a read-mode flag and a wait-mode flag. This parameter can be null if the mode is not being set.
        lpMaxCollectionCount - The maximum number of bytes collected on the client computer before transmission to the server. This parameter can be null if the count is not being set.
        lpCollectDataTimeout - The maximum time, in milliseconds, that can pass before a remote named pipe transfers information over the network. This parameter can be null if the timeout is not being set.
        Returns:
        true if successful, false otherwise. To get extended error information, call GetLastError().
        See Also:
        SetNamedPipeHandleState documentation
      • TransactNamedPipe

        boolean TransactNamedPipe(WinNT.HANDLE hNamedPipe,
                                  byte[] lpInBuffer,
                                  int nInBufferSize,
                                  byte[] lpOutBuffer,
                                  int nOutBufferSize,
                                  IntByReference lpBytesRead,
                                  WinBase.OVERLAPPED lpOverlapped)
        Combines the functions that write a message to and read a message from the specified named pipe into a single network operation.
        Parameters:
        hNamedPipe - A handle to the named pipe
        lpInBuffer - The buffer containing the data to be written to the pipe.
        nInBufferSize - The size of the input buffer, in bytes.
        lpOutBuffer - The buffer that receives the data read from the pipe.
        nOutBufferSize - The size of the output buffer, in bytes.
        lpBytesRead - Variable that receives the number of bytes read from the pipe.
        lpOverlapped - A pointer to an WinBase.OVERLAPPED structure. Can be null if pipe not opened with WinNT.FILE_FLAG_OVERLAPPED.
        Returns:
        true if successful, false otherwise. To get extended error information, call GetLastError().
        See Also:
        TransactNamedPipe documentation
      • WaitNamedPipe

        boolean WaitNamedPipe(java.lang.String lpNamedPipeName,
                              int nTimeOut)
        Waits until either a time-out interval elapses or an instance of the specified named pipe is available for connection - i.e., the pipe's server process has a pending ConnectNamedPipe(com.sun.jna.platform.win32.WinNT.HANDLE, com.sun.jna.platform.win32.WinBase.OVERLAPPED) operation on the pipe.
        Parameters:
        lpNamedPipeName - The name of the named pipe. The string must include the name of the computer on which the server process is executing. The following pipe name format is used:

        \\servername\pipe\pipename

        A period may be used for the servername if the pipe is local.

        nTimeOut - The number of milliseconds that the function will wait for an instance of the named pipe to be available.
        Returns:
        true if successful, false otherwise. To get extended error information, call GetLastError().
        See Also:
        WaitNamedPipe documentation
      • SetHandleInformation

        boolean SetHandleInformation(WinNT.HANDLE hObject,
                                     int dwMask,
                                     int dwFlags)
        Sets certain properties of an object handle.
        Parameters:
        hObject - A handle to an object whose information is to be set.
        dwMask - A mask that specifies the bit flags to be changed. Use the same constants shown in the description of dwFlags.
        dwFlags - Set of bit flags that specifies properties of the object handle.
        Returns:
        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.
      • GetFileAttributes

        int GetFileAttributes(java.lang.String lpFileName)
        Retrieves file system attributes for a specified file or directory.
        Parameters:
        lpFileName - The name of the file or directory. Prepend \\?\ to the path for names up to 32,767 wide characters
        Returns:
        INVALID_FILE_ATTRIBUTES if the function fails, otherwise the file attributes WinNT.FILE_ATTRIBUTE_*
      • GetFileType

        int GetFileType(WinNT.HANDLE hFile)
        Retrieves the file type of the specified file.
        Parameters:
        hFile - A handle to the file.
        Returns:
        FILE_TYPE_UNKNOWN if the function fails, or if the type is unknown. You can distinguish between a "valid" return of FILE_TYPE_UNKNOWN and its return due to a calling error (for example, passing an invalid handle to GetFileType) by calling GetLastError. If the function worked properly and FILE_TYPE_UNKNOWN was returned, a call to GetLastError will return NO_ERROR.
      • DeviceIoControl

        boolean DeviceIoControl(WinNT.HANDLE hDevice,
                                int dwIoControlCode,
                                Pointer lpInBuffer,
                                int nInBufferSize,
                                Pointer lpOutBuffer,
                                int nOutBufferSize,
                                IntByReference lpBytesReturned,
                                Pointer lpOverlapped)
        Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.
        Parameters:
        hDevice - A handle to the device on which the operation is to be performed. The device is typically a volume, directory, file, or stream. To retrieve a device handle, use the CreateFile function. For more information, see Remarks.
        dwIoControlCode - The control code for the operation. This value identifies the specific operation to be performed and the type of device on which to perform it. For a list of the control codes, see Remarks. The documentation for each control code provides usage details for the lpInBuffer, nInBufferSize, lpOutBuffer, and nOutBufferSize parameters.
        lpInBuffer - A pointer to the input buffer that contains the data required to perform the operation. The format of this data depends on the value of the dwIoControlCode parameter. This parameter can be NULL if dwIoControlCode specifies an operation that does not require input data.
        nInBufferSize - The size of the input buffer, in bytes.
        lpOutBuffer - A pointer to the output buffer that is to receive the data returned by the operation. The format of this data depends on the value of the dwIoControlCode parameter. This parameter can be NULL if dwIoControlCode specifies an operation that does not return data.
        nOutBufferSize - The size of the output buffer, in bytes.
        lpBytesReturned - A pointer to a variable that receives the size of the data stored in the output buffer, in bytes. If the output buffer is too small to receive any data, the call fails, GetLastError returns ERROR_INSUFFICIENT_BUFFER, and lpBytesReturned is zero. If the output buffer is too small to hold all of the data but can hold some entries, some drivers will return as much data as fits. In this case, the call fails, GetLastError returns ERROR_MORE_DATA, and lpBytesReturned indicates the amount of data received. Your application should call DeviceIoControl again with the same operation, specifying a new starting point. If lpOverlapped is NULL, lpBytesReturned cannot be NULL. Even when an operation returns no output data and lpOutBuffer is NULL, DeviceIoControl makes use of lpBytesReturned. After such an operation, the value of lpBytesReturned is meaningless. If lpOverlapped is not NULL, lpBytesReturned can be NULL. If this parameter is not NULL and the operation returns data, lpBytesReturned is meaningless until the overlapped operation has completed. To retrieve the number of bytes returned, call GetOverlappedResult. If hDevice is associated with an I/O completion port, you can retrieve the number of bytes returned by calling GetQueuedCompletionStatus.
        lpOverlapped - A pointer to an OVERLAPPED structure. If hDevice was opened without specifying FILE_FLAG_OVERLAPPED, lpOverlapped is ignored. If hDevice was opened with the FILE_FLAG_OVERLAPPED flag, the operation is performed as an overlapped (asynchronous) operation. In this case, lpOverlapped must point to a valid OVERLAPPED structure that contains a handle to an event object. Otherwise, the function fails in unpredictable ways. For overlapped operations, DeviceIoControl returns immediately, and the event object is signaled when the operation has been completed. Otherwise, the function does not return until the operation has been completed or an error occurs.
        Returns:
        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.
      • CreateToolhelp32Snapshot

        WinNT.HANDLE CreateToolhelp32Snapshot(WinDef.DWORD dwFlags,
                                              WinDef.DWORD th32ProcessID)
        Takes a snapshot of the specified processes, as well as the heaps, modules, and threads used by these processes.
        Parameters:
        dwFlags - The portions of the system to be included in the snapshot.
        th32ProcessID - The process identifier of the process to be included in the snapshot. This parameter can be zero to indicate the current process. This parameter is used when the TH32CS_SNAPHEAPLIST, TH32CS_SNAPMODULE, TH32CS_SNAPMODULE32, or TH32CS_SNAPALL value is specified. Otherwise, it is ignored and all processes are included in the snapshot. If the specified process is the Idle process or one of the CSRSS processes, this function fails and the last error code is ERROR_ACCESS_DENIED because their access restrictions prevent user-level code from opening them. If the specified process is a 64-bit process and the caller is a 32-bit process, this function fails and the last error code is ERROR_PARTIAL_COPY (299).
        Returns:
        If the function succeeds, it returns an open handle to the specified snapshot. If the function fails, it returns INVALID_HANDLE_VALUE. To get extended error information, call GetLastError. Possible error codes include ERROR_BAD_LENGTH.
      • Process32First

        boolean Process32First(WinNT.HANDLE hSnapshot,
                               Tlhelp32.PROCESSENTRY32 lppe)
        Retrieves information about the first process encountered in a system snapshot.
        Parameters:
        hSnapshot - A handle to the snapshot returned from a previous call to the CreateToolhelp32Snapshot function.
        lppe - A pointer to a PROCESSENTRY32 structure. It contains process information such as the name of the executable file, the process identifier, and the process identifier of the parent process.
        Returns:
        Returns TRUE if the first entry of the process list has been copied to the buffer or FALSE otherwise. The ERROR_NO_MORE_FILES error value is returned by the GetLastError function if no processes exist or the snapshot does not contain process information.
      • Process32Next

        boolean Process32Next(WinNT.HANDLE hSnapshot,
                              Tlhelp32.PROCESSENTRY32 lppe)
        Retrieves information about the next process recorded in a system snapshot.
        Parameters:
        hSnapshot - A handle to the snapshot returned from a previous call to the CreateToolhelp32Snapshot function.
        lppe - A pointer to a PROCESSENTRY32 structure.
        Returns:
        Returns TRUE if the next entry of the process list has been copied to the buffer or FALSE otherwise. The ERROR_NO_MORE_FILES error value is returned by the GetLastError function if no processes exist or the snapshot does not contain process information.
      • Thread32First

        boolean Thread32First(WinNT.HANDLE hSnapshot,
                              Tlhelp32.THREADENTRY32 lpte)
        Retrieves information about the first thread of any process encountered in a system snapshot.
        Parameters:
        hSnapshot - A handle to the snapshot returned from a previous call to the CreateToolhelp32Snapshot function.
        lpte - A pointer to a THREADENTRY32 structure.
        Returns:
        Returns TRUE if the first entry of the thread list has been copied to the buffer or FALSE otherwise. The ERROR_NO_MORE_FILES error value is returned by the GetLastError function if no threads exist or the snapshot does not contain thread information.
      • Thread32Next

        boolean Thread32Next(WinNT.HANDLE hSnapshot,
                             Tlhelp32.THREADENTRY32 lpte)
        Retrieves information about the next process recorded in a system snapshot.
        Parameters:
        hSnapshot - A handle to the snapshot returned from a previous call to the CreateToolhelp32Snapshot function.
        lpte - A pointer to a THREADENTRY32 structure.
        Returns:
        Returns TRUE if the next entry of the thread list has been copied to the buffer or FALSE otherwise. The ERROR_NO_MORE_FILES error value is returned by the GetLastError function if no threads exist or the snapshot does not contain thread information.
      • SetEnvironmentVariable

        boolean SetEnvironmentVariable(java.lang.String lpName,
                                       java.lang.String lpValue)
        The SetEnvironmentVariable function sets the contents of the specified environment variable for the current process.
        Parameters:
        lpName - Pointer to a string containing the name of the environment variable to set.
        lpValue - Pointer to a string containing the value to set it to. if this value is NULL, the variable is deleted from the current process' environment.
        Returns:
        If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To get extended error information, call GetLastError.
      • GetEnvironmentVariable

        int GetEnvironmentVariable(java.lang.String lpName,
                                   char[] lpBuffer,
                                   int nSize)
        Retrieves the contents of the specified variable from the environment block of the calling process.
        Parameters:
        lpName - The name of the environment variable.
        lpBuffer - A pointer to a buffer that receives the contents of the specified environment variable as a null-terminated string. An environment variable has a maximum size limit of 32,767 characters, including the null-terminating character.
        nSize - The size of the buffer pointed to by the lpBuffer parameter, including the null-terminating character, in characters.
        Returns:
        If the function succeeds, the return value is the number of characters stored in the buffer pointed to by lpBuffer, not including the terminating null character. If lpBuffer is not large enough to hold the data, the return value is the buffer size, in characters, required to hold the string and its terminating null character and the contents of lpBuffer are undefined. If the function fails, the return value is zero. To get extended error information, call GetLastError.
      • GetEnvironmentStrings

        Pointer GetEnvironmentStrings()

        Retrieves the environment variables for the current process. The block of variables format is as follows:

        Var1=Value1\0 Var2=Value2\0 Var3=Value3\0 ... VarN=ValueN\0\0

        Returns:
        If the function succeeds, the return value is a Pointer. to the environment block of the current process. If fails, then null is returned. When the data is no longer needed the memory block must be released using FreeEnvironmentStrings(Pointer)
        See Also:
        GetEnvironmentStrings documentation
      • GetSystemDefaultLCID

        WinDef.LCID GetSystemDefaultLCID()
        Returns the locale identifier for the system locale.
        Returns:
        Returns the locale identifier for the system default locale, identified by LOCALE_SYSTEM_DEFAULT.
      • GetUserDefaultLCID

        WinDef.LCID GetUserDefaultLCID()
        Returns the locale identifier for the user default locale.
        Returns:
        Returns the locale identifier for the user default locale, represented as LOCALE_USER_DEFAULT. If the user default locale is a custom locale, this function always returns LOCALE_CUSTOM_DEFAULT, regardless of the custom locale that is selected. For example, whether the user locale is Hawaiian (US), haw-US, or Fijiian (Fiji), fj-FJ, the function returns the same value.
      • GetPrivateProfileInt

        int GetPrivateProfileInt(java.lang.String appName,
                                 java.lang.String keyName,
                                 int defaultValue,
                                 java.lang.String fileName)
        Retrieves an integer associated with a key in the specified section of an initialization file.
        Parameters:
        appName - The name of the section in the initialization file.
        keyName - The name of the key whose value is to be retrieved. This value is in the form of a string; the GetPrivateProfileInt(java.lang.String, java.lang.String, int, java.lang.String) function converts the string into an integer and returns the integer.
        defaultValue - The default value to return if the key name cannot be found in the initialization file.
        fileName - The name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.
        Returns:
        The return value is the integer equivalent of the string following the specified key name in the specified initialization file. If the key is not found, the return value is the specified default value.
      • GetPrivateProfileString

        WinDef.DWORD GetPrivateProfileString(java.lang.String lpAppName,
                                             java.lang.String lpKeyName,
                                             java.lang.String lpDefault,
                                             char[] lpReturnedString,
                                             WinDef.DWORD nSize,
                                             java.lang.String lpFileName)
        Retrieves a string from the specified section in an initialization file.
        Parameters:
        lpAppName - The name of the section containing the key name. If this parameter is null, the GetPrivateProfileString(java.lang.String, java.lang.String, java.lang.String, char[], com.sun.jna.platform.win32.WinDef.DWORD, java.lang.String) function copies all section names in the file to the supplied buffer.
        lpKeyName - The name of the key whose associated string is to be retrieved. If this parameter is null, all key names in the section specified by the lpAppName parameter are copied to the buffer specified by the lpReturnedString parameter.
        lpDefault - A default string. If the lpKeyName key cannot be found in the initialization file, GetPrivateProfileString(java.lang.String, java.lang.String, java.lang.String, char[], com.sun.jna.platform.win32.WinDef.DWORD, java.lang.String) copies the default string to the lpReturnedString buffer. If this parameter is null, the default is an empty string, "".

        Avoid specifying a default string with trailing blank characters. The function inserts a null character in the lpReturnedString buffer to strip any trailing blanks.

        lpReturnedString - A pointer to the buffer that receives the retrieved string.
        nSize - The size of the buffer pointed to by the lpReturnedString parameter, in characters.
        lpFileName - The name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.
        Returns:
        The return value is the number of characters copied to the buffer, not including the terminating null character.

        If neither lpAppName nor lpKeyName is null and the supplied destination buffer is too small to hold the requested string, the string is truncated and followed by a null character, and the return value is equal to nSize minus one.

        If either lpAppName or lpKeyName is null and the supplied destination buffer is too small to hold all the strings, the last string is truncated and followed by two null characters. In this case, the return value is equal to nSize minus two.

        In the event the initialization file specified by lpFileName is not found, or contains invalid values, this function will set errorno with a value of '0x2' (File Not Found). To retrieve extended error information, call GetLastError().

      • WritePrivateProfileString

        boolean WritePrivateProfileString(java.lang.String lpAppName,
                                          java.lang.String lpKeyName,
                                          java.lang.String lpString,
                                          java.lang.String lpFileName)
        Copies a string into the specified section of an initialization file. If the file was created using Unicode characters, the function writes Unicode characters to the file. Otherwise, the function writes ANSI characters.
        Parameters:
        lpAppName - The name of the section to which the string will be copied. If the section does not exist, it is created. The name of the section is case-independent; the string can be any combination of uppercase and lowercase letters.
        lpKeyName - The name of the key to be associated with a string. If the key does not exist in the specified section, it is created. If this parameter is null, the entire section, including all entries within the section, is deleted.
        lpString - A string to be written to the file. If this parameter is null, the key pointed to by the lpKeyName parameter is deleted.
        lpFileName - The name of the initialization file.
        Returns:
        If the function successfully copies the string to the initialization file, the return value is true.

        If the function fails, or if it flushes the cached version of the most recently accessed initialization file, the return value is false. To get extended error information, call GetLastError().

      • GetPrivateProfileSection

        WinDef.DWORD GetPrivateProfileSection(java.lang.String lpAppName,
                                              char[] lpReturnedString,
                                              WinDef.DWORD nSize,
                                              java.lang.String lpFileName)
        Retrieves all the keys and values for the specified section of an initialization file.

        Each string has the following format: key=string.

        This operation is atomic; no updates to the specified initialization file are allowed while the key name and value pairs for the section are being copied to the buffer pointed to by the lpReturnedString parameter.

        Parameters:
        lpAppName - The name of the section in the initialization file.
        lpReturnedString - A buffer that receives the key name and value pairs associated with the named section. The buffer is filled with one or more null -terminated strings; the last string is followed by a second null character.
        nSize - The size of the buffer pointed to by the lpReturnedString parameter, in characters. The maximum profile section size is 32,767 characters.
        lpFileName - The name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.
        Returns:
        The number of characters copied to the buffer, not including the terminating null character. If the buffer is not large enough to contain all the key name and value pairs associated with the named section, the return value is equal to nSize minus two.
      • GetPrivateProfileSectionNames

        WinDef.DWORD GetPrivateProfileSectionNames(char[] lpszReturnBuffer,
                                                   WinDef.DWORD nSize,
                                                   java.lang.String lpFileName)
        Retrieves the names of all sections in an initialization file.

        This operation is atomic; no updates to the initialization file are allowed while the section names are being copied to the buffer.

        Parameters:
        lpszReturnBuffer - A pointer to a buffer that receives the section names associated with the named file. The buffer is filled with one or more null -terminated strings; the last string is followed by a second null character.
        nSize - size of the buffer pointed to by the lpszReturnBuffer parameter, in characters.
        lpFileName - The name of the initialization file. If this parameter is NULL, the function searches the Win.ini file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.
        Returns:
        The return value specifies the number of characters copied to the specified buffer, not including the terminating null character. If the buffer is not large enough to contain all the section names associated with the specified initialization file, the return value is equal to the size specified by nSize minus two.
      • WritePrivateProfileSection

        boolean WritePrivateProfileSection(java.lang.String lpAppName,
                                           java.lang.String lpString,
                                           java.lang.String lpFileName)
        Parameters:
        lpAppName - The name of the section in which data is written. This section name is typically the name of the calling application.
        lpString - The new key names and associated values that are to be written to the named section. This string is limited to 65,535 bytes. Must be filled with zero or many null-terminated strings of the form key=value, appended by an additional null byte to terminate the list.
        lpFileName - The name of the initialization file. If this parameter does not contain a full path for the file, the function searches the Windows directory for the file. If the file does not exist and lpFileName does not contain a full path, the function creates the file in the Windows directory.
        Returns:
        If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
      • FileTimeToLocalFileTime

        boolean FileTimeToLocalFileTime(WinBase.FILETIME lpFileTime,
                                        WinBase.FILETIME lpLocalFileTime)
        Converts a file time to a local file time.
        Parameters:
        lpFileTime - [in] A pointer to a FILETIME structure containing the UTC-based file time to be converted into a local file time.
        lpLocalFileTime - [out] A pointer to a FILETIME structure to receive the converted local file time. This parameter cannot be the same as the lpFileTime parameter.
        Returns:
        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.
      • SystemTimeToTzSpecificLocalTime

        boolean SystemTimeToTzSpecificLocalTime(WinBase.TIME_ZONE_INFORMATION lpTimeZone,
                                                WinBase.SYSTEMTIME lpUniversalTime,
                                                WinBase.SYSTEMTIME lpLocalTime)
        Converts a time in Coordinated Universal Time (UTC) to a specified time zone's corresponding local time.
        Parameters:
        lpTimeZone - [in, optional] A pointer to a TIME_ZONE_INFORMATION structure that specifies the time zone of interest. If lpTimeZone is NULL, the function uses the currently active time zone.
        lpUniversalTime - [in] A pointer to a SYSTEMTIME structure that specifies the UTC time to be converted. The function converts this universal time to the specified time zone's corresponding local time.
        lpLocalTime - [out] A pointer to a SYSTEMTIME structure that receives the local time.
        Returns:
        status
      • SystemTimeToFileTime

        boolean SystemTimeToFileTime(WinBase.SYSTEMTIME lpSystemTime,
                                     WinBase.FILETIME lpFileTime)
        Converts a system time to file time format. System time is based on Coordinated Universal Time (UTC).
        Parameters:
        lpSystemTime - [in] A pointer to a SYSTEMTIME structure that contains the system time to be converted from UTC to file time format.
        lpFileTime - [out] A pointer to a FILETIME structure to receive the converted system time.
        Returns:
        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.
      • FileTimeToSystemTime

        boolean FileTimeToSystemTime(WinBase.FILETIME lpFileTime,
                                     WinBase.SYSTEMTIME lpSystemTime)
        Converts a file time to system time format. System time is based on Coordinated Universal Time (UTC).
        Parameters:
        lpFileTime - [in] A pointer to a FILETIME structure containing the file time to be converted to system (UTC) date and time format. This value must be less than 0x8000000000000000. Otherwise, the function fails.
        lpSystemTime - A pointer to a SYSTEMTIME structure to receive the converted file time.
        Returns:
        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.
      • CreateRemoteThread

        WinNT.HANDLE CreateRemoteThread(WinNT.HANDLE hProcess,
                                        WinBase.SECURITY_ATTRIBUTES lpThreadAttributes,
                                        int dwStackSize,
                                        Pointer lpStartAddress,
                                        Pointer lpParameter,
                                        int dwCreationFlags,
                                        WinDef.DWORDByReference lpThreadId)
        Creates a thread that runs in the virtual address space of another process.
        Parameters:
        hProcess - A handle to the process in which the thread is to be created.
        lpThreadAttributes - The WinBase.SECURITY_ATTRIBUTES structure that specifies a security descriptor for the new thread. If null, the thread gets a default security descriptor and the handle cannot be inherited.
        dwStackSize - The initial size of the stack, in bytes. The system rounds this value to the nearest page. If this parameter is 0 (zero), the new thread uses the default size for the executable.
        lpStartAddress - The application-defined WinBase.FOREIGN_THREAD_START_ROUTINE to be executed by the thread and represents the starting address of the thread in the remote process. The function must exist in the remote process.
        lpParameter - A pointer to a variable to be passed to the thread function.
        dwCreationFlags - The flags that control the creation of the thread.
        lpThreadId - A variable that receives the thread identifier. If this parameter is null, the thread identifier is not returned.
        Returns:
        If the function succeeds, the return value is a handle to the new thread. If the function fails, the return value is null. To get extended error information, call GetLastError().
        See Also:
        CreateRemoteThread documentation
      • WriteProcessMemory

        boolean WriteProcessMemory(WinNT.HANDLE hProcess,
                                   Pointer lpBaseAddress,
                                   Pointer lpBuffer,
                                   int nSize,
                                   IntByReference lpNumberOfBytesWritten)
        Writes data to an area of memory in a specified process. The entire area to be written to must be accessible or the operation fails.
        Parameters:
        hProcess - A handle to the process memory to be modified.
        lpBaseAddress - The base address in the specified process to which data is written.
        lpBuffer - The buffer that contains data to be written in the address space of the specified process.
        nSize - The number of bytes to be written to the specified process.
        lpNumberOfBytesWritten - A variable that receives the number of bytes transferred into the specified process. If null the parameter is ignored.
        Returns:
        true if successful, false otherwise. To get extended error information, call GetLastError().
        See Also:
        WriteProcessMemory documentation
      • ReadProcessMemory

        boolean ReadProcessMemory(WinNT.HANDLE hProcess,
                                  Pointer lpBaseAddress,
                                  Pointer lpBuffer,
                                  int nSize,
                                  IntByReference lpNumberOfBytesRead)
        Reads data from an area of memory in a specified process. The entire area to be read must be accessible or the operation fails.
        Parameters:
        hProcess - A handle to the process with memory that is being read. The handle must have PROCESS_VM_READ access to the process.
        lpBaseAddress - A pointer to the base address in the specified process from which to read.
        Before any data transfer occurs, the system verifies that all data in the base address and memory of the specified size is accessible for read access, and if it is not accessible the function fails.
        lpBuffer - A pointer to a buffer that receives the contents from the address space of the specified process.
        nSize - The number of bytes to be read from the specified process.
        lpNumberOfBytesRead - A pointer to a variable that receives the number of bytes transferred into the specified buffer. If lpNumberOfBytesRead is NULL, the parameter is ignored.
        Returns:
        If the function succeeds, the return value is nonzero.
        If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.
        The function fails if the requested read operation crosses into an area of the process that is inaccessible.
        See Also:
        MSDN
      • VirtualQueryEx

        BaseTSD.SIZE_T VirtualQueryEx(WinNT.HANDLE hProcess,
                                      Pointer lpAddress,
                                      WinNT.MEMORY_BASIC_INFORMATION lpBuffer,
                                      BaseTSD.SIZE_T dwLength)
        Retrieves information about a range of pages within the virtual address space of a specified process.
        Parameters:
        hProcess - A handle to the process whose memory information is queried.
        lpAddress - The base address of the region of pages to be queried.
        lpBuffer - A WinNT.MEMORY_BASIC_INFORMATION structure in which information about the specified page range is returned.
        dwLength - The size of the buffer pointed to by the lpBuffer parameter, in bytes.
        Returns:
        The return value is the actual number of bytes returned in the information buffer. If the function fails, the return value is zero. To get extended error information, call GetLastError().
        See Also:
        VirtualQueryEx documentation
      • DefineDosDevice

        boolean DefineDosDevice(int dwFlags,
                                java.lang.String lpDeviceName,
                                java.lang.String lpTargetPath)
        Defines, redefines, or deletes MS-DOS device names.
        Parameters:
        dwFlags - The controllable aspects of the function - see the various DDD_XXX constants
        lpDeviceName - The MS-DOS device name string specifying the device the function is defining, redefining, or deleting. The device name string must not have a colon as the last character, unless a drive letter is being defined, redefined, or deleted. For example, drive C would be the string "C:". In no case is a trailing backslash ("\") allowed.
        lpTargetPath - The path string that will implement this device. The string is an MS-DOS path string unless the DDD_RAW_TARGET_PATH flag is specified, in which case this string is a path string.
        Returns:
        true if succeeds. If fails then call GetLastError() to get extended error information
        See Also:
        DefineDosDevice
      • QueryDosDevice

        int QueryDosDevice(java.lang.String lpDeviceName,
                           char[] lpTargetPath,
                           int ucchMax)
        Retrieves information about MS-DOS device names
        Parameters:
        lpDeviceName - An MS-DOS device name string specifying the target of the query. The device name cannot have a trailing backslash; for example, use "C:", not "C:\". This parameter can be NULL. In that case, the function will store a list of all existing MS-DOS device names into the buffer.
        lpTargetPath - A buffer that will receive the result of the query. The function fills this buffer with one or more null-terminated strings. The final null-terminated string is followed by an additional NULL. If device name is non-NULL, the function retrieves information about the particular MS-DOS device. The first null-terminated string stored into the buffer is the current mapping for the device. The other null-terminated strings represent undeleted prior mappings for the device. Each null-terminated string stored into the buffer is the name of an existing MS-DOS device, for example, \Device\HarddiskVolume1 or \Device\Floppy0.
        ucchMax - The maximum number of characters that can be stored into the buffer
        Returns:
        If the function succeeds, the return value is the number of characters stored into the buffer, otherwise zero. Use GetLastError() to get extended error information. If the buffer is too small, the function fails and the last error code is ERROR_INSUFFICIENT_BUFFER.
        See Also:
        QueryDosDevice
      • FindFirstFile

        WinNT.HANDLE FindFirstFile(java.lang.String lpFileName,
                                   Pointer lpFindFileData)
        Searches a directory for a file or subdirectory with a name that matches a specific name (or partial name if wildcards are used). To specify additional attributes to use in a search, use the FindFirstFileEx function.
        Parameters:
        lpFileName - The directory or path, and the file name. The file name can include wildcard characters, for example, an asterisk (*) or a question mark (?). This parameter should not be NULL, an invalid string (for example, an empty string or a string that is missing the terminating null character), or end in a trailing backslash (\). If the string ends with a wildcard, period, or directory name, the user must have access to the root and all subdirectories on the path. In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to approximately 32,000 wide characters, call the Unicode version of the function (FindFirstFileExW), and prepend "\\?\" to the path. For more information, see Naming a File. Tip Starting in Windows 10, version 1607, for the unicode version of this function (FindFirstFileExW), you can opt-in to remove the MAX_PATH character limitation without prepending "\\?\". See the "Maximum Path Limitation" section of Naming Files, Paths, and Namespaces for details.
        lpFindFileData - A pointer to the buffer that receives the file data. The pointer type is determined by the level of information that is specified in the fInfoLevelId parameter.
        Returns:
        If the function succeeds, the return value is a search handle used in a subsequent call to FindNextFile or FindClose, and the lpFindFileData parameter contains information about the first file or directory found. If the function fails or fails to locate files from the search string in the lpFileName parameter, the return value is INVALID_HANDLE_VALUE and the contents of lpFindFileData are indeterminate. To get extended error information, call the GetLastError function. If the function fails because no matching files can be found, the GetLastError function returns ERROR_FILE_NOT_FOUND.
      • FindFirstFileEx

        WinNT.HANDLE FindFirstFileEx(java.lang.String lpFileName,
                                     int fInfoLevelId,
                                     Pointer lpFindFileData,
                                     int fSearchOp,
                                     Pointer lpSearchFilter,
                                     WinDef.DWORD dwAdditionalFlags)
        Searches a directory for a file or subdirectory with a name and attributes that match those specified. For the most basic version of this function, see FindFirstFile.
        Parameters:
        lpFileName - The directory or path, and the file name. The file name can include wildcard characters, for example, an asterisk (*) or a question mark (?). This parameter should not be NULL, an invalid string (for example, an empty string or a string that is missing the terminating null character), or end in a trailing backslash (\). If the string ends with a wildcard, period, or directory name, the user must have access to the root and all subdirectories on the path. In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to approximately 32,000 wide characters, call the Unicode version of the function (FindFirstFileExW), and prepend "\\?\" to the path. For more information, see Naming a File. Tip Starting in Windows 10, version 1607, for the unicode version of this function (FindFirstFileExW), you can opt-in to remove the MAX_PATH character limitation without prepending "\\?\". See the "Maximum Path Limitation" section of Naming Files, Paths, and Namespaces for details.
        fInfoLevelId - The information level of the returned data. This parameter is one of the FINDEX_INFO_LEVELS enumeration values.
        lpFindFileData - A pointer to the buffer that receives the file data. The pointer type is determined by the level of information that is specified in the fInfoLevelId parameter.
        fSearchOp - The type of filtering to perform that is different from wildcard matching. This parameter is one of the FINDEX_SEARCH_OPS enumeration values.
        lpSearchFilter - A pointer to the search criteria if the specified fSearchOp needs structured search information. At this time, none of the supported fSearchOp values require extended search information. Therefore, this pointer must be NULL.
        dwAdditionalFlags - Specifies additional flags that control the search. FIND_FIRST_EX_CASE_SENSITIVE (0x01) - Searches are case-sensitive. FIND_FIRST_EX_LARGE_FETCH (0x02) - Uses a larger buffer for directory queries, which can increase performance of the find operation. Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This value is not supported until Windows Server 2008 R2 and Windows 7.
        Returns:
        If the function succeeds, the return value is a search handle used in a subsequent call to FindNextFile or FindClose, and the lpFindFileData parameter contains information about the first file or directory found. If the function fails or fails to locate files from the search string in the lpFileName parameter, the return value is INVALID_HANDLE_VALUE and the contents of lpFindFileData are indeterminate. To get extended error information, call the GetLastError function. If the function fails because no matching files can be found, the GetLastError function returns ERROR_FILE_NOT_FOUND.
      • FindNextFile

        boolean FindNextFile(WinNT.HANDLE hFindFile,
                             Pointer lpFindFileData)
        Continues a file search from a previous call to the FindFirstFile, FindFirstFileEx, or FindFirstFileTransacted functions.
        Parameters:
        hFindFile - The search handle returned by a previous call to the FindFirstFile or FindFirstFileEx function.
        lpFindFileData - A pointer to the WIN32_FIND_DATA structure that receives information about the found file or subdirectory.
        Returns:
        If the function succeeds, the return value is nonzero and the lpFindFileData parameter contains information about the next file or directory found. If the function fails, the return value is zero and the contents of lpFindFileData are indeterminate. To get extended error information, call the GetLastError function. If the function fails because no more matching files can be found, the GetLastError function returns ERROR_NO_MORE_FILES.
      • FindClose

        boolean FindClose(WinNT.HANDLE hFindFile)
        Closes a file search handle opened by the FindFirstFile, FindFirstFileEx, FindFirstFileNameW, FindFirstFileNameTransactedW, FindFirstFileTransacted, FindFirstStreamTransactedW, or FindFirstStreamW functions.
        Parameters:
        hFindFile - The file search handle.
        Returns:
        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.
      • FindFirstVolumeMountPoint

        WinNT.HANDLE FindFirstVolumeMountPoint(java.lang.String lpszRootPathName,
                                               char[] lpszVolumeMountPoint,
                                               int cchBufferLength)
        Retrieves the name of a mounted folder on the specified volume - used to begin scanning the mounted folders on a volume
        Parameters:
        lpszRootPathName - A volume GUID path for the volume to scan for mounted folders. A trailing backslash is required.
        lpszVolumeMountPoint - A buffer that receives the name of the first mounted folder that is found.
        cchBufferLength - The length of the buffer that receives the path to the mounted folder
        Returns:
        If succeeds, a search handle used in a subsequent call to the FindNextVolumeMountPoint and FindVolumeMountPointClose functions. Otherwise, the return value is the WinBase.INVALID_HANDLE_VALUE. To get extended error information, call GetLastError().
        See Also:
        FindFirstVolumeMountPoint
      • FindNextVolumeMountPoint

        boolean FindNextVolumeMountPoint(WinNT.HANDLE hFindVolumeMountPoint,
                                         char[] lpszVolumeMountPoint,
                                         int cchBufferLength)
        Continues a mounted folder search started by a call to the FindFirstVolumeMountPoint(String, char[], int) function - finds one (next) mounted folder per call.
        Parameters:
        hFindVolumeMountPoint - A mounted folder search handle returned by a previous call to the FindFirstVolumeMountPoint(String, char[], int) function.
        lpszVolumeMountPoint - A buffer that receives the name of the (next) mounted folder that is found.
        cchBufferLength - The