From f1749b0808c66a0341b77409cc9338ab5624a04c Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 4 Aug 2023 13:11:50 +0200 Subject: [PATCH] win32u: Pack input param for CB_GETCOMBOBOXINFO message. Based on patch by Tim Clem. --- dlls/win32u/message.c | 10 ++++++++-- dlls/win32u/tests/win32u.c | 18 +++++++++++------- dlls/wow64win/user.c | 16 ++++++++++++++++ 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 71c1017a3f0..d15f9af3f9f 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1843,8 +1843,14 @@ void pack_user_message( void *buffer, size_t size, UINT message, return; } case CB_GETCOMBOBOXINFO: - memset( buffer, 0, size ); - return; + if (sizeof(void *) == 4) + { + COMBOBOXINFO *cbi = buffer; + memcpy( cbi, lparam_ptr, sizeof(*cbi) ); + cbi->cbSize = sizeof(*cbi); + return; + } + break; } if (size) memcpy( buffer, lparam_ptr, size ); diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index beb2050c695..25358c5d0d8 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -1362,7 +1362,7 @@ struct lparam_hook_test const void *lparam; const void *change_lparam; const void *check_lparam; - const void *default_lparam; + const void *in_lparam; size_t lparam_size; size_t lparam_init_size; size_t check_size; @@ -1425,10 +1425,12 @@ static void check_params( const struct lparam_hook_test *test, UINT message, default: if (test->check_size) { const void *expected; - if (is_ret && test->change_lparam) + if (is_ret && test->check_lparam) + expected = test->check_lparam; + else if (is_ret && test->change_lparam) expected = test->change_lparam; - else if (test->default_lparam) - expected = test->default_lparam; + else if (test->in_lparam) + expected = test->in_lparam; else expected = test->lparam; ok( !memcmp( (const void *)lparam, expected, test->check_size ), "unexpected lparam content\n" ); @@ -1686,7 +1688,9 @@ 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_in = { .cbSize = 1, .hwndList = HWND_MESSAGE }; + static const COMBOBOXINFO cbi_check = + { .cbSize = sizeof(void *) == 4 ? sizeof(cbi_in) : 1, .hwndList = HWND_MESSAGE }; static const COMBOBOXINFO cbi_out = { .hwndList = (HWND)2 }; static const COMBOBOXINFO cbi_ret = { .hwndList = (HWND)2, .cbSize = sizeof(void *) == 4 ? sizeof(cbi_in) : 0 }; @@ -1920,8 +1924,8 @@ static void test_wndproc_hook(void) }, { "CB_GETCOMBOBOXINFO", CB_GETCOMBOBOXINFO, - .lparam_size = sizeof(cbi_in), .change_lparam = &cbi_out, .default_lparam = &cbi_in, - .check_lparam = &cbi_ret, + .lparam_size = sizeof(cbi_in), .change_lparam = &cbi_out, .lparam = &cbi_in, + .check_lparam = &cbi_ret, .check_size = sizeof(cbi_in), .in_lparam = &cbi_check, }, /* messages that don't change lparam */ { "WM_USER", WM_USER }, diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index b15f0a263cf..07143b78195 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -802,6 +802,22 @@ static size_t packed_message_64to32( UINT message, WPARAM wparam, memcpy( params32, &mcs32, sizeof(mcs32) ); return sizeof(mcs32) + size; } + + case CB_GETCOMBOBOXINFO: + { + COMBOBOXINFO32 ci32; + const COMBOBOXINFO *ci64 = params64; + + ci32.cbSize = sizeof(ci32); + ci32.rcItem = ci64->rcItem; + ci32.rcButton = ci64->rcButton; + ci32.stateButton = ci64->stateButton; + ci32.hwndCombo = HandleToLong( ci64->hwndCombo ); + ci32.hwndItem = HandleToLong( ci64->hwndItem ); + ci32.hwndList = HandleToLong( ci64->hwndList ); + memcpy( params32, &ci32, sizeof(ci32) ); + return sizeof(ci32); + } } memmove( params32, params64, size );