Aric Stewart : hidclass.sys: Implement HID_Device_write.

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


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Mon Jan 11 08:40:07 2016 -0600

hidclass.sys: Implement HID_Device_write.

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

---

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

diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index 53ec569..09e3c0c 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -607,16 +607,29 @@ NTSTATUS WINAPI HID_Device_read(DEVICE_OBJECT *device, IRP *irp)
 NTSTATUS WINAPI HID_Device_write(DEVICE_OBJECT *device, IRP *irp)
 {
     IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp );
+    HID_XFER_PACKET packet;
+    NTSTATUS rc;
 
     irp->IoStatus.Information = 0;
 
-    TRACE("Buffer length %i\n", irpsp->Parameters.Write.Length);
+    TRACE_(hid_report)("Device %p Buffer length %i Buffer %p\n", device, irpsp->Parameters.Write.Length, irp->AssociatedIrp.SystemBuffer);
+    packet.reportBuffer = irp->AssociatedIrp.SystemBuffer;
+    packet.reportId = ((char*)irp->AssociatedIrp.SystemBuffer)[0];
+    packet.reportBufferLen = irpsp->Parameters.Write.Length;
+    TRACE_(hid_report)("(id %i, len %i buffer %p)\n", packet.reportId, packet.reportBufferLen, packet.reportBuffer);
 
-    FIXME("device %p\n", device);
+    rc = call_minidriver(IOCTL_HID_WRITE_REPORT, device, NULL, 0, &packet, sizeof(packet));
+
+    irp->IoStatus.u.Status = rc;
+    if (irp->IoStatus.u.Status == STATUS_SUCCESS)
+        irp->IoStatus.Information = irpsp->Parameters.Write.Length;
+    else
+        irp->IoStatus.Information = 0;
+
+    TRACE_(hid_report)("Result 0x%x wrote %li bytes\n", rc, irp->IoStatus.Information);
 
-    irp->IoStatus.u.Status = STATUS_SUCCESS;
     IoCompleteRequest( irp, IO_NO_INCREMENT );
-    return STATUS_SUCCESS;
+    return rc;
 }
 
 NTSTATUS WINAPI HID_Device_create(DEVICE_OBJECT *device, IRP *irp)




More information about the wine-cvs mailing list