Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/input.c | 16 ++++++++++++---- dlls/user32/tests/input.c | 15 +++++++-------- 2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 22e53585f00..e97264960ea 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -180,7 +180,7 @@ static void update_mouse_coords( INPUT *input ) UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size ) { UINT i; - NTSTATUS status; + NTSTATUS status = STATUS_SUCCESS;
if (size != sizeof(INPUT)) { @@ -202,14 +202,22 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
for (i = 0; i < count; i++) { - if (inputs[i].type == INPUT_MOUSE) + INPUT input = inputs[i]; + switch (input.type) { + case INPUT_MOUSE: /* we need to update the coordinates to what the server expects */ - INPUT input = inputs[i]; update_mouse_coords( &input ); + /* fallthrough */ + case INPUT_KEYBOARD: status = send_hardware_message( 0, &input, SEND_HWMSG_INJECTED ); + break; +#ifdef _WIN64 + case INPUT_HARDWARE: + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return 0; +#endif } - else status = send_hardware_message( 0, &inputs[i], SEND_HWMSG_INJECTED );
if (status) { diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index f48807a27a0..564ab2e1ba0 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -4286,13 +4286,12 @@ static void test_SendInput(void) SetLastError( 0xdeadbeef ); res = SendInput( 16, input, sizeof(*input) ); #ifdef _WIN64 - todo_wine ok( res == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED, "SendInput returned %u, error %#x\n", res, GetLastError() ); #else ok( res == 16 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#x\n", res, GetLastError() ); #endif while ((res = wait_for_message(&msg)) && msg.message == WM_TIMER) DispatchMessageA(&msg); - todo_wine ok( !res, "SendInput triggered unexpected message %#x\n", msg.message ); + ok( !res, "SendInput triggered unexpected message %#x\n", msg.message ); empty_message_queue();
memset( input, 0, sizeof(input) ); @@ -4306,27 +4305,27 @@ static void test_SendInput(void) SetLastError( 0xdeadbeef ); res = SendInput( 16, input, sizeof(*input) ); #ifdef _WIN64 - todo_wine ok( res == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED, "SendInput returned %u, error %#x\n", res, GetLastError() ); + ok( res == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED, "SendInput returned %u, error %#x\n", res, GetLastError() ); while ((res = wait_for_message(&msg)) && msg.message == WM_TIMER) DispatchMessageA(&msg); - todo_wine ok( !res, "SendInput triggered unexpected message %#x\n", msg.message ); + ok( !res, "SendInput triggered unexpected message %#x\n", msg.message ); empty_message_queue(); #else ok( res == 16 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#x\n", res, GetLastError() ); while ((res = wait_for_message(&msg)) && msg.message == WM_TIMER) DispatchMessageA(&msg); ok( !!res, "SendInput did not trigger any message\n" ); - todo_wine ok( msg.message == WM_KEYDOWN, "SendInput triggered unexpected message %#x\n", msg.message ); + ok( msg.message == WM_KEYDOWN, "SendInput triggered unexpected message %#x\n", msg.message ); while ((res = wait_for_message(&msg)) && msg.message == WM_TIMER) DispatchMessageA(&msg); ok( !!res, "SendInput did not trigger any message\n" ); - todo_wine ok( msg.message == WM_KEYUP, "SendInput triggered unexpected message %#x\n", msg.message ); + ok( msg.message == WM_KEYUP, "SendInput triggered unexpected message %#x\n", msg.message ); empty_message_queue(); #endif
for (i = 0; i < ARRAY_SIZE(input); ++i) input[i].type = INPUT_HARDWARE + 1; SetLastError( 0xdeadbeef ); res = SendInput( 16, input, sizeof(*input) ); - todo_wine ok( res == 16 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#x\n", res, GetLastError() ); + ok( res == 16 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#x\n", res, GetLastError() ); while ((res = wait_for_message(&msg)) && msg.message == WM_TIMER) DispatchMessageA(&msg); - todo_wine ok( !res, "SendInput triggered unexpected message %#x\n", msg.message ); + ok( !res, "SendInput triggered unexpected message %#x\n", msg.message ); empty_message_queue();
trace( "done\n" );