Commit f693d660 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Remove no longer needed needs_unpack from win_proc_params.

parent 813e04e6
......@@ -805,31 +805,27 @@ void unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
{
size_t packed_size = 0;
void *buffer = NULL;
LRESULT result;
if (params->needs_unpack)
if (size > sizeof(*params))
{
void *buffer;
const size_t offset = (sizeof(*params) + 15) & ~15;
packed_size = size - offset;
buffer = (char *)params + offset;
size -= sizeof(*params);
buffer = params + 1;
if (size)
unpack_message( params->hwnd, params->msg, &params->wparam,
&params->lparam, buffer, size, params->ansi );
unpack_message( params->hwnd, params->msg, &params->wparam, &params->lparam,
buffer, packed_size, params->ansi );
}
result = dispatch_win_proc_params( params );
if (size)
if (packed_size)
{
LRESULT *result_ptr = (LRESULT *)buffer - 1;
*result_ptr = result;
return NtCallbackReturn( result_ptr, sizeof(*result_ptr) + size, TRUE );
}
}
else
{
result = dispatch_win_proc_params( params );
return NtCallbackReturn( result_ptr, sizeof(*result_ptr) + packed_size, TRUE );
}
return NtCallbackReturn( &result, sizeof(result), TRUE );
}
......
......@@ -377,7 +377,6 @@ static BOOL init_win_proc_params( struct win_proc_params *params, HWND hwnd, UIN
params->wparam = wparam;
params->lparam = lparam;
params->ansi = params->ansi_dst = ansi;
params->needs_unpack = FALSE;
params->mapping = WMCHAR_MAP_CALLWINDOWPROC;
params->dpi_awareness = get_window_dpi_awareness_context( params->hwnd );
get_winproc_params( params, TRUE );
......@@ -409,7 +408,6 @@ static BOOL init_window_call_params( struct win_proc_params *params, HWND hwnd,
params->wparam = wParam;
params->lparam = lParam;
params->ansi = ansi;
params->needs_unpack = FALSE;
params->mapping = mapping;
params->dpi_awareness = get_window_dpi_awareness_context( params->hwnd );
get_winproc_params( params, !is_dialog );
......@@ -2155,10 +2153,10 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar
{
struct win_proc_params p, *params = &p;
BOOL ansi = ansi_dst && type == MSG_ASCII;
size_t packed_size = 0, offset = sizeof(*params);
LRESULT result = 0;
CWPSTRUCT cwp;
CWPRETSTRUCT cwpret;
size_t packed_size = 0;
void *ret_ptr;
size_t ret_len = 0;
......@@ -2177,7 +2175,12 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar
call_message_hooks( WH_CALLWNDPROC, HC_ACTION, same_thread, (LPARAM)&cwp, sizeof(cwp),
packed_size, ansi );
if (packed_size && !(params = malloc( sizeof(*params) + packed_size ))) return 0;
if (packed_size)
{
offset = (offset + 15) & ~15;
if (!(params = malloc( offset + packed_size ))) return 0;
}
if (!init_window_call_params( params, hwnd, msg, wparam, lparam, ansi_dst, mapping ))
{
if (params != &p) free( params );
......@@ -2185,11 +2188,10 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar
}
if (type == MSG_OTHER_PROCESS) params->ansi = FALSE;
params->needs_unpack = packed_size != 0;
if (packed_size)
pack_user_message( params + 1, packed_size, msg, wparam, lparam, ansi );
pack_user_message( (char *)params + offset, packed_size, msg, wparam, lparam, ansi );
result = dispatch_win_proc_params( params, sizeof(*params) + packed_size, &ret_ptr, &ret_len );
result = dispatch_win_proc_params( params, offset + packed_size, &ret_ptr, &ret_len );
if (params != &p) free( params );
copy_user_result( ret_ptr, min( ret_len, packed_size ), result, msg, wparam, lparam, ansi );
......
......@@ -353,7 +353,6 @@ struct win_proc_params32
ULONG lparam;
BOOL ansi;
BOOL ansi_dst;
BOOL needs_unpack;
enum wm_char_mapping mapping;
ULONG dpi_awareness;
ULONG procA;
......@@ -471,7 +470,6 @@ static void win_proc_params_64to32( const struct win_proc_params *src, struct wi
params.lparam = src->lparam;
params.ansi = src->ansi;
params.ansi_dst = src->ansi_dst;
params.needs_unpack = src->needs_unpack;
params.mapping = src->mapping;
params.dpi_awareness = HandleToUlong( src->dpi_awareness );
params.procA = PtrToUlong( src->procA );
......@@ -932,7 +930,7 @@ static NTSTATUS WINAPI wow64_NtUserCallWinProc( void *arg, ULONG size )
{
struct win_proc_params *params = arg;
struct win_proc_params32 *params32 = arg;
size_t lparam_size = 0;
size_t lparam_size = 0, offset32 = sizeof(*params32);
LRESULT result = 0;
void *ret_ptr;
ULONG ret_len;
......@@ -940,11 +938,17 @@ static NTSTATUS WINAPI wow64_NtUserCallWinProc( void *arg, ULONG size )
win_proc_params_64to32( params, params32 );
if (size > sizeof(*params))
lparam_size = packed_message_64to32( params32->msg, params32->wparam, params + 1, params32 + 1,
size - sizeof(*params) );
{
const size_t offset64 = (sizeof(*params) + 15) & ~15;
offset32 = (offset32 + 15) & ~15;
lparam_size = packed_message_64to32( params32->msg, params32->wparam,
(char *)params + offset64,
(char *)params32 + offset32,
size - offset64 );
}
status = Wow64KiUserCallbackDispatcher( NtUserCallWinProc, params32,
sizeof(*params32) + lparam_size,
offset32 + lparam_size,
&ret_ptr, &ret_len );
if (ret_len >= sizeof(LONG))
......
......@@ -149,7 +149,6 @@ struct win_proc_params
LPARAM lparam;
BOOL ansi;
BOOL ansi_dst;
BOOL needs_unpack;
enum wm_char_mapping mapping;
DPI_AWARENESS_CONTEXT dpi_awareness;
WNDPROC procA;
......
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