1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 03:45:57 +00:00

win32u: Pack input param for CB_GETCOMBOBOXINFO message.

Based on patch by Tim Clem.
This commit is contained in:
Jacek Caban 2023-08-04 13:11:50 +02:00 committed by Alexandre Julliard
parent 59865c9e51
commit f1749b0808
3 changed files with 35 additions and 9 deletions

View File

@ -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 );

View File

@ -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 },

View File

@ -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 );