Aric Stewart : hidclass.sys: Implement IOCTL_HID_SET_FEATURE.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 14 11:10:26 CST 2016


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Mon Jan 11 09:18:44 2016 -0600

hidclass.sys: Implement IOCTL_HID_SET_FEATURE.

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

---

 dlls/hidclass.sys/device.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index 7c2904a..41b5405 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -464,6 +464,33 @@ static NTSTATUS HID_get_feature(DEVICE_OBJECT *device, IRP *irp)
     return rc;
 }
 
+static NTSTATUS HID_set_feature(DEVICE_OBJECT *device, IRP *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, NULL, 0, &packet, sizeof(packet));
+
+    irp->IoStatus.u.Status = rc;
+    if (irp->IoStatus.u.Status == STATUS_SUCCESS)
+        irp->IoStatus.Information = irpsp->Parameters.DeviceIoControl.InputBufferLength;
+    else
+        irp->IoStatus.Information = 0;
+
+    TRACE_(hid_report)("Result 0x%x set %li bytes\n", rc, irp->IoStatus.Information);
+
+    return rc;
+}
+
 NTSTATUS WINAPI HID_Device_ioctl(DEVICE_OBJECT *device, IRP *irp)
 {
     NTSTATUS rc = STATUS_SUCCESS;
@@ -582,6 +609,9 @@ NTSTATUS WINAPI HID_Device_ioctl(DEVICE_OBJECT *device, IRP *irp)
         case IOCTL_HID_GET_FEATURE:
             rc = HID_get_feature(device, irp);
             break;
+        case IOCTL_HID_SET_FEATURE:
+            rc = HID_set_feature(device, irp);
+            break;
         default:
         {
             ULONG code = irpsp->Parameters.DeviceIoControl.IoControlCode;




More information about the wine-cvs mailing list