[PATCH 1/3] hidclass.sys: Use the report length when copying report data.

Rémi Bernon rbernon at codeweavers.com
Mon Oct 4 03:18:12 CDT 2021


From: Ivo Ivanov <logos128 at gmail.com>

Instead of the HID descriptor input report length.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51828
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/hidclass.sys/device.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index 026ec1efeb1..632e98ab740 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -216,7 +216,6 @@ static struct hid_report *hid_queue_pop_report( struct hid_queue *queue )
 static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *packet )
 {
     BASE_DEVICE_EXTENSION *ext = device->DeviceExtension;
-    HIDP_COLLECTION_DESC *desc = ext->u.pdo.device_desc.CollectionDesc;
     const BOOL polled = ext->u.pdo.information.Polled;
     struct hid_report *last_report, *report;
     struct hid_queue *queue;
@@ -270,7 +269,7 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack
             if (!(irp = hid_queue_pop_irp( queue ))) break;
             if (!(report = hid_queue_pop_report( queue ))) hid_report_incref( (report = last_report) );
 
-            memcpy( irp->AssociatedIrp.SystemBuffer, report->buffer, desc->InputLength );
+            memcpy( irp->AssociatedIrp.SystemBuffer, report->buffer, report->length );
             irp->IoStatus.Information = report->length;
             irp->IoStatus.Status = STATUS_SUCCESS;
             hid_report_decref( report );
@@ -652,7 +651,7 @@ NTSTATUS WINAPI pdo_read(DEVICE_OBJECT *device, IRP *irp)
     irp->IoStatus.Information = 0;
     if ((report = hid_queue_pop_report( queue )))
     {
-        memcpy( irp->AssociatedIrp.SystemBuffer, report->buffer, desc->InputLength );
+        memcpy( irp->AssociatedIrp.SystemBuffer, report->buffer, report->length );
         irp->IoStatus.Information = report->length;
         irp->IoStatus.Status = STATUS_SUCCESS;
         hid_report_decref( report );
-- 
2.33.0




More information about the wine-devel mailing list