diff --git "a/win32ss/user/ntuser/msgqueue.c" "b/win32ss/user/ntuser/msgqueue.c" index 7f308530749..35f43d2d482 100644 --- "a/win32ss/user/ntuser/msgqueue.c" +++ "b/win32ss/user/ntuser/msgqueue.c" @@ -245,8 +245,17 @@ UserGetKeyState(DWORD dwKey) static VOID UpdateKeyState(PUSER_MESSAGE_QUEUE MessageQueue, WORD wVk, BOOL bIsDown) { + static PUSER_MESSAGE_QUEUE SysMsgQue = NULL; TRACE("UpdateKeyState wVk: %u, bIsDown: %d\n", wVk, bIsDown); + if (!SysMsgQue) + { + /* The first time this functions is entered it will be + * with the System Message Queue. Save it for later. */ + SysMsgQue = MessageQueue; + TRACE("Storing SysMsgQue '%p'.\n", MessageQueue); + } + if (bIsDown) { /* If it's first key down event, xor lock bit */ @@ -257,7 +266,17 @@ UpdateKeyState(PUSER_MESSAGE_QUEUE MessageQueue, WORD wVk, BOOL bIsDown) MessageQueue->afKeyRecentDown[wVk / 8] |= (1 << (wVk % 8)); } else + { SET_KEY_DOWN(MessageQueue->afKeyState, wVk, FALSE); + if (SysMsgQue && (MessageQueue != SysMsgQue) && (wVk == VK_SHIFT)) + { + /* If this is the shift key up and not going to the + * System Message Queue, then send it to the saved + * System Message Queue. See CORE-18525. */ + SET_KEY_DOWN(SysMsgQue->afKeyState, wVk, FALSE); + TRACE("SysMsgQue Fixing '%u'.\n", wVk); + } + } } /* update the input key state for a keyboard message */