From 26ef94413dcd44f2916740ea8b624036a51f7079 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 27 Dec 2015 19:57:46 +0100 Subject: [PATCH] Added patch to pass MOUSEHOOKSTRUCTEX struct to mouse hook callback. --- README.md | 3 +- patches/patchinstall.sh | 19 ++++++ ...HOOKSTRUCTEX-to-fix-mouse-wheel-supp.patch | 67 +++++++++++++++++++ patches/user32-MOUSEHOOKSTRUCTEX/definition | 1 + staging/changelog | 1 + 5 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 patches/user32-MOUSEHOOKSTRUCTEX/0001-user32-Add-MOUSEHOOKSTRUCTEX-to-fix-mouse-wheel-supp.patch create mode 100644 patches/user32-MOUSEHOOKSTRUCTEX/definition diff --git a/README.md b/README.md index 439771c4..5e1dae50 100644 --- a/README.md +++ b/README.md @@ -34,10 +34,11 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- -**Bug fixes and features included in the next upcoming release [4]:** +**Bug fixes and features included in the next upcoming release [5]:** * Avoid corruption of caret when SetCaretPos() is called * Check IsWoW64Process before calling Wow64 functions in UNIXFS_get_unix_path +* Pass MOUSEHOOKSTRUCTEX struct to mouse hook callback ([Wine Bug #38314](https://bugs.winehq.org/show_bug.cgi?id=38314)) * SHMapHandle should not set error when NULL is passed as hShared * SysAllocStringByteLen should align terminating null WCHAR diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 51ab0d5c..3968e7ac 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -285,6 +285,7 @@ patch_enable_all () enable_user32_GetSystemMetrics="$1" enable_user32_Invalidate_Key_State="$1" enable_user32_ListBox_Size="$1" + enable_user32_MOUSEHOOKSTRUCTEX="$1" enable_user32_Mouse_Message_Hwnd="$1" enable_user32_Refresh_MDI_Menus="$1" enable_user32_ScrollWindowEx="$1" @@ -968,6 +969,9 @@ patch_enable () user32-ListBox_Size) enable_user32_ListBox_Size="$2" ;; + user32-MOUSEHOOKSTRUCTEX) + enable_user32_MOUSEHOOKSTRUCTEX="$2" + ;; user32-Mouse_Message_Hwnd) enable_user32_Mouse_Message_Hwnd="$2" ;; @@ -5597,6 +5601,21 @@ if test "$enable_user32_ListBox_Size" -eq 1; then ) >> "$patchlist" fi +# Patchset user32-MOUSEHOOKSTRUCTEX +# | +# | This patchset fixes the following Wine bugs: +# | * [#38314] Pass MOUSEHOOKSTRUCTEX struct to mouse hook callback +# | +# | Modified files: +# | * dlls/user32/message.c +# | +if test "$enable_user32_MOUSEHOOKSTRUCTEX" -eq 1; then + patch_apply user32-MOUSEHOOKSTRUCTEX/0001-user32-Add-MOUSEHOOKSTRUCTEX-to-fix-mouse-wheel-supp.patch + ( + echo '+ { "Kira Backes", "user32: Add MOUSEHOOKSTRUCTEX to fix mouse wheel support for JA2 1.13 and other apps which use it.", 1 },'; + ) >> "$patchlist" +fi + # Patchset user32-Mouse_Message_Hwnd # | # | This patchset fixes the following Wine bugs: diff --git a/patches/user32-MOUSEHOOKSTRUCTEX/0001-user32-Add-MOUSEHOOKSTRUCTEX-to-fix-mouse-wheel-supp.patch b/patches/user32-MOUSEHOOKSTRUCTEX/0001-user32-Add-MOUSEHOOKSTRUCTEX-to-fix-mouse-wheel-supp.patch new file mode 100644 index 00000000..5559bcb1 --- /dev/null +++ b/patches/user32-MOUSEHOOKSTRUCTEX/0001-user32-Add-MOUSEHOOKSTRUCTEX-to-fix-mouse-wheel-supp.patch @@ -0,0 +1,67 @@ +From f3a55ca22853088d82f30711f9616b22b20bd228 Mon Sep 17 00:00:00 2001 +From: Kira Backes +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 +Signed-off-by: Sebastian Lackner +--- + 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 + diff --git a/patches/user32-MOUSEHOOKSTRUCTEX/definition b/patches/user32-MOUSEHOOKSTRUCTEX/definition new file mode 100644 index 00000000..f23320b4 --- /dev/null +++ b/patches/user32-MOUSEHOOKSTRUCTEX/definition @@ -0,0 +1 @@ +Fixes: [38314] Pass MOUSEHOOKSTRUCTEX struct to mouse hook callback diff --git a/staging/changelog b/staging/changelog index b7c25b44..cd71d509 100644 --- a/staging/changelog +++ b/staging/changelog @@ -4,6 +4,7 @@ wine-staging (1.9.0) UNRELEASED; urgency=low * Added patch to avoid setting error when NULL is passed to SHMapHandle. * Added patch to check IsWoW64Process before calling Wow64 functions in UNIXFS_get_unix_path. + * Added patch to pass MOUSEHOOKSTRUCTEX struct to mouse hook callback. * Removed patch to add a stub driver for tdi.sys (accepted upstream). * Removed patch to implement support for ws2_32.dll.WSAPoll (accepted upstream).