- Revert parts of 51283, thanks to Giannis for setting me straight on SetCursorPos and without breaking setting the Track window for TrackMouseEvent. Pass the new SetCursorPos, and wine test_TrackMouseEvent and input test_mouse_ll_hook tests.

svn path=/trunk/; revision=51305
This commit is contained in:
James Tabor 2011-04-09 20:32:52 +00:00
parent 36147ed99d
commit 86153cc8a8
7 changed files with 26 additions and 25 deletions

View file

@ -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); INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags);
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon); 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); int UserShowCursor(BOOL bShow);

View file

@ -245,7 +245,7 @@ co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
VOID FASTCALL VOID FASTCALL
MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam); MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam);
VOID FASTCALL VOID FASTCALL
co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo); co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook);
BOOL FASTCALL BOOL FASTCALL
MsqIsClkLck(LPMSG Msg, BOOL Remove); MsqIsClkLck(LPMSG Msg, BOOL Remove);
BOOL FASTCALL BOOL FASTCALL

View file

@ -159,7 +159,7 @@ UserSetCursor(
return OldCursor; 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; PWND DesktopWindow;
PSYSTEM_CURSORINFO CurInfo; PSYSTEM_CURSORINFO CurInfo;
@ -194,12 +194,12 @@ BOOL UserSetCursorPos( INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo)
pt.x = x; pt.x = x;
pt.y = y; 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.message = WM_MOUSEMOVE;
Msg.wParam = CurInfo->ButtonsDown; Msg.wParam = CurInfo->ButtonsDown;
Msg.lParam = MAKELPARAM(x, y); Msg.lParam = MAKELPARAM(x, y);
Msg.pt = pt; Msg.pt = pt;
co_MsqInsertMouseMessage(&Msg, flags, dwExtraInfo); co_MsqInsertMouseMessage(&Msg, flags, dwExtraInfo, Hook);
/* 1. Store the new cursor position */ /* 1. Store the new cursor position */
gpsi->ptCursor = pt; gpsi->ptCursor = pt;
@ -677,7 +677,7 @@ UserClipCursor(
{ {
CurInfo->bClipped = TRUE; CurInfo->bClipped = TRUE;
RECTL_bIntersectRect(&CurInfo->rcClip, prcl, &DesktopWindow->rcWindow); 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 else
{ {

View file

@ -1046,7 +1046,7 @@ co_HOOK_CallHooks( INT HookId,
ObDereferenceObject(Hook->Thread); ObDereferenceObject(Hook->Thread);
} }
if ( Global && !pti->sphkCurrent) if ( Global )
{ {
PTHREADINFO ptiHook; 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 * hook ID, this will have to post to each of the thread message queues
* or make a direct call. * or make a direct call.
*/ */
pti->sphkCurrent = Hook; // Prevent recursion within this thread.
do do
{ {
/* Hook->Thread is null, we hax around this with Hook->head.pti. */ /* Hook->Thread is null, we hax around this with Hook->head.pti. */
@ -1109,7 +1108,6 @@ co_HOOK_CallHooks( INT HookId,
} }
while ( Hook ); while ( Hook );
DPRINT("Ret: Global HookId %d Result 0x%x\n", HookId,Result); DPRINT("Ret: Global HookId %d Result 0x%x\n", HookId,Result);
pti->sphkCurrent = NULL;
} }
Exit: Exit:
return Result; return Result;

View file

@ -1138,7 +1138,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected)
if(mi->dwFlags & MOUSEEVENTF_MOVE) 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) if(mi->dwFlags & MOUSEEVENTF_LEFTDOWN)
{ {
@ -1146,7 +1146,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected)
Msg.message = SwapBtnMsg[0][SwapButtons]; Msg.message = SwapBtnMsg[0][SwapButtons];
CurInfo->ButtonsDown |= SwapBtn[SwapButtons]; CurInfo->ButtonsDown |= SwapBtn[SwapButtons];
Msg.wParam |= CurInfo->ButtonsDown; Msg.wParam |= CurInfo->ButtonsDown;
co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE);
} }
else if(mi->dwFlags & MOUSEEVENTF_LEFTUP) else if(mi->dwFlags & MOUSEEVENTF_LEFTUP)
{ {
@ -1154,7 +1154,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected)
Msg.message = SwapBtnMsg[1][SwapButtons]; Msg.message = SwapBtnMsg[1][SwapButtons];
CurInfo->ButtonsDown &= ~SwapBtn[SwapButtons]; CurInfo->ButtonsDown &= ~SwapBtn[SwapButtons];
Msg.wParam |= CurInfo->ButtonsDown; Msg.wParam |= CurInfo->ButtonsDown;
co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE);
} }
if(mi->dwFlags & MOUSEEVENTF_MIDDLEDOWN) if(mi->dwFlags & MOUSEEVENTF_MIDDLEDOWN)
{ {
@ -1162,7 +1162,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected)
Msg.message = WM_MBUTTONDOWN; Msg.message = WM_MBUTTONDOWN;
CurInfo->ButtonsDown |= MK_MBUTTON; CurInfo->ButtonsDown |= MK_MBUTTON;
Msg.wParam |= CurInfo->ButtonsDown; Msg.wParam |= CurInfo->ButtonsDown;
co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE);
} }
else if(mi->dwFlags & MOUSEEVENTF_MIDDLEUP) else if(mi->dwFlags & MOUSEEVENTF_MIDDLEUP)
{ {
@ -1170,7 +1170,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected)
Msg.message = WM_MBUTTONUP; Msg.message = WM_MBUTTONUP;
CurInfo->ButtonsDown &= ~MK_MBUTTON; CurInfo->ButtonsDown &= ~MK_MBUTTON;
Msg.wParam |= CurInfo->ButtonsDown; Msg.wParam |= CurInfo->ButtonsDown;
co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE);
} }
if(mi->dwFlags & MOUSEEVENTF_RIGHTDOWN) if(mi->dwFlags & MOUSEEVENTF_RIGHTDOWN)
{ {
@ -1178,7 +1178,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected)
Msg.message = SwapBtnMsg[0][!SwapButtons]; Msg.message = SwapBtnMsg[0][!SwapButtons];
CurInfo->ButtonsDown |= SwapBtn[!SwapButtons]; CurInfo->ButtonsDown |= SwapBtn[!SwapButtons];
Msg.wParam |= CurInfo->ButtonsDown; Msg.wParam |= CurInfo->ButtonsDown;
co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE);
} }
else if(mi->dwFlags & MOUSEEVENTF_RIGHTUP) else if(mi->dwFlags & MOUSEEVENTF_RIGHTUP)
{ {
@ -1186,7 +1186,7 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected)
Msg.message = SwapBtnMsg[1][!SwapButtons]; Msg.message = SwapBtnMsg[1][!SwapButtons];
CurInfo->ButtonsDown &= ~SwapBtn[!SwapButtons]; CurInfo->ButtonsDown &= ~SwapBtn[!SwapButtons];
Msg.wParam |= CurInfo->ButtonsDown; Msg.wParam |= CurInfo->ButtonsDown;
co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE);
} }
if((mi->dwFlags & (MOUSEEVENTF_XDOWN | MOUSEEVENTF_XUP)) && if((mi->dwFlags & (MOUSEEVENTF_XDOWN | MOUSEEVENTF_XUP)) &&
@ -1204,14 +1204,14 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected)
gQueueKeyStateTable[VK_XBUTTON1] |= 0xc0; gQueueKeyStateTable[VK_XBUTTON1] |= 0xc0;
CurInfo->ButtonsDown |= MK_XBUTTON1; CurInfo->ButtonsDown |= MK_XBUTTON1;
Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1); Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1);
co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE);
} }
if(mi->mouseData & XBUTTON2) if(mi->mouseData & XBUTTON2)
{ {
gQueueKeyStateTable[VK_XBUTTON2] |= 0xc0; gQueueKeyStateTable[VK_XBUTTON2] |= 0xc0;
CurInfo->ButtonsDown |= MK_XBUTTON2; CurInfo->ButtonsDown |= MK_XBUTTON2;
Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, 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) else if(mi->dwFlags & MOUSEEVENTF_XUP)
@ -1222,21 +1222,21 @@ IntMouseInput(MOUSEINPUT *mi, BOOL Injected)
gQueueKeyStateTable[VK_XBUTTON1] &= ~0x80; gQueueKeyStateTable[VK_XBUTTON1] &= ~0x80;
CurInfo->ButtonsDown &= ~MK_XBUTTON1; CurInfo->ButtonsDown &= ~MK_XBUTTON1;
Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1); Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, XBUTTON1);
co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE);
} }
if(mi->mouseData & XBUTTON2) if(mi->mouseData & XBUTTON2)
{ {
gQueueKeyStateTable[VK_XBUTTON2] &= ~0x80; gQueueKeyStateTable[VK_XBUTTON2] &= ~0x80;
CurInfo->ButtonsDown &= ~MK_XBUTTON2; CurInfo->ButtonsDown &= ~MK_XBUTTON2;
Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, 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) if(mi->dwFlags & MOUSEEVENTF_WHEEL)
{ {
Msg.message = WM_MOUSEWHEEL; Msg.message = WM_MOUSEWHEEL;
Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, mi->mouseData); Msg.wParam = MAKEWPARAM(CurInfo->ButtonsDown, mi->mouseData);
co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo); co_MsqInsertMouseMessage(&Msg, Injected, mi->dwExtraInfo, TRUE);
} }
return TRUE; return TRUE;

View file

@ -291,7 +291,7 @@ MsqPostMouseMove(PUSER_MESSAGE_QUEUE MessageQueue, MSG* Msg)
} }
VOID FASTCALL 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; LARGE_INTEGER LargeTickCount;
MSLLHOOKSTRUCT MouseHookData; MSLLHOOKSTRUCT MouseHookData;
@ -326,8 +326,11 @@ co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo)
MouseHookData.dwExtraInfo = dwExtraInfo; MouseHookData.dwExtraInfo = dwExtraInfo;
/* If the hook procedure returned non zero, dont send the message */ /* If the hook procedure returned non zero, dont send the message */
if (co_HOOK_CallHooks(WH_MOUSE_LL, HC_ACTION, Msg->message, (LPARAM) &MouseHookData)) if (Hook)
return; {
if (co_HOOK_CallHooks(WH_MOUSE_LL, HC_ACTION, Msg->message, (LPARAM) &MouseHookData))
return;
}
/* Get the desktop window */ /* Get the desktop window */
pwndDesktop = UserGetDesktopWindow(); pwndDesktop = UserGetDesktopWindow();

View file

@ -473,7 +473,7 @@ NtUserCallTwoParam(
RETURN( (DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2)); RETURN( (DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
case TWOPARAM_ROUTINE_SETCURSORPOS: 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: case TWOPARAM_ROUTINE_UNHOOKWINDOWSHOOK:
RETURN( IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2)); RETURN( IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2));