[ros-diffs] [dgorbachev] 38667: In co_MsqPostKeyboardMessage(), do not forget to release lock - this should cure the "blue death" and the "black death" diseases (bug #3995, bug #3997).

dgorbachev at svn.reactos.org dgorbachev at svn.reactos.org
Fri Jan 9 16:39:29 CET 2009


Author: dgorbachev
Date: Fri Jan  9 09:39:28 2009
New Revision: 38667

URL: http://svn.reactos.org/svn/reactos?rev=38667&view=rev
Log:
In co_MsqPostKeyboardMessage(), do not forget to release lock - this should cure the "blue death" and the "black death" diseases (bug #3995, bug #3997).

Modified:
    trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c?rev=38667&r1=38666&r2=38667&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Fri Jan  9 09:39:28 2009
@@ -738,12 +738,18 @@
    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 @@
    {
       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 @@
    {
          DPRINT("Invalid focus window handle\n");
    }
-   if (UserIsEntered()) UserLeave();
+
+   if (Entered) UserLeave();
+   return;
 }
 
 VOID FASTCALL



More information about the Ros-diffs mailing list