Package EOorg.EOeolang.EOsys.Win32
Interface Kernel32
-
- All Superinterfaces:
com.sun.jna.AltCallingConvention
,BaseTSD
,com.sun.jna.Library
,com.sun.jna.win32.StdCall
,com.sun.jna.win32.StdCallLibrary
,WinBase
,Wincon
,WinDef
,WinNT
public interface Kernel32 extends com.sun.jna.win32.StdCallLibrary, WinNT, Wincon
Interface definitions forkernel32.dll
.- Since:
- 0.40
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface EOorg.EOeolang.EOsys.Win32.BaseTSD
BaseTSD.ULONG_PTR
-
Nested classes/interfaces inherited from interface com.sun.jna.win32.StdCallLibrary
com.sun.jna.win32.StdCallLibrary.StdCallCallback
-
Nested classes/interfaces inherited from interface EOorg.EOeolang.EOsys.Win32.WinBase
WinBase.OVERLAPPED, WinBase.SECURITY_ATTRIBUTES
-
Nested classes/interfaces inherited from interface EOorg.EOeolang.EOsys.Win32.WinDef
WinDef.DWORD, WinDef.WORD
-
Nested classes/interfaces inherited from interface EOorg.EOeolang.EOsys.Win32.WinNT
WinNT.HANDLE
-
-
Field Summary
Fields Modifier and Type Field Description static Kernel32
INSTANCE
Instance.-
Fields inherited from interface com.sun.jna.Library
OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_SYMBOL_PROVIDER, OPTION_TYPE_MAPPER
-
Fields inherited from interface com.sun.jna.win32.StdCallLibrary
FUNCTION_MAPPER, STDCALL_CONVENTION
-
Fields inherited from interface EOorg.EOeolang.EOsys.Win32.WinBase
INVALID_HANDLE_VALUE
-
Fields inherited from interface EOorg.EOeolang.EOsys.Win32.Wincon
STD_INPUT_HANDLE, STD_OUTPUT_HANDLE
-
Fields inherited from interface EOorg.EOeolang.EOsys.Win32.WinNT
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, GENERIC_READ, GENERIC_WRITE, OPEN_EXISTING
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
CloseHandle(WinNT.HANDLE handle)
Closes an open object handle.WinNT.HANDLE
CreateFile(String name, int access, int mode, WinBase.SECURITY_ATTRIBUTES security, int disposition, int flags, WinNT.HANDLE template)
The CreateFile function creates or opens a file, file stream, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe.int
GetCurrentProcessId()
This function returns the process identifier of the calling process.int
GetEnvironmentVariable(String name, char[] buffer, int size)
Retrieves the contents of the specified variable from the environment block of the calling process.WinNT.HANDLE
GetStdHandle(int handle)
Get a handle to specified standard device.void
GetSystemTime(GetSystemTimeFuncCall.SystemTime time)
Retrieves the current system date and time in Coordinated Universal Time (UTC) format.boolean
ReadFile(WinNT.HANDLE handle, byte[] buffer, int count, com.sun.jna.ptr.IntByReference read, WinBase.OVERLAPPED overlapped)
Reads data from the specified file or input/output (I/O) device.void
SetLastError(int code)
Set a custom error code.boolean
SetStdHandle(int std, WinNT.HANDLE handle)
Set a standard device handle.boolean
WriteFile(WinNT.HANDLE handle, byte[] buffer, int count, com.sun.jna.ptr.IntByReference written, WinBase.OVERLAPPED overlapped)
Writes data to the specified file or input/output (I/O) device.
-
-
-
Field Detail
-
INSTANCE
static final Kernel32 INSTANCE
Instance.
-
-
Method Detail
-
GetStdHandle
WinNT.HANDLE GetStdHandle(int handle)
Get a handle to specified standard device.- Parameters:
handle
- The standard device identifier- Returns:
- A handle to the specified standard device (standard input, output, or error)
-
SetStdHandle
boolean SetStdHandle(int std, WinNT.HANDLE handle)
Set a standard device handle.- Parameters:
std
- The standard device identifierhandle
- The handle for the standard device- Returns:
- True if successful, if False then use
GetLastError()
to get extended error information - See Also:
- SetStdHandle documentation
-
CloseHandle
boolean CloseHandle(WinNT.HANDLE handle)
Closes an open object handle.- Parameters:
handle
- 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
-
SetLastError
void SetLastError(int code)
Set a custom error code.- Parameters:
code
- Error code to set
-
WriteFile
boolean WriteFile(WinNT.HANDLE handle, byte[] buffer, int count, com.sun.jna.ptr.IntByReference written, WinBase.OVERLAPPED overlapped)
Writes data to the specified file or input/output (I/O) device.- Parameters:
handle
- 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).buffer
- A pointer to the buffer containing the data to be written to the file or device.count
- The number of bytes to be written to the file or device.written
- A pointer to the variable that receives the number of bytes written when using a synchronous hFile parameter.overlapped
- A pointer to anWinBase.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.
-
ReadFile
boolean ReadFile(WinNT.HANDLE handle, byte[] buffer, int count, com.sun.jna.ptr.IntByReference read, WinBase.OVERLAPPED overlapped)
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.- Parameters:
handle
- A handle to the device (for example, a file, file stream, physical disk, volume, console buffer, tape drive, socket, communications resource, mailslot, or pipe).buffer
- A pointer to the buffer that receives the data read from a file or device.count
- The maximum number of bytes to be read.read
- A pointer to the variable that receives the number of bytes read when using a synchronous hFile parameteroverlapped
- A pointer to an OVERLAPPED structure is required if the handle 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).
-
CreateFile
WinNT.HANDLE CreateFile(String name, int access, int mode, WinBase.SECURITY_ATTRIBUTES security, int disposition, int flags, WinNT.HANDLE template)
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:
name
- A pointer to a null-terminated string that specifies the name of an object to create or open.access
- The access to the object, which can be read, write, or both.mode
- The sharing mode of an object, which can be read, write, both, or none.security
- A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. If lpSecurityAttributes is NULL, the handle cannot be inherited.disposition
- An action to take on files that exist and do not exist.flags
- The file attributes and flags.template
- 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.
-
GetEnvironmentVariable
int GetEnvironmentVariable(String name, char[] buffer, int size)
Retrieves the contents of the specified variable from the environment block of the calling process.- Parameters:
name
- The name of the environment variable.buffer
- 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.size
- The size of the buffer pointed to by the buffer 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 buffer, not including the terminating null character. If buffer 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 buffer are undefined. If the function fails, the return value is zero. To get extended error information, call GetLastError.
-
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.
-
GetSystemTime
void GetSystemTime(GetSystemTimeFuncCall.SystemTime time)
Retrieves the current system date and time in Coordinated Universal Time (UTC) format.- Parameters:
time
- System time structure
-
-