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

win32u: Use syscall interface for NtUserMessageCall and NtUserTrackPopupMenuEx.

try_finally() hack is no longer needed. We don't expect exceptions from unixlib code and client callbacks' exceptions are not propagated anyway.
parent b3fddeb8
...@@ -1198,7 +1198,6 @@ static struct unix_funcs unix_funcs = ...@@ -1198,7 +1198,6 @@ static struct unix_funcs unix_funcs =
NtUserInvalidateRgn, NtUserInvalidateRgn,
NtUserIsClipboardFormatAvailable, NtUserIsClipboardFormatAvailable,
NtUserMapVirtualKeyEx, NtUserMapVirtualKeyEx,
NtUserMessageCall,
NtUserMoveWindow, NtUserMoveWindow,
NtUserOpenClipboard, NtUserOpenClipboard,
NtUserPeekMessage, NtUserPeekMessage,
...@@ -1245,7 +1244,6 @@ static struct unix_funcs unix_funcs = ...@@ -1245,7 +1244,6 @@ static struct unix_funcs unix_funcs =
NtUserSystemParametersInfoForDpi, NtUserSystemParametersInfoForDpi,
NtUserToUnicodeEx, NtUserToUnicodeEx,
NtUserTrackMouseEvent, NtUserTrackMouseEvent,
NtUserTrackPopupMenuEx,
NtUserTranslateAccelerator, NtUserTranslateAccelerator,
NtUserTranslateMessage, NtUserTranslateMessage,
NtUserUnregisterClass, NtUserUnregisterClass,
......
...@@ -4053,14 +4053,7 @@ static UINT find_item_by_key( HWND owner, HMENU hmenu, WCHAR key, BOOL force_men ...@@ -4053,14 +4053,7 @@ static UINT find_item_by_key( HWND owner, HMENU hmenu, WCHAR key, BOOL force_men
return -1; return -1;
} }
static BOOL seh_release_capture; static BOOL track_menu( HMENU hmenu, UINT flags, int x, int y, HWND hwnd, const RECT *rect )
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 )
{ {
BOOL enter_idle_sent = FALSE; BOOL enter_idle_sent = FALSE;
int executed_menu_id = -1; 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 ...@@ -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) if ((flags & TPM_POPUPMENU) && menu->nItems == 0)
return FALSE; return FALSE;
seh_release_capture = TRUE;
while (!exit_menu) while (!exit_menu)
{ {
if (!(menu = unsafe_menu_ptr( mt.hCurrentMenu ))) break; 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 ...@@ -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; else mt.trackFlags &= ~TF_SKIPREMOVE;
} }
seh_release_capture = FALSE;
set_capture_window( 0, GUI_INMENUMODE, NULL ); set_capture_window( 0, GUI_INMENUMODE, NULL );
/* If dropdown is still painted and the close box is clicked on /* 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 ...@@ -4344,36 +4334,6 @@ static BOOL track_menu_impl( HMENU hmenu, UINT flags, int x, int y, HWND hwnd, c
return executed_menu_id; 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, &params, finally_release_capture );
}
static BOOL init_tracking( HWND hwnd, HMENU handle, BOOL is_popup, UINT flags ) static BOOL init_tracking( HWND hwnd, HMENU handle, BOOL is_popup, UINT flags )
{ {
struct menu *menu; struct menu *menu;
......
...@@ -163,6 +163,7 @@ static void * const syscalls[] = ...@@ -163,6 +163,7 @@ static void * const syscalls[] =
NtUserKillTimer, NtUserKillTimer,
NtUserLockWindowUpdate, NtUserLockWindowUpdate,
NtUserMenuItemFromPoint, NtUserMenuItemFromPoint,
NtUserMessageCall,
NtUserMsgWaitForMultipleObjectsEx, NtUserMsgWaitForMultipleObjectsEx,
NtUserNotifyWinEvent, NtUserNotifyWinEvent,
NtUserOpenDesktop, NtUserOpenDesktop,
...@@ -187,6 +188,7 @@ static void * const syscalls[] = ...@@ -187,6 +188,7 @@ static void * const syscalls[] =
NtUserSetWindowsHookEx, NtUserSetWindowsHookEx,
NtUserThunkedMenuInfo, NtUserThunkedMenuInfo,
NtUserThunkedMenuItemInfo, NtUserThunkedMenuItemInfo,
NtUserTrackPopupMenuEx,
NtUserUnhookWinEvent, NtUserUnhookWinEvent,
NtUserUnhookWindowsHookEx, NtUserUnhookWindowsHookEx,
NtUserUpdateInputContext, NtUserUpdateInputContext,
......
...@@ -1079,7 +1079,7 @@ ...@@ -1079,7 +1079,7 @@
@ stdcall NtUserMapVirtualKeyEx(long long long) @ stdcall NtUserMapVirtualKeyEx(long long long)
@ stub NtUserMarkWindowForRawMouse @ stub NtUserMarkWindowForRawMouse
@ stdcall -syscall NtUserMenuItemFromPoint(long long long long) @ 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 NtUserMinInitialize
@ stub NtUserMinMaximize @ stub NtUserMinMaximize
@ stub NtUserModifyUserStartupInfoFlags @ stub NtUserModifyUserStartupInfoFlags
...@@ -1278,7 +1278,7 @@ ...@@ -1278,7 +1278,7 @@
@ stdcall -syscall NtUserThunkedMenuItemInfo(long long long long ptr ptr) @ stdcall -syscall NtUserThunkedMenuItemInfo(long long long long ptr ptr)
@ stdcall NtUserToUnicodeEx(long long ptr ptr long long long) @ stdcall NtUserToUnicodeEx(long long ptr ptr long long long)
@ stdcall NtUserTrackMouseEvent(ptr) @ stdcall NtUserTrackMouseEvent(ptr)
@ stdcall NtUserTrackPopupMenuEx(long long long long long ptr) @ stdcall -syscall NtUserTrackPopupMenuEx(long long long long long ptr)
@ stub NtUserTransformPoint @ stub NtUserTransformPoint
@ stub NtUserTransformRect @ stub NtUserTransformRect
@ stdcall NtUserTranslateAccelerator(long long ptr) @ stdcall NtUserTranslateAccelerator(long long ptr)
......
...@@ -262,8 +262,6 @@ struct unix_funcs ...@@ -262,8 +262,6 @@ struct unix_funcs
BOOL (WINAPI *pNtUserInvalidateRgn)( HWND hwnd, HRGN hrgn, BOOL erase ); BOOL (WINAPI *pNtUserInvalidateRgn)( HWND hwnd, HRGN hrgn, BOOL erase );
BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format ); BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format );
UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout ); 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 *pNtUserMoveWindow)( HWND hwnd, INT x, INT y, INT cx, INT cy, BOOL repaint );
BOOL (WINAPI *pNtUserOpenClipboard)( HWND hwnd, ULONG unk ); BOOL (WINAPI *pNtUserOpenClipboard)( HWND hwnd, ULONG unk );
BOOL (WINAPI *pNtUserPeekMessage)( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT flags ); BOOL (WINAPI *pNtUserPeekMessage)( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT flags );
...@@ -320,8 +318,6 @@ struct unix_funcs ...@@ -320,8 +318,6 @@ struct unix_funcs
INT (WINAPI *pNtUserToUnicodeEx)( UINT virt, UINT scan, const BYTE *state, INT (WINAPI *pNtUserToUnicodeEx)( UINT virt, UINT scan, const BYTE *state,
WCHAR *str, int size, UINT flags, HKL layout ); WCHAR *str, int size, UINT flags, HKL layout );
BOOL (WINAPI *pNtUserTrackMouseEvent)( TRACKMOUSEEVENT *info ); 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 ); INT (WINAPI *pNtUserTranslateAccelerator)( HWND hwnd, HACCEL accel, MSG *msg );
BOOL (WINAPI *pNtUserTranslateMessage)( const MSG *msg, UINT flags ); BOOL (WINAPI *pNtUserTranslateMessage)( const MSG *msg, UINT flags );
BOOL (WINAPI *pNtUserUnregisterClass)( UNICODE_STRING *name, HINSTANCE instance, BOOL (WINAPI *pNtUserUnregisterClass)( UNICODE_STRING *name, HINSTANCE instance,
......
...@@ -1103,13 +1103,6 @@ UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout ) ...@@ -1103,13 +1103,6 @@ UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout )
return unix_funcs->pNtUserMapVirtualKeyEx( code, type, 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 ) BOOL WINAPI NtUserOpenClipboard( HWND hwnd, ULONG unk )
{ {
if (!unix_funcs) return FALSE; if (!unix_funcs) return FALSE;
...@@ -1388,13 +1381,6 @@ BOOL WINAPI NtUserTrackMouseEvent( TRACKMOUSEEVENT *info ) ...@@ -1388,13 +1381,6 @@ BOOL WINAPI NtUserTrackMouseEvent( TRACKMOUSEEVENT *info )
return unix_funcs->pNtUserTrackMouseEvent( 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 ) INT WINAPI NtUserTranslateAccelerator( HWND hwnd, HACCEL accel, MSG *msg )
{ {
if (!unix_funcs) return 0; if (!unix_funcs) return 0;
......
...@@ -150,6 +150,7 @@ ...@@ -150,6 +150,7 @@
SYSCALL_ENTRY( NtUserKillTimer ) \ SYSCALL_ENTRY( NtUserKillTimer ) \
SYSCALL_ENTRY( NtUserLockWindowUpdate ) \ SYSCALL_ENTRY( NtUserLockWindowUpdate ) \
SYSCALL_ENTRY( NtUserMenuItemFromPoint ) \ SYSCALL_ENTRY( NtUserMenuItemFromPoint ) \
SYSCALL_ENTRY( NtUserMessageCall ) \
SYSCALL_ENTRY( NtUserMsgWaitForMultipleObjectsEx ) \ SYSCALL_ENTRY( NtUserMsgWaitForMultipleObjectsEx ) \
SYSCALL_ENTRY( NtUserNotifyWinEvent ) \ SYSCALL_ENTRY( NtUserNotifyWinEvent ) \
SYSCALL_ENTRY( NtUserOpenDesktop ) \ SYSCALL_ENTRY( NtUserOpenDesktop ) \
...@@ -174,6 +175,7 @@ ...@@ -174,6 +175,7 @@
SYSCALL_ENTRY( NtUserSetWindowsHookEx ) \ SYSCALL_ENTRY( NtUserSetWindowsHookEx ) \
SYSCALL_ENTRY( NtUserThunkedMenuInfo ) \ SYSCALL_ENTRY( NtUserThunkedMenuInfo ) \
SYSCALL_ENTRY( NtUserThunkedMenuItemInfo ) \ SYSCALL_ENTRY( NtUserThunkedMenuItemInfo ) \
SYSCALL_ENTRY( NtUserTrackPopupMenuEx ) \
SYSCALL_ENTRY( NtUserUnhookWinEvent ) \ SYSCALL_ENTRY( NtUserUnhookWinEvent ) \
SYSCALL_ENTRY( NtUserUnhookWindowsHookEx ) \ SYSCALL_ENTRY( NtUserUnhookWindowsHookEx ) \
SYSCALL_ENTRY( NtUserUpdateInputContext ) \ SYSCALL_ENTRY( NtUserUpdateInputContext ) \
......
...@@ -836,6 +836,20 @@ NTSTATUS WINAPI wow64_NtUserMenuItemFromPoint( UINT *args ) ...@@ -836,6 +836,20 @@ NTSTATUS WINAPI wow64_NtUserMenuItemFromPoint( UINT *args )
return NtUserMenuItemFromPoint( hwnd, handle, x, y ); 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 ) NTSTATUS WINAPI wow64_NtUserMsgWaitForMultipleObjectsEx( UINT *args )
{ {
DWORD count = get_ulong( &args ); DWORD count = get_ulong( &args );
...@@ -1151,6 +1165,18 @@ NTSTATUS WINAPI wow64_NtUserThunkedMenuItemInfo( UINT *args ) ...@@ -1151,6 +1165,18 @@ NTSTATUS WINAPI wow64_NtUserThunkedMenuItemInfo( UINT *args )
unicode_str_32to64( &str, str32 )); 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 ) NTSTATUS WINAPI wow64_NtUserUnhookWinEvent( UINT *args )
{ {
HWINEVENTHOOK handle = get_handle( &args ); HWINEVENTHOOK handle = get_handle( &args );
......
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