Index: reactos\subsystems\win32\win32k\ntuser\input.c =================================================================== --- reactos\subsystems\win32\win32k\ntuser\input.c (revision 41733) +++ reactos\subsystems\win32\win32k\ntuser\input.c (working copy) @@ -731,6 +731,7 @@ for (;NumKeys;memcpy(&KeyInput, &NextKeyInput, sizeof(KeyInput)), NumKeys--) { + PKBL keyboardLayout = NULL; lParam = 0; IntKeyboardUpdateLeds(KeyboardDeviceHandle, @@ -801,31 +802,33 @@ } /* Find the target thread whose locale is in effect */ - FocusQueue = IntGetFocusMessageQueue(); + FocusQueue = IntGetFocusMessageQueue(); /* This might cause us to lose hot keys, which are important * (ctrl-alt-del secure attention sequence). Not sure if it * can happen though. */ - if (!FocusQueue) - continue; + if (FocusQueue) + { + msg.hwnd = FocusQueue->FocusWindow; + FocusThread = FocusQueue->Thread; + if (FocusThread && FocusThread->Tcb.Win32Thread) + { + keyboardLayout = ((PTHREADINFO)FocusThread->Tcb.Win32Thread)->KeyboardLayout; + } + } + msg.lParam = lParam; - msg.hwnd = FocusQueue->FocusWindow; - FocusThread = FocusQueue->Thread; - - if (!(FocusThread && FocusThread->Tcb.Win32Thread && - ((PTHREADINFO)FocusThread->Tcb.Win32Thread)->KeyboardLayout)) - continue; - /* This function uses lParam to fill wParam according to the * keyboard layout in use. */ W32kKeyProcessMessage(&msg, - ((PTHREADINFO)FocusThread->Tcb.Win32Thread)->KeyboardLayout->KBTables, + keyboardLayout ? keyboardLayout->KBTables : + W32kGetDefaultKeyLayout()->KBTables, KeyInput.Flags & KEY_E0 ? 0xE0 : - (KeyInput.Flags & KEY_E1 ? 0xE1 : 0)); + (KeyInput.Flags & KEY_E1 ? 0xE1 : 0)); if (GetHotKey(ModifierState, msg.wParam, @@ -833,18 +836,23 @@ &hWnd, &id)) { - if (!(KeyInput.Flags & KEY_BREAK)) - { - DPRINT("Hot key pressed (hWnd %lx, id %d)\n", hWnd, id); - MsqPostHotKeyMessage (Thread, - hWnd, - (WPARAM)id, - MAKELPARAM((WORD)ModifierState, - (WORD)msg.wParam)); - } - continue; /* Eat key up motion too */ + if (!(KeyInput.Flags & KEY_BREAK)) + { + DPRINT("Hot key pressed (hWnd %lx, id %d)\n", hWnd, id); + MsqPostHotKeyMessage (Thread, + hWnd, + (WPARAM)id, + MAKELPARAM((WORD)ModifierState, + (WORD)msg.wParam)); + } + continue; /* Eat key up motion too */ } + if (!keyboardLayout) + { + /* there is no focused window to receice keyboard message */ + continue; + } /* * Post a keyboard message. */