Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/message.c | 4 +++- dlls/user32/rawinput.c | 4 ++-- server/protocol.def | 3 +++ server/queue.c | 15 ++++++++++++++- server/trace.c | 4 ++-- tools/make_requests | 2 +- 6 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 886c10e36bd..59b1924e263 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -3298,11 +3298,13 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r 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; + req->input.hw.rawinput.hid.count = rawinput->data.hid.dwCount; + req->input.hw.rawinput.hid.length = rawinput->data.hid.dwSizeHid; + wine_server_add_data( req, rawinput->data.hid.bRawData, rawinput->data.hid.dwCount * rawinput->data.hid.dwSizeHid ); break; default: assert( 0 ); diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c index 87f7175a6c1..41d627c62c2 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c @@ -397,8 +397,8 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms rawinput->header.hDevice = ULongToHandle( msg_data->rawinput.hid.device ); rawinput->header.wParam = 0;
- rawinput->data.hid.dwCount = 0; - rawinput->data.hid.dwSizeHid = 0; + rawinput->data.hid.dwCount = msg_data->rawinput.hid.count; + rawinput->data.hid.dwSizeHid = msg_data->rawinput.hid.length; memcpy( rawinput->data.hid.bRawData, msg_data + 1, size ); } else diff --git a/server/protocol.def b/server/protocol.def index 6a185b822e7..8b8b9844221 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -302,6 +302,8 @@ union rawinput unsigned int param; /* rawinput message param */ unsigned short usage_page;/* HID usage page */ unsigned short usage; /* HID usage */ + unsigned int count; /* HID report count */ + unsigned int length; /* HID report length */ } hid; };
@@ -2033,6 +2035,7 @@ enum message_type user_handle_t win; /* window handle */ hw_input_t input; /* input data */ unsigned int flags; /* flags (see below) */ + VARARG(report,bytes); /* HID report data */ @REPLY int wait; /* do we need to wait for a reply? */ int prev_x; /* previous cursor position */ diff --git a/server/queue.c b/server/queue.c index 76ee469ffef..e4903bcb79f 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1995,6 +1995,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ struct hardware_msg_data *msg_data; struct rawinput_message raw_msg; struct message *msg; + data_size_t report_size = 0;
switch (input->hw.msg) { @@ -2007,9 +2008,21 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ raw_msg.message = input->hw.msg; raw_msg.hid_report = NULL;
+ if (input->hw.rawinput.type == RIM_TYPEHID) + { + raw_msg.hid_report = get_req_data(); + report_size = input->hw.rawinput.hid.length * input->hw.rawinput.hid.count; + } + + if (report_size != get_req_data_size()) + { + set_error( STATUS_INVALID_PARAMETER ); + return; + } + msg_data = &raw_msg.data; msg_data->info = 0; - msg_data->size = sizeof(*msg_data); + msg_data->size = sizeof(*msg_data) + report_size; msg_data->flags = 0; msg_data->rawinput = input->hw.rawinput;
diff --git a/server/trace.c b/server/trace.c index 5e1c7675b0a..d84f4c9543a 100644 --- a/server/trace.c +++ b/server/trace.c @@ -408,9 +408,9 @@ static void dump_rawinput( const char *prefix, const union rawinput *rawinput ) rawinput->kbd.message, rawinput->kbd.vkey, rawinput->kbd.scan ); break; case RIM_TYPEHID: - fprintf( stderr, "%s{type=HID,device=%04x,param=%04x,page=%04hx,usage=%04hx}", + fprintf( stderr, "%s{type=HID,device=%04x,param=%04x,page=%04hx,usage=%04hx,count=%u,length=%u}", prefix, rawinput->hid.device, rawinput->hid.param, rawinput->hid.usage_page, - rawinput->hid.usage ); + rawinput->hid.usage, rawinput->hid.count, rawinput->hid.length ); break; default: fprintf( stderr, "%s{type=%04x}", prefix, rawinput->type ); diff --git a/tools/make_requests b/tools/make_requests index a70b29df3d2..1c4e5977c8b 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -52,7 +52,7 @@ my %formats = "luid_t" => [ 8, 4, "&dump_luid" ], "generic_map_t" => [ 16, 4, "&dump_generic_map" ], "ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ], - "hw_input_t" => [ 32, 8, "&dump_hw_input" ], + "hw_input_t" => [ 40, 8, "&dump_hw_input" ], );
my @requests = ();