wine-staging/patches/user32-MOUSEHOOKSTRUCTEX/0001-user32-Add-MOUSEHOOKSTRUCTEX-to-fix-mouse-wheel-supp.patch

68 lines
2.6 KiB
Diff

From f3a55ca22853088d82f30711f9616b22b20bd228 Mon Sep 17 00:00:00 2001
From: Kira Backes <kira.backes@nrwsoft.de>
Date: Tue, 22 Dec 2015 16:34:41 +0100
Subject: user32: Add MOUSEHOOKSTRUCTEX to fix mouse wheel support for JA2 1.13
and other apps which use it
- Fixes out-of-bounds access for programs which cast to MOUSEHOOKSTRUCTEX (instead of just MOUSEHOOKSTRUCT) on mouse hooks
- Enables mouse wheel support for those programs
- Fixes Bug 38314 (and maybe others?)
Signed-off-by: Kira Backes <kira.backes@nrwsoft.de>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/user32/message.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 96e7f2e..b96418f 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -2488,8 +2488,12 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
INT hittest;
EVENTMSG event;
GUITHREADINFO info;
- MOUSEHOOKSTRUCT hook;
BOOL eatMsg;
+ struct /* MOUSEHOOKSTRUCTEX */
+ {
+ MOUSEHOOKSTRUCT hook;
+ DWORD mouseData;
+ } hook;
/* find the window to dispatch this mouse message to */
@@ -2584,17 +2588,21 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
/* message is accepted now (but may still get dropped) */
- hook.pt = msg->pt;
- hook.hwnd = msg->hwnd;
- hook.wHitTestCode = hittest;
- hook.dwExtraInfo = extra_info;
+ hook.hook.pt = msg->pt;
+ hook.hook.hwnd = msg->hwnd;
+ hook.hook.wHitTestCode = hittest;
+ hook.hook.dwExtraInfo = extra_info;
+ /* the correct mouseData for the events WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK,
+ * WM_NCXBUTTONDOWN, WM_NCXBUTTONUP, and WM_NCXBUTTONDBLCLK is not yet implemented */
+ hook.mouseData = (msg->message == WM_MOUSEWHEEL ? msg->wParam : 0);
if (HOOK_CallHooks( WH_MOUSE, remove ? HC_ACTION : HC_NOREMOVE,
message, (LPARAM)&hook, TRUE ))
{
- hook.pt = msg->pt;
- hook.hwnd = msg->hwnd;
- hook.wHitTestCode = hittest;
- hook.dwExtraInfo = extra_info;
+ hook.hook.pt = msg->pt;
+ hook.hook.hwnd = msg->hwnd;
+ hook.hook.wHitTestCode = hittest;
+ hook.hook.dwExtraInfo = extra_info;
+ hook.mouseData = (msg->message == WM_MOUSEWHEEL ? msg->wParam : 0);
HOOK_CallHooks( WH_CBT, HCBT_CLICKSKIPPED, message, (LPARAM)&hook, TRUE );
accept_hardware_message( hw_id, TRUE );
return FALSE;
--
2.6.4