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

win32u: Use syscall interface for NtUserMsgWaitForMultipleObjectsEx.

parent 6395bf96
......@@ -133,7 +133,6 @@ static NTSTATUS try_finally( NTSTATUS (CDECL *func)( void *), void *arg,
static const struct user_callbacks user_funcs =
{
NtWaitForMultipleObjects,
try_finally,
};
......
......@@ -811,12 +811,8 @@ static NTSTATUS nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *
DWORD mask, DWORD flags )
{
if (!count && timeout && !timeout->QuadPart) return WAIT_TIMEOUT;
if (!user_callbacks)
return NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
return user_callbacks->pNtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
return NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
}
static void nulldrv_ReleaseDC( HWND hwnd, HDC hdc )
......
......@@ -1200,7 +1200,6 @@ static struct unix_funcs unix_funcs =
NtUserMapVirtualKeyEx,
NtUserMessageCall,
NtUserMoveWindow,
NtUserMsgWaitForMultipleObjectsEx,
NtUserOpenClipboard,
NtUserPeekMessage,
NtUserPostMessage,
......
......@@ -32,7 +32,6 @@ struct hardware_msg_data;
struct user_callbacks
{
NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
NTSTATUS (CDECL *try_finally)( NTSTATUS (CDECL *func)( void *), void *arg,
void (CALLBACK *finally_func)( BOOL ));
};
......
......@@ -163,6 +163,7 @@ static void * const syscalls[] =
NtUserKillTimer,
NtUserLockWindowUpdate,
NtUserMenuItemFromPoint,
NtUserMsgWaitForMultipleObjectsEx,
NtUserNotifyWinEvent,
NtUserOpenDesktop,
NtUserOpenInputDesktop,
......
......@@ -1085,7 +1085,7 @@
@ stub NtUserModifyUserStartupInfoFlags
@ stub NtUserModifyWindowTouchCapability
@ stdcall NtUserMoveWindow(long long long long long long)
@ stdcall NtUserMsgWaitForMultipleObjectsEx(long ptr long long long)
@ stdcall -syscall NtUserMsgWaitForMultipleObjectsEx(long ptr long long long)
@ stub NtUserNavigateFocus
@ stub NtUserNotifyIMEStatus
@ stub NtUserNotifyProcessCreate
......
......@@ -265,8 +265,6 @@ struct unix_funcs
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 );
DWORD (WINAPI *pNtUserMsgWaitForMultipleObjectsEx)( DWORD count, const HANDLE *handles,
DWORD timeout, DWORD mask, DWORD flags );
BOOL (WINAPI *pNtUserOpenClipboard)( HWND hwnd, ULONG unk );
BOOL (WINAPI *pNtUserPeekMessage)( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT flags );
BOOL (WINAPI *pNtUserPostMessage)( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam );
......
......@@ -1110,13 +1110,6 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
return unix_funcs->pNtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi );
}
DWORD WINAPI NtUserMsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
DWORD timeout, DWORD mask, DWORD flags )
{
if (!unix_funcs) return 0;
return unix_funcs->pNtUserMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
}
BOOL WINAPI NtUserOpenClipboard( HWND hwnd, ULONG unk )
{
if (!unix_funcs) return FALSE;
......
......@@ -120,8 +120,6 @@ extern NTSTATUS android_java_init( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS android_java_uninit( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS android_register_window( void *arg ) DECLSPEC_HIDDEN;
extern PNTAPCFUNC register_window_callback;
extern NTSTATUS (WINAPI *pNtWaitForMultipleObjects)( ULONG,const HANDLE*,BOOLEAN,
BOOLEAN,const LARGE_INTEGER* ) DECLSPEC_HIDDEN;
extern unsigned int screen_width DECLSPEC_HIDDEN;
extern unsigned int screen_height DECLSPEC_HIDDEN;
......
......@@ -130,7 +130,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
return FALSE;
params.register_window_callback = register_window_callback;
params.pNtWaitForMultipleObjects = NtWaitForMultipleObjects;
if (__wine_unix_call( unix_handle, unix_init, &params )) return FALSE;
callback_table = NtCurrentTeb()->Peb->KernelCallbackTable;
......
......@@ -563,8 +563,6 @@ jobject *p_java_object = NULL;
unsigned short *p_java_gdt_sel = NULL;
static NTSTATUS CDECL unix_call( enum android_funcs code, void *params );
NTSTATUS (WINAPI *pNtWaitForMultipleObjects)( ULONG,const HANDLE*,BOOLEAN,
BOOLEAN,const LARGE_INTEGER* );
static HRESULT android_init( void *arg )
{
......@@ -611,7 +609,6 @@ static HRESULT android_init( void *arg )
#endif
}
__wine_set_user_driver( &android_drv_funcs, WINE_GDI_DRIVER_VERSION );
pNtWaitForMultipleObjects = params->pNtWaitForMultipleObjects;
params->unix_call = unix_call;
return STATUS_SUCCESS;
}
......
......@@ -37,7 +37,6 @@ enum android_funcs
struct init_params
{
PNTAPCFUNC register_window_callback;
NTSTATUS (WINAPI *pNtWaitForMultipleObjects)( ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER* );
NTSTATUS (CDECL *unix_call)( enum android_funcs code, void *params );
};
......
......@@ -1212,8 +1212,8 @@ NTSTATUS ANDROID_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles
if (current_event) mask = 0;
if (process_events( mask )) return count - 1;
}
return pNtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
return NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
}
/**********************************************************************
......
......@@ -414,7 +414,6 @@ static BOOL process_attach(void)
str->len = LoadStringW(macdrv_module, str->id, (WCHAR *)&str->str, 0);
params.strings = strings;
params.pNtWaitForMultipleObjects = NtWaitForMultipleObjects;
if (__wine_unix_call(macdrv_handle, unix_init, &params)) return FALSE;
callback_table = NtCurrentTeb()->Peb->KernelCallbackTable;
......
......@@ -525,8 +525,8 @@ NTSTATUS macdrv_MsgWaitForMultipleObjectsEx(DWORD count, const HANDLE *handles,
if (!data)
{
if (!count && timeout && !timeout->QuadPart) return WAIT_TIMEOUT;
return pNtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
return NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
}
if (data->current_event && data->current_event->type != QUERY_EVENT &&
......@@ -538,8 +538,8 @@ NTSTATUS macdrv_MsgWaitForMultipleObjectsEx(DWORD count, const HANDLE *handles,
if (process_events(data->queue, event_mask)) ret = count - 1;
else if (count || !timeout || timeout->QuadPart)
{
ret = pNtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
ret = NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
if (ret == count - 1) process_events(data->queue, event_mask);
}
else ret = WAIT_TIMEOUT;
......
......@@ -42,9 +42,6 @@ extern BOOL allow_set_gamma DECLSPEC_HIDDEN;
extern BOOL allow_software_rendering DECLSPEC_HIDDEN;
extern BOOL disable_window_decorations DECLSPEC_HIDDEN;
extern NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,
BOOLEAN,const LARGE_INTEGER*) DECLSPEC_HIDDEN;
extern const char* debugstr_cf(CFTypeRef t) DECLSPEC_HIDDEN;
static inline CGRect cgrect_from_rect(RECT rect)
......
......@@ -69,8 +69,6 @@ int enable_app_nap = FALSE;
CFDictionaryRef localized_strings;
NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,
BOOLEAN,const LARGE_INTEGER*);
/**************************************************************************
* debugstr_cf
......@@ -461,7 +459,6 @@ static NTSTATUS macdrv_init(void *arg)
init_user_driver();
macdrv_init_display_devices(FALSE);
pNtWaitForMultipleObjects = params->pNtWaitForMultipleObjects;
params->unix_call = unix_call;
return STATUS_SUCCESS;
}
......
......@@ -83,7 +83,6 @@ struct localized_string
struct init_params
{
NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
struct localized_string *strings;
NTSTATUS (CDECL *unix_call)(enum macdrv_funcs code, void *params);
};
......
......@@ -67,7 +67,6 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
void **callback_table;
struct init_params params =
{
NtWaitForMultipleObjects,
foreign_window_proc,
};
......
......@@ -483,8 +483,8 @@ NTSTATUS X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
if (!data)
{
if (!count && timeout && !timeout->QuadPart) return WAIT_TIMEOUT;
return pNtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
return NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
}
if (data->current_event) mask = 0; /* don't process nested events */
......@@ -492,8 +492,8 @@ NTSTATUS X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
if (process_events( data->display, filter_event, mask )) ret = count - 1;
else if (count || !timeout || timeout->QuadPart)
{
ret = pNtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
ret = NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL),
!!(flags & MWMO_ALERTABLE), timeout );
if (ret == count - 1) process_events( data->display, filter_event, mask );
}
else ret = WAIT_TIMEOUT;
......
......@@ -50,7 +50,6 @@ struct create_desktop_params
/* x11drv_init params */
struct init_params
{
NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
WNDPROC foreign_window_proc;
BOOL show_systray;
NTSTATUS (CDECL *unix_call)( enum x11drv_funcs code, void *params );
......
......@@ -446,9 +446,6 @@ extern char *process_name DECLSPEC_HIDDEN;
extern Display *clipboard_display DECLSPEC_HIDDEN;
extern WNDPROC client_foreign_window_proc;
extern NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,
BOOLEAN,const LARGE_INTEGER*) DECLSPEC_HIDDEN;
/* atoms */
enum x11drv_atoms
......
......@@ -220,14 +220,6 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
"text/uri-list"
};
/* We use use pointer to call NtWaitForMultipleObjects to make it go through
* syscall dispatcher. We need that because win32u bypasses syscall thunks and
* if we called NtWaitForMultipleObjects directly, it wouldn't be able to handle
* user APCs. This will be removed as soon as we may use syscall interface
* for NtUserMsgWaitForMultipleObjectsEx. */
NTSTATUS (WINAPI *pNtWaitForMultipleObjects)( ULONG, const HANDLE *, BOOLEAN,
BOOLEAN, const LARGE_INTEGER* );
static NTSTATUS CDECL unix_call( enum x11drv_funcs code, void *params );
/***********************************************************************
......@@ -686,7 +678,6 @@ static NTSTATUS x11drv_init( void *arg )
if (!XInitThreads()) ERR( "XInitThreads failed, trouble ahead\n" );
if (!(display = XOpenDisplay( NULL ))) return STATUS_UNSUCCESSFUL;
pNtWaitForMultipleObjects = params->pNtWaitForMultipleObjects;
client_foreign_window_proc = params->foreign_window_proc;
fcntl( ConnectionNumber(display), F_SETFD, 1 ); /* set close on exec flag */
......
......@@ -150,6 +150,7 @@
SYSCALL_ENTRY( NtUserKillTimer ) \
SYSCALL_ENTRY( NtUserLockWindowUpdate ) \
SYSCALL_ENTRY( NtUserMenuItemFromPoint ) \
SYSCALL_ENTRY( NtUserMsgWaitForMultipleObjectsEx ) \
SYSCALL_ENTRY( NtUserNotifyWinEvent ) \
SYSCALL_ENTRY( NtUserOpenDesktop ) \
SYSCALL_ENTRY( NtUserOpenInputDesktop ) \
......
......@@ -836,6 +836,27 @@ NTSTATUS WINAPI wow64_NtUserMenuItemFromPoint( UINT *args )
return NtUserMenuItemFromPoint( hwnd, handle, x, y );
}
NTSTATUS WINAPI wow64_NtUserMsgWaitForMultipleObjectsEx( UINT *args )
{
DWORD count = get_ulong( &args );
const ULONG *handles32 = get_ptr( &args );
DWORD timeout = get_ulong( &args );
DWORD mask = get_ulong( &args );
DWORD flags = get_ulong( &args );
HANDLE handles[MAXIMUM_WAIT_OBJECTS];
unsigned int i;
if (count > ARRAYSIZE(handles))
{
SetLastError( ERROR_INVALID_PARAMETER );
return WAIT_FAILED;
}
for (i = 0; i < count; i++) handles[i] = UlongToHandle( handles32[i] );
return NtUserMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
}
NTSTATUS WINAPI wow64_NtUserNotifyWinEvent( UINT *args )
{
DWORD event = get_ulong( &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