dwControlKeyState behaviour changed between Windows 10/Windows 11 #20771

Open
opened 2026-01-31 07:23:36 +00:00 by claunia · 0 comments
Owner

Originally created by @taviso on GitHub (Nov 6, 2023).

Originally assigned to: @lhecker on GitHub.

Windows Terminal version

1.19.231010001-preview

Windows build number

10.0.22621.0

Other Software

hiew 8.79 (inside wsl)

Steps to reproduce

I have a win32 console application (hiew, a powerful hex editor) that worked fine when invoked from within WSL in Windows 10, but no longer works in Windows 11. It still works okay when invoked from cmd or powershell, but I liked using it under WSL ☹️

Various keys no longer seem to register.

I wrote a quick c program to dump console input events, and I observe the following pattern:

  • Pressing F11 with a win32 console application under WSL on Windows 10 (conhost 10.0.19041.3393) (Works ):
Key event:
 bKeyDown:          1
 wRepeatCount:      1
 wVirtualKeyCode:   0x7a
    MAPVK_VK_TO_VSC  => 0x57
    MAPVK_VK_TO_CHAR => 00
 wVirtualScanCode:  0x57
    MAPVK_VSC_TO_VK => 0x7a
    MAPVK_VSC_TO_VK_EX => 0x7a
 uChar:
  UnicodeChar:      '' (0000)
  AsciiChar:        '' (00)
    VkKeyScanA  => 0x3c0
 dwControlKeyState: 0
  • Pressing F11 with a win32 console application under cmd on Windows 11 (I've tried release conhost, and current stable and preview OpenConsole, with same result )
Key event:
 bKeyDown:          1
 wRepeatCount:      1
 wVirtualKeyCode:   0x7a
    MAPVK_VK_TO_VSC  => 0x57
    MAPVK_VK_TO_CHAR => 00
 wVirtualScanCode:  0x57
    MAPVK_VSC_TO_VK => 0x7a
    MAPVK_VSC_TO_VK_EX => 0x7a
 uChar:
  UnicodeChar:      ' ' (0000)
  AsciiChar:        ' ' (00)
    VkKeyScanA  => 0x3c0
 dwControlKeyState: 0
  • Pressing F11 with a win32 console application under WSL on Windows 11 (Also tried release conhost, stable and preview OpenConsole, with same result )
Key event:
 bKeyDown:          1
 wRepeatCount:      1
 wVirtualKeyCode:   0x7a
    MAPVK_VK_TO_VSC  => 0x57
    MAPVK_VK_TO_CHAR => 00
 wVirtualScanCode:  0x57
    MAPVK_VSC_TO_VK => 0x7a
    MAPVK_VSC_TO_VK_EX => 0x7a
 uChar:
  UnicodeChar:      '' (0000)
  AsciiChar:        '' (00)
    VkKeyScanA  => 0x3c0
 dwControlKeyState: 256
ENHANCED_KEY

I think the issue is that ENHANCED_KEY is now being set, and it wasn't before. I don't know why this changed, but it seems to have broken at least one app ☹️

Do you know what might be causing this?

Expected Behavior

Keys to register.

Actual Behavior

Keys are ignored, I suspect because dwControlKeyState changed.

Originally created by @taviso on GitHub (Nov 6, 2023). Originally assigned to: @lhecker on GitHub. ### Windows Terminal version 1.19.231010001-preview ### Windows build number 10.0.22621.0 ### Other Software hiew 8.79 (inside wsl) ### Steps to reproduce I have a win32 console application ([hiew](https://hiew.ru/), a powerful hex editor) that worked fine when invoked from within WSL in Windows 10, but no longer works in Windows 11. It still works okay when invoked from cmd or powershell, but I liked using it under WSL ☹️ Various keys no longer seem to register. I wrote a quick c program to dump console input events, and I observe the following pattern: - Pressing F11 with a win32 console application under WSL on Windows 10 (conhost 10.0.19041.3393) (Works ✅): ``` Key event: bKeyDown: 1 wRepeatCount: 1 wVirtualKeyCode: 0x7a MAPVK_VK_TO_VSC => 0x57 MAPVK_VK_TO_CHAR => 00 wVirtualScanCode: 0x57 MAPVK_VSC_TO_VK => 0x7a MAPVK_VSC_TO_VK_EX => 0x7a uChar: UnicodeChar: '' (0000) AsciiChar: '' (00) VkKeyScanA => 0x3c0 dwControlKeyState: 0 ``` - Pressing F11 with a win32 console application under cmd on Windows 11 (I've tried release conhost, and current stable and preview OpenConsole, with same result ✅) ``` Key event: bKeyDown: 1 wRepeatCount: 1 wVirtualKeyCode: 0x7a MAPVK_VK_TO_VSC => 0x57 MAPVK_VK_TO_CHAR => 00 wVirtualScanCode: 0x57 MAPVK_VSC_TO_VK => 0x7a MAPVK_VSC_TO_VK_EX => 0x7a uChar: UnicodeChar: ' ' (0000) AsciiChar: ' ' (00) VkKeyScanA => 0x3c0 dwControlKeyState: 0 ``` - Pressing F11 with a win32 console application under *WSL* on Windows 11 (Also tried release conhost, stable and preview OpenConsole, with same result ❌ ) ``` Key event: bKeyDown: 1 wRepeatCount: 1 wVirtualKeyCode: 0x7a MAPVK_VK_TO_VSC => 0x57 MAPVK_VK_TO_CHAR => 00 wVirtualScanCode: 0x57 MAPVK_VSC_TO_VK => 0x7a MAPVK_VSC_TO_VK_EX => 0x7a uChar: UnicodeChar: '' (0000) AsciiChar: '' (00) VkKeyScanA => 0x3c0 dwControlKeyState: 256 ENHANCED_KEY ``` I think the issue is that [ENHANCED_KEY](https://learn.microsoft.com/en-us/windows/console/key-event-record-str#) is now being set, and it wasn't before. I don't know why this changed, but it seems to have broken at least one app ☹️ Do you know what might be causing this? ### Expected Behavior Keys to register. ### Actual Behavior Keys are ignored, I suspect because dwControlKeyState changed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20771