Class Kernel32


  • public class Kernel32
    extends java.lang.Object
    Interface to access Win32 base APIs.
    See Also:
    JansiLoader
    • Field Detail

      • FOREGROUND_BLUE

        public static short FOREGROUND_BLUE
      • FOREGROUND_GREEN

        public static short FOREGROUND_GREEN
      • FOREGROUND_RED

        public static short FOREGROUND_RED
      • FOREGROUND_INTENSITY

        public static short FOREGROUND_INTENSITY
      • BACKGROUND_BLUE

        public static short BACKGROUND_BLUE
      • BACKGROUND_GREEN

        public static short BACKGROUND_GREEN
      • BACKGROUND_RED

        public static short BACKGROUND_RED
      • BACKGROUND_INTENSITY

        public static short BACKGROUND_INTENSITY
      • COMMON_LVB_LEADING_BYTE

        public static short COMMON_LVB_LEADING_BYTE
      • COMMON_LVB_TRAILING_BYTE

        public static short COMMON_LVB_TRAILING_BYTE
      • COMMON_LVB_GRID_HORIZONTAL

        public static short COMMON_LVB_GRID_HORIZONTAL
      • COMMON_LVB_GRID_LVERTICAL

        public static short COMMON_LVB_GRID_LVERTICAL
      • COMMON_LVB_GRID_RVERTICAL

        public static short COMMON_LVB_GRID_RVERTICAL
      • COMMON_LVB_REVERSE_VIDEO

        public static short COMMON_LVB_REVERSE_VIDEO
      • COMMON_LVB_UNDERSCORE

        public static short COMMON_LVB_UNDERSCORE
      • FORMAT_MESSAGE_FROM_SYSTEM

        public static int FORMAT_MESSAGE_FROM_SYSTEM
      • STD_INPUT_HANDLE

        public static int STD_INPUT_HANDLE
      • STD_OUTPUT_HANDLE

        public static int STD_OUTPUT_HANDLE
      • STD_ERROR_HANDLE

        public static int STD_ERROR_HANDLE
      • INVALID_HANDLE_VALUE

        public static int INVALID_HANDLE_VALUE
    • Constructor Detail

      • Kernel32

        public Kernel32()
    • Method Detail

      • init

        private static void init()
      • malloc

        public static long malloc​(long size)
      • free

        public static void free​(long ptr)
      • SetConsoleTextAttribute

        public static int SetConsoleTextAttribute​(long consoleOutput,
                                                  short attributes)
        see http://msdn.microsoft.com/en-us/library/ms686047%28VS.85%29.aspx
      • WaitForSingleObject

        public static int WaitForSingleObject​(long hHandle,
                                              int dwMilliseconds)
      • CloseHandle

        public static int CloseHandle​(long handle)
        see: http://msdn.microsoft.com/en-us/library/ms724211%28VS.85%29.aspx
      • GetLastError

        public static int GetLastError()
        see: http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspx
      • FormatMessageW

        public static int FormatMessageW​(int flags,
                                         long source,
                                         int messageId,
                                         int languageId,
                                         byte[] buffer,
                                         int size,
                                         long[] args)
      • GetConsoleScreenBufferInfo

        public static int GetConsoleScreenBufferInfo​(long consoleOutput,
                                                     Kernel32.CONSOLE_SCREEN_BUFFER_INFO consoleScreenBufferInfo)
        See: http://msdn.microsoft.com/en-us/library/ms683171%28VS.85%29.aspx
      • GetStdHandle

        public static long GetStdHandle​(int stdHandle)
        see: http://msdn.microsoft.com/en-us/library/ms683231%28VS.85%29.aspx
      • SetConsoleCursorPosition

        public static int SetConsoleCursorPosition​(long consoleOutput,
                                                   Kernel32.COORD cursorPosition)
        http://msdn.microsoft.com/en-us/library/ms686025%28VS.85%29.aspx
      • FillConsoleOutputCharacterW

        public static int FillConsoleOutputCharacterW​(long consoleOutput,
                                                      char character,
                                                      int length,
                                                      Kernel32.COORD writeCoord,
                                                      int[] numberOfCharsWritten)
        see: http://msdn.microsoft.com/en-us/library/ms682663%28VS.85%29.aspx
      • FillConsoleOutputAttribute

        public static int FillConsoleOutputAttribute​(long consoleOutput,
                                                     short attribute,
                                                     int length,
                                                     Kernel32.COORD writeCoord,
                                                     int[] numberOfAttrsWritten)
        see: https://msdn.microsoft.com/en-us/library/ms682662%28VS.85%29.aspx
      • WriteConsoleW

        public static int WriteConsoleW​(long consoleOutput,
                                        char[] buffer,
                                        int numberOfCharsToWrite,
                                        int[] numberOfCharsWritten,
                                        long reserved)
        see: http://msdn.microsoft.com/en-us/library/ms687401(v=VS.85).aspx
      • GetConsoleMode

        public static int GetConsoleMode​(long handle,
                                         int[] mode)
        see: http://msdn.microsoft.com/en-us/library/ms683167%28VS.85%29.aspx
      • SetConsoleMode

        public static int SetConsoleMode​(long handle,
                                         int mode)
        see: http://msdn.microsoft.com/en-us/library/ms686033%28VS.85%29.aspx
      • _getch

        public static int _getch()
        see: http://msdn.microsoft.com/en-us/library/078sfkak(VS.80).aspx
      • SetConsoleTitle

        public static int SetConsoleTitle​(java.lang.String title)
        see: http://msdn.microsoft.com/en-us/library/ms686050%28VS.85%29.aspx
        Returns:
        0 if title was set successfully
      • GetConsoleOutputCP

        public static int GetConsoleOutputCP()
        see: http://msdn.microsoft.com/en-us/library/ms683169(v=VS.85).aspx
        Returns:
        the current output code page
      • SetConsoleOutputCP

        public static int SetConsoleOutputCP​(int codePageID)
        see: http://msdn.microsoft.com/en-us/library/ms686036(v=VS.85).aspx
        Returns:
        non 0 if code page was set
      • ReadConsoleInputW

        private static int ReadConsoleInputW​(long handle,
                                             long inputRecord,
                                             int length,
                                             int[] eventsCount)
        see: http://msdn.microsoft.com/en-us/library/ms684961(v=VS.85).aspx
      • PeekConsoleInputW

        private static int PeekConsoleInputW​(long handle,
                                             long inputRecord,
                                             int length,
                                             int[] eventsCount)
        see: http://msdn.microsoft.com/en-us/library/ms684344(v=VS.85).aspx
      • GetNumberOfConsoleInputEvents

        public static int GetNumberOfConsoleInputEvents​(long handle,
                                                        int[] numberOfEvents)
        see: http://msdn.microsoft.com/en-us/library/ms683207(v=VS.85).aspx
      • FlushConsoleInputBuffer

        public static int FlushConsoleInputBuffer​(long handle)
        see: http://msdn.microsoft.com/en-us/library/ms683147(v=VS.85).aspx
      • readConsoleInputHelper

        public static Kernel32.INPUT_RECORD[] readConsoleInputHelper​(long handle,
                                                                     int count,
                                                                     boolean peek)
                                                              throws java.io.IOException
        Return console input events.
        Throws:
        java.io.IOException
      • readConsoleKeyInput

        public static Kernel32.INPUT_RECORD[] readConsoleKeyInput​(long handle,
                                                                  int count,
                                                                  boolean peek)
                                                           throws java.io.IOException
        Return console input key events (discard other events).
        Parameters:
        count - requested number of events
        Returns:
        array possibly of size smaller then count
        Throws:
        java.io.IOException