From 9411ecf6707bd40eddca4e21f43e1b09282db7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 4 Oct 2021 10:18:14 +0200 Subject: [PATCH] hidclass.sys: Drop reports when length doesn't match their declaration. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on a patch from Ivo Ivanov . Instead of using the descriptor input report length, which is the maximum length of all input reports. Tests show that the reports should be dropped, in non-polled mode, when their length is invalid, but we were dropping too many of them. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51828 Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/hidclass.sys/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 6530efcdb84..e4592c4d242 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -349,7 +349,8 @@ static DWORD CALLBACK hid_device_thread(void *args) packet->reportBuffer = buffer; packet->reportBufferLen = io.Information; - if (polled || io.Information == desc->InputLength) + report = find_report_with_type_and_id( ext, HidP_Input, buffer[0], FALSE ); + if (polled || (report && report->InputLength == io.Information)) hid_device_queue_input( device, packet ); }