From 92d6cc11544be555fc04cb8e6ae09dcd141e8637 Mon Sep 17 00:00:00 2001 From: Dmitry Gorbachev Date: Fri, 9 Jan 2009 15:39:28 +0000 Subject: [PATCH] In co_MsqPostKeyboardMessage(), do not forget to release lock - this should cure the "blue death" and the "black death" diseases (bug #3995, bug #3997). svn path=/trunk/; revision=38667 --- reactos/subsystems/win32/win32k/ntuser/msgqueue.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index 3cedbefeda2..73a37718f82 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -738,12 +738,18 @@ co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) LARGE_INTEGER LargeTickCount; KBDLLHOOKSTRUCT KbdHookData; EVENTMSG Event; + BOOLEAN Entered = FALSE; DPRINT("MsqPostKeyboardMessage(uMsg 0x%x, wParam 0x%x, lParam 0x%x)\n", uMsg, wParam, lParam); // Condition may arise when calling MsqPostMessage and waiting for an event. - if (!UserIsEntered()) UserEnterExclusive(); // Fixme: Not sure ATM if this thread is locked. + if (!UserIsEntered()) + { + // Fixme: Not sure ATM if this thread is locked. + UserEnterExclusive(); + Entered = TRUE; + } FocusMessageQueue = IntGetFocusMessageQueue(); @@ -781,12 +787,14 @@ co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { DPRINT("Kbd msg %d wParam %d lParam 0x%08x dropped by WH_KEYBOARD_LL hook\n", Msg.message, Msg.wParam, Msg.lParam); + if (Entered) UserLeave(); return; } if (FocusMessageQueue == NULL) { DPRINT("No focus message queue\n"); + if (Entered) UserLeave(); return; } @@ -805,7 +813,9 @@ co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { DPRINT("Invalid focus window handle\n"); } - if (UserIsEntered()) UserLeave(); + + if (Entered) UserLeave(); + return; } VOID FASTCALL