Aric Stewart : hidclass.sys: Improvements for IOCTL_HID_GET_FEATURE handling.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 5 11:07:34 CDT 2016


Module: wine
Branch: master
Commit: be91fcd879a1de768a57b4a06be470c10313b08d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=be91fcd879a1de768a57b4a06be470c10313b08d

Author: Aric Stewart <aric at codeweavers.com>
Date:   Tue Apr  5 08:43:48 2016 -0500

hidclass.sys: Improvements for IOCTL_HID_GET_FEATURE handling.

Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hidclass.sys/device.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index 2900d9e..aae4e5f 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -437,11 +437,11 @@ static NTSTATUS HID_get_feature(DEVICE_OBJECT *device, IRP *irp)
     HID_XFER_PACKET *packet;
     DWORD len;
     NTSTATUS rc = STATUS_SUCCESS;
-    WCHAR *out_buffer;
+    BYTE *out_buffer;
 
     irp->IoStatus.Information = 0;
 
-    out_buffer = (WCHAR*)(((BYTE*)irp->MdlAddress->StartVa) + irp->MdlAddress->ByteOffset);
+    out_buffer = (((BYTE*)irp->MdlAddress->StartVa) + irp->MdlAddress->ByteOffset);
     TRACE_(hid_report)("Device %p Buffer length %i Buffer %p\n", device, irpsp->Parameters.DeviceIoControl.OutputBufferLength, out_buffer);
 
     len = sizeof(*packet) + irpsp->Parameters.DeviceIoControl.OutputBufferLength;
@@ -452,16 +452,21 @@ static NTSTATUS HID_get_feature(DEVICE_OBJECT *device, IRP *irp)
 
     TRACE_(hid_report)("(id %i, len %i buffer %p)\n", packet->reportId, packet->reportBufferLen, packet->reportBuffer);
 
-    rc = call_minidriver(IOCTL_HID_GET_FEATURE, device, NULL, 0, packet, len);
+    rc = call_minidriver(IOCTL_HID_GET_FEATURE, device, NULL, 0, packet, sizeof(*packet));
 
     irp->IoStatus.u.Status = rc;
     if (irp->IoStatus.u.Status == STATUS_SUCCESS)
-        irp->IoStatus.Information = irpsp->Parameters.DeviceIoControl.OutputBufferLength;
+    {
+        irp->IoStatus.Information = packet->reportBufferLen;
+        memcpy(out_buffer, packet->reportBuffer, packet->reportBufferLen);
+    }
     else
         irp->IoStatus.Information = 0;
 
     TRACE_(hid_report)("Result 0x%x get %li bytes\n", rc, irp->IoStatus.Information);
 
+    HeapFree(GetProcessHeap(), 0, packet);
+
     return rc;
 }
 




More information about the wine-cvs mailing list