Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/driver_hid.c | 3 --- dlls/dinput8/tests/driver_hid.h | 1 - dlls/dinput8/tests/hid.c | 3 --- dlls/hidclass.sys/device.c | 17 ++++++----------- 4 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/dlls/dinput8/tests/driver_hid.c b/dlls/dinput8/tests/driver_hid.c index 7d613f1d92c..91f420d7bf6 100644 --- a/dlls/dinput8/tests/driver_hid.c +++ b/dlls/dinput8/tests/driver_hid.c @@ -389,7 +389,6 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp ) winetest_push_context( "%s expect[%d]", expect.context, index ); ok( expect.code == code, "got %#x, expected %#x\n", expect.code, code ); ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId ); - todo_wine_if( expect.todo_report_len ) ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen ); ok( RtlCompareMemory( packet->reportBuffer, expect.report_buf, expect.report_len ) == expect.report_len, "unexpected data\n" ); @@ -439,7 +438,6 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp ) winetest_push_context( "%s expect[%d]", expect.context, index ); ok( expect.code == code, "got %#x, expected %#x\n", expect.code, code ); ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId ); - todo_wine_if( expect.todo_report_len ) ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen ); ok( RtlCompareMemory( packet->reportBuffer, expect.report_buf, expect.report_len ) == expect.report_len, "unexpected data\n" ); @@ -489,7 +487,6 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp ) winetest_push_context( "%s expect[%d]", expect.context, index ); ok( expect.code == code, "got %#x, expected %#x\n", expect.code, code ); ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId ); - todo_wine_if( expect.todo_report_len ) ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen ); ok( RtlCompareMemory( packet->reportBuffer, expect.report_buf, expect.report_len ) == expect.report_len, "unexpected data\n" ); diff --git a/dlls/dinput8/tests/driver_hid.h b/dlls/dinput8/tests/driver_hid.h index e7202594c25..c9c75c6d081 100644 --- a/dlls/dinput8/tests/driver_hid.h +++ b/dlls/dinput8/tests/driver_hid.h @@ -48,7 +48,6 @@ struct hid_expect DWORD ret_status; BYTE broken; /* missing on some win versions */ BYTE report_id; - BYTE todo_report_len; BYTE report_len; BYTE report_buf[128]; char context[64]; diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 5bcfc5b9f83..85ccc2a05df 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -946,7 +946,6 @@ static void test_hidp_set_feature( HANDLE file, int report_id, ULONG report_len, { .code = IOCTL_HID_SET_FEATURE, .report_id = report_id, - .todo_report_len = TRUE, .report_len = report_len - (report_id ? 0 : 1), .report_buf = { @@ -1048,7 +1047,6 @@ static void test_hidp_set_output( HANDLE file, int report_id, ULONG report_len, { .code = IOCTL_HID_SET_OUTPUT_REPORT, .report_id = report_id, - .todo_report_len = TRUE, .report_len = report_len - (report_id ? 0 : 1), .report_buf = {report_id,0,0xcd,0xcd,0xcd}, .ret_length = 3, @@ -1135,7 +1133,6 @@ static void test_write_file( HANDLE file, int report_id, ULONG report_len ) { .code = IOCTL_HID_WRITE_REPORT, .report_id = report_id, - .todo_report_len = report_id == 0, .report_len = report_len - (report_id ? 0 : 1), .report_buf = {report_id ? report_id : 0xcd,0xcd,0xcd,0xcd,0xcd}, .ret_length = 3, diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 9b91834267e..71fb4a366db 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -365,7 +365,7 @@ static void hid_device_xfer_report( BASE_DEVICE_EXTENSION *ext, ULONG code, IRP HIDP_REPORT_IDS *reports = ext->u.pdo.device_desc.ReportIDs; ULONG report_count = ext->u.pdo.device_desc.ReportIDsLength; IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation( irp ); - ULONG i, report_len = 0, buffer_len = 0; + ULONG i, offset = 0, report_len = 0, buffer_len = 0; HID_XFER_PACKET packet; BYTE *buffer = NULL;
@@ -402,6 +402,7 @@ static void hid_device_xfer_report( BASE_DEVICE_EXTENSION *ext, ULONG code, IRP irp->IoStatus.Status = STATUS_INVALID_PARAMETER; return; } + if (!reports[i].ReportID) offset = 1;
switch (code) { @@ -423,26 +424,20 @@ static void hid_device_xfer_report( BASE_DEVICE_EXTENSION *ext, ULONG code, IRP return; }
- packet.reportId = buffer[0]; - packet.reportBuffer = buffer; - packet.reportBufferLen = buffer_len; - - if (!reports[i].ReportID) - { - packet.reportId = 0; - packet.reportBuffer++; - packet.reportBufferLen--; - } + packet.reportId = reports[i].ReportID; + packet.reportBuffer = buffer + offset;
switch (code) { case IOCTL_HID_GET_FEATURE: case IOCTL_HID_GET_INPUT_REPORT: + packet.reportBufferLen = buffer_len - offset; call_minidriver( code, ext->u.pdo.parent_fdo, NULL, 0, &packet, sizeof(packet), &irp->IoStatus ); break; case IOCTL_HID_SET_FEATURE: case IOCTL_HID_SET_OUTPUT_REPORT: case IOCTL_HID_WRITE_REPORT: + packet.reportBufferLen = report_len - offset; call_minidriver( code, ext->u.pdo.parent_fdo, NULL, sizeof(packet), &packet, 0, &irp->IoStatus ); if (code == IOCTL_HID_WRITE_REPORT && packet.reportId) irp->IoStatus.Information--; break;