Commit 58dece67 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Use user message packing for WM_MEASUREITEM.

parent 0be20785
......@@ -842,20 +842,8 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
case EM_REPLACESEL:
case WM_GETMINMAXINFO:
case WM_DRAWITEM:
break;
case WM_MEASUREITEM:
{
MEASUREITEMSTRUCT mis;
if (size < sizeof(ps->mis)) return FALSE;
mis.CtlType = ps->mis.CtlType;
mis.CtlID = ps->mis.CtlID;
mis.itemID = ps->mis.itemID;
mis.itemWidth = ps->mis.itemWidth;
mis.itemHeight = ps->mis.itemHeight;
mis.itemData = (ULONG_PTR)unpack_ptr( ps->mis.itemData );
memcpy( *buffer, &mis, sizeof(mis) );
break;
}
case WM_DELETEITEM:
{
DELETEITEMSTRUCT dls;
......@@ -1171,6 +1159,7 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
case LB_ADDFILE:
case EM_REPLACESEL:
case WM_GETMINMAXINFO:
case WM_MEASUREITEM:
{
LRESULT *result_ptr = (LRESULT *)buffer - 1;
*result_ptr = result;
......
......@@ -449,6 +449,19 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa
memcpy( *buffer, &dis, sizeof(dis) );
break;
}
case WM_MEASUREITEM:
{
MEASUREITEMSTRUCT mis;
if (size < sizeof(ps->mis)) return FALSE;
mis.CtlType = ps->mis.CtlType;
mis.CtlID = ps->mis.CtlID;
mis.itemID = ps->mis.itemID;
mis.itemWidth = ps->mis.itemWidth;
mis.itemHeight = ps->mis.itemHeight;
mis.itemData = (ULONG_PTR)unpack_ptr( ps->mis.itemData );
memcpy( *buffer, &mis, sizeof(mis) );
break;
}
case WM_WINE_SETWINDOWPOS:
{
WINDOWPOS wp;
......@@ -1239,6 +1252,9 @@ size_t user_message_size( UINT message, WPARAM wparam, LPARAM lparam, BOOL other
case WM_DRAWITEM:
size = sizeof(DRAWITEMSTRUCT);
break;
case WM_MEASUREITEM:
size = sizeof(MEASUREITEMSTRUCT);
break;
}
return size;
......@@ -1353,6 +1369,9 @@ static void copy_user_result( void *buffer, size_t size, LRESULT result, UINT me
case WM_GETMINMAXINFO:
copy_size = sizeof(MINMAXINFO);
break;
case WM_MEASUREITEM:
copy_size = sizeof(MEASUREITEMSTRUCT);
break;
default:
return;
}
......@@ -1377,9 +1396,6 @@ static void copy_reply( LRESULT result, HWND hwnd, UINT message, WPARAM wparam,
case LB_GETTEXT:
copy_size = (result + 1) * sizeof(WCHAR);
break;
case WM_MEASUREITEM:
copy_size = sizeof(MEASUREITEMSTRUCT);
break;
case WM_WINDOWPOSCHANGING:
case WM_WINDOWPOSCHANGED:
copy_size = sizeof(WINDOWPOS);
......
......@@ -1622,6 +1622,8 @@ static void test_wndproc_hook(void)
static const MINMAXINFO minmax_in = { .ptMinTrackSize.x = 1 };
static const MINMAXINFO minmax_out = { .ptMinTrackSize.x = 2 };
static const DRAWITEMSTRUCT drawitem_in = { .itemID = 1 };
static const MEASUREITEMSTRUCT mis_in = { .itemID = 1 };
static const MEASUREITEMSTRUCT mis_out = { .itemID = 2, .CtlType = 3, .CtlID = 4, .itemData = 5 };
static const struct lparam_hook_test lparam_hook_tests[] =
{
......@@ -1711,6 +1713,11 @@ static void test_wndproc_hook(void)
.lparam_size = sizeof(minmax_in), .lparam = &minmax_in, .change_lparam = &minmax_out,
.check_size = sizeof(minmax_in)
},
{
"WM_MEASUREITEM", WM_MEASUREITEM, .wparam = 10,
.lparam_size = sizeof(mis_in), .lparam = &mis_in, .change_lparam = &mis_out,
.check_size = sizeof(mis_in),
},
/* messages that don't change lparam */
{ "WM_USER", WM_USER },
{ "WM_NOTIFY", WM_NOTIFY },
......
......@@ -669,6 +669,21 @@ static size_t packed_message_64to32( UINT message, WPARAM wparam,
memcpy( params32, &dis32, sizeof(dis32) );
return sizeof(dis32);
}
case WM_MEASUREITEM:
{
MEASUREITEMSTRUCT32 mis32;
const MEASUREITEMSTRUCT *mis64 = params64;
mis32.CtlType = mis64->CtlType;
mis32.CtlID = mis64->CtlID;
mis32.itemID = mis64->itemID;
mis32.itemWidth = mis64->itemWidth;
mis32.itemHeight = mis64->itemHeight;
mis32.itemData = mis64->itemData;
memcpy( params32, &mis32, sizeof(mis32) );
return sizeof(mis32);
}
}
memmove( params32, params64, size );
......@@ -716,6 +731,20 @@ static size_t packed_result_32to64( UINT message, WPARAM wparam, const void *par
}
break;
case WM_MEASUREITEM:
{
const MEASUREITEMSTRUCT32 *mis32 = params32;
MEASUREITEMSTRUCT *mis64 = params64;
mis64->CtlType = mis32->CtlType;
mis64->CtlID = mis32->CtlID;
mis64->itemID = mis32->itemID;
mis64->itemWidth = mis32->itemWidth;
mis64->itemHeight = mis32->itemHeight;
mis64->itemData = mis32->itemData;
return sizeof(*mis64);
}
case WM_GETTEXT:
case WM_ASKCBFORMATNAME:
case WM_GETMINMAXINFO:
......@@ -3155,8 +3184,12 @@ static LRESULT message_call_32to64( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
mis.itemHeight = mis32->itemHeight;
mis.itemData = mis32->itemData;
ret = NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&mis, result_info, type, ansi );
mis32->CtlType = mis.CtlType;
mis32->CtlID = mis.CtlID;
mis32->itemID = mis.itemID;
mis32->itemWidth = mis.itemWidth;
mis32->itemHeight = mis.itemHeight;
mis32->itemData = mis.itemData;
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment