Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-20202

GetKeyState(VK_NUMLOCK) always returns 0; toggle state not reflected

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • Win32SS
    • None

    Description

      GetKeyState(VK_NUMLOCK) consistently returns 0x0000 on ReactOS, regardless of the actual toggle state of the Num Lock key. This behavior was confirmed using a low-level keyboard hook that logs the result of GetKeyState immediately after Num Lock is released.

      On Windows, this function returns:

      • 0x0001 when Num Lock is active (bit 0 = toggle state),
      • 0x0000 when it is not.

      On ReactOS, however, the return value is always 0x0000, indicating that the toggle state is not being reported.

      Test Case:

      A simple C program using SetWindowsHookEx(WH_KEYBOARD_LL) was used to log the result of GetKeyState(VK_NUMLOCK) on each key-up event of the Num Lock key. The test prints a timestamp, virtual key code, scan code, and the raw return value of GetKeyState. The source code is attached.

      Observed Output (ReactOS):

      [12:34:56] nCode=0 wParam=0x0101 vk=0x90 sc=0x45 fl=0x81 raw=0x0000 => OFF
      [12:34:58] nCode=0 wParam=0x0101 vk=0x90 sc=0x45 fl=0x81 raw=0x0000 => OFF 

      The toggle state never switches to ON, despite physical toggling.

      Expected Output (Windows):{}

      [12:34:56] nCode=0 wParam=0x0101 vk=0x90 sc=0x45 fl=0x81 raw=0xFF81 => ON
      [12:34:58] nCode=0 wParam=0x0101 vk=0x90 sc=0x45 fl=0x81 raw=0xFF80 => OFF 

      This indicates that Windows correctly tracks the toggle state and reflects it through GetKeyState.

      Attachments

        1. i8042prt.zip
          27 kB
        2. keystate.patch
          2 kB
        3. numlock_debug.c
          3 kB
        4. t.log
          759 kB

        Activity

          People

            Unassigned Unassigned
            feldrim feldrim
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: