From: Jacek Caban jacek@codeweavers.com
try_finally() hack is no longer needed. We don't expect exceptions from unixlib code and client callbacks' exceptions are not propagated anyway. --- dlls/win32u/gdiobj.c | 2 -- dlls/win32u/menu.c | 42 +----------------------------------- dlls/win32u/syscall.c | 2 ++ dlls/win32u/win32u.spec | 4 ++-- dlls/win32u/win32u_private.h | 4 ---- dlls/win32u/wrappers.c | 14 ------------ dlls/wow64win/syscall.h | 2 ++ dlls/wow64win/user.c | 26 ++++++++++++++++++++++ 8 files changed, 33 insertions(+), 63 deletions(-)
diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index 2c3d46b7a5b..30c507275fc 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1198,7 +1198,6 @@ static struct unix_funcs unix_funcs = NtUserInvalidateRgn, NtUserIsClipboardFormatAvailable, NtUserMapVirtualKeyEx, - NtUserMessageCall, NtUserMoveWindow, NtUserOpenClipboard, NtUserPeekMessage, @@ -1245,7 +1244,6 @@ static struct unix_funcs unix_funcs = NtUserSystemParametersInfoForDpi, NtUserToUnicodeEx, NtUserTrackMouseEvent, - NtUserTrackPopupMenuEx, NtUserTranslateAccelerator, NtUserTranslateMessage, NtUserUnregisterClass, diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c index 2530c04241c..641eb926e16 100644 --- a/dlls/win32u/menu.c +++ b/dlls/win32u/menu.c @@ -4053,14 +4053,7 @@ static UINT find_item_by_key( HWND owner, HMENU hmenu, WCHAR key, BOOL force_men return -1; }
-static BOOL seh_release_capture; - -static void CALLBACK finally_release_capture( BOOL __normal ) -{ - if (seh_release_capture) set_capture_window( 0, GUI_INMENUMODE, NULL ); -} - -static BOOL track_menu_impl( HMENU hmenu, UINT flags, int x, int y, HWND hwnd, const RECT *rect ) +static BOOL track_menu( HMENU hmenu, UINT flags, int x, int y, HWND hwnd, const RECT *rect ) { BOOL enter_idle_sent = FALSE; int executed_menu_id = -1; @@ -4103,8 +4096,6 @@ static BOOL track_menu_impl( HMENU hmenu, UINT flags, int x, int y, HWND hwnd, c if ((flags & TPM_POPUPMENU) && menu->nItems == 0) return FALSE;
- seh_release_capture = TRUE; - while (!exit_menu) { if (!(menu = unsafe_menu_ptr( mt.hCurrentMenu ))) break; @@ -4308,7 +4299,6 @@ static BOOL track_menu_impl( HMENU hmenu, UINT flags, int x, int y, HWND hwnd, c else mt.trackFlags &= ~TF_SKIPREMOVE; }
- seh_release_capture = FALSE; set_capture_window( 0, GUI_INMENUMODE, NULL );
/* If dropdown is still painted and the close box is clicked on @@ -4344,36 +4334,6 @@ static BOOL track_menu_impl( HMENU hmenu, UINT flags, int x, int y, HWND hwnd, c return executed_menu_id; }
-/* FIXME: this is an ugly hack to work around unixlib exceptions limitations. - * For this to work properly we need recursive exception handlers capable of - * catching exceptions from client callbacks. We probably need to actually - * run on Unix stack first, so we need a hack for now. */ -struct track_menu_params -{ - HMENU handle; - UINT flags; - int x; - int y; - HWND hwnd; - const RECT *rect; -}; - -static NTSTATUS CDECL track_menu_proc( void *arg ) -{ - struct track_menu_params *params = arg; - return track_menu_impl( params->handle, params->flags, params->x, params->y, - params->hwnd, params->rect ); -} - -static BOOL track_menu( HMENU handle, UINT flags, int x, int y, HWND hwnd, const RECT *rect ) -{ - struct track_menu_params params = - { .handle = handle, .flags = flags, .x = x, .y = y, .hwnd = hwnd, .rect = rect }; - if (!user_callbacks) - return track_menu_impl( handle, flags, x, y, hwnd, rect ); - return user_callbacks->try_finally( track_menu_proc, ¶ms, finally_release_capture ); -} - static BOOL init_tracking( HWND hwnd, HMENU handle, BOOL is_popup, UINT flags ) { struct menu *menu; diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index f4ec0b8dc3b..eeebf521bc2 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -163,6 +163,7 @@ static void * const syscalls[] = NtUserKillTimer, NtUserLockWindowUpdate, NtUserMenuItemFromPoint, + NtUserMessageCall, NtUserMsgWaitForMultipleObjectsEx, NtUserNotifyWinEvent, NtUserOpenDesktop, @@ -187,6 +188,7 @@ static void * const syscalls[] = NtUserSetWindowsHookEx, NtUserThunkedMenuInfo, NtUserThunkedMenuItemInfo, + NtUserTrackPopupMenuEx, NtUserUnhookWinEvent, NtUserUnhookWindowsHookEx, NtUserUpdateInputContext, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index b56059e7fd8..83de1ab87c8 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1079,7 +1079,7 @@ @ stdcall NtUserMapVirtualKeyEx(long long long) @ stub NtUserMarkWindowForRawMouse @ stdcall -syscall NtUserMenuItemFromPoint(long long long long) -@ stdcall NtUserMessageCall(long long long long long long long) +@ stdcall -syscall NtUserMessageCall(long long long long long long long) @ stub NtUserMinInitialize @ stub NtUserMinMaximize @ stub NtUserModifyUserStartupInfoFlags @@ -1278,7 +1278,7 @@ @ stdcall -syscall NtUserThunkedMenuItemInfo(long long long long ptr ptr) @ stdcall NtUserToUnicodeEx(long long ptr ptr long long long) @ stdcall NtUserTrackMouseEvent(ptr) -@ stdcall NtUserTrackPopupMenuEx(long long long long long ptr) +@ stdcall -syscall NtUserTrackPopupMenuEx(long long long long long ptr) @ stub NtUserTransformPoint @ stub NtUserTransformRect @ stdcall NtUserTranslateAccelerator(long long ptr) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index d811ac6e879..262d46d3d7c 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -262,8 +262,6 @@ struct unix_funcs BOOL (WINAPI *pNtUserInvalidateRgn)( HWND hwnd, HRGN hrgn, BOOL erase ); BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format ); UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout ); - LRESULT (WINAPI *pNtUserMessageCall)( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, - void *result_info, DWORD type, BOOL ansi ); BOOL (WINAPI *pNtUserMoveWindow)( HWND hwnd, INT x, INT y, INT cx, INT cy, BOOL repaint ); BOOL (WINAPI *pNtUserOpenClipboard)( HWND hwnd, ULONG unk ); BOOL (WINAPI *pNtUserPeekMessage)( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT flags ); @@ -320,8 +318,6 @@ struct unix_funcs INT (WINAPI *pNtUserToUnicodeEx)( UINT virt, UINT scan, const BYTE *state, WCHAR *str, int size, UINT flags, HKL layout ); BOOL (WINAPI *pNtUserTrackMouseEvent)( TRACKMOUSEEVENT *info ); - BOOL (WINAPI *pNtUserTrackPopupMenuEx)( HMENU handle, UINT flags, INT x, INT y, HWND hwnd, - TPMPARAMS *params ); INT (WINAPI *pNtUserTranslateAccelerator)( HWND hwnd, HACCEL accel, MSG *msg ); BOOL (WINAPI *pNtUserTranslateMessage)( const MSG *msg, UINT flags ); BOOL (WINAPI *pNtUserUnregisterClass)( UNICODE_STRING *name, HINSTANCE instance, diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 4c22c14ca6f..923254dcf96 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -1103,13 +1103,6 @@ UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout ) return unix_funcs->pNtUserMapVirtualKeyEx( code, type, layout ); }
-LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, - void *result_info, DWORD type, BOOL ansi ) -{ - if (!unix_funcs) return 0; - return unix_funcs->pNtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi ); -} - BOOL WINAPI NtUserOpenClipboard( HWND hwnd, ULONG unk ) { if (!unix_funcs) return FALSE; @@ -1388,13 +1381,6 @@ BOOL WINAPI NtUserTrackMouseEvent( TRACKMOUSEEVENT *info ) return unix_funcs->pNtUserTrackMouseEvent( info ); }
-BOOL WINAPI NtUserTrackPopupMenuEx( HMENU handle, UINT flags, INT x, INT y, HWND hwnd, - TPMPARAMS *params ) -{ - if (!unix_funcs) return FALSE; - return unix_funcs->pNtUserTrackPopupMenuEx( handle, flags, x, y, hwnd, params ); -} - INT WINAPI NtUserTranslateAccelerator( HWND hwnd, HACCEL accel, MSG *msg ) { if (!unix_funcs) return 0; diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index b5103726e50..937abaf8b3b 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -150,6 +150,7 @@ SYSCALL_ENTRY( NtUserKillTimer ) \ SYSCALL_ENTRY( NtUserLockWindowUpdate ) \ SYSCALL_ENTRY( NtUserMenuItemFromPoint ) \ + SYSCALL_ENTRY( NtUserMessageCall ) \ SYSCALL_ENTRY( NtUserMsgWaitForMultipleObjectsEx ) \ SYSCALL_ENTRY( NtUserNotifyWinEvent ) \ SYSCALL_ENTRY( NtUserOpenDesktop ) \ @@ -174,6 +175,7 @@ SYSCALL_ENTRY( NtUserSetWindowsHookEx ) \ SYSCALL_ENTRY( NtUserThunkedMenuInfo ) \ SYSCALL_ENTRY( NtUserThunkedMenuItemInfo ) \ + SYSCALL_ENTRY( NtUserTrackPopupMenuEx ) \ SYSCALL_ENTRY( NtUserUnhookWinEvent ) \ SYSCALL_ENTRY( NtUserUnhookWindowsHookEx ) \ SYSCALL_ENTRY( NtUserUpdateInputContext ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 4e6e86028ba..be91b830e7a 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -836,6 +836,20 @@ NTSTATUS WINAPI wow64_NtUserMenuItemFromPoint( UINT *args ) return NtUserMenuItemFromPoint( hwnd, handle, x, y ); }
+NTSTATUS WINAPI wow64_NtUserMessageCall( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + UINT msg = get_ulong( &args ); + UINT wparam = get_ulong( &args ); + UINT lparam = get_ulong( &args ); + void *result_info = get_ptr( &args ); + UINT type = get_ulong ( &args ); + BOOL ansi = get_ulong( &args ); + + FIXME( "%p %x %x %x %p %x %x\n", hwnd, msg, wparam, lparam, result_info, type, ansi ); + return 0; +} + NTSTATUS WINAPI wow64_NtUserMsgWaitForMultipleObjectsEx( UINT *args ) { DWORD count = get_ulong( &args ); @@ -1151,6 +1165,18 @@ NTSTATUS WINAPI wow64_NtUserThunkedMenuItemInfo( UINT *args ) unicode_str_32to64( &str, str32 )); }
+NTSTATUS WINAPI wow64_NtUserTrackPopupMenuEx( UINT *args ) +{ + HMENU handle = get_handle( &args ); + UINT flags = get_ulong( &args ); + int x = get_ulong( &args ); + int y = get_ulong( &args ); + HWND hwnd = get_handle( &args ); + TPMPARAMS *params = get_ptr( &args ); + + return NtUserTrackPopupMenuEx( handle, flags, x, y, hwnd, params ); +} + NTSTATUS WINAPI wow64_NtUserUnhookWinEvent( UINT *args ) { HWINEVENTHOOK handle = get_handle( &args );