Aric Stewart : hidclass.sys: IOCTL_HID_GET_INPUT_REPORT has report ID as first byte.
Alexandre Julliard
julliard at winehq.org
Thu Feb 2 15:49:27 CST 2017
Module: wine
Branch: master
Commit: 1ccb1719cb33c15c7a25854e9fdeef376104a6ec
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1ccb1719cb33c15c7a25854e9fdeef376104a6ec
Author: Aric Stewart <aric at codeweavers.com>
Date: Thu Feb 2 10:35:55 2017 -0600
hidclass.sys: IOCTL_HID_GET_INPUT_REPORT has report ID as first byte.
Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/hid/tests/device.c | 1 +
dlls/hidclass.sys/device.c | 27 +++++++++++++++++++--------
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/dlls/hid/tests/device.c b/dlls/hid/tests/device.c
index ff47e30..91fade4 100644
--- a/dlls/hid/tests/device.c
+++ b/dlls/hid/tests/device.c
@@ -356,6 +356,7 @@ static void test_get_input_report(void)
if (rc)
{
+ ok(data[0] == 0, "Report ID (0) is not the first byte of the data\n");
report[0] = 0;
for (i = 0; i < Caps.InputReportByteLength && i < Caps.InputReportByteLength; i++)
{
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index ff9655e..40d458a 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -584,19 +584,30 @@ NTSTATUS WINAPI HID_Device_ioctl(DEVICE_OBJECT *device, IRP *irp)
}
case IOCTL_HID_GET_INPUT_REPORT:
{
- HID_XFER_PACKET packet;
+ HID_XFER_PACKET *packet;
+ UINT packet_size = sizeof(*packet) + irpsp->Parameters.DeviceIoControl.OutputBufferLength;
BYTE *buffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress, NormalPagePriority);
+ ULONG out_length;
+
+ packet = HeapAlloc(GetProcessHeap(), 0, packet_size);
if (extension->preparseData->InputReports[0].reportID)
- packet.reportId = buffer[0];
+ packet->reportId = buffer[0];
else
- packet.reportId = 0;
- packet.reportBuffer = buffer;
- packet.reportBufferLen = irpsp->Parameters.DeviceIoControl.OutputBufferLength;
+ packet->reportId = 0;
+ packet->reportBuffer = (BYTE *)packet + sizeof(*packet);
+ packet->reportBufferLen = irpsp->Parameters.DeviceIoControl.OutputBufferLength - 1;
- call_minidriver(IOCTL_HID_GET_INPUT_REPORT, device, NULL, 0, &packet, sizeof(packet));
- irp->IoStatus.Information = packet.reportBufferLen;
- irp->IoStatus.u.Status = STATUS_SUCCESS;
+ rc = call_minidriver(IOCTL_HID_GET_INPUT_REPORT, device, NULL, 0, packet, sizeof(*packet));
+ if (rc == STATUS_SUCCESS)
+ {
+ rc = copy_packet_into_buffer(packet, buffer, irpsp->Parameters.DeviceIoControl.OutputBufferLength, &out_length);
+ irp->IoStatus.Information = out_length;
+ }
+ else
+ irp->IoStatus.Information = 0;
+ irp->IoStatus.u.Status = rc;
+ HeapFree(GetProcessHeap(), 0, packet);
break;
}
case IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS:
More information about the wine-cvs
mailing list