Module: wine Branch: master Commit: 9b3aa968992a53686b38b7b5ecdb0bf3f5f9059e URL: https://gitlab.winehq.org/wine/wine/-/commit/9b3aa968992a53686b38b7b5ecdb0bf...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Jul 19 17:04:30 2023 +0200
win32u: Pack messages in WH_CALLWNDPROCRET hooks.
---
dlls/user32/hook.c | 12 ++++++++++++ dlls/win32u/hook.c | 7 +++++++ dlls/wow64win/user.c | 9 +++++++++ 3 files changed, 28 insertions(+)
diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c index 1ae49587688..a21b11735ab 100644 --- a/dlls/user32/hook.c +++ b/dlls/user32/hook.c @@ -495,6 +495,18 @@ BOOL WINAPI User32CallWindowsHook( struct win_hook_params *params, ULONG size ) ret_size = 0; break; } + case WH_CALLWNDPROCRET: + if (ret_size > sizeof(CWPRETSTRUCT)) + { + CWPRETSTRUCT *cwpret = (CWPRETSTRUCT *)params->lparam; + size_t offset = (lparam_offset + sizeof(*cwpret) + 15) & ~15; + void *buffer = (char *)params + offset; + + unpack_message( cwpret->hwnd, cwpret->message, &cwpret->wParam, &cwpret->lParam, + &buffer, size - offset, !params->prev_unicode ); + ret_size = 0; + break; + } } } if (params->module[0] && !(proc = get_hook_proc( proc, params->module, &free_module ))) diff --git a/dlls/win32u/hook.c b/dlls/win32u/hook.c index 27b109ce545..e3c3a0ce5ba 100644 --- a/dlls/win32u/hook.c +++ b/dlls/win32u/hook.c @@ -295,6 +295,13 @@ static LRESULT call_hook( struct win_hook_params *info, const WCHAR *module, siz cwp->message, cwp->lParam, ansi ); } break; + case WH_CALLWNDPROCRET: + { + CWPRETSTRUCT *cwpret = (CWPRETSTRUCT *)((char *)params + lparam_offset); + pack_user_message( (char *)params + message_offset, message_size, + cwpret->message, cwpret->lParam, ansi ); + } + break; } }
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 94df46cbb90..7e77e5a2f73 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -766,6 +766,15 @@ static UINT hook_lparam_64to32( int id, int code, const void *lp, size_t size, v cwpret32.message = cwpret->message; cwpret32.hwnd = HandleToUlong( cwpret->hwnd ); memcpy( lp32, &cwpret32, sizeof(cwpret32) ); + if (size > sizeof(*cwpret)) + { + const size_t offset64 = (sizeof(*cwpret) + 15) & ~15; + const size_t offset32 = (sizeof(cwpret32) + 15) & ~15; + size = packed_message_64to32( cwpret32.message, + (const char *)lp + offset64, + (char *)lp32 + offset32, size - offset64 ); + return offset32 + size; + } return sizeof(cwpret32); }