From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/message.c | 2 +- dlls/user32/winproc.c | 9 +++------ dlls/win32u/message.c | 39 ++++++++++++++++++++++++++++-------- dlls/win32u/sysparams.c | 6 +++--- dlls/win32u/win32u_private.h | 2 +- include/ntuser.h | 13 ++++++------ 6 files changed, 46 insertions(+), 25 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 2cbdd761fe9..f6431e0c28a 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -700,7 +700,7 @@ BOOL WINAPI SendMessageCallbackW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa */ BOOL WINAPI ReplyMessage( LRESULT result ) { - return NtUserReplyMessage( result, NULL ); + return NtUserReplyMessage( result ); }
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index cc59a290ca5..2c0aaf03da5 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -1236,7 +1236,6 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size ) char stack_buffer[128]; void *buffer; LRESULT result; - MSG msg;
if (size > sizeof(*params)) { @@ -1253,13 +1252,11 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size ) return 0; params->result = &result;
- msg.hwnd = params->hwnd; - msg.message = params->msg; - msg.wParam = params->wparam; - msg.lParam = params->lparam; + dispatch_win_proc_params( params );
- NtUserReplyMessage( result, &msg ); + NtUserMessageCall( params->hwnd, params->msg, params->wparam, params->lparam, + (void *)result, NtUserWinProcResult, FALSE ); if (buffer != stack_buffer && buffer != params + 1) HeapFree( GetProcessHeap(), 0, buffer ); } diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 746238bfc5c..6506a201559 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1069,18 +1069,37 @@ static void reply_message( struct received_message_info *info, LRESULT result, M * * Send a reply to a sent message and update thread receive info. */ -BOOL reply_message_result( LRESULT result, MSG *msg ) +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;
if (!info) return FALSE; - reply_message( info, result, msg ); - if (msg) - { - thread_info->receive_info = info->prev; - thread_info->client_info.receive_flags = info->prev ? info->prev->flags : ISMEX_NOSEND; - } + reply_message( info, result, NULL ); + return TRUE; +} + +/*********************************************************************** + * reply_winproc_result + * + * Send a reply to a sent message and update thread receive info. + */ +static BOOL reply_winproc_result( LRESULT result, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam ) +{ + struct user_thread_info *thread_info = get_user_thread_info(); + struct received_message_info *info = thread_info->receive_info; + MSG msg; + + if (!info) return FALSE; + + msg.hwnd = hwnd; + msg.message = message; + msg.wParam = wparam; + msg.lParam = lparam; + reply_message( info, result, &msg ); + + thread_info->receive_info = info->prev; + thread_info->client_info.receive_flags = info->prev ? info->prev->flags : ISMEX_NOSEND; return TRUE; }
@@ -1877,7 +1896,8 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, info.msg.lParam, (info.type != MSG_ASCII), FALSE, WMCHAR_MAP_RECVMESSAGE, needs_unpack, buffer, size ); if (thread_info->receive_info == &info) - reply_message_result( result, &info.msg ); + reply_winproc_result( result, info.msg.hwnd, info.msg.message, + info.msg.wParam, info.msg.lParam );
/* if some PM_QS* flags were specified, only handle sent messages from now on */ if (HIWORD(flags) && !changed_mask) flags = PM_QS_SENDMESSAGE | LOWORD(flags); @@ -2965,6 +2985,9 @@ 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/win32u/sysparams.c b/dlls/win32u/sysparams.c index 33ff35eb21a..99495349246 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -5027,6 +5027,9 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) case NtUserCallOneParam_MessageBeep: return message_beep( arg );
+ case NtUserCallOneParam_ReplyMessage: + return reply_message_result( arg ); + case NtUserCallOneParam_SetCaretBlinkTime: return set_caret_blink_time( arg );
@@ -5063,9 +5066,6 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code case NtUserCallTwoParam_MonitorFromRect: return HandleToUlong( monitor_from_rect( (const RECT *)arg1, arg2, get_thread_dpi() ));
- case NtUserCallTwoParam_ReplyMessage: - return reply_message_result( arg1, (MSG *)arg2 ); - case NtUserCallTwoParam_SetCaretPos: return set_caret_pos( arg1, arg2 );
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index fbd6c4fccad..ba6479a5426 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -300,7 +300,7 @@ extern void track_mouse_menu_bar( HWND hwnd, INT ht, int x, int y ) DECLSPEC_HID
/* message.c */ extern BOOL kill_system_timer( HWND hwnd, UINT_PTR id ) DECLSPEC_HIDDEN; -extern BOOL reply_message_result( LRESULT result, MSG *msg ) DECLSPEC_HIDDEN; +extern BOOL reply_message_result( LRESULT result ) DECLSPEC_HIDDEN; extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput, UINT flags ) DECLSPEC_HIDDEN; extern LRESULT send_internal_message_timeout( DWORD dest_pid, DWORD dest_tid, UINT msg, WPARAM wparam, diff --git a/include/ntuser.h b/include/ntuser.h index f5555056078..053f60b8d1e 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -300,6 +300,7 @@ enum NtUserSpyGetMsgName = 0x3002, NtUserSpyEnter = 0x0303, NtUserSpyExit = 0x0304, + NtUserWinProcResult = 0x0305, };
/* NtUserThunkedMenuItemInfo codes */ @@ -941,6 +942,7 @@ enum NtUserCallOneParam_IsWindowRectFullScreen, NtUserCallOneParam_MessageBeep, NtUserCallOneParam_RealizePalette, + NtUserCallOneParam_ReplyMessage, NtUserCallOneParam_SetCaretBlinkTime, NtUserCallOneParam_SetProcessDefaultLayout, /* temporary exports */ @@ -1051,6 +1053,11 @@ static inline UINT NtUserRealizePalette( HDC hdc ) return NtUserCallOneParam( HandleToUlong(hdc), NtUserCallOneParam_RealizePalette ); }
+static inline BOOL NtUserReplyMessage( LRESULT result ) +{ + return NtUserCallOneParam( result, NtUserCallOneParam_ReplyMessage ); +} + static inline UINT NtUserSetProcessDefaultLayout( DWORD layout ) { return NtUserCallOneParam( layout, NtUserCallOneParam_SetProcessDefaultLayout ); @@ -1063,7 +1070,6 @@ enum NtUserCallTwoParam_GetMonitorInfo, NtUserCallTwoParam_GetSystemMetricsForDpi, NtUserCallTwoParam_MonitorFromRect, - NtUserCallTwoParam_ReplyMessage, NtUserCallTwoParam_SetCaretPos, NtUserCallTwoParam_SetIconParam, NtUserCallTwoParam_UnhookWindowsHook, @@ -1094,11 +1100,6 @@ static inline HMONITOR NtUserMonitorFromRect( const RECT *rect, DWORD flags ) return UlongToHandle( ret ); }
-static inline BOOL NtUserReplyMessage( LRESULT result, MSG *msg ) -{ - return NtUserCallTwoParam( result, (UINT_PTR)msg, NtUserCallTwoParam_ReplyMessage ); -} - static inline BOOL NtUserSetCaretPos( int x, int y ) { return NtUserCallTwoParam( x, y, NtUserCallTwoParam_SetCaretPos );
From: Jacek Caban jacek@codeweavers.com
--- dlls/wow64win/user.c | 191 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 170 insertions(+), 21 deletions(-)
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 1f4acc04e2a..1ad8674a08e 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -30,6 +30,17 @@
WINE_DEFAULT_DEBUG_CHANNEL(wow);
+typedef struct +{ + DWORD cbSize; + DWORD fMask; + DWORD dwStyle; + UINT cyMax; + ULONG hbrBack; + DWORD dwContextHelpID; + ULONG dwMenuData; +} MENUINFO32; + typedef struct { UINT cbSize; @@ -505,8 +516,41 @@ NTSTATUS WINAPI wow64_NtUserCallHwndParam( UINT *args ) DWORD_PTR param = get_ulong( &args ); DWORD code = get_ulong( &args );
- FIXME( "%p %Ix %lu\n", hwnd, param, code ); - return 0; + switch (code) + { + case NtUserCallHwndParam_GetScrollInfo: + { + struct + { + int bar; + ULONG info; + } *info32 = UlongToPtr( param ); + struct get_scroll_info_params info; + + info.bar = info32->bar; + info.info = UlongToPtr( info32->info ); + return NtUserCallHwndParam( hwnd, (UINT_PTR)&info, code ); + } + + case NtUserCallHwndParam_MapWindowPoints: + { + struct + { + ULONG hwnd_to; + ULONG points; + UINT count; + } *params32 = UlongToPtr( param ); + struct map_window_points_params params; + + params.hwnd_to = UlongToHandle( params32->hwnd_to ); + params.points = UlongToPtr( params32->points ); + params.count = params32->count; + return NtUserCallHwndParam( hwnd, (UINT_PTR)¶ms, code ); + } + + default: + return NtUserCallHwndParam( hwnd, param, code ); + } }
NTSTATUS WINAPI wow64_NtUserCallMsgFilter( UINT *args ) @@ -543,8 +587,7 @@ NTSTATUS WINAPI wow64_NtUserCallOneParam( UINT *args ) ULONG_PTR arg = get_ulong( &args ); ULONG code = get_ulong( &args );
- FIXME( "%Ix %lu\n", arg, code ); - return 0; + return NtUserCallOneParam( arg, code ); }
NTSTATUS WINAPI wow64_NtUserCallTwoParam( UINT *args ) @@ -553,8 +596,33 @@ NTSTATUS WINAPI wow64_NtUserCallTwoParam( UINT *args ) ULONG_PTR arg2 = get_ulong( &args ); ULONG code = get_ulong( &args );
- FIXME( "%Ix %Ix %lu\n", arg1, arg2, code ); - return 0; + switch (code) + { + case NtUserCallTwoParam_GetMenuInfo: + { + MENUINFO32 *info32 = UlongToPtr( arg2 ); + MENUINFO info; + + if (!info32 || info32->cbSize != sizeof(*info32)) + { + set_last_error32( ERROR_INVALID_PARAMETER ); + return FALSE; + } + + info.cbSize = sizeof(info); + info.fMask = info32->fMask; + if (!NtUserCallTwoParam( arg1, (UINT_PTR)&info, code )) return FALSE; + if (info.fMask & MIM_BACKGROUND) info32->hbrBack = HandleToUlong( info.hbrBack ); + if (info.fMask & MIM_HELPID) info32->dwContextHelpID = info.dwContextHelpID; + if (info.fMask & MIM_MAXHEIGHT) info32->cyMax = info.cyMax; + if (info.fMask & MIM_MENUDATA) info32->dwMenuData = info.dwMenuData; + if (info.fMask & MIM_STYLE) info32->dwStyle = info.dwStyle; + return TRUE; + } + + default: + return NtUserCallTwoParam( arg1, arg2, code ); + } }
NTSTATUS WINAPI wow64_NtUserChangeClipboardChain( UINT *args ) @@ -1767,10 +1835,57 @@ NTSTATUS WINAPI wow64_NtUserHiliteMenuItem( UINT *args ) return NtUserHiliteMenuItem( hwnd, handle, item, hilite ); }
+struct user_client_procs32 +{ + ULONG pButtonWndProc; + ULONG pComboWndProc; + ULONG pDefWindowProc; + ULONG pDefDlgProc; + ULONG pEditWndProc; + ULONG pListBoxWndProc; + ULONG pMDIClientWndProc; + ULONG pScrollBarWndProc; + ULONG pStaticWndProc; + ULONG pImeWndProc; + ULONG pDesktopWndProc; + ULONG pIconTitleWndProc; + ULONG pPopupMenuWndProc; + ULONG pMessageWndProc; +}; + +static struct user_client_procs *user_client_procs_32to64( struct user_client_procs *procs, + const struct user_client_procs32 *procs32 ) +{ + if (!procs32) return NULL; + + procs->pButtonWndProc = UlongToPtr( procs32->pButtonWndProc ); + procs->pComboWndProc = UlongToPtr( procs32->pComboWndProc ); + procs->pDefWindowProc = UlongToPtr( procs32->pDefWindowProc ); + procs->pDefDlgProc = UlongToPtr( procs32->pDefDlgProc ); + procs->pEditWndProc = UlongToPtr( procs32->pEditWndProc ); + procs->pListBoxWndProc = UlongToPtr( procs32->pListBoxWndProc ); + procs->pMDIClientWndProc = UlongToPtr( procs32->pMDIClientWndProc ); + procs->pScrollBarWndProc = UlongToPtr( procs32->pScrollBarWndProc ); + procs->pStaticWndProc = UlongToPtr( procs32->pStaticWndProc ); + procs->pImeWndProc = UlongToPtr( procs32->pImeWndProc ); + procs->pDesktopWndProc = UlongToPtr( procs32->pDesktopWndProc ); + procs->pIconTitleWndProc = UlongToPtr( procs32->pIconTitleWndProc ); + procs->pPopupMenuWndProc = UlongToPtr( procs32->pPopupMenuWndProc ); + procs->pMessageWndProc = UlongToPtr( procs32->pMessageWndProc ); + return procs; +} + NTSTATUS WINAPI wow64_NtUserInitializeClientPfnArrays( UINT *args ) { - FIXME( "\n" ); - return STATUS_NOT_SUPPORTED; + const struct user_client_procs32 *procsA32 = get_ptr( &args ); + const struct user_client_procs32 *procsW32 = get_ptr( &args ); + void *workers = get_ptr( &args ); + HINSTANCE user_module = get_ptr( &args ); + + struct user_client_procs procsA, procsW; + return NtUserInitializeClientPfnArrays( user_client_procs_32to64( &procsA, procsA32 ), + user_client_procs_32to64( &procsW, procsW32 ), + workers, user_module ); }
NTSTATUS WINAPI wow64_NtUserInternalGetWindowIcon( UINT *args ) @@ -2209,10 +2324,53 @@ NTSTATUS WINAPI wow64_NtUserSetCursorIconData( UINT *args ) HCURSOR cursor = get_handle( &args ); UNICODE_STRING32 *module32 = get_ptr( &args ); UNICODE_STRING32 *res_name32 = get_ptr( &args ); - void *desc = get_ptr( &args ); + struct + { + UINT flags; + UINT num_steps; + UINT num_frames; + UINT delay; + ULONG frames; + ULONG frame_seq; + ULONG frame_rates; + ULONG rsrc; + } *desc32 = get_ptr( &args ); + struct + { + UINT width; + UINT height; + ULONG color; + ULONG alpha; + ULONG mask; + POINT hotspot; + } *frames32 = UlongToPtr( desc32->frames );
- FIXME( "%p %p %p %p\n", cursor, module32, res_name32, desc ); - return 0; + UNICODE_STRING module, res_name; + struct cursoricon_desc desc; + UINT i, num_frames; + + num_frames = max( desc32->num_frames, 1 ); + if (!(desc.frames = Wow64AllocateTemp( num_frames * sizeof(*desc.frames) ))) return FALSE; + desc.flags = desc32->flags; + desc.num_steps = desc32->num_steps; + desc.num_frames = desc32->num_frames; + desc.delay = desc32->delay; + desc.frame_seq = UlongToPtr( desc32->frame_seq ); + desc.frame_rates = UlongToPtr( desc32->frame_rates ); + desc.rsrc = UlongToPtr( desc32->rsrc ); + + for (i = 0; i < num_frames; i++) + { + desc.frames[i].width = frames32[i].width; + desc.frames[i].height = frames32[i].height; + desc.frames[i].color = UlongToHandle( frames32[i].color ); + desc.frames[i].alpha = UlongToHandle( frames32[i].alpha ); + desc.frames[i].mask = UlongToHandle( frames32[i].mask ); + desc.frames[i].hotspot = frames32[i].hotspot; + } + + return NtUserSetCursorIconData( cursor, unicode_str_32to64( &module, module32 ), + unicode_str_32to64( &res_name, res_name32), &desc ); }
NTSTATUS WINAPI wow64_NtUserSetCursorPos( UINT *args ) @@ -2625,16 +2783,7 @@ NTSTATUS WINAPI wow64_NtUserSystemParametersInfoForDpi( UINT *args ) NTSTATUS WINAPI wow64_NtUserThunkedMenuInfo( UINT *args ) { HMENU menu = get_handle( &args ); - const struct - { - DWORD cbSize; - DWORD fMask; - DWORD dwStyle; - UINT cyMax; - ULONG hbrBack; - DWORD dwContextHelpID; - ULONG dwMenuData; - } *info32 = get_ptr( &args ); + MENUINFO32 *info32 = get_ptr( &args ); MENUINFO info;
if (info32)
From: Jacek Caban jacek@codeweavers.com
--- dlls/wow64win/user.c | 169 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 153 insertions(+), 16 deletions(-)
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 1ad8674a08e..7c6abd5bef6 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -210,14 +210,42 @@ static NTSTATUS dispatch_callback( ULONG id, void *args, ULONG len )
static NTSTATUS WINAPI wow64_NtUserCallEnumDisplayMonitor( void *arg, ULONG size ) { - FIXME( "\n" ); - return 0; + struct enum_display_monitor_params *params = arg; + struct + { + ULONG proc; + ULONG monitor; + ULONG hdc; + RECT rect; + ULONG lparam; + } params32; + + params32.proc = PtrToUlong( params->proc ); + params32.monitor = HandleToUlong( params->monitor ); + params32.hdc = HandleToUlong( params->hdc ); + params32.rect = params->rect; + params32.lparam = params->lparam; + return dispatch_callback( NtUserCallEnumDisplayMonitor, ¶ms32, sizeof(params32) ); }
static NTSTATUS WINAPI wow64_NtUserCallSendAsyncCallback( void *arg, ULONG size ) { - FIXME( "\n" ); - return 0; + struct send_async_params *params = arg; + struct + { + ULONG callback; + ULONG hwnd; + UINT msg; + ULONG data; + ULONG result; + } params32; + + params32.callback = PtrToUlong( params->callback ); + params32.hwnd = HandleToUlong( params->hwnd ); + params32.msg = params->msg; + params32.data = params->data; + params32.result = params->result; + return dispatch_callback( NtUserCallSendAsyncCallback, ¶ms32, sizeof(params32) ); }
static NTSTATUS WINAPI wow64_NtUserCallWinEventHook( void *arg, ULONG size ) @@ -240,14 +268,71 @@ static NTSTATUS WINAPI wow64_NtUserCallWindowsHook( void *arg, ULONG size )
static NTSTATUS WINAPI wow64_NtUserCopyImage( void *arg, ULONG size ) { - FIXME( "\n" ); - return 0; + struct copy_image_params *params = arg; + struct + { + ULONG hwnd; + UINT type; + INT dx; + INT dy; + UINT flags; + } params32; + + params32.hwnd = HandleToUlong( params->hwnd ); + params32.type = params->type; + params32.dx = params->dx; + params32.dy = params->dy; + params32.flags = params->flags; + return dispatch_callback( NtUserCopyImage, ¶ms32, sizeof(params32) ); }
static NTSTATUS WINAPI wow64_NtUserDrawScrollBar( void *arg, ULONG size ) { - FIXME( "\n" ); - return 0; + struct draw_scroll_bar_params *params = arg; + struct + { + ULONG hwnd; + ULONG hdc; + INT bar; + UINT hit_test; + struct + { + ULONG win; + INT bar; + INT thumb_pos; + INT thumb_val; + BOOL vertical; + enum SCROLL_HITTEST hit_test; + } tracking_info; + BOOL arrows; + BOOL interior; + RECT rect; + UINT enable_flags; + INT arrow_size; + INT thumb_pos; + INT thumb_size; + BOOL vertical; + } params32; + + params32.hwnd = HandleToUlong( params->hwnd ); + params32.hdc = HandleToUlong( params->hdc ); + params32.bar = params->bar; + params32.hit_test = params->hit_test; + params32.tracking_info.win = HandleToUlong( params->tracking_info.win ); + params32.tracking_info.bar = params->tracking_info.bar; + params32.tracking_info.thumb_pos = params->tracking_info.thumb_pos; + params32.tracking_info.thumb_val = params->tracking_info.thumb_val; + params32.tracking_info.vertical = params->tracking_info.vertical; + params32.tracking_info.hit_test = params->tracking_info.hit_test; + params32.arrows = params->arrows; + params32.interior = params->interior; + params32.rect = params->rect; + params32.enable_flags = params->enable_flags; + params32.arrow_size = params->arrow_size; + params32.thumb_pos = params->thumb_pos; + params32.thumb_size = params->thumb_size; + params32.vertical = params->vertical; + return dispatch_callback( NtUserDrawScrollBar, ¶ms32, sizeof(params32) ); }
static NTSTATUS WINAPI wow64_NtUserDrawText( void *arg, ULONG size ) @@ -258,14 +343,34 @@ static NTSTATUS WINAPI wow64_NtUserDrawText( void *arg, ULONG size )
static NTSTATUS WINAPI wow64_NtUserFreeCachedClipboardData( void *arg, ULONG size ) { - FIXME( "\n" ); - return 0; + struct free_cached_data_params *params = arg; + struct + { + UINT format; + ULONG handle; + } params32; + + params32.format = params->format; + params32.handle = HandleToUlong( params->handle ); + return dispatch_callback( NtUserFreeCachedClipboardData, ¶ms32, sizeof(params32) ); }
static NTSTATUS WINAPI wow64_NtUserImmProcessKey( void *arg, ULONG size ) { - FIXME( "\n" ); - return 0; + struct imm_process_key_params *params = arg; + struct + { + ULONG hwnd; + ULONG hkl; + UINT vkey; + ULONG key_data; + } params32; + + params32.hwnd = HandleToUlong( params->hwnd ); + params32.hkl = HandleToUlong( params->hkl ); + params32.vkey = params->vkey; + params32.key_data = params->key_data; + return dispatch_callback( NtUserImmProcessKey, ¶ms32, sizeof(params32) ); }
static NTSTATUS WINAPI wow64_NtUserImmTranslateMessage( void *arg, ULONG size ) @@ -286,8 +391,24 @@ static NTSTATUS WINAPI wow64_NtUserLoadDriver( void *arg, ULONG size )
static NTSTATUS WINAPI wow64_NtUserLoadImage( void *arg, ULONG size ) { - FIXME( "\n" ); - return 0; + struct load_image_params *params = arg; + struct + { + ULONG hinst; + ULONG name; + UINT type; + INT dx; + INT dy; + UINT flags; + } params32; + + params32.hinst = PtrToUlong( params->hinst ); + params32.name = PtrToUlong( params->name ); + params32.type = params->type; + params32.dx = params->dx; + params32.dy = params->dy; + params32.flags = params->flags; + return dispatch_callback( NtUserLoadImage, ¶ms32, sizeof(params32) ); }
static NTSTATUS WINAPI wow64_NtUserLoadSysMenu( void *arg, ULONG size ) @@ -297,8 +418,24 @@ static NTSTATUS WINAPI wow64_NtUserLoadSysMenu( void *arg, ULONG size )
static NTSTATUS WINAPI wow64_NtUserPostDDEMessage( void *arg, ULONG size ) { - FIXME( "\n" ); - return 0; + struct post_dde_message_params *params = arg; + struct + { + ULONG hwnd; + UINT msg; + LONG wparam; + LONG lparam; + DWORD dest_tid; + DWORD type; + } params32; + + params32.hwnd = HandleToUlong( params->hwnd ); + params32.msg = params->msg; + params32.wparam = params->wparam; + params32.lparam = params->lparam; + params32.dest_tid = params->dest_tid; + params32.type = params->type; + return dispatch_callback( NtUserPostDDEMessage, ¶ms32, sizeof(params32) ); }
static NTSTATUS WINAPI wow64_NtUserRenderSynthesizedFormat( void *arg, ULONG size )
From: Jacek Caban jacek@codeweavers.com
--- dlls/wow64win/gdi.c | 115 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-)
diff --git a/dlls/wow64win/gdi.c b/dlls/wow64win/gdi.c index 4d98a1b9b13..f13ed3da1f0 100644 --- a/dlls/wow64win/gdi.c +++ b/dlls/wow64win/gdi.c @@ -27,6 +27,35 @@ #include "ntgdi.h" #include "wow64win_private.h"
+typedef struct +{ + INT bmType; + INT bmWidth; + INT bmHeight; + INT bmWidthBytes; + WORD bmPlanes; + WORD bmBitsPixel; + ULONG bmBits; +} BITMAP32; + +typedef struct +{ + DWORD elpPenStyle; + DWORD elpWidth; + UINT elpBrushStyle; + COLORREF elpColor; + ULONG elpHatch; + DWORD elpNumEntries; + DWORD elpStyleEntry[1]; +} EXTLOGPEN32; + + +static DWORD gdi_handle_type( HGDIOBJ obj ) +{ + unsigned int handle = HandleToUlong( obj ); + return handle & NTGDI_HANDLE_TYPE_MASK; +} + NTSTATUS WINAPI wow64_NtGdiAddFontMemResourceEx( UINT *args ) { void *ptr = get_ptr( &args ); @@ -334,7 +363,91 @@ NTSTATUS WINAPI wow64_NtGdiExtGetObjectW( UINT *args ) INT count = get_ulong( &args ); void *buffer = get_ptr( &args );
- return NtGdiExtGetObjectW( handle, count, buffer ); + switch (gdi_handle_type( handle )) + { + case NTGDI_OBJ_BITMAP: + { + BITMAP32 *bitmap32 = buffer; + struct + { + BITMAP32 dsBm; + BITMAPINFOHEADER dsBmih; + DWORD dsBitfields[3]; + ULONG dshSection; + DWORD dsOffset; + } *dib32 = buffer; + DIBSECTION dib; + int ret; + + if (buffer) + { + if (count < sizeof(*bitmap32)) return 0; + count = count < sizeof(*dib32) ? sizeof(BITMAP) : sizeof(DIBSECTION); + } + + if (!(ret = NtGdiExtGetObjectW( handle, count, buffer ? &dib : NULL ))) return 0; + + if (bitmap32) + { + bitmap32->bmType = dib.dsBm.bmType; + bitmap32->bmWidth = dib.dsBm.bmWidth; + bitmap32->bmHeight = dib.dsBm.bmHeight; + bitmap32->bmWidthBytes = dib.dsBm.bmWidthBytes; + bitmap32->bmPlanes = dib.dsBm.bmPlanes; + bitmap32->bmBitsPixel = dib.dsBm.bmBitsPixel; + bitmap32->bmBits = PtrToUlong( dib.dsBm.bmBits ); + } + if (ret != sizeof(dib)) return sizeof(*bitmap32); + + if (dib32) + { + dib32->dsBmih = dib.dsBmih; + dib32->dsBitfields[0] = dib.dsBitfields[0]; + dib32->dsBitfields[1] = dib.dsBitfields[1]; + dib32->dsBitfields[2] = dib.dsBitfields[2]; + dib32->dshSection = HandleToUlong( dib.dshSection ); + dib32->dsOffset = dib.dsOffset; + } + return sizeof(*dib32); + } + + case NTGDI_OBJ_PEN: + case NTGDI_OBJ_EXTPEN: + { + EXTLOGPEN32 *pen32 = buffer; + EXTLOGPEN *pen = NULL; + + if (count == sizeof(LOGPEN) || (buffer && !HIWORD( buffer ))) + return NtGdiExtGetObjectW( handle, count, buffer ); + + if (pen32 && count && !(pen = Wow64AllocateTemp( count + sizeof(ULONG) ))) return 0; + count = NtGdiExtGetObjectW( handle, count + sizeof(ULONG), pen ); + + if (count == sizeof(LOGPEN)) + { + if (buffer) memcpy( buffer, pen, count ); + } + else if (count) + { + if (pen32) + { + pen32->elpPenStyle = pen->elpPenStyle; + pen32->elpWidth = pen->elpWidth; + pen32->elpBrushStyle = pen->elpBrushStyle; + pen32->elpColor = pen->elpColor; + pen32->elpHatch = pen->elpHatch; + pen32->elpNumEntries = pen->elpNumEntries; + } + count -= FIELD_OFFSET( EXTLOGPEN, elpStyleEntry ); + if (count && pen32) memcpy( pen32->elpStyleEntry, pen->elpStyleEntry, count ); + count += FIELD_OFFSET( EXTLOGPEN32, elpStyleEntry ); + } + return count; + } + + default: + return NtGdiExtGetObjectW( handle, count, buffer ); + } }
NTSTATUS WINAPI wow64_NtGdiFlattenPath( UINT *args )
From: Jacek Caban jacek@codeweavers.com
--- dlls/wow64win/gdi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wow64win/gdi.c b/dlls/wow64win/gdi.c index f13ed3da1f0..5ddadaa642b 100644 --- a/dlls/wow64win/gdi.c +++ b/dlls/wow64win/gdi.c @@ -136,7 +136,7 @@ NTSTATUS WINAPI wow64_NtGdiCreateDIBSection( UINT *args )
ret = NtGdiCreateDIBSection( hdc, section, offset, bmi, usage, header_size, flags, color_space, addr_32to64( &bits, bits32 )); - if (ret) put_addr( bits32, bits ); + put_addr( bits32, bits ); return HandleToUlong( ret ); }
From: Jacek Caban jacek@codeweavers.com
--- dlls/wow64win/user.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 7c6abd5bef6..551ba44ccd9 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -1565,10 +1565,11 @@ NTSTATUS WINAPI wow64_NtUserGetMessage( UINT *args ) UINT first = get_ulong( &args ); UINT last = get_ulong( &args ); MSG msg; + int ret;
- if (!NtUserGetMessage( &msg, hwnd, first, last )) return FALSE; - msg_64to32( &msg, msg32 ); - return TRUE; + ret = NtUserGetMessage( &msg, hwnd, first, last ); + if (ret != -1) msg_64to32( &msg, msg32 ); + return ret; }
NTSTATUS WINAPI wow64_NtUserGetMouseMovePointsEx( UINT *args )
From: Jacek Caban jacek@codeweavers.com
--- dlls/wow64win/user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 551ba44ccd9..6aecdacda39 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -2209,7 +2209,7 @@ NTSTATUS WINAPI wow64_NtUserPeekMessage( UINT *args ) UINT flags = get_ulong( &args ); MSG msg;
- if (!NtUserPeekMessage( &msg, hwnd, first, last, flags )) return FALSE; + if (!NtUserPeekMessage( msg32 ? &msg : NULL, hwnd, first, last, flags )) return FALSE; msg_64to32( &msg, msg32 ); return TRUE; }
This merge request was approved by Huw Davies.