Remaining !3388 parts.
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/winproc.c | 2 ++ dlls/win32u/message.c | 19 ++++++++++++--- dlls/win32u/tests/win32u.c | 18 +++++++++++++- dlls/wow64win/user.c | 49 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 217b02f70ad..3d8e6833602 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -857,6 +857,7 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, case WM_NEXTMENU: case WM_SIZING: case WM_MOVING: + case CB_GETCOMBOBOXINFO: break; case WM_MDIGETACTIVE: if (!*lparam) return TRUE; @@ -1001,6 +1002,7 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size ) case WM_SIZING: case WM_MOVING: case WM_MDICREATE: + case CB_GETCOMBOBOXINFO: { LRESULT *result_ptr = (LRESULT *)buffer - 1; *result_ptr = result; diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 9ca3eab23b6..1dcacf66f38 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1696,6 +1696,9 @@ size_t user_message_size( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, if (!IS_INTRESOURCE(mcs->szTitle)) size += string_size( mcs->szTitle, ansi ); break; } + case CB_GETCOMBOBOXINFO: + size = sizeof(COMBOBOXINFO); + break; }
return size; @@ -1782,6 +1785,9 @@ void pack_user_message( void *buffer, size_t size, UINT message, } return; } + case CB_GETCOMBOBOXINFO: + memset( buffer, 0, size ); + return; }
if (size) memcpy( buffer, lparam_ptr, size ); @@ -1892,6 +1898,16 @@ static void copy_user_result( void *buffer, size_t size, LRESULT result, UINT me case WM_NEXTMENU: copy_size = sizeof(MDINEXTMENU); break; + case CB_GETCOMBOBOXINFO: + if (sizeof(void *) == 4) + { + COMBOBOXINFO *cbi = lparam_ptr; + memcpy( cbi, buffer, size ); + cbi->cbSize = sizeof(*cbi); + return; + } + copy_size = sizeof(COMBOBOXINFO); + break; default: return; } @@ -1912,9 +1928,6 @@ static void copy_reply( LRESULT result, HWND hwnd, UINT message, WPARAM wparam,
switch(message) { - case CB_GETCOMBOBOXINFO: - copy_size = sizeof(COMBOBOXINFO); - break; case WM_MDIGETACTIVE: if (lparam) copy_size = sizeof(BOOL); break; diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index 0acea87ac10..b82e7d80687 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -1362,6 +1362,7 @@ struct lparam_hook_test const void *lparam; const void *change_lparam; const void *check_lparam; + const void *default_lparam; size_t lparam_size; size_t lparam_init_size; size_t check_size; @@ -1424,7 +1425,13 @@ static void check_params( const struct lparam_hook_test *test, UINT message,
default: if (test->check_size) { - const void *expected = is_ret && test->change_lparam ? test->change_lparam : test->lparam; + const void *expected; + if (is_ret && test->change_lparam) + expected = test->change_lparam; + else if (test->default_lparam) + expected = test->default_lparam; + else + expected = test->lparam; ok( !memcmp( (const void *)lparam, expected, test->check_size ), "unexpected lparam content\n" ); } } @@ -1685,6 +1692,10 @@ 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_out = { .hwndList = (HWND)2 }; + static const COMBOBOXINFO cbi_ret = { .hwndList = (HWND)2, + .cbSize = sizeof(void *) == 4 ? sizeof(cbi_in) : 0 };
static const struct lparam_hook_test lparam_hook_tests[] = { @@ -1914,6 +1925,11 @@ static void test_wndproc_hook(void) .lparam_size = sizeof(mcs_in), .lparam = &mcs_in, .poison_lparam = TRUE, .check_size = sizeof(mcs_in), }, + { + "CB_GETCOMBOBOXINFO", CB_GETCOMBOBOXINFO, + .lparam_size = sizeof(cbi_in), .change_lparam = &cbi_out, .default_lparam = &cbi_in, + .check_lparam = &cbi_ret, + }, /* messages that don't change lparam */ { "WM_USER", WM_USER }, { "WM_NOTIFY", WM_NOTIFY }, diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 6e86056cdb8..70f91c8210b 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -251,6 +251,17 @@ typedef struct ULONG itemData; } DRAWITEMSTRUCT32;
+typedef struct +{ + DWORD cbSize; + RECT rcItem; + RECT rcButton; + DWORD stateButton; + ULONG hwndCombo; + ULONG hwndItem; + ULONG hwndList; +} COMBOBOXINFO32; + typedef struct { ULONG lParam; @@ -870,6 +881,21 @@ static size_t packed_result_32to64( UINT message, WPARAM wparam, const void *par return sizeof(*next64); }
+ case CB_GETCOMBOBOXINFO: + { + const COMBOBOXINFO32 *ci32 = params32; + COMBOBOXINFO *ci64 = params64; + + ci64->cbSize = sizeof(*ci32); + ci64->rcItem = ci32->rcItem; + ci64->rcButton = ci32->rcButton; + ci64->stateButton = ci32->stateButton; + ci64->hwndCombo = LongToHandle( ci32->hwndCombo ); + ci64->hwndItem = LongToHandle( ci32->hwndItem ); + ci64->hwndList = LongToHandle( ci32->hwndList ); + return sizeof(*ci64); + } + case WM_GETTEXT: case WM_ASKCBFORMATNAME: case WM_GETMINMAXINFO: @@ -3416,6 +3442,29 @@ static LRESULT message_call_32to64( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&ps, result_info, type, ansi ); }
+ case CB_GETCOMBOBOXINFO: + { + COMBOBOXINFO32 *ci32 = (COMBOBOXINFO32 *)lparam; + COMBOBOXINFO ci; + + ci.cbSize = ci32->cbSize; + ci.rcItem = ci32->rcItem; + ci.rcButton = ci32->rcButton; + ci.stateButton = ci32->stateButton; + ci.hwndCombo = LongToHandle( ci32->hwndCombo ); + ci.hwndItem = LongToHandle( ci32->hwndItem ); + ci.hwndList = LongToHandle( ci32->hwndList ); + ret = NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&ci, result_info, type, ansi ); + ci32->cbSize = ci.cbSize; + ci32->rcItem = ci.rcItem; + ci32->rcButton = ci.rcButton; + ci32->stateButton = ci.stateButton; + ci32->hwndCombo = HandleToLong( ci.hwndCombo ); + ci32->hwndItem = HandleToLong( ci.hwndItem ); + ci32->hwndList = HandleToLong( ci.hwndList ); + return ret; + } + default: return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi ); }
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/hook.c | 8 +++---- dlls/user32/user_private.h | 2 +- dlls/user32/winproc.c | 47 +++++++++++--------------------------- dlls/win32u/message.c | 37 ++++++++---------------------- dlls/win32u/tests/win32u.c | 7 ------ dlls/wow64win/user.c | 1 + 6 files changed, 28 insertions(+), 74 deletions(-)
diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c index a21b11735ab..b2e213f42fe 100644 --- a/dlls/user32/hook.c +++ b/dlls/user32/hook.c @@ -478,7 +478,7 @@ BOOL WINAPI User32CallWindowsHook( struct win_hook_params *params, ULONG size ) { cbtc.hwndInsertAfter = HWND_TOP; unpack_message( (HWND)params->wparam, WM_CREATE, NULL, (LPARAM *)&cbtc.lpcs, - &ret_ptr, ret_size, FALSE ); + ret_ptr, ret_size, FALSE ); params->lparam = (LPARAM)&cbtc; ret_size = sizeof(*cbtc.lpcs); } @@ -488,10 +488,9 @@ BOOL WINAPI User32CallWindowsHook( struct win_hook_params *params, ULONG size ) { CWPSTRUCT *cwp = (CWPSTRUCT *)params->lparam; size_t offset = (lparam_offset + sizeof(*cwp) + 15) & ~15; - void *buffer = (char *)params + offset;
unpack_message( cwp->hwnd, cwp->message, &cwp->wParam, &cwp->lParam, - &buffer, size - offset, !params->prev_unicode ); + (char *)params + offset, size - offset, !params->prev_unicode ); ret_size = 0; break; } @@ -500,10 +499,9 @@ BOOL WINAPI User32CallWindowsHook( struct win_hook_params *params, ULONG size ) { CWPRETSTRUCT *cwpret = (CWPRETSTRUCT *)params->lparam; size_t offset = (lparam_offset + sizeof(*cwpret) + 15) & ~15; - void *buffer = (char *)params + offset;
unpack_message( cwpret->hwnd, cwpret->message, &cwpret->wParam, &cwpret->lParam, - &buffer, size - offset, !params->prev_unicode ); + (char *)params + offset, size - offset, !params->prev_unicode ); ret_size = 0; break; } diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 267c535defe..1a467712f0e 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -52,7 +52,7 @@ extern BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM extern void free_cached_data( UINT format, HANDLE handle ) DECLSPEC_HIDDEN; extern HANDLE render_synthesized_format( UINT format, UINT from ) DECLSPEC_HIDDEN; extern BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, - void **buffer, size_t size, BOOL ansi ); + void *buffer, size_t size, BOOL ansi );
extern void CLIPBOARD_ReleaseOwner( HWND hwnd ) DECLSPEC_HIDDEN; extern HDC get_display_dc(void) DECLSPEC_HIDDEN; diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 3d8e6833602..3ebe1eb2d8c 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -730,14 +730,6 @@ LRESULT dispatch_win_proc_params( struct win_proc_params *params ) return result; }
-/* make sure that there is space for 'size' bytes in buffer, growing it if needed */ -static inline void *get_buffer_space( void **buffer, size_t size, size_t prev_size ) -{ - if (prev_size < size) - *buffer = HeapAlloc( GetProcessHeap(), 0, size ); - return *buffer; -} - static size_t string_size( const void *str, BOOL ansi ) { return ansi ? strlen( str ) + 1 : (wcslen( str ) + 1) * sizeof(WCHAR); @@ -749,7 +741,7 @@ static size_t string_size( const void *str, BOOL ansi ) * Unpack a message received from another process. */ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, - void **buffer, size_t size, BOOL ansi ) + void *buffer, size_t size, BOOL ansi ) { size_t minsize = 0;
@@ -758,7 +750,7 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, case WM_NCCREATE: case WM_CREATE: { - CREATESTRUCTA *cs = *buffer; + CREATESTRUCTA *cs = buffer; char *str = (char *)(cs + 1);
if (!IS_INTRESOURCE(cs->lpszName)) @@ -775,13 +767,13 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, case WM_NCCALCSIZE: if (*wparam) { - NCCALCSIZE_PARAMS *ncp = *buffer; + NCCALCSIZE_PARAMS *ncp = buffer; ncp->lppos = (WINDOWPOS *)((NCCALCSIZE_PARAMS *)ncp + 1); } break; case WM_COPYDATA: { - COPYDATASTRUCT *cds = *buffer; + COPYDATASTRUCT *cds = buffer; if (cds->lpData) cds->lpData = cds + 1; break; } @@ -789,14 +781,14 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, case SBM_GETRANGE: case CB_GETEDITSEL: { - DWORD *ptr = *buffer; + DWORD *ptr = buffer; *wparam = (WPARAM)ptr++; *lparam = (LPARAM)ptr; return TRUE; } case WM_MDICREATE: { - MDICREATESTRUCTA *mcs = *buffer; + MDICREATESTRUCTA *mcs = buffer; char *str = (char *)(mcs + 1);
if (!IS_INTRESOURCE(mcs->szClass)) @@ -858,10 +850,7 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, case WM_SIZING: case WM_MOVING: case CB_GETCOMBOBOXINFO: - break; case WM_MDIGETACTIVE: - if (!*lparam) return TRUE; - if (!get_buffer_space( buffer, sizeof(BOOL), size )) return FALSE; break; case WM_DEVICECHANGE: if (!(*wparam & 0x8000)) return TRUE; @@ -916,7 +905,7 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
/* default exit for most messages: check minsize and store buffer in lparam */ if (size < minsize) return FALSE; - *lparam = (LPARAM)*buffer; + *lparam = (LPARAM)buffer; return TRUE; }
@@ -926,22 +915,13 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
if (params->needs_unpack) { - char stack_buffer[128]; - size_t msg_size = size - sizeof(*params); void *buffer;
- if (size > sizeof(*params)) - { - size -= sizeof(*params); - buffer = params + 1; - } - else - { - size = sizeof(stack_buffer); - buffer = stack_buffer; - } + size -= sizeof(*params); + buffer = params + 1; + if (!unpack_message( params->hwnd, params->msg, ¶ms->wparam, - ¶ms->lparam, &buffer, size, params->ansi )) + ¶ms->lparam, buffer, size, params->ansi )) return 0;
result = dispatch_win_proc_params( params ); @@ -1003,17 +983,16 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size ) case WM_MOVING: case WM_MDICREATE: case CB_GETCOMBOBOXINFO: + case WM_MDIGETACTIVE: { LRESULT *result_ptr = (LRESULT *)buffer - 1; *result_ptr = result; - return NtCallbackReturn( result_ptr, sizeof(*result_ptr) + msg_size, TRUE ); + return NtCallbackReturn( result_ptr, sizeof(*result_ptr) + size, TRUE ); } }
NtUserMessageCall( params->hwnd, params->msg, params->wparam, params->lparam, (void *)result, NtUserWinProcResult, FALSE ); - if (buffer != stack_buffer && buffer != params + 1) - HeapFree( GetProcessHeap(), 0, buffer ); } else { diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 1dcacf66f38..80802f6425f 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -874,6 +874,10 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa memcpy( ps, &cbi, sizeof(cbi) ); break; } + case WM_MDIGETACTIVE: + if (!*lparam) return TRUE; + if (!get_buffer_space( buffer, sizeof(BOOL), size )) return FALSE; + break; default: return TRUE; /* message doesn't need any unpacking */ } @@ -1699,6 +1703,9 @@ size_t user_message_size( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, case CB_GETCOMBOBOXINFO: size = sizeof(COMBOBOXINFO); break; + case WM_MDIGETACTIVE: + if (lparam) size = sizeof(BOOL); + break; }
return size; @@ -1908,26 +1915,6 @@ static void copy_user_result( void *buffer, size_t size, LRESULT result, UINT me } copy_size = sizeof(COMBOBOXINFO); break; - default: - return; - } - - if (copy_size > size) copy_size = size; - if (copy_size) memcpy( lparam_ptr, buffer, copy_size ); -} - -/*********************************************************************** - * copy_reply - * - * Copy a message reply received from client. - */ -static void copy_reply( LRESULT result, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, - WPARAM wparam_src, LPARAM lparam_src ) -{ - size_t copy_size = 0; - - switch(message) - { case WM_MDIGETACTIVE: if (lparam) copy_size = sizeof(BOOL); break; @@ -1935,7 +1922,8 @@ static void copy_reply( LRESULT result, HWND hwnd, UINT message, WPARAM wparam, return; }
- if (copy_size) memcpy( (void *)lparam, (void *)lparam_src, copy_size ); + if (copy_size > size) copy_size = size; + if (copy_size) memcpy( lparam_ptr, buffer, copy_size ); }
/*********************************************************************** @@ -2001,12 +1989,7 @@ static BOOL reply_winproc_result( LRESULT result, HWND hwnd, UINT message, WPARA MSG msg;
if (!info) return FALSE; - - if (info->type == MSG_CLIENT_MESSAGE) - { - copy_reply( result, hwnd, message, info->msg.wParam, info->msg.lParam, wparam, lparam ); - return TRUE; - } + if (info->type == MSG_CLIENT_MESSAGE) return TRUE;
msg.hwnd = hwnd; msg.message = message; diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index b82e7d80687..beb2050c695 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -1368,7 +1368,6 @@ struct lparam_hook_test size_t check_size; BOOL poison_lparam; BOOL not_allowed; - BOOL todo; };
static const struct lparam_hook_test *current_hook_test; @@ -1594,7 +1593,6 @@ static void test_msg_output( const struct lparam_hook_test *test, LRESULT result (test->message == LB_GETTEXT && test->msg_result == 7)) ok( !memcmp( lparam_buffer, expected, test->lparam_size ), "unexpected lparam content\n" );
- todo_wine_if(test->todo) ok( wndproc_lparam != orig, "wndproc_lparam unmodified\n" ); if (!hooks_called) return; @@ -1604,13 +1602,9 @@ static void test_msg_output( const struct lparam_hook_test *test, LRESULT result ok( retwnd_hook_lparam, "retwnd_hook_lparam not called\n" ); ok( retwnd_hook_lparam2, "retwnd_hook_lparam2 not called\n" );
- todo_wine_if(test->todo) ok( orig != callwnd_hook_lparam, "callwnd_hook_lparam not modified\n" ); - todo_wine_if(test->todo) ok( orig != callwnd_hook_lparam2, "callwnd_hook_lparam2 not modified\n" ); - todo_wine_if(test->todo) ok( orig != retwnd_hook_lparam, "retwnd_hook_lparam not modified\n" ); - todo_wine_if(test->todo) ok( orig != retwnd_hook_lparam2, "retwnd_hook_lparam2 not modified\n" );
/* @@ -1788,7 +1782,6 @@ static void test_wndproc_hook(void) { "WM_MDIGETACTIVE", WM_MDIGETACTIVE, .no_wparam_check = TRUE, .lparam_size = sizeof(BOOL), .change_lparam = &false_lparam, - .todo = TRUE }, { "WM_GETMINMAXINFO", WM_GETMINMAXINFO, diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 70f91c8210b..28c6fa9b6d4 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -917,6 +917,7 @@ static size_t packed_result_32to64( UINT message, WPARAM wparam, const void *par case LB_GETSELITEMS: case WM_SIZING: case WM_MOVING: + case WM_MDIGETACTIVE: break;
default:
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/winproc.c | 63 +------------------------------------------ dlls/win32u/message.c | 21 +-------------- dlls/wow64win/user.c | 7 ----- include/ntuser.h | 3 +-- 4 files changed, 3 insertions(+), 91 deletions(-)
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 3ebe1eb2d8c..b1193773ed2 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -926,73 +926,12 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
result = dispatch_win_proc_params( params );
- switch (params->msg) - { - case WM_NCCREATE: - case WM_CREATE: - case WM_NCCALCSIZE: - case WM_GETTEXT: - case WM_ASKCBFORMATNAME: - case WM_WININICHANGE: - case WM_SETTEXT: - case WM_DEVMODECHANGE: - case CB_DIR: - case LB_DIR: - case LB_ADDFILE: - case EM_REPLACESEL: - case WM_GETMINMAXINFO: - case WM_MEASUREITEM: - case WM_DELETEITEM: - case WM_COMPAREITEM: - case WM_WINDOWPOSCHANGING: - case WM_WINDOWPOSCHANGED: - case WM_COPYDATA: - case WM_HELP: - case WM_STYLECHANGING: - case WM_STYLECHANGED: - case WM_GETDLGCODE: - case SBM_SETSCROLLINFO: - case SBM_GETSCROLLINFO: - case SBM_GETSCROLLBARINFO: - case EM_GETSEL: - case SBM_GETRANGE: - case CB_GETEDITSEL: - case EM_GETRECT: - case LB_GETITEMRECT: - case CB_GETDROPPEDCONTROLRECT: - case EM_SETRECT: - case EM_SETRECTNP: - case EM_GETLINE: - case EM_SETTABSTOPS: - case LB_SETTABSTOPS: - case CB_ADDSTRING: - case CB_INSERTSTRING: - case CB_FINDSTRING: - case CB_FINDSTRINGEXACT: - case CB_SELECTSTRING: - case LB_ADDSTRING: - case LB_INSERTSTRING: - case LB_FINDSTRING: - case LB_FINDSTRINGEXACT: - case LB_SELECTSTRING: - case CB_GETLBTEXT: - case LB_GETTEXT: - case LB_GETSELITEMS: - case WM_NEXTMENU: - case WM_SIZING: - case WM_MOVING: - case WM_MDICREATE: - case CB_GETCOMBOBOXINFO: - case WM_MDIGETACTIVE: + if (size) { LRESULT *result_ptr = (LRESULT *)buffer - 1; *result_ptr = result; return NtCallbackReturn( result_ptr, sizeof(*result_ptr) + size, TRUE ); } - } - - NtUserMessageCall( params->hwnd, params->msg, params->wparam, params->lparam, - (void *)result, NtUserWinProcResult, FALSE ); } else { diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 80802f6425f..28a2b7d39cc 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -57,8 +57,6 @@ struct received_message_info struct received_message_info *prev; };
-#define MSG_CLIENT_MESSAGE 0xff - struct packed_hook_extra_info { user_handle_t handle; @@ -1971,7 +1969,6 @@ BOOL reply_message_result( LRESULT result ) struct user_thread_info *thread_info = get_user_thread_info(); struct received_message_info *info = thread_info->receive_info;
- while (info && info->type == MSG_CLIENT_MESSAGE) info = info->prev; if (!info) return FALSE; reply_message( info, result, NULL ); return TRUE; @@ -1989,7 +1986,6 @@ static BOOL reply_winproc_result( LRESULT result, HWND hwnd, UINT message, WPARA MSG msg;
if (!info) return FALSE; - if (info->type == MSG_CLIENT_MESSAGE) return TRUE;
msg.hwnd = hwnd; msg.message = message; @@ -3595,8 +3591,6 @@ static BOOL broadcast_message( struct send_message_info *info, DWORD_PTR *res_pt
static BOOL process_packed_message( struct send_message_info *info, LRESULT *res_ptr, BOOL ansi ) { - struct user_thread_info *thread_info = get_user_thread_info(); - struct received_message_info receive_info; struct packed_message data; size_t buffer_size = 0, i; void *buffer = NULL; @@ -3613,19 +3607,9 @@ static BOOL process_packed_message( struct send_message_info *info, LRESULT *res ptr += data.size[i]; }
- receive_info.type = MSG_CLIENT_MESSAGE; - receive_info.msg.hwnd = info->hwnd; - receive_info.msg.message = info->msg; - receive_info.msg.wParam = info->wparam; - receive_info.msg.lParam = info->lparam; - receive_info.flags = 0; - receive_info.prev = thread_info->receive_info; - thread_info->receive_info = &receive_info; - *res_ptr = call_window_proc( info->hwnd, info->msg, info->wparam, info->lparam, !ansi, TRUE, info->wm_char, TRUE, buffer, buffer_size ); - if (thread_info->receive_info == &receive_info) - thread_info->receive_info = receive_info.prev; + free( buffer ); return TRUE; } @@ -4273,9 +4257,6 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa case NtUserClipboardWindowProc: return user_driver->pClipboardWindowProc( hwnd, msg, wparam, lparam );
- case NtUserWinProcResult: - return reply_winproc_result( (LRESULT)result_info, hwnd, msg, wparam, lparam ); - case NtUserGetDispatchParams: if (!hwnd) return FALSE; if (init_window_call_params( result_info, hwnd, msg, wparam, lparam, diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 28c6fa9b6d4..e593da7ba53 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -3552,13 +3552,6 @@ NTSTATUS WINAPI wow64_NtUserMessageCall( UINT *args ) /* no argument conversion */ return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi );
- case NtUserWinProcResult: - { - LONG result32 = PtrToLong( result_info ); - return message_call_32to64( hwnd, msg, wparam, lparam, - LongToPtr( result32 ), type, ansi ); - } - case NtUserImeDriverCall: { struct diff --git a/include/ntuser.h b/include/ntuser.h index 9077ebbb589..110aa3a3c54 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -306,8 +306,7 @@ enum NtUserSpyGetMsgName = 0x3003, NtUserSpyEnter = 0x0304, NtUserSpyExit = 0x0305, - NtUserWinProcResult = 0x0306, - NtUserImeDriverCall = 0x0307, + NtUserImeDriverCall = 0x0306, };
/* NtUserThunkedMenuItemInfo codes */
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/winproc.c | 3 --- dlls/win32u/message.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index b1193773ed2..7d53269dc80 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -851,10 +851,7 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, case WM_MOVING: case CB_GETCOMBOBOXINFO: case WM_MDIGETACTIVE: - break; case WM_DEVICECHANGE: - if (!(*wparam & 0x8000)) return TRUE; - minsize = sizeof(DEV_BROADCAST_HDR); break; case WM_NOTIFY: /* WM_NOTIFY cannot be sent across processes (MSDN) */ diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 28a2b7d39cc..56a05ba7eac 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -876,6 +876,10 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa if (!*lparam) return TRUE; if (!get_buffer_space( buffer, sizeof(BOOL), size )) return FALSE; break; + case WM_DEVICECHANGE: + if (!(*wparam & 0x8000)) return TRUE; + minsize = sizeof(DEV_BROADCAST_HDR); + break; default: return TRUE; /* message doesn't need any unpacking */ } @@ -1704,6 +1708,13 @@ size_t user_message_size( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, case WM_MDIGETACTIVE: if (lparam) size = sizeof(BOOL); break; + case WM_DEVICECHANGE: + if ((wparam & 0x8000) && lparam) + { + const DEV_BROADCAST_HDR *header = lparam_ptr; + size = header->dbch_size; + } + break; }
return size;
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/user_private.h | 2 +- dlls/user32/winproc.c | 127 ++++--------------------------------- dlls/win32u/message.c | 43 +++++++++++++ 3 files changed, 56 insertions(+), 116 deletions(-)
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 1a467712f0e..9330174a778 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -51,7 +51,7 @@ extern BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM const void *buffer, size_t size ) DECLSPEC_HIDDEN; extern void free_cached_data( UINT format, HANDLE handle ) DECLSPEC_HIDDEN; extern HANDLE render_synthesized_format( UINT format, UINT from ) DECLSPEC_HIDDEN; -extern BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, +extern void unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, void *buffer, size_t size, BOOL ansi );
extern void CLIPBOARD_ReleaseOwner( HWND hwnd ) DECLSPEC_HIDDEN; diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 7d53269dc80..d0ebbb5ea8d 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -176,8 +176,7 @@ LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg, { LRESULT ret = 0;
- TRACE_(msg)("(hwnd=%p,msg=%s,wp=%08Ix,lp=%08Ix)\n", - hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam); + TRACE( "(hwnd=%p,msg=%s,wp=%08Ix,lp=%08Ix)\n", hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam );
switch(msg) { @@ -415,8 +414,8 @@ LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
case WM_PAINTCLIPBOARD: case WM_SIZECLIPBOARD: - FIXME_(msg)( "message %s (0x%x) needs translation, please report\n", - SPY_GetMsgName(msg, hwnd), msg ); + FIXME( "message %s (0x%x) needs translation, please report\n", + SPY_GetMsgName(msg, hwnd), msg ); break;
default: @@ -437,8 +436,7 @@ static LRESULT WINPROC_CallProcWtoA( winproc_callback_t callback, HWND hwnd, UIN { LRESULT ret = 0;
- TRACE_(msg)("(hwnd=%p,msg=%s,wp=%08Ix,lp=%08Ix)\n", - hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam); + TRACE( "(hwnd=%p,msg=%s,wp=%08Ix,lp=%08Ix)\n", hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam );
switch(msg) { @@ -683,8 +681,8 @@ static LRESULT WINPROC_CallProcWtoA( winproc_callback_t callback, HWND hwnd, UIN
case WM_PAINTCLIPBOARD: case WM_SIZECLIPBOARD: - FIXME_(msg)( "message %s (%04x) needs translation, please report\n", - SPY_GetMsgName(msg, hwnd), msg ); + FIXME( "message %s (%04x) needs translation, please report\n", + SPY_GetMsgName(msg, hwnd), msg ); break;
default: @@ -738,13 +736,11 @@ static size_t string_size( const void *str, BOOL ansi ) /*********************************************************************** * unpack_message * - * Unpack a message received from another process. + * Unpack a message received from win32u. */ -BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, +void unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, void *buffer, size_t size, BOOL ansi ) { - size_t minsize = 0; - switch(message) { case WM_NCCREATE: @@ -784,7 +780,7 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, DWORD *ptr = buffer; *wparam = (WPARAM)ptr++; *lparam = (LPARAM)ptr; - return TRUE; + return; } case WM_MDICREATE: { @@ -802,108 +798,9 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, } break; } - case WM_GETTEXT: - case WM_ASKCBFORMATNAME: - case WM_WININICHANGE: - case WM_SETTEXT: - case WM_DEVMODECHANGE: - case CB_DIR: - case LB_DIR: - case LB_ADDFILE: - case EM_REPLACESEL: - case WM_GETMINMAXINFO: - case WM_DRAWITEM: - case WM_MEASUREITEM: - case WM_DELETEITEM: - case WM_COMPAREITEM: - case WM_WINDOWPOSCHANGING: - case WM_WINDOWPOSCHANGED: - case WM_HELP: - case WM_STYLECHANGING: - case WM_STYLECHANGED: - case WM_GETDLGCODE: - case SBM_SETSCROLLINFO: - case SBM_GETSCROLLINFO: - case SBM_GETSCROLLBARINFO: - case EM_GETRECT: - case LB_GETITEMRECT: - case CB_GETDROPPEDCONTROLRECT: - case EM_SETRECT: - case EM_SETRECTNP: - case EM_GETLINE: - case EM_SETTABSTOPS: - case LB_SETTABSTOPS: - case CB_ADDSTRING: - case CB_INSERTSTRING: - case CB_FINDSTRING: - case CB_FINDSTRINGEXACT: - case CB_SELECTSTRING: - case LB_ADDSTRING: - case LB_INSERTSTRING: - case LB_FINDSTRING: - case LB_FINDSTRINGEXACT: - case LB_SELECTSTRING: - case CB_GETLBTEXT: - case LB_GETTEXT: - case LB_GETSELITEMS: - case WM_NEXTMENU: - case WM_SIZING: - case WM_MOVING: - case CB_GETCOMBOBOXINFO: - case WM_MDIGETACTIVE: - case WM_DEVICECHANGE: - break; - case WM_NOTIFY: - /* WM_NOTIFY cannot be sent across processes (MSDN) */ - return FALSE; - case WM_NCPAINT: - if (*wparam <= 1) return TRUE; - FIXME( "WM_NCPAINT hdc unpacking not supported\n" ); - return FALSE; - case WM_PAINT: - if (!*wparam) return TRUE; - /* fall through */ - - /* these contain an HFONT */ - case WM_SETFONT: - case WM_GETFONT: - /* these contain an HDC */ - case WM_ERASEBKGND: - case WM_ICONERASEBKGND: - case WM_CTLCOLORMSGBOX: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLORSCROLLBAR: - case WM_CTLCOLORSTATIC: - case WM_PRINT: - case WM_PRINTCLIENT: - /* these contain an HGLOBAL */ - case WM_PAINTCLIPBOARD: - case WM_SIZECLIPBOARD: - /* these contain HICON */ - case WM_GETICON: - case WM_SETICON: - case WM_QUERYDRAGICON: - case WM_QUERYPARKICON: - /* these contain pointers */ - case WM_DROPOBJECT: - case WM_QUERYDROPOBJECT: - case WM_DRAGLOOP: - case WM_DRAGSELECT: - case WM_DRAGMOVE: - FIXME( "msg %x (%s) not supported yet\n", message, SPY_GetMsgName(message, hwnd) ); - return FALSE; - - default: - return TRUE; /* message doesn't need any unpacking */ }
- /* default exit for most messages: check minsize and store buffer in lparam */ - if (size < minsize) return FALSE; *lparam = (LPARAM)buffer; - return TRUE; }
BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size ) @@ -917,9 +814,9 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size ) size -= sizeof(*params); buffer = params + 1;
- if (!unpack_message( params->hwnd, params->msg, ¶ms->wparam, - ¶ms->lparam, buffer, size, params->ansi )) - return 0; + if (size) + unpack_message( params->hwnd, params->msg, ¶ms->wparam, + ¶ms->lparam, buffer, size, params->ansi );
result = dispatch_win_proc_params( params );
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 56a05ba7eac..6e5b686c32e 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -880,6 +880,49 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa if (!(*wparam & 0x8000)) return TRUE; minsize = sizeof(DEV_BROADCAST_HDR); break; + case WM_NOTIFY: + /* WM_NOTIFY cannot be sent across processes (MSDN) */ + return FALSE; + case WM_NCPAINT: + if (*wparam <= 1) return TRUE; + FIXME( "WM_NCPAINT hdc unpacking not supported\n" ); + return FALSE; + case WM_PAINT: + if (!*wparam) return TRUE; + /* fall through */ + + /* these contain an HFONT */ + case WM_SETFONT: + case WM_GETFONT: + /* these contain an HDC */ + case WM_ERASEBKGND: + case WM_ICONERASEBKGND: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + case WM_PRINT: + case WM_PRINTCLIENT: + /* these contain an HGLOBAL */ + case WM_PAINTCLIPBOARD: + case WM_SIZECLIPBOARD: + /* these contain HICON */ + case WM_GETICON: + case WM_SETICON: + case WM_QUERYDRAGICON: + case WM_QUERYPARKICON: + /* these contain pointers */ + case WM_DROPOBJECT: + case WM_QUERYDROPOBJECT: + case WM_DRAGLOOP: + case WM_DRAGSELECT: + case WM_DRAGMOVE: + FIXME( "msg %x (%s) not supported yet\n", message, debugstr_msg_name( message, hwnd )); + return FALSE; + default: return TRUE; /* message doesn't need any unpacking */ }
From: Jacek Caban jacek@codeweavers.com
--- dlls/win32u/message.c | 62 +++++++++---------------------------------- 1 file changed, 13 insertions(+), 49 deletions(-)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 6e5b686c32e..588cd4e7cc8 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2150,11 +2150,11 @@ BOOL WINAPI NtUserGetGUIThreadInfo( DWORD id, GUITHREADINFO *info ) * Call a window procedure and the corresponding hooks. */ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, - BOOL unicode, BOOL same_thread, enum wm_char_mapping mapping, - BOOL needs_unpack, void *buffer, size_t size ) + enum message_type type, BOOL same_thread, + enum wm_char_mapping mapping, BOOL ansi_dst ) { struct win_proc_params p, *params = &p; - BOOL ansi = !unicode && !needs_unpack; + BOOL ansi = ansi_dst && type == MSG_ASCII; LRESULT result = 0; CWPSTRUCT cwp; CWPRETSTRUCT cwpret; @@ -2165,11 +2165,9 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar if (msg & 0x80000000) return handle_internal_message( hwnd, msg, wparam, lparam );
- if (!needs_unpack) size = 0; if (!is_current_thread_window( hwnd )) return 0;
- packed_size = user_message_size( hwnd, msg, wparam, lparam, needs_unpack, ansi ); - if (packed_size) size = packed_size; + packed_size = user_message_size( hwnd, msg, wparam, lparam, type == MSG_OTHER_PROCESS, ansi );
/* first the WH_CALLWNDPROC hook */ cwp.lParam = lparam; @@ -2179,21 +2177,19 @@ 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 (size && !(params = malloc( sizeof(*params) + size ))) return 0; - if (!init_window_call_params( params, hwnd, msg, wparam, lparam, !unicode, mapping )) + if (packed_size && !(params = malloc( sizeof(*params) + packed_size ))) return 0; + if (!init_window_call_params( params, hwnd, msg, wparam, lparam, ansi_dst, mapping )) { if (params != &p) free( params ); return 0; }
- if (needs_unpack) params->ansi = FALSE; - params->needs_unpack = needs_unpack || packed_size; + 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 ); - else if (size) - memcpy( params + 1, buffer, size );
- result = dispatch_win_proc_params( params, sizeof(*params) + size, &ret_ptr, &ret_len ); + result = dispatch_win_proc_params( params, sizeof(*params) + 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 ); @@ -2637,7 +2633,6 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, NTSTATUS res; size_t size = 0; const message_data_t *msg_data = buffer; - BOOL needs_unpack = FALSE;
thread_info->client_info.msg_source = prev_source;
@@ -2703,7 +2698,6 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, if (!unpack_message( info.msg.hwnd, info.msg.message, &info.msg.wParam, &info.msg.lParam, &buffer, size )) continue; - needs_unpack = TRUE; break; case MSG_CALLBACK: info.flags = ISMEX_CALLBACK; @@ -2786,7 +2780,6 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, reply_message( &info, 0, &info.msg ); continue; } - needs_unpack = TRUE; break; case MSG_HARDWARE: if (size >= sizeof(msg_data->hardware)) @@ -2867,8 +2860,8 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, thread_info->client_info.msg_source = msg_source_unavailable; thread_info->client_info.receive_flags = info.flags; result = call_window_proc( info.msg.hwnd, info.msg.message, info.msg.wParam, - info.msg.lParam, (info.type != MSG_ASCII), FALSE, - WMCHAR_MAP_RECVMESSAGE, needs_unpack, buffer, size ); + info.msg.lParam, info.type, FALSE, WMCHAR_MAP_RECVMESSAGE, + info.type == MSG_ASCII ); if (thread_info->receive_info == &info) reply_winproc_result( result, info.msg.hwnd, info.msg.message, info.msg.wParam, info.msg.lParam ); @@ -3643,31 +3636,6 @@ static BOOL broadcast_message( struct send_message_info *info, DWORD_PTR *res_pt return TRUE; }
-static BOOL process_packed_message( struct send_message_info *info, LRESULT *res_ptr, BOOL ansi ) -{ - struct packed_message data; - size_t buffer_size = 0, i; - void *buffer = NULL; - char *ptr; - - pack_message( info->hwnd, info->msg, info->wparam, info->lparam, &data ); - if (data.count == -1) return FALSE; - - for (i = 0; i < data.count; i++) buffer_size += data.size[i]; - if (!(buffer = malloc( buffer_size ))) return FALSE; - for (ptr = buffer, i = 0; i < data.count; i++) - { - memcpy( ptr, data.data[i], data.size[i] ); - ptr += data.size[i]; - } - - *res_ptr = call_window_proc( info->hwnd, info->msg, info->wparam, info->lparam, - !ansi, TRUE, info->wm_char, TRUE, buffer, buffer_size ); - - free( buffer ); - return TRUE; -} - static inline void *get_buffer( void *static_buffer, size_t size, size_t need ) { if (size >= need) return static_buffer; @@ -3974,18 +3942,14 @@ static BOOL process_message( struct send_message_info *info, DWORD_PTR *res_ptr, else ret = send_inter_thread_message( info, &result ); } - else if (info->type != MSG_OTHER_PROCESS) + else { result = call_window_proc( info->hwnd, info->msg, info->wparam, info->lparam, - !ansi, TRUE, info->wm_char, FALSE, NULL, 0 ); + info->type, TRUE, info->wm_char, ansi ); if (info->type == MSG_CALLBACK) call_sendmsg_callback( info->callback, info->hwnd, info->msg, info->data, result ); ret = TRUE; } - else - { - ret = process_packed_message( info, &result, ansi ); - }
spy_exit_message( SPY_RESULT_OK, info->hwnd, info->msg, result, info->wparam, info->lparam ); thread_info->msg_source = prev_source;
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/winproc.c | 32 ++++++++++++++------------------ dlls/win32u/message.c | 16 +++++++++------- dlls/wow64win/user.c | 16 ++++++++++------ include/ntuser.h | 1 - 4 files changed, 33 insertions(+), 32 deletions(-)
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index d0ebbb5ea8d..5ab85eb81cd 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -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, ¶ms->wparam, - ¶ms->lparam, buffer, size, params->ansi ); + unpack_message( params->hwnd, params->msg, ¶ms->wparam, ¶ms->lparam, + buffer, packed_size, params->ansi ); + }
- result = dispatch_win_proc_params( params ); + result = dispatch_win_proc_params( params );
- if (size) - { - LRESULT *result_ptr = (LRESULT *)buffer - 1; - *result_ptr = result; - return NtCallbackReturn( result_ptr, sizeof(*result_ptr) + size, TRUE ); - } - } - else + if (packed_size) { - result = dispatch_win_proc_params( params ); + LRESULT *result_ptr = (LRESULT *)buffer - 1; + *result_ptr = result; + return NtCallbackReturn( result_ptr, sizeof(*result_ptr) + packed_size, TRUE ); } return NtCallbackReturn( &result, sizeof(result), TRUE ); } diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 588cd4e7cc8..b83ab32976b 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -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 ); diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index e593da7ba53..b15f0a263cf 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -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)) diff --git a/include/ntuser.h b/include/ntuser.h index 110aa3a3c54..2d6c41f0e62 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -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;
From: Jacek Caban jacek@codeweavers.com
All messages are packed now anyway. --- dlls/win32u/message.c | 4 ---- dlls/winemac.drv/macdrv.h | 2 +- dlls/winex11.drv/x11drv.h | 2 +- include/ntuser.h | 9 ++++----- 4 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index b83ab32976b..71c1017a3f0 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -4286,10 +4286,6 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa else RtlSetLastWin32Error( ERROR_MESSAGE_SYNC_ONLY ); return FALSE;
- case NtUserSendDriverMessage: - /* used by driver to send packed messages */ - return send_message( hwnd, msg, wparam, lparam ); - case NtUserSpyEnter: spy_enter_message( ansi, hwnd, msg, wparam, lparam ); return 0; diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 35ee6425b86..bcb048707ca 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -290,7 +290,7 @@ extern NTSTATUS macdrv_client_func(enum macdrv_client_funcs func, const void *pa
static inline LRESULT send_message(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - return NtUserMessageCall(hwnd, msg, wparam, lparam, NULL, NtUserSendDriverMessage, FALSE); + return NtUserMessageCall(hwnd, msg, wparam, lparam, NULL, NtUserSendMessage, FALSE); }
static inline LRESULT send_message_timeout(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 3c41ce60854..9ee6498a02e 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -862,7 +862,7 @@ static inline UINT get_palette_entries( HPALETTE palette, UINT start, UINT count
static inline LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { - return NtUserMessageCall( hwnd, msg, wparam, lparam, NULL, NtUserSendDriverMessage, FALSE ); + return NtUserMessageCall( hwnd, msg, wparam, lparam, NULL, NtUserSendMessage, FALSE ); }
static inline LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, diff --git a/include/ntuser.h b/include/ntuser.h index 2d6c41f0e62..b873512dbd1 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -301,11 +301,10 @@ enum /* Wine-specific exports */ NtUserClipboardWindowProc = 0x0300, NtUserGetDispatchParams = 0x3001, - NtUserSendDriverMessage = 0x3002, - NtUserSpyGetMsgName = 0x3003, - NtUserSpyEnter = 0x0304, - NtUserSpyExit = 0x0305, - NtUserImeDriverCall = 0x0306, + NtUserSpyGetMsgName = 0x3002, + NtUserSpyEnter = 0x0303, + NtUserSpyExit = 0x0304, + NtUserImeDriverCall = 0x0305, };
/* NtUserThunkedMenuItemInfo codes */
This merge request was approved by Huw Davies.