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.