diff --git a/dlls/user32/message.c b/dlls/user32/message.c index f87ef9fb3af..148b35f8caf 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -35,6 +35,7 @@ #include "dbt.h" #include "dde.h" #include "imm.h" +#include "hidusage.h" #include "ddk/imm.h" #include "wine/server.h" #include "user_private.h" @@ -3233,6 +3234,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r struct send_message_info info; int prev_x, prev_y, new_x, new_y; INT counter = global_key_state_counter; + USAGE hid_usage_page, hid_usage; NTSTATUS ret; BOOL wait; @@ -3242,6 +3244,15 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r info.flags = 0; info.timeout = 0; + if (input->type == INPUT_HARDWARE && rawinput->header.dwType == RIM_TYPEHID) + { + if (input->u.hi.uMsg == WM_INPUT_DEVICE_CHANGE) + { + hid_usage_page = ((USAGE *)rawinput->data.hid.bRawData)[0]; + hid_usage = ((USAGE *)rawinput->data.hid.bRawData)[1]; + } + } + SERVER_START_REQ( send_hardware_message ) { req->win = wine_server_user_handle( hwnd ); @@ -3267,6 +3278,24 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r case INPUT_HARDWARE: req->input.hw.msg = input->u.hi.uMsg; req->input.hw.lparam = MAKELONG( input->u.hi.wParamL, input->u.hi.wParamH ); + switch (input->u.hi.uMsg) + { + case WM_INPUT_DEVICE_CHANGE: + req->input.hw.rawinput.type = rawinput->header.dwType; + switch (rawinput->header.dwType) + { + case RIM_TYPEHID: + assert( rawinput->data.hid.dwCount <= 1 ); + req->input.hw.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice ); + req->input.hw.rawinput.hid.param = rawinput->header.wParam; + req->input.hw.rawinput.hid.usage_page = hid_usage_page; + req->input.hw.rawinput.hid.usage = hid_usage; + break; + default: + assert( 0 ); + break; + } + } break; } if (key_state_info) wine_server_set_reply( req, key_state_info->state,