Module: wine Branch: master Commit: 8561e8e9585bbf18f7cc2e208b4acb821a2438ba URL: https://gitlab.winehq.org/wine/wine/-/commit/8561e8e9585bbf18f7cc2e208b4acb8...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Jul 19 00:14:31 2023 +0200
win32u: Use user message packing for CB_GETCOMBOBOXINFO.
---
dlls/user32/winproc.c | 2 ++ dlls/win32u/message.c | 19 +++++++++++++++--- dlls/win32u/tests/win32u.c | 18 ++++++++++++++++- dlls/wow64win/user.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 217b02f70ad..3d8e6833602 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -857,6 +857,7 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, case WM_NEXTMENU: case WM_SIZING: case WM_MOVING: + case CB_GETCOMBOBOXINFO: break; case WM_MDIGETACTIVE: if (!*lparam) return TRUE; @@ -1001,6 +1002,7 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size ) case WM_SIZING: case WM_MOVING: case WM_MDICREATE: + case CB_GETCOMBOBOXINFO: { LRESULT *result_ptr = (LRESULT *)buffer - 1; *result_ptr = result; diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 9ca3eab23b6..1dcacf66f38 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1696,6 +1696,9 @@ size_t user_message_size( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, if (!IS_INTRESOURCE(mcs->szTitle)) size += string_size( mcs->szTitle, ansi ); break; } + case CB_GETCOMBOBOXINFO: + size = sizeof(COMBOBOXINFO); + break; }
return size; @@ -1782,6 +1785,9 @@ void pack_user_message( void *buffer, size_t size, UINT message, } return; } + case CB_GETCOMBOBOXINFO: + memset( buffer, 0, size ); + return; }
if (size) memcpy( buffer, lparam_ptr, size ); @@ -1892,6 +1898,16 @@ static void copy_user_result( void *buffer, size_t size, LRESULT result, UINT me case WM_NEXTMENU: copy_size = sizeof(MDINEXTMENU); break; + case CB_GETCOMBOBOXINFO: + if (sizeof(void *) == 4) + { + COMBOBOXINFO *cbi = lparam_ptr; + memcpy( cbi, buffer, size ); + cbi->cbSize = sizeof(*cbi); + return; + } + copy_size = sizeof(COMBOBOXINFO); + break; default: return; } @@ -1912,9 +1928,6 @@ static void copy_reply( LRESULT result, HWND hwnd, UINT message, WPARAM wparam,
switch(message) { - case CB_GETCOMBOBOXINFO: - copy_size = sizeof(COMBOBOXINFO); - break; case WM_MDIGETACTIVE: if (lparam) copy_size = sizeof(BOOL); break; diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index 0acea87ac10..b82e7d80687 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -1362,6 +1362,7 @@ struct lparam_hook_test const void *lparam; const void *change_lparam; const void *check_lparam; + const void *default_lparam; size_t lparam_size; size_t lparam_init_size; size_t check_size; @@ -1424,7 +1425,13 @@ static void check_params( const struct lparam_hook_test *test, UINT message,
default: if (test->check_size) { - const void *expected = is_ret && test->change_lparam ? test->change_lparam : test->lparam; + const void *expected; + if (is_ret && test->change_lparam) + expected = test->change_lparam; + else if (test->default_lparam) + expected = test->default_lparam; + else + expected = test->lparam; ok( !memcmp( (const void *)lparam, expected, test->check_size ), "unexpected lparam content\n" ); } } @@ -1685,6 +1692,10 @@ static void test_wndproc_hook(void) static const MDINEXTMENU nm_in = { .hmenuIn = (HMENU)0xdeadbeef }; static const MDINEXTMENU nm_out = { .hmenuIn = (HMENU)1 }; static const MDICREATESTRUCTW mcs_in = { .x = 1, .y = 2 }; + static const COMBOBOXINFO cbi_in = {}; + static const COMBOBOXINFO cbi_out = { .hwndList = (HWND)2 }; + static const COMBOBOXINFO cbi_ret = { .hwndList = (HWND)2, + .cbSize = sizeof(void *) == 4 ? sizeof(cbi_in) : 0 };
static const struct lparam_hook_test lparam_hook_tests[] = { @@ -1914,6 +1925,11 @@ static void test_wndproc_hook(void) .lparam_size = sizeof(mcs_in), .lparam = &mcs_in, .poison_lparam = TRUE, .check_size = sizeof(mcs_in), }, + { + "CB_GETCOMBOBOXINFO", CB_GETCOMBOBOXINFO, + .lparam_size = sizeof(cbi_in), .change_lparam = &cbi_out, .default_lparam = &cbi_in, + .check_lparam = &cbi_ret, + }, /* messages that don't change lparam */ { "WM_USER", WM_USER }, { "WM_NOTIFY", WM_NOTIFY }, diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 6e86056cdb8..70f91c8210b 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -251,6 +251,17 @@ typedef struct ULONG itemData; } DRAWITEMSTRUCT32;
+typedef struct +{ + DWORD cbSize; + RECT rcItem; + RECT rcButton; + DWORD stateButton; + ULONG hwndCombo; + ULONG hwndItem; + ULONG hwndList; +} COMBOBOXINFO32; + typedef struct { ULONG lParam; @@ -870,6 +881,21 @@ static size_t packed_result_32to64( UINT message, WPARAM wparam, const void *par return sizeof(*next64); }
+ case CB_GETCOMBOBOXINFO: + { + const COMBOBOXINFO32 *ci32 = params32; + COMBOBOXINFO *ci64 = params64; + + ci64->cbSize = sizeof(*ci32); + ci64->rcItem = ci32->rcItem; + ci64->rcButton = ci32->rcButton; + ci64->stateButton = ci32->stateButton; + ci64->hwndCombo = LongToHandle( ci32->hwndCombo ); + ci64->hwndItem = LongToHandle( ci32->hwndItem ); + ci64->hwndList = LongToHandle( ci32->hwndList ); + return sizeof(*ci64); + } + case WM_GETTEXT: case WM_ASKCBFORMATNAME: case WM_GETMINMAXINFO: @@ -3416,6 +3442,29 @@ static LRESULT message_call_32to64( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&ps, result_info, type, ansi ); }
+ case CB_GETCOMBOBOXINFO: + { + COMBOBOXINFO32 *ci32 = (COMBOBOXINFO32 *)lparam; + COMBOBOXINFO ci; + + ci.cbSize = ci32->cbSize; + ci.rcItem = ci32->rcItem; + ci.rcButton = ci32->rcButton; + ci.stateButton = ci32->stateButton; + ci.hwndCombo = LongToHandle( ci32->hwndCombo ); + ci.hwndItem = LongToHandle( ci32->hwndItem ); + ci.hwndList = LongToHandle( ci32->hwndList ); + ret = NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&ci, result_info, type, ansi ); + ci32->cbSize = ci.cbSize; + ci32->rcItem = ci.rcItem; + ci32->rcButton = ci.rcButton; + ci32->stateButton = ci.stateButton; + ci32->hwndCombo = HandleToLong( ci.hwndCombo ); + ci32->hwndItem = HandleToLong( ci.hwndItem ); + ci32->hwndList = HandleToLong( ci.hwndList ); + return ret; + } + default: return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi ); }