win32u: Use user message packing for LB_GETSELITEMS.

This commit is contained in:
Jacek Caban 2023-07-18 22:07:07 +02:00 committed by Alexandre Julliard
parent 6b592e8102
commit c66984d174
4 changed files with 17 additions and 5 deletions

View file

@ -875,9 +875,7 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
case LB_SELECTSTRING: case LB_SELECTSTRING:
case CB_GETLBTEXT: case CB_GETLBTEXT:
case LB_GETTEXT: case LB_GETTEXT:
break;
case LB_GETSELITEMS: case LB_GETSELITEMS:
if (!get_buffer_space( buffer, *wparam * sizeof(UINT), size )) return FALSE;
break; break;
case WM_NEXTMENU: case WM_NEXTMENU:
{ {
@ -1063,6 +1061,7 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
case LB_SELECTSTRING: case LB_SELECTSTRING:
case CB_GETLBTEXT: case CB_GETLBTEXT:
case LB_GETTEXT: case LB_GETTEXT:
case LB_GETSELITEMS:
{ {
LRESULT *result_ptr = (LRESULT *)buffer - 1; LRESULT *result_ptr = (LRESULT *)buffer - 1;
*result_ptr = result; *result_ptr = result;

View file

@ -631,6 +631,9 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa
if (!get_buffer_space( buffer, size, prev_size )) return FALSE; if (!get_buffer_space( buffer, size, prev_size )) return FALSE;
break; break;
} }
case LB_GETSELITEMS:
if (!get_buffer_space( buffer, *wparam * sizeof(UINT), size )) return FALSE;
break;
case WM_WINE_SETWINDOWPOS: case WM_WINE_SETWINDOWPOS:
{ {
WINDOWPOS wp; WINDOWPOS wp;
@ -1470,6 +1473,9 @@ size_t user_message_size( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam,
size = send_message_timeout( hwnd, LB_GETTEXTLEN, wparam, 0, SMTO_NORMAL, 0, ansi ); size = send_message_timeout( hwnd, LB_GETTEXTLEN, wparam, 0, SMTO_NORMAL, 0, ansi );
size = (size + 1) * char_size( ansi ); size = (size + 1) * char_size( ansi );
break; break;
case LB_GETSELITEMS:
size = wparam * sizeof(UINT);
break;
} }
return size; return size;
@ -1640,6 +1646,9 @@ static void copy_user_result( void *buffer, size_t size, LRESULT result, UINT me
case EM_GETLINE: case EM_GETLINE:
copy_size = string_size( buffer, ansi ); copy_size = string_size( buffer, ansi );
break; break;
case LB_GETSELITEMS:
copy_size = wparam * sizeof(UINT);
break;
default: default:
return; return;
} }
@ -1667,9 +1676,6 @@ static void copy_reply( LRESULT result, HWND hwnd, UINT message, WPARAM wparam,
case WM_MOVING: case WM_MOVING:
copy_size = sizeof(RECT); copy_size = sizeof(RECT);
break; break;
case LB_GETSELITEMS:
copy_size = wparam * sizeof(UINT);
break;
case WM_MDIGETACTIVE: case WM_MDIGETACTIVE:
if (lparam) copy_size = sizeof(BOOL); if (lparam) copy_size = sizeof(BOOL);
break; break;

View file

@ -1681,6 +1681,7 @@ static void test_wndproc_hook(void)
static const SCROLLBARINFO sbi_out = { .xyThumbTop = 60 }; static const SCROLLBARINFO sbi_out = { .xyThumbTop = 60 };
static const DWORD dw_in = 1, dw_out = 2; static const DWORD dw_in = 1, dw_out = 2;
static const UINT32 tabstops_in[2] = { 3, 4 }; static const UINT32 tabstops_in[2] = { 3, 4 };
static const UINT32 items_out[2] = { 1, 2 };
static const struct lparam_hook_test lparam_hook_tests[] = static const struct lparam_hook_test lparam_hook_tests[] =
{ {
@ -1891,6 +1892,11 @@ static void test_wndproc_hook(void)
.lparam_size = sizeof(tabstops_in), .lparam = &tabstops_in, .poison_lparam = TRUE, .lparam_size = sizeof(tabstops_in), .lparam = &tabstops_in, .poison_lparam = TRUE,
.check_size = sizeof(tabstops_in), .check_size = sizeof(tabstops_in),
}, },
{
"LB_GETSELITEMS", LB_GETSELITEMS,
.wparam = ARRAYSIZE(items_out), .msg_result = ARRAYSIZE(items_out),
.lparam_size = sizeof(items_out), .change_lparam = items_out,
},
/* messages that don't change lparam */ /* messages that don't change lparam */
{ "WM_USER", WM_USER }, { "WM_USER", WM_USER },
{ "WM_NOTIFY", WM_NOTIFY }, { "WM_NOTIFY", WM_NOTIFY },

View file

@ -846,6 +846,7 @@ static size_t packed_result_32to64( UINT message, WPARAM wparam, const void *par
case EM_GETLINE: case EM_GETLINE:
case CB_GETLBTEXT: case CB_GETLBTEXT:
case LB_GETTEXT: case LB_GETTEXT:
case LB_GETSELITEMS:
break; break;
default: default: