[WIN32K]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 20 Aug 2010 19:24:48 +0000 (19:24 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 20 Aug 2010 19:24:48 +0000 (19:24 +0000)
- co_IntTranslateMouseMessage: properly initialize *HitTest and only send WM_NCHITTEST when the message is going to be removed
- co_IntPeekMessage: Prevent possible use of uninitialized HitTest by ProcessMouseMessage()
- Patch by Jan Roeloffzen [jroeloffzen at hotmail dot com]
- Fixes bug 2139

svn path=/trunk/; revision=48576

reactos/subsystems/win32/win32k/ntuser/message.c

index 5d1cf8e..b6ed7e5 100644 (file)
@@ -579,14 +579,20 @@ co_IntTranslateMouseMessage(
       return TRUE;
    }
 
+   *HitTest = HTCLIENT;
+
    UserRefObjectCo(Window, &Ref);
 
    if ( ThreadQueue == Window->pti->MessageQueue &&
         ThreadQueue->CaptureWindow != Window->hSelf)
    {
       /* only send WM_NCHITTEST messages if we're not capturing the window! */
-      *HitTest = co_IntSendMessage(Window->hSelf, WM_NCHITTEST, 0,
-                                   MAKELONG(Msg->pt.x, Msg->pt.y));
+      if (Remove ) 
+      {
+         *HitTest = co_IntSendMessage(Window->hSelf, WM_NCHITTEST, 0,
+                                      MAKELONG(Msg->pt.x, Msg->pt.y));
+      } 
+      /* else we are going to see this message again, but then with Remove == TRUE */
 
       if (*HitTest == (USHORT)HTTRANSPARENT)
       {
@@ -626,10 +632,6 @@ co_IntTranslateMouseMessage(
          }
       }
    }
-   else
-   {
-      *HitTest = HTCLIENT;
-   }
 
    if ( gspv.bMouseClickLock && 
         ( (Msg->message == WM_LBUTTONUP) ||
@@ -801,6 +803,8 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
  */
 CheckMessages:
 
+   HitTest = HTNOWHERE;
+
    Present = FALSE;
 
    KeQueryTickCount(&LargeTickCount);