diff --git a/reactos/subsystems/win32/win32k/include/cursoricon.h b/reactos/subsystems/win32/win32k/include/cursoricon.h index 90cb134ddd3..f60023c5805 100644 --- a/reactos/subsystems/win32/win32k/include/cursoricon.h +++ b/reactos/subsystems/win32/win32k/include/cursoricon.h @@ -69,7 +69,7 @@ BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxW INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon); -BOOL UserSetCursorPos( INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo); +BOOL UserSetCursorPos( INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook); int UserShowCursor(BOOL bShow); diff --git a/reactos/subsystems/win32/win32k/include/msgqueue.h b/reactos/subsystems/win32/win32k/include/msgqueue.h index 870cf874527..8b6eeddf998 100644 --- a/reactos/subsystems/win32/win32k/include/msgqueue.h +++ b/reactos/subsystems/win32/win32k/include/msgqueue.h @@ -245,7 +245,7 @@ co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); VOID FASTCALL MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam); VOID FASTCALL -co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo); +co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook); BOOL FASTCALL MsqIsClkLck(LPMSG Msg, BOOL Remove); BOOL FASTCALL diff --git a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c index 54033c258ef..488c2f3ad40 100644 --- a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c +++ b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c @@ -159,7 +159,7 @@ UserSetCursor( return OldCursor; } -BOOL UserSetCursorPos( INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo) +BOOL UserSetCursorPos( INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook) { PWND DesktopWindow; PSYSTEM_CURSORINFO CurInfo; @@ -194,12 +194,12 @@ BOOL UserSetCursorPos( INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo) pt.x = x; pt.y = y; - /* 3. Generate a mouse move message, this sets the htEx. */ + /* 3. Generate a mouse move message, this sets the htEx and Track Window too. */ Msg.message = WM_MOUSEMOVE; Msg.wParam = CurInfo->ButtonsDown; Msg.lParam = MAKELPARAM(x, y); Msg.pt = pt; - co_MsqInsertMouseMessage(&Msg, flags, dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, flags, dwExtraInfo, Hook); /* 1. Store the new cursor position */ gpsi->ptCursor = pt; @@ -677,7 +677,7 @@ UserClipCursor( { CurInfo->bClipped = TRUE; RECTL_bIntersectRect(&CurInfo->rcClip, prcl, &DesktopWindow->rcWindow); - UserSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y, 0, 0); + UserSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y, 0, 0, FALSE); } else { diff --git a/reactos/subsystems/win32/win32k/ntuser/hook.c b/reactos/subsystems/win32/win32k/ntuser/hook.c index e252716f921..466232d6b43 100644 --- a/reactos/subsystems/win32/win32k/ntuser/hook.c +++ b/reactos/subsystems/win32/win32k/ntuser/hook.c @@ -1046,7 +1046,7 @@ co_HOOK_CallHooks( INT HookId, ObDereferenceObject(Hook->Thread); } - if ( Global && !pti->sphkCurrent) + if ( Global ) { PTHREADINFO ptiHook; @@ -1061,7 +1061,6 @@ co_HOOK_CallHooks( INT HookId, * hook ID, this will have to post to each of the thread message queues * or make a direct call. */ - pti->sphkCurrent = Hook; // Prevent recursion within this thread. do { /* Hook->Thread is null, we hax around this with Hook->head.pti. */ @@ -1109,7 +1108,6 @@ co_HOOK_CallHooks( INT HookId, } while ( Hook ); DPRINT("Ret: Global HookId %d Result 0x%x\n", HookId,Result); - pti->sphkCurrent = NULL; } Exit: return Result; diff --git a/reactos/subsystems/win32/win32k/ntuser/input.c b/reactos/subsystems/win32/win32k/ntuser/input.c index 6d7d7eacbc3..8e627548112 100644 --- a/reactos/subsystems/win32/win32k/ntuser/input.c +++ b/reactos/subsystems/win32/win32k/ntuser/input.c @@ -1138,7 +1138,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) if(mi->dwFlags & MOUSEEVENTF_MOVE) { - UserSetCursorPos(MousePos.x, MousePos.y, Injected, mi->dwExtraInfo); + UserSetCursorPos(MousePos.x, MousePos.y, Injected, mi->dwExtraInfo, TRUE); } if(mi->dwFlags & MOUSEEVENTF_LEFTDOWN) { @@ -1146,7 +1146,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) Msg.message = SwapBtnMsg[0][SwapButtons]; CurInfo->ButtonsDown |= SwapBtn[SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } else if(mi->dwFlags & MOUSEEVENTF_LEFTUP) { @@ -1154,7 +1154,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) Msg.message = SwapBtnMsg[1][SwapButtons]; CurInfo->ButtonsDown &= ~SwapBtn[SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } if(mi->dwFlags & MOUSEEVENTF_MIDDLEDOWN) { @@ -1162,7 +1162,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) Msg.message = WM_MBUTTONDOWN; CurInfo->ButtonsDown |= MK_MBUTTON; Msg.wParam |= CurInfo->ButtonsDown; - co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } else if(mi->dwFlags & MOUSEEVENTF_MIDDLEUP) { @@ -1170,7 +1170,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) Msg.message = WM_MBUTTONUP; CurInfo->ButtonsDown &= ~MK_MBUTTON; Msg.wParam |= CurInfo->ButtonsDown; - co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } if(mi->dwFlags & MOUSEEVENTF_RIGHTDOWN) { @@ -1178,7 +1178,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) Msg.message = SwapBtnMsg[0][!SwapButtons]; CurInfo->ButtonsDown |= SwapBtn[!SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } else if(mi->dwFlags & MOUSEEVENTF_RIGHTUP) { @@ -1186,7 +1186,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) Msg.message = SwapBtnMsg[1][!SwapButtons]; CurInfo->ButtonsDown &= ~SwapBtn[!SwapButtons]; Msg.wParam |= CurInfo->ButtonsDown; - co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } if((mi->dwFlags & (MOUSEEVENTF_XDOWN | MOUSEEVENTF_XUP)) && @@ -1204,14 +1204,14 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) gQueueKeyStateTable[VK_XBUTTON1] |= 0xc0; CurInfo->ButtonsDown |= MK_XBUTTON1; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1); - co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } if(mi->mouseData & XBUTTON2) { gQueueKeyStateTable[VK_XBUTTON2] |= 0xc0; CurInfo->ButtonsDown |= MK_XBUTTON2; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON2); - co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } } else if(mi->dwFlags & MOUSEEVENTF_XUP) @@ -1222,21 +1222,21 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected) gQueueKeyStateTable[VK_XBUTTON1] &= ~0x80; CurInfo->ButtonsDown &= ~MK_XBUTTON1; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1); - co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } if(mi->mouseData & XBUTTON2) { gQueueKeyStateTable[VK_XBUTTON2] &= ~0x80; CurInfo->ButtonsDown &= ~MK_XBUTTON2; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON2); - co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } } if(mi->dwFlags & MOUSEEVENTF_WHEEL) { Msg.message = WM_MOUSEWHEEL; Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, mi->mouseData); - co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); + co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE); } return TRUE; diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index 2fb518dfed3..8c036a415e1 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -291,7 +291,7 @@ MsqPostMouseMove(PUSER_MESSAGE_QUEUE MessageQueue, MSG* Msg) } VOID FASTCALL -co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo) +co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook) { LARGE_INTEGER LargeTickCount; MSLLHOOKSTRUCT MouseHookData; @@ -326,8 +326,11 @@ co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo) MouseHookData.dwExtraInfo = dwExtraInfo; /* 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; + if (Hook) + { + if (co_HOOK_CallHooks(WH_MOUSE_LL, HC_ACTION, Msg->message, (LPARAM) &MouseHookData)) + return; + } /* Get the desktop window */ pwndDesktop = UserGetDesktopWindow(); diff --git a/reactos/subsystems/win32/win32k/ntuser/simplecall.c b/reactos/subsystems/win32/win32k/ntuser/simplecall.c index c7de5ca265a..af25a1f1a97 100644 --- a/reactos/subsystems/win32/win32k/ntuser/simplecall.c +++ b/reactos/subsystems/win32/win32k/ntuser/simplecall.c @@ -473,7 +473,7 @@ NtUserCallTwoParam( RETURN( (DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2)); case TWOPARAM_ROUTINE_SETCURSORPOS: - RETURN( (DWORD_PTR)UserSetCursorPos((int)Param1, (int)Param2, 0, 0)); + RETURN( (DWORD_PTR)UserSetCursorPos((int)Param1, (int)Param2, 0, 0, FALSE)); case TWOPARAM_ROUTINE_UNHOOKWINDOWSHOOK: RETURN( IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2));