From fc1485b86b8554cacb0066162feee094de799583 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Wed, 26 Oct 2016 12:46:12 -0500 Subject: [PATCH] hid: Implement HidD_SetOutputReport. Signed-off-by: Aric Stewart Signed-off-by: Sebastian Lackner Signed-off-by: Alexandre Julliard --- dlls/hid/hid.spec | 2 +- dlls/hid/hidd.c | 6 ++++++ dlls/hidclass.sys/device.c | 12 ++++++------ include/ddk/hidsdi.h | 1 + 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/dlls/hid/hid.spec b/dlls/hid/hid.spec index 2131af27928..91a83f6f1f9 100644 --- a/dlls/hid/hid.spec +++ b/dlls/hid/hid.spec @@ -17,7 +17,7 @@ @ stub HidD_SetConfiguration @ stdcall HidD_SetFeature(long ptr long) @ stdcall HidD_SetNumInputBuffers(long long) -@ stub HidD_SetOutputReport +@ stdcall HidD_SetOutputReport(long ptr long) @ stdcall HidP_GetButtonCaps(long ptr ptr ptr) @ stdcall HidP_GetCaps(ptr ptr) @ stub HidP_GetData diff --git a/dlls/hid/hidd.c b/dlls/hid/hidd.c index 31220ec4909..99665dd1319 100644 --- a/dlls/hid/hidd.c +++ b/dlls/hid/hidd.c @@ -133,3 +133,9 @@ BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DAT *PreparsedData = data; return TRUE; } + +BOOLEAN WINAPI HidD_SetOutputReport(HANDLE HidDeviceObject, void *ReportBuffer, ULONG ReportBufferLength) +{ + TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength); + return DeviceIoControl(HidDeviceObject, IOCTL_HID_SET_OUTPUT_REPORT, ReportBuffer, ReportBufferLength, NULL, 0, NULL, NULL); +} diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 45f88ebbe76..bc871b9ad19 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -463,21 +463,20 @@ static NTSTATUS HID_get_feature(DEVICE_OBJECT *device, IRP *irp) return rc; } -static NTSTATUS HID_set_feature(DEVICE_OBJECT *device, IRP *irp) +static NTSTATUS HID_set_to_device(DEVICE_OBJECT *device, IRP *irp) { - IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp ); + IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp); HID_XFER_PACKET packet; NTSTATUS rc; - irp->IoStatus.Information = 0; - TRACE_(hid_report)("Device %p Buffer length %i Buffer %p\n", device, irpsp->Parameters.DeviceIoControl.InputBufferLength, irp->AssociatedIrp.SystemBuffer); packet.reportBuffer = irp->AssociatedIrp.SystemBuffer; packet.reportId = ((char*)irp->AssociatedIrp.SystemBuffer)[0]; packet.reportBufferLen = irpsp->Parameters.DeviceIoControl.InputBufferLength; TRACE_(hid_report)("(id %i, len %i buffer %p)\n", packet.reportId, packet.reportBufferLen, packet.reportBuffer); - rc = call_minidriver(IOCTL_HID_SET_FEATURE, device, &packet, sizeof(packet), NULL, 0); + rc = call_minidriver(irpsp->Parameters.DeviceIoControl.IoControlCode, + device, NULL, 0, &packet, sizeof(packet)); irp->IoStatus.u.Status = rc; if (irp->IoStatus.u.Status == STATUS_SUCCESS) @@ -609,7 +608,8 @@ NTSTATUS WINAPI HID_Device_ioctl(DEVICE_OBJECT *device, IRP *irp) rc = HID_get_feature(device, irp); break; case IOCTL_HID_SET_FEATURE: - rc = HID_set_feature(device, irp); + case IOCTL_HID_SET_OUTPUT_REPORT: + rc = HID_set_to_device(device, irp); break; default: { diff --git a/include/ddk/hidsdi.h b/include/ddk/hidsdi.h index 75f2e3b6c78..8b3b5a293d8 100644 --- a/include/ddk/hidsdi.h +++ b/include/ddk/hidsdi.h @@ -45,5 +45,6 @@ BOOLEAN WINAPI HidD_SetNumInputBuffers(HANDLE HidDeviceObject, ULONG NumberBuffe BOOLEAN WINAPI HidD_GetPreparsedData( HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData); BOOLEAN WINAPI HidD_FreePreparsedData(PHIDP_PREPARSED_DATA PreparsedData); BOOLEAN WINAPI HidD_GetAttributes(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attr); +BOOLEAN WINAPI HidD_SetOutputReport(HANDLE HidDeviceObject, void *ReportBuffer, ULONG ReportBufferLength); #endif /* __WINE_HIDSDI_H */