Interface Kernel32Library
public interface Kernel32Library
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfacestatic interfaceBasic limit information for a job object https://msdn.microsoft.com/en-us/library/windows/desktop/ms684147%28v=vs.85%29.aspxstatic interfaceContains information about a range of pages in the virtual address space of a process. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAssociates a process with an existing job https://msdn.microsoft.com/en-us/library/windows/desktop/ms681949%28v=vs.85%29.aspxbooleanCloseHandle(Kernel32Library.Handle handle) Creates or opens a new job object https://msdn.microsoft.com/en-us/library/windows/desktop/ms682409%28v=vs.85%29.aspx Note: the two params to this are omitted because all implementations pass null for them bothintGetCompressedFileSizeW(String lpFileName, IntConsumer lpFileSizeHigh) Retrieves the actual number of bytes of disk storage used to store a specified file.intintGetShortPathNameW(String lpszLongPath, char[] lpszShortPath, int cchBuffer) Retrieves the short path form of the specified path.Create a new MemoryBasicInformation for use by VirtualQuery and VirtualQueryExbooleanQueryInformationJobObject(Kernel32Library.Handle job, int infoClass, Kernel32Library.JobObjectBasicLimitInformation info) Get job limit and state information https://msdn.microsoft.com/en-us/library/windows/desktop/ms684925%28v=vs.85%29.aspx Note: The infoLength parameter is omitted because implementions handle passing it Note: The returnLength parameter is omitted because all implementations pass nullbooleanSetConsoleCtrlHandler(WindowsNativeAccess.ConsoleCtrlHandler handler, boolean add) Native call to the Kernel32 API to set a new Console Ctrl Handler.booleanSetInformationJobObject(Kernel32Library.Handle job, int infoClass, Kernel32Library.JobObjectBasicLimitInformation info) Set job limit and state information https://msdn.microsoft.com/en-us/library/windows/desktop/ms686216%28v=vs.85%29.aspx Note: The infoLength parameter is omitted because implementions handle passing itbooleanSetProcessWorkingSetSize(Kernel32Library.Handle handle, long minSize, long maxSize) Sets the minimum and maximum working set sizes for the specified process.booleanVirtualLock(Kernel32Library.Address address, long size) Locks the specified region of the process's virtual address space into physical memory, ensuring that subsequent access to the region will not incur a page fault.intVirtualQueryEx(Kernel32Library.Handle handle, Kernel32Library.Address address, Kernel32Library.MemoryBasicInformation memoryInfo) Retrieves information about a range of pages within the virtual address space of a specified process.
-
Method Details
-
GetCurrentProcess
Kernel32Library.Handle GetCurrentProcess() -
CloseHandle
-
GetLastError
int GetLastError() -
newMemoryBasicInformation
Kernel32Library.MemoryBasicInformation newMemoryBasicInformation()Create a new MemoryBasicInformation for use by VirtualQuery and VirtualQueryEx -
VirtualLock
Locks the specified region of the process's virtual address space into physical memory, ensuring that subsequent access to the region will not incur a page fault.- Parameters:
address- A pointer to the base address of the region of pages to be locked.size- The size of the region to be locked, in bytes.- Returns:
- true if the function succeeds
- See Also:
-
VirtualQueryEx
int VirtualQueryEx(Kernel32Library.Handle handle, Kernel32Library.Address address, Kernel32Library.MemoryBasicInformation memoryInfo) Retrieves information about a range of pages within the virtual address space of a specified process. Note: the dwLength parameter is handled by the underlying implementation- Parameters:
handle- A handle to the process whose memory information is queried.address- A pointer to the base address of the region of pages to be queried.memoryInfo- A pointer to a structure in which information about the specified page range is returned.- Returns:
- the actual number of bytes returned in the information buffer.
- See Also:
-
SetProcessWorkingSetSize
Sets the minimum and maximum working set sizes for the specified process.- Parameters:
handle- A handle to the process whose working set sizes is to be set.minSize- The minimum working set size for the process, in bytes.maxSize- The maximum working set size for the process, in bytes.- Returns:
- true if the function succeeds.
- See Also:
-
GetCompressedFileSizeW
Retrieves the actual number of bytes of disk storage used to store a specified file. https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getcompressedfilesizew- Parameters:
lpFileName- the path stringlpFileSizeHigh- pointer to high-order DWORD for compressed file size (or null if not needed)- Returns:
- the low-order DWORD for compressed file size
-
GetShortPathNameW
Retrieves the short path form of the specified path.- Parameters:
lpszLongPath- the path stringlpszShortPath- a buffer to receive the short namecchBuffer- the size of the buffer- Returns:
- the length of the string copied into
lpszShortPath, otherwise zero for failure - See Also:
-
SetConsoleCtrlHandler
Native call to the Kernel32 API to set a new Console Ctrl Handler.- Parameters:
handler- A callback to handle control eventsadd- True if the handler should be added, false if it should replace existing handlers- Returns:
- true if the handler is correctly set
- See Also:
-
CreateJobObjectW
Kernel32Library.Handle CreateJobObjectW()Creates or opens a new job object https://msdn.microsoft.com/en-us/library/windows/desktop/ms682409%28v=vs.85%29.aspx Note: the two params to this are omitted because all implementations pass null for them both- Returns:
- job handle if the function succeeds
-
AssignProcessToJobObject
Associates a process with an existing job https://msdn.microsoft.com/en-us/library/windows/desktop/ms681949%28v=vs.85%29.aspx- Parameters:
job- job handleprocess- process handle- Returns:
- true if the function succeeds
-
newJobObjectBasicLimitInformation
Kernel32Library.JobObjectBasicLimitInformation newJobObjectBasicLimitInformation() -
QueryInformationJobObject
boolean QueryInformationJobObject(Kernel32Library.Handle job, int infoClass, Kernel32Library.JobObjectBasicLimitInformation info) Get job limit and state information https://msdn.microsoft.com/en-us/library/windows/desktop/ms684925%28v=vs.85%29.aspx Note: The infoLength parameter is omitted because implementions handle passing it Note: The returnLength parameter is omitted because all implementations pass null- Parameters:
job- job handleinfoClass- information class constantinfo- pointer to information structure- Returns:
- true if the function succeeds
-
SetInformationJobObject
boolean SetInformationJobObject(Kernel32Library.Handle job, int infoClass, Kernel32Library.JobObjectBasicLimitInformation info) Set job limit and state information https://msdn.microsoft.com/en-us/library/windows/desktop/ms686216%28v=vs.85%29.aspx Note: The infoLength parameter is omitted because implementions handle passing it- Parameters:
job- job handleinfoClass- information class constantinfo- pointer to information structure- Returns:
- true if the function succeeds
-