From: Rémi Bernon rbernon@codeweavers.com
--- dlls/hidclass.sys/device.c | 2 +- dlls/hidclass.sys/pnp.c | 2 +- dlls/win32u/input.c | 12 +----------- dlls/win32u/main.c | 5 ----- dlls/win32u/message.c | 19 +++++++++++++------ dlls/win32u/win32syscalls.h | 6 ++---- dlls/win32u/win32u.spec | 1 - dlls/win32u/win32u_private.h | 3 +-- dlls/win32u/window.c | 6 ++++++ dlls/wineandroid.drv/keyboard.c | 2 +- dlls/wineandroid.drv/window.c | 4 ++-- dlls/winemac.drv/keyboard.c | 2 +- dlls/winemac.drv/mouse.c | 2 +- dlls/winewayland.drv/wayland_keyboard.c | 6 +++--- dlls/winewayland.drv/wayland_pointer.c | 8 ++++---- dlls/winex11.drv/keyboard.c | 2 +- dlls/winex11.drv/mouse.c | 8 ++++---- dlls/wow64win/user.c | 22 ++++++++++++++++------ include/ntuser.h | 14 ++++++++++++++ 19 files changed, 72 insertions(+), 54 deletions(-)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 62dc9f86379..1b5233e84b6 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -252,7 +252,7 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack input.hi.uMsg = WM_INPUT; input.hi.wParamH = 0; input.hi.wParamL = 0; - __wine_send_input( 0, &input, rawinput ); + NtUserSendHardwareInput( 0, 0, &input, (LPARAM)rawinput );
free( rawinput ); } diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index e2bdd82f567..afa217c539f 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -134,7 +134,7 @@ static void send_wm_input_device_change(BASE_DEVICE_EXTENSION *ext, LPARAM param input.hi.uMsg = WM_INPUT_DEVICE_CHANGE; input.hi.wParamH = 0; input.hi.wParamL = 0; - __wine_send_input(0, &input, &rawinput); + NtUserSendHardwareInput(0, 0, &input, (LPARAM)&rawinput); }
static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *bus_pdo) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index ef8d564c264..0f6b9482942 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -604,16 +604,6 @@ BOOL WINAPI NtUserAttachThreadInput( DWORD from, DWORD to, BOOL attach ) return ret; }
-/*********************************************************************** - * __wine_send_input (win32u.@) - * - * Internal SendInput function to allow the graphics driver to inject real events. - */ -BOOL WINAPI __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ) -{ - return set_ntstatus( send_hardware_message( hwnd, input, rawinput, 0 )); -} - /*********************************************************************** * update_mouse_coords * @@ -693,7 +683,7 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size ) update_mouse_coords( &input ); /* fallthrough */ case INPUT_KEYBOARD: - status = send_hardware_message( 0, &input, NULL, SEND_HWMSG_INJECTED ); + status = send_hardware_message( 0, SEND_HWMSG_INJECTED, &input, 0 ); break; case INPUT_HARDWARE: RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED ); diff --git a/dlls/win32u/main.c b/dlls/win32u/main.c index e06386da693..234120408f0 100644 --- a/dlls/win32u/main.c +++ b/dlls/win32u/main.c @@ -2162,11 +2162,6 @@ BOOL SYSCALL_API __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *siz SYSCALL_FUNC( __wine_get_icm_profile ); }
-BOOL SYSCALL_API __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ) -{ - SYSCALL_FUNC( __wine_send_input ); -} - #else /* __arm64ec__ */
#ifdef _WIN64 diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 08222fd460f..e0944ca64d8 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3482,7 +3482,7 @@ LRESULT send_internal_message_timeout( DWORD dest_pid, DWORD dest_tid, /*********************************************************************** * send_hardware_message */ -NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput, UINT flags ) +NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARAM lparam ) { struct send_message_info info; int prev_x, prev_y, new_x, new_y; @@ -3500,18 +3500,22 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r if (input->type == INPUT_MOUSE && (input->mi.dwFlags & (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_RIGHTDOWN))) clip_fullscreen_window( hwnd, FALSE );
- if (input->type == INPUT_HARDWARE && rawinput->header.dwType == RIM_TYPEHID) + if (input->type == INPUT_HARDWARE) { if (input->hi.uMsg == WM_INPUT_DEVICE_CHANGE) { + const RAWINPUT *rawinput = (const RAWINPUT *)lparam; hid_usage_page = ((USAGE *)rawinput->data.hid.bRawData)[0]; hid_usage = ((USAGE *)rawinput->data.hid.bRawData)[1]; } - if (input->hi.uMsg == WM_INPUT && - !rawinput_device_get_usages( rawinput->header.hDevice, &hid_usage_page, &hid_usage )) + if (input->hi.uMsg == WM_INPUT) { - WARN( "unable to get HID usages for device %p\n", rawinput->header.hDevice ); - return STATUS_INVALID_HANDLE; + const RAWINPUT *rawinput = (const RAWINPUT *)lparam; + if (!rawinput_device_get_usages( rawinput->header.hDevice, &hid_usage_page, &hid_usage )) + { + WARN( "unable to get HID usages for device %p\n", rawinput->header.hDevice ); + return STATUS_INVALID_HANDLE; + } } }
@@ -3549,6 +3553,8 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r { case WM_INPUT: case WM_INPUT_DEVICE_CHANGE: + { + const RAWINPUT *rawinput = (const RAWINPUT *)lparam; switch (rawinput->header.dwType) { case RIM_TYPEHID: @@ -3565,6 +3571,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r break; } } + } break; } ret = wine_server_call( req ); diff --git a/dlls/win32u/win32syscalls.h b/dlls/win32u/win32syscalls.h index da0ba39f771..6dedc3333a2 100644 --- a/dlls/win32u/win32syscalls.h +++ b/dlls/win32u/win32syscalls.h @@ -402,8 +402,7 @@ SYSCALL_ENTRY( 0x018e, NtUserWindowFromDC, 4 ) \ SYSCALL_ENTRY( 0x018f, NtUserWindowFromPoint, 8 ) \ SYSCALL_ENTRY( 0x0190, __wine_get_file_outline_text_metric, 16 ) \ - SYSCALL_ENTRY( 0x0191, __wine_get_icm_profile, 16 ) \ - SYSCALL_ENTRY( 0x0192, __wine_send_input, 12 ) + SYSCALL_ENTRY( 0x0191, __wine_get_icm_profile, 16 )
#define ALL_SYSCALLS64 \ SYSCALL_ENTRY( 0x0000, NtGdiAbortDoc, 8 ) \ @@ -807,5 +806,4 @@ SYSCALL_ENTRY( 0x018e, NtUserWindowFromDC, 8 ) \ SYSCALL_ENTRY( 0x018f, NtUserWindowFromPoint, 16 ) \ SYSCALL_ENTRY( 0x0190, __wine_get_file_outline_text_metric, 32 ) \ - SYSCALL_ENTRY( 0x0191, __wine_get_icm_profile, 32 ) \ - SYSCALL_ENTRY( 0x0192, __wine_send_input, 24 ) + SYSCALL_ENTRY( 0x0191, __wine_get_icm_profile, 32 ) diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 8aa241b1e7a..c2f51a014eb 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1322,4 +1322,3 @@
@ stdcall -syscall __wine_get_icm_profile(long long ptr ptr) @ stdcall -syscall __wine_get_file_outline_text_metric(wstr ptr ptr ptr) -@ stdcall -syscall __wine_send_input(long ptr ptr) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index d5f010a8249..eba9a3389eb 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -131,8 +131,7 @@ extern void track_mouse_menu_bar( HWND hwnd, INT ht, int x, int y ); /* message.c */ extern BOOL kill_system_timer( HWND hwnd, UINT_PTR id ); extern BOOL reply_message_result( LRESULT result ); -extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput, - UINT flags ); +extern NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARAM lparam ); extern LRESULT send_internal_message_timeout( DWORD dest_pid, DWORD dest_tid, UINT msg, WPARAM wparam, LPARAM lparam, UINT flags, UINT timeout, PDWORD_PTR res_ptr ); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 69dd8caba5d..73a0fa9e896 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5590,6 +5590,12 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) case NtUserCallHwndParam_ShowOwnedPopups: return show_owned_popups( hwnd, param );
+ case NtUserCallHwndParam_SendHardwareInput: + { + struct send_hardware_input_params *params = (void *)param; + return send_hardware_message( hwnd, params->flags, params->input, params->lparam ); + } + /* temporary exports */ case NtUserSetWindowStyle: { diff --git a/dlls/wineandroid.drv/keyboard.c b/dlls/wineandroid.drv/keyboard.c index 9f369094949..b0380d147da 100644 --- a/dlls/wineandroid.drv/keyboard.c +++ b/dlls/wineandroid.drv/keyboard.c @@ -680,7 +680,7 @@ static void send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags ) input.ki.time = 0; input.ki.dwExtraInfo = 0;
- __wine_send_input( hwnd, &input, NULL ); + NtUserSendHardwareInput( hwnd, 0, &input, 0 ); }
/*********************************************************************** diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index d62a2c53909..ed7ee808b29 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -514,7 +514,7 @@ static int process_events( DWORD mask ) } SERVER_END_REQ; } - __wine_send_input( capture ? capture : event->data.motion.hwnd, &event->data.motion.input, NULL ); + NtUserSendHardwareInput( capture ? capture : event->data.motion.hwnd, &event->data.motion.input, 0, 0 ); } break;
@@ -528,7 +528,7 @@ static int process_events( DWORD mask ) event->data.kbd.input.ki.wVk, event->data.kbd.input.ki.wVk, event->data.kbd.input.ki.wScan ); update_keyboard_lock_state( event->data.kbd.input.ki.wVk, event->data.kbd.lock_state ); - __wine_send_input( 0, &event->data.kbd.input, NULL ); + NtUserSendHardwareInput( 0, 0, &event->data.kbd.input, 0 ); break;
default: diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index bf1daa7a5df..474ca499961 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -1001,7 +1001,7 @@ static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, unsigned input.ki.time = time; input.ki.dwExtraInfo = 0;
- __wine_send_input(hwnd, &input, NULL); + NtUserSendHardwareInput(hwnd, 0, &input, 0); }
diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c index 2f05a33a8b5..a87654e9885 100644 --- a/dlls/winemac.drv/mouse.c +++ b/dlls/winemac.drv/mouse.c @@ -158,7 +158,7 @@ static void send_mouse_input(HWND hwnd, macdrv_window cocoa_window, UINT flags, input.mi.time = time; input.mi.dwExtraInfo = 0;
- __wine_send_input(top_level_hwnd, &input, NULL); + NtUserSendHardwareInput(top_level_hwnd, 0, &input, 0); }
diff --git a/dlls/winewayland.drv/wayland_keyboard.c b/dlls/winewayland.drv/wayland_keyboard.c index a5d01fe1f08..04a1c0a9fc3 100644 --- a/dlls/winewayland.drv/wayland_keyboard.c +++ b/dlls/winewayland.drv/wayland_keyboard.c @@ -642,7 +642,7 @@ static void release_all_keys(HWND hwnd) input.ki.wScan = scan & 0xff; input.ki.dwFlags = KEYEVENTF_KEYUP; if (scan & ~0xff) input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY; - __wine_send_input(hwnd, &input, NULL); + NtUserSendHardwareInput(hwnd, 0, &input, 0); } } } @@ -805,7 +805,7 @@ static void send_right_control(HWND hwnd, uint32_t state) input.ki.wVk = VK_RCONTROL; input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY; if (state == WL_KEYBOARD_KEY_STATE_RELEASED) input.ki.dwFlags |= KEYEVENTF_KEYUP; - __wine_send_input(hwnd, &input, NULL); + NtUserSendHardwareInput(hwnd, 0, &input, 0); }
static void keyboard_handle_key(void *data, struct wl_keyboard *wl_keyboard, @@ -829,7 +829,7 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *wl_keyboard, if (scan & ~0xff) input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY;
if (state == WL_KEYBOARD_KEY_STATE_RELEASED) input.ki.dwFlags |= KEYEVENTF_KEYUP; - __wine_send_input(hwnd, &input, NULL); + NtUserSendHardwareInput(hwnd, 0, &input, 0); }
static void keyboard_handle_modifiers(void *data, struct wl_keyboard *wl_keyboard, diff --git a/dlls/winewayland.drv/wayland_pointer.c b/dlls/winewayland.drv/wayland_pointer.c index 54dd7931b6e..df76a4e9954 100644 --- a/dlls/winewayland.drv/wayland_pointer.c +++ b/dlls/winewayland.drv/wayland_pointer.c @@ -86,7 +86,7 @@ static void pointer_handle_motion_internal(wl_fixed_t sx, wl_fixed_t sy) hwnd, wl_fixed_to_double(sx), wl_fixed_to_double(sy), (int)screen.x, (int)screen.y);
- __wine_send_input(hwnd, &input, NULL); + NtUserSendHardwareInput(hwnd, 0, &input, 0); }
static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer, @@ -185,7 +185,7 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
TRACE("hwnd=%p button=%#x state=%u\n", hwnd, button, state);
- __wine_send_input(hwnd, &input, NULL); + NtUserSendHardwareInput(hwnd, 0, &input, 0); }
static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer, @@ -232,7 +232,7 @@ static void pointer_handle_axis_discrete(void *data, struct wl_pointer *wl_point
TRACE("hwnd=%p axis=%u discrete=%d\n", hwnd, axis, discrete);
- __wine_send_input(hwnd, &input, NULL); + NtUserSendHardwareInput(hwnd, 0, &input, 0); }
static const struct wl_pointer_listener pointer_listener = @@ -317,7 +317,7 @@ static void relative_pointer_v1_relative_motion(void *data, hwnd, wl_fixed_to_double(dx), wl_fixed_to_double(dy), (int)screen.x, (int)screen.y);
- __wine_send_input(hwnd, &input, NULL); + NtUserSendHardwareInput(hwnd, 0, &input, 0); }
static const struct zwp_relative_pointer_v1_listener relative_pointer_v1_listener = diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index dde74303bad..23f07b851a7 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1131,7 +1131,7 @@ static void X11DRV_send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, UINT fl input.ki.time = time; input.ki.dwExtraInfo = 0;
- __wine_send_input( hwnd, &input, NULL ); + NtUserSendHardwareInput( hwnd, 0, &input, 0 ); }
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index bdbd559b107..03c2152b76b 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -524,7 +524,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU { struct x11drv_thread_data *thread_data = x11drv_thread_data(); if (!thread_data->clipping_cursor || thread_data->clip_window != window) return; - __wine_send_input( hwnd, input, NULL ); + NtUserSendHardwareInput( hwnd, 0, input, 0 ); return; }
@@ -551,7 +551,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU SERVER_END_REQ; }
- __wine_send_input( hwnd, input, NULL ); + NtUserSendHardwareInput( hwnd, 0, input, 0 ); }
#ifdef SONAME_LIBXCURSOR @@ -1494,7 +1494,7 @@ void move_resize_window( HWND hwnd, int dir ) input.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; input.mi.time = NtGetTickCount(); input.mi.dwExtraInfo = 0; - __wine_send_input( hwnd, &input, NULL ); + NtUserSendHardwareInput( hwnd, 0, &input, 0 ); }
while (NtUserPeekMessage( &msg, 0, 0, 0, PM_REMOVE )) @@ -1722,7 +1722,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.mi.dy = 0; if (!map_raw_event_coords( event, &input )) return FALSE;
- __wine_send_input( 0, &input, NULL ); + NtUserSendHardwareInput( 0, 0, &input, 0 ); return TRUE; }
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index ff3f92c81fe..9a293826ba9 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -1710,6 +1710,22 @@ NTSTATUS WINAPI wow64_NtUserCallHwndParam( UINT *args ) return NtUserCallHwndParam( hwnd, (UINT_PTR)¶ms, code ); }
+ case NtUserCallHwndParam_SendHardwareInput: + { + struct + { + UINT flags; + ULONG input; + ULONG lparam; + } *params32 = UlongToPtr( param ); + struct send_hardware_input_params params; + + params.flags = params32->flags; + params.input = UlongToPtr( params32->input ); + params.lparam = params32->lparam; + return NtUserCallHwndParam( hwnd, (UINT_PTR)¶ms, code ); + } + default: return NtUserCallHwndParam( hwnd, param, code ); } @@ -4875,9 +4891,3 @@ NTSTATUS WINAPI wow64_NtUserDisplayConfigGetDeviceInfo( UINT *args )
return NtUserDisplayConfigGetDeviceInfo( packet ); } - -NTSTATUS WINAPI wow64___wine_send_input( UINT *args ) -{ - ERR( "not supported\n" ); - return 0; -} diff --git a/include/ntuser.h b/include/ntuser.h index 9cf23373cdc..eb8c95ac8b4 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1236,6 +1236,7 @@ enum NtUserCallHwndParam_SetMDIClientInfo, NtUserCallHwndParam_SetWindowContextHelpId, NtUserCallHwndParam_ShowOwnedPopups, + NtUserCallHwndParam_SendHardwareInput, /* temporary exports */ NtUserSetWindowStyle, }; @@ -1406,6 +1407,19 @@ static inline BOOL NtUserShowOwnedPopups( HWND hwnd, BOOL show ) return NtUserCallHwndParam( hwnd, show, NtUserCallHwndParam_ShowOwnedPopups ); }
+struct send_hardware_input_params +{ + UINT flags; + const INPUT *input; + LPARAM lparam; /* RAWINPUT pointer for WM_INPUT* messages */ +}; + +static inline BOOL NtUserSendHardwareInput( HWND hwnd, UINT flags, const INPUT *input, LPARAM lparam ) +{ + struct send_hardware_input_params params = {.flags = flags, .input = input, .lparam = lparam}; + return NtUserCallHwndParam( hwnd, (UINT_PTR)¶ms, NtUserCallHwndParam_SendHardwareInput ); +} + /* Wine extensions */ W32KAPI BOOL WINAPI __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput );