Interface Kernel32Library

All Superinterfaces:
NativeLibrary

public non-sealed interface Kernel32Library extends NativeLibrary
  • Method Details

    • GetCurrentProcess

      Kernel32Library.Handle GetCurrentProcess()
    • CloseHandle

      boolean CloseHandle(Kernel32Library.Handle handle)
    • GetLastError

      int GetLastError()
    • newMemoryBasicInformation

      Kernel32Library.MemoryBasicInformation newMemoryBasicInformation()
      Create a new MemoryBasicInformation for use by VirtualQuery and VirtualQueryEx
    • VirtualLock

      boolean VirtualLock(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.
      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

      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

      boolean SetProcessWorkingSetSize(Kernel32Library.Handle handle, long minSize, long maxSize)
      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

      int GetCompressedFileSizeW(String lpFileName, IntConsumer lpFileSizeHigh)
      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 string
      lpFileSizeHigh - pointer to high-order DWORD for compressed file size (or null if not needed)
      Returns:
      the low-order DWORD for compressed file size
    • GetShortPathNameW

      int GetShortPathNameW(String lpszLongPath, char[] lpszShortPath, int cchBuffer)
      Retrieves the short path form of the specified path.
      Parameters:
      lpszLongPath - the path string
      lpszShortPath - a buffer to receive the short name
      cchBuffer - the size of the buffer
      Returns:
      the length of the string copied into lpszShortPath, otherwise zero for failure
      See Also:
    • SetConsoleCtrlHandler

      boolean SetConsoleCtrlHandler(WindowsFunctions.ConsoleCtrlHandler handler, boolean add)
      Native call to the Kernel32 API to set a new Console Ctrl Handler.
      Parameters:
      handler - A callback to handle control events
      add - 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

      boolean AssignProcessToJobObject(Kernel32Library.Handle job, Kernel32Library.Handle process)
      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 handle
      process - 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 handle
      infoClass - information class constant
      info - 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 handle
      infoClass - information class constant
      info - pointer to information structure
      Returns:
      true if the function succeeds