[ros-diffs] [mjmartin] 47325: [win32k] - For the Low Level Mouse Hook (WH_MOUSE_LL), input can come from the mouse driver or mouse_event. Both of which result in a call to UserSetCursorPos. UserMode SetCursorPos API also ends up here. Add BOOL parameter that can be used to determine if hooks are to be called. - Move the code related to calling the hook procedure from MsqInsertSystemMessage into UserSetCursorPos and call the hook procedure here if needed. If hook procedure returns non 0 value. Dont insert the system message. - Fixes a recursive call to the hook procedure resulting thread using to much stack exposed by user32 winetest for input.

mjmartin at svn.reactos.org mjmartin at svn.reactos.org
Sun May 23 13:53:02 CEST 2010


Author: mjmartin
Date: Sun May 23 13:53:01 2010
New Revision: 47325

URL: http://svn.reactos.org/svn/reactos?rev=47325&view=rev
Log:
[win32k]
- For the Low Level Mouse Hook (WH_MOUSE_LL), input can come from the mouse driver or mouse_event. Both of which result in a call to UserSetCursorPos.
UserMode SetCursorPos API also ends up here. Add BOOL parameter that can be used to determine if hooks are to be called.
- Move the code related to calling the hook procedure from MsqInsertSystemMessage into UserSetCursorPos and call the hook procedure here if needed.
If hook procedure returns non 0 value. Dont insert the system message.
- Fixes a recursive call to the hook procedure resulting thread using to much stack exposed by user32 winetest for input.

Modified:
    trunk/reactos/subsystems/win32/win32k/include/cursoricon.h
    trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
    trunk/reactos/subsystems/win32/win32k/ntuser/input.c
    trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
    trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c

Modified: trunk/reactos/subsystems/win32/win32k/include/cursoricon.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/cursoricon.h?rev=47325&r1=47324&r2=47325&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/cursoricon.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/cursoricon.h [iso-8859-1] Sun May 23 13:53:01 2010
@@ -77,7 +77,7 @@
    INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags);
 PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon);
 
-BOOL UserSetCursorPos( INT x, INT y);
+BOOL UserSetCursorPos( INT x, INT y, BOOL CallHooks);
 
 int UserShowCursor(BOOL bShow);
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c?rev=47325&r1=47324&r2=47325&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] Sun May 23 13:53:01 2010
@@ -175,10 +175,12 @@
     return hOldCursor;
 }
 
-BOOL UserSetCursorPos( INT x, INT y)
+BOOL UserSetCursorPos( INT x, INT y, BOOL CallHooks)
 {
     PWINDOW_OBJECT DesktopWindow;
     PSYSTEM_CURSORINFO CurInfo;
+    LARGE_INTEGER LargeTickCount;
+    MSLLHOOKSTRUCT MouseHookData;
     HDC hDC;
     MSG Msg;
 
@@ -221,6 +223,9 @@
     gpsi->ptCursor.x = x;
     gpsi->ptCursor.y = y;
 
+    KeQueryTickCount(&LargeTickCount);
+    Msg.time = MsqCalculateMessageTime(&LargeTickCount);
+
     //Move the mouse pointer
     GreMovePointer(hDC, x, y);
 
@@ -229,8 +234,39 @@
     Msg.wParam = CurInfo->ButtonsDown;
     Msg.lParam = MAKELPARAM(x, y);
     Msg.pt = gpsi->ptCursor;
+
+    MouseHookData.pt.x = LOWORD(Msg.lParam);
+    MouseHookData.pt.y = HIWORD(Msg.lParam);
+    switch(Msg.message)
+    {
+        case WM_MOUSEWHEEL:
+            MouseHookData.mouseData = MAKELONG(0, GET_WHEEL_DELTA_WPARAM(Msg.wParam));
+            break;
+        case WM_XBUTTONDOWN:
+        case WM_XBUTTONUP:
+        case WM_XBUTTONDBLCLK:
+        case WM_NCXBUTTONDOWN:
+        case WM_NCXBUTTONUP:
+        case WM_NCXBUTTONDBLCLK:
+             MouseHookData.mouseData = MAKELONG(0, HIWORD(Msg.wParam));
+             break;
+        default:
+             MouseHookData.mouseData = 0;
+             break;
+     }
+
+    MouseHookData.flags = 0;
+    MouseHookData.time = Msg.time;
+    MouseHookData.dwExtraInfo = 0;
+
+    if (CallHooks)
+    {
+      /* If the hook procedure returned non zero, dont send the message */
+      if (co_HOOK_CallHooks(WH_MOUSE_LL, HC_ACTION, Msg.message, (LPARAM) &MouseHookData))
+        return FALSE;
+    }
+
     MsqInsertSystemMessage(&Msg);
-
     return TRUE;
 }
 
@@ -814,7 +850,7 @@
         CurInfo->CursorClipInfo.Right = min(Rect.right, DesktopWindow->Wnd->rcWindow.right);
         CurInfo->CursorClipInfo.Bottom = min(Rect.bottom, DesktopWindow->Wnd->rcWindow.bottom);
 
-        UserSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y);
+        UserSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y, FALSE);
 
         RETURN(TRUE);
     }

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/input.c?rev=47325&r1=47324&r2=47325&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Sun May 23 13:53:01 2010
@@ -1128,7 +1128,7 @@
 
    if(mi->dwFlags & MOUSEEVENTF_MOVE)
    {
-      UserSetCursorPos(MousePos.x, MousePos.y);
+      UserSetCursorPos(MousePos.x, MousePos.y, TRUE);
    }
    if(mi->dwFlags & MOUSEEVENTF_LEFTDOWN)
    {

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=47325&r1=47324&r2=47325&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] Sun May 23 13:53:01 2010
@@ -171,38 +171,8 @@
 VOID FASTCALL
 MsqInsertSystemMessage(MSG* Msg)
 {
-   LARGE_INTEGER LargeTickCount;
    KIRQL OldIrql;
    ULONG Prev;
-   MSLLHOOKSTRUCT MouseHookData;
-
-   KeQueryTickCount(&LargeTickCount);
-   Msg->time = MsqCalculateMessageTime(&LargeTickCount);
-
-   MouseHookData.pt.x = LOWORD(Msg->lParam);
-   MouseHookData.pt.y = HIWORD(Msg->lParam);
-   switch(Msg->message)
-   {
-        case WM_MOUSEWHEEL:
-           MouseHookData.mouseData = MAKELONG(0, GET_WHEEL_DELTA_WPARAM(Msg->wParam));
-           break;
-        case WM_XBUTTONDOWN:
-        case WM_XBUTTONUP:
-        case WM_XBUTTONDBLCLK:
-        case WM_NCXBUTTONDOWN:
-        case WM_NCXBUTTONUP:
-        case WM_NCXBUTTONDBLCLK:
-           MouseHookData.mouseData = MAKELONG(0, HIWORD(Msg->wParam));
-           break;
-        default:
-           MouseHookData.mouseData = 0;
-           break;
-     }
-     MouseHookData.flags = 0;
-     MouseHookData.time = Msg->time;
-     MouseHookData.dwExtraInfo = 0;
-     if( co_HOOK_CallHooks(WH_MOUSE_LL, HC_ACTION, Msg->message, (LPARAM) &MouseHookData))
-         return;
 
    /*
     * If we got WM_MOUSEMOVE and there are already messages in the

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c?rev=47325&r1=47324&r2=47325&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Sun May 23 13:53:01 2010
@@ -440,7 +440,7 @@
          RETURN( (DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
 
       case TWOPARAM_ROUTINE_SETCURSORPOS:
-         RETURN( (DWORD_PTR)UserSetCursorPos((int)Param1, (int)Param2));
+         RETURN( (DWORD_PTR)UserSetCursorPos((int)Param1, (int)Param2, FALSE));
 
    }
    DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",




More information about the Ros-diffs mailing list