From 02cb45ab9c7aaf4feece55190430b9c9d6a6aed0 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 20 Aug 2010 19:24:48 +0000 Subject: [PATCH] [WIN32K] - 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 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index 5d1cf8ef9d2..b6ed7e5d1aa 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -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);