fixed wrong handling of WM_MOUSEWHEEL messages that caused the desktop thread crashing
authorThomas Bluemel <thomas@reactsoft.com>
Sun, 14 Dec 2003 23:30:32 +0000 (23:30 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Sun, 14 Dec 2003 23:30:32 +0000 (23:30 +0000)
svn path=/trunk/; revision=7071

reactos/subsys/win32k/ntuser/msgqueue.c

index c9842ac..2a4cff6 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: msgqueue.c,v 1.46 2003/12/14 22:14:45 weiden Exp $
+/* $Id: msgqueue.c,v 1.47 2003/12/14 23:30:32 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -182,7 +182,7 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
                         PPOINT ScreenPoint, PBOOL MouseClick)
 {
   USHORT Msg = Message->Msg.message;
-  PWINDOW_OBJECT CaptureWin, Window = NULL;
+  PWINDOW_OBJECT FocusWin, CaptureWin, Window = NULL;
   HWND Wnd;
   POINT Point;
 
@@ -195,17 +195,31 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
   {
     Wnd = IntGetFocusWindow();
     
-    if(Wnd)
+    if(Wnd && (FocusWin = IntGetWindowObject(Wnd)))
     {
+      if (FocusWin->MessageQueue != PsGetWin32Thread()->MessageQueue)
+      {
+        ExAcquireFastMutex(&FocusWin->MessageQueue->HardwareLock);
+        InsertTailList(&FocusWin->MessageQueue->HardwareMessagesListHead,
+                       &Message->ListEntry);
+        ExReleaseFastMutex(&FocusWin->MessageQueue->HardwareLock);
+        KeSetEvent(&FocusWin->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
+        IntReleaseWindowObject(FocusWin);
+        *Freed = FALSE;
+        return(FALSE);
+      }
       *ScreenPoint = Message->Msg.pt;
       
       /* FIXME: Check message filter. */
       
       if(Remove)
       {
-        Message->Msg.hwnd = Wnd;
+        Message->Msg.hwnd = FocusWin->Self;
         Message->Msg.lParam = MAKELONG(Message->Msg.pt.x, Message->Msg.pt.y);
       }
+      
+      IntReleaseWindowObject(FocusWin);
+      
       *Freed = FALSE;
       return TRUE;
     }