Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jna.platform.win32
Interface Kernel32

All Superinterfaces:
  com.sun.jna.AltCallingConvention, com.sun.jna.Library, com.sun.jna.win32.StdCall, com.sun.jna.win32.StdCallLibrary

    public interface Kernel32

extends com.sun.jna.win32.StdCallLibrary

Definition (incomplete) of `kernel32.dll`.

Nested Class Summary
`static interface` | `Kernel32.OVERLAPPED_COMPLETION_ROUTINE`

Nested classes/interfaces inherited from interface com.sun.jna.win32.StdCallLibrary
`com.sun.jna.win32.StdCallLibrary.StdCallCallback`

Nested classes/interfaces inherited from interface com.sun.jna.Library
`com.sun.jna.Library.Handler`

Field Summary
`static Kernel32` | `INSTANCE`

Fields inherited from interface com.sun.jna.win32.StdCallLibrary
`FUNCTION_MAPPER, STDCALL_CONVENTION`

Fields inherited from interface com.sun.jna.Library
`OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER`

Method Summary
`boolean` | `CloseHandle(WinNT.HANDLE hObject)` The CloseHandle function closes an open object handle.
`boolean` | `CreateDirectory(java.lang.String lpPathName, WinNT.SECURITY_ATTRIBUTES lpSecurityAttributes)` The CreateDirectory function creates a new directory.
`WinNT.HANDLE` | `CreateEvent(WinNT.SECURITY_ATTRIBUTES lpEventAttributes, boolean bManualReset, boolean bInitialState, java.lang.String lpName)` Creates or opens a named or unnamed event object.
`WinNT.HANDLE` | `CreateFile(java.lang.String lpFileName, int dwDesiredAccess, int dwShareMode, WinNT.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.
`WinNT.HANDLE` | `CreateFileMapping(WinNT.HANDLE hFile, WinNT.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.
`WinNT.HANDLE` | `CreateIoCompletionPort(WinNT.HANDLE FileHandle, WinNT.HANDLE ExistingCompletionPort, com.sun.jna.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.
`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.
`int` | `FormatMessage(int dwFlags, com.sun.jna.Pointer lpSource, int dwMessageId, int dwLanguageId, java.nio.Buffer lpBuffer, int nSize, com.sun.jna.Pointer va_list)` The FormatMessage function formats a message string.
`int` | `FormatMessage(int dwFlags, com.sun.jna.Pointer lpSource, int dwMessageId, int dwLanguageId, com.sun.jna.ptr.PointerByReference lpBuffer, int nSize, com.sun.jna.Pointer va_list)` The FormatMessage function formats a message string.
`boolean` | `GetComputerName(char[] buffer, com.sun.jna.ptr.IntByReference lpnSize)` Retrieves only the NetBIOS name of the local computer.
`WinNT.HANDLE` | `GetCurrentProcess()` This function returns a pseudohandle for the current process.
`int` | `GetCurrentProcessId()` This function returns the process identifier of the calling process.
`WinNT.HANDLE` | `GetCurrentThread()` The GetCurrentThread function retrieves a pseudo handle for the current thread.
`int` | `GetCurrentThreadId()` The GetCurrentThreadId function retrieves the thread identifier of the calling thread.
`boolean` | `GetDiskFreeSpaceEx(java.lang.String lpDirectoryName, WinNT.LARGE_INTEGER.ByReference lpFreeBytesAvailable, WinNT.LARGE_INTEGER.ByReference lpTotalNumberOfBytes, WinNT.LARGE_INTEGER.ByReference 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.
`int` | `GetDriveType(java.lang.String lpRootPathName)` The GetDriveType function determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
`int` | `GetLastError()` The GetLastError function retrieves the calling thread's last-error code value.
`WinDef.DWORD` | `GetLogicalDriveStrings(WinDef.DWORD nBufferLength, char[] lpBuffer)` The GetLogicalDriveStrings function fills a buffer with strings that specify valid drives in the system.
`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.
`void` | `GetNativeSystemInfo(WinBase.SYSTEM_INFO lpSystemInfo)` The GetNativeSystemInfo function retrieves information about the current system to an application running under WOW64.
`int` | `GetProcessId(WinNT.HANDLE process)` The GetProcessId function retrieves the process identifier of the specified process.
`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.
`boolean` | `GetQueuedCompletionStatus(WinNT.HANDLE CompletionPort, com.sun.jna.ptr.IntByReference lpNumberOfBytes, com.sun.jna.ptr.ByReference lpCompletionKey, com.sun.jna.ptr.PointerByReference lpOverlapped, int dwMilliseconds)` Attempts to dequeue an I/O completion packet from the specified I/O completion port.
`int` | `GetShortPathName(java.lang.String lpszLongPath, char[] lpdzShortPath, int cchBuffer)` Retrieves the short path form of the specified path.
`void` | `GetSystemInfo(WinBase.SYSTEM_INFO lpSystemInfo)` The GetSystemInfo function returns information about the current system.
`void` | `GetSystemTime(WinBase.SYSTEMTIME lpSystemTime)` The GetSystemTime function retrieves the current system date and time.
`WinDef.DWORD` | `GetTempPath(WinDef.DWORD nBufferLength, char[] buffer)` The GetTempPath function retrieves the path of the directory designated for temporary files.
`WinDef.DWORD` | `GetVersion()` The GetVersion function returns the current version number of the operating system.
`boolean` | `GetVersionEx(WinNT.OSVERSIONINFO lpVersionInfo)` The GetVersionEx function obtains extended information about the version of the operating system that is currently running.
`boolean` | `GetVersionEx(WinNT.OSVERSIONINFOEX lpVersionInfo)` The GetVersionEx function obtains extended information about the version of the operating system that is currently running.
`com.sun.jna.Pointer` | `GlobalFree(com.sun.jna.Pointer hGlobal)` Frees the specified global memory object and invalidates its handle.
`boolean` | `GlobalMemoryStatusEx(WinBase.MEMORYSTATUSEX lpBuffer)` Retrieves information about the system's current usage of both physical and virtual memory.
`boolean` | `IsWow64Process(WinNT.HANDLE hProcess, com.sun.jna.ptr.IntByReference Wow64Process)` The IsWow64Process function determines whether the specified process is running under WOW64.
`com.sun.jna.Pointer` | `LocalAlloc(int type, int cbInput)` The LocalAlloc function allocates the specified number of bytes from the heap.
`com.sun.jna.Pointer` | `LocalFree(com.sun.jna.Pointer hLocal)` Frees the specified local memory object and invalidates its handle.
`com.sun.jna.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.
`WinNT.HANDLE` | `OpenProcess(int fdwAccess, boolean fInherit, int IDProcess)` This function returns a handle to an existing process object.
`WinNT.HANDLE` | `OpenThread(int dwDesiredAccess, boolean bInheritHandle, int dwThreadId)` The OpenThread function opens an existing thread object.
`boolean` | `PostQueuedCompletionStatus(WinNT.HANDLE CompletionPort, int dwNumberOfBytesTransferred, com.sun.jna.Pointer dwCompletionKey, WinBase.OVERLAPPED lpOverlapped)` Posts an I/O completion packet to an I/O completion port.
`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.
`boolean` | `ReadDirectoryChangesW(WinNT.HANDLE directory, WinNT.FILE_NOTIFY_INFORMATION info, int length, boolean watchSubtree, int notifyFilter, com.sun.jna.ptr.IntByReference bytesReturned, WinBase.OVERLAPPED overlapped, Kernel32.OVERLAPPED_COMPLETION_ROUTINE completionRoutine)` Retrieves information that describes the changes within the specified directory.
`boolean` | `SetEvent(WinNT.HANDLE hEvent)` Sets the specified event object to the signaled state.
`void` | `SetLastError(int dwErrCode)` The SetLastError function sets the last-error code for the calling thread.
`boolean` | `UnmapViewOfFile(com.sun.jna.Pointer lpBaseAddress)` Unmaps a mapped view of a file from the calling process's address space.
`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.
`int` | `WaitForSingleObject(WinNT.HANDLE hHandle, int dwMilliseconds)` Waits until the specified object is in the signaled state or the time-out interval elapses.
`boolean` | `WriteFile(WinNT.HANDLE hFile, byte[] lpBuffer, int nNumberOfBytesToWrite, com.sun.jna.ptr.IntByReference lpNumberOfBytesWritten, WinBase.OVERLAPPED lpOverlapped)` Writes data to the specified file or input/output (I/O) device.

Field Detail

### INSTANCE

    static final Kernel32 INSTANCE

Method Detail

### LocalFree

    com.sun.jna.Pointer LocalFree(com.sun.jna.Pointer hLocal)

  Frees the specified local memory object and invalidates its handle.

  Parameters:
    `hLocal` - A handle to the local 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 local memory object. To get extended error information, call GetLastError.

### GlobalFree

    com.sun.jna.Pointer GlobalFree(com.sun.jna.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.

### 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 SYSTEMTIME structure to receive the current system date and time.

### 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.

### 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)

  The GetDriveType function 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.

### FormatMessage

    int FormatMessage(int dwFlags,
                      com.sun.jna.Pointer lpSource,
                      int dwMessageId,
                      int dwLanguageId,
                      com.sun.jna.ptr.PointerByReference lpBuffer,
                      int nSize,
                      com.sun.jna.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.
    `lpSource` - Location of the message definition.
    `dwMessageId` - Message identifier for the requested message.
    `dwLanguageId` - Language identifier for the requested message.
    `lpBuffer` - Pointer to a buffer that receives the null-terminated string that specifies the formatted message.
    `nSize` - If the FORMAT_MESSAGE_ALLOCATE_BUFFER flag is not set, this parameter specifies the size of the output buffer, in TCHARs. If FORMAT_MESSAGE_ALLOCATE_BUFFER is set, 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.

### FormatMessage

    int FormatMessage(int dwFlags,
                      com.sun.jna.Pointer lpSource,
                      int dwMessageId,
                      int dwLanguageId,
                      java.nio.Buffer lpBuffer,
                      int nSize,
                      com.sun.jna.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.
    `lpSource` - Location of the message definition.
    `dwMessageId` - Message identifier for the requested message.
    `dwLanguageId` - Language identifier for the requested message.
    `lpBuffer` - Pointer to a buffer that receives the null-terminated string that specifies the formatted message.
    `nSize` - If the FORMAT_MESSAGE_ALLOCATE_BUFFER flag is not set, this parameter specifies the size of the output buffer, in TCHARs. If FORMAT_MESSAGE_ALLOCATE_BUFFER is set, 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,
                            WinNT.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.

### CreateDirectory

    boolean CreateDirectory(java.lang.String lpPathName,
                            WinNT.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,
                                        com.sun.jna.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,
                                      com.sun.jna.ptr.IntByReference lpNumberOfBytes,
                                      com.sun.jna.ptr.ByReference lpCompletionKey,
                                      com.sun.jna.ptr.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,
                                       com.sun.jna.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)

  The CloseHandle function 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.

### ReadDirectoryChangesW

    boolean ReadDirectoryChangesW(WinNT.HANDLE directory,
                                  WinNT.FILE_NOTIFY_INFORMATION info,
                                  int length,
                                  boolean watchSubtree,
                                  int notifyFilter,
                                  com.sun.jna.ptr.IntByReference bytesReturned,
                                  WinBase.OVERLAPPED overlapped,
                                  Kernel32.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

    com.sun.jna.Pointer LocalAlloc(int type,
                                   int cbInput)

  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:
    `type` - Memory allocation attributes. The default is the LMEM_FIXED value.
    `cbInput` - 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,
                      com.sun.jna.ptr.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.

### CreateEvent

    WinNT.HANDLE CreateEvent(WinNT.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.

### 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.

### 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,
                                   WinNT.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

    com.sun.jna.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(com.sun.jna.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,
                            com.sun.jna.ptr.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.

### 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.

### OpenProcess

    WinNT.HANDLE OpenProcess(int fdwAccess,
                             boolean fInherit,
                             int IDProcess)

  This function returns a handle to an existing process object.

  Parameters:
    `fdwAccess` - Not supported; set to zero.
    `fInherit` - Not supported; set to FALSE.
    `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.

### 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.

### 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,
                           com.sun.jna.ptr.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.

### 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.

### GetDiskFreeSpaceEx

    boolean GetDiskFreeSpaceEx(java.lang.String lpDirectoryName,
                               WinNT.LARGE_INTEGER.ByReference lpFreeBytesAvailable,
                               WinNT.LARGE_INTEGER.ByReference lpTotalNumberOfBytes,
                               WinNT.LARGE_INTEGER.ByReference 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 pointer to a null-terminated 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:
    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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD