Module: wine Branch: master Commit: 0d96ffbca924f6ba69a05375f2d43d0de3d7e47c URL: http://source.winehq.org/git/wine.git/?a=commit;h=0d96ffbca924f6ba69a05375f2...
Author: Aric Stewart aric@codeweavers.com Date: Mon Nov 7 13:42:34 2016 -0600
winebus.sys: IOCTL_HID_GET_STRING for iohid.
Signed-off-by: Aric Stewart aric@codeweavers.com Signed-off-by: Ken Thomases ken@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winebus.sys/bus_iohid.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 50b5d76..954b021 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -88,6 +88,7 @@ #include "winternl.h" #include "winioctl.h" #include "ddk/wdm.h" +#include "ddk/hidtypes.h" #include "wine/debug.h"
#include "bus.h" @@ -156,7 +157,37 @@ static NTSTATUS get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD
static NTSTATUS get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length) { - return STATUS_NOT_IMPLEMENTED; + struct platform_private *private = impl_from_DEVICE_OBJECT(device); + CFStringRef str; + switch (index) + { + case HID_STRING_ID_IPRODUCT: + str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDProductKey)); + break; + case HID_STRING_ID_IMANUFACTURER: + str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDManufacturerKey)); + break; + case HID_STRING_ID_ISERIALNUMBER: + str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDSerialNumberKey)); + break; + default: + ERR("Unknown string index\n"); + return STATUS_NOT_IMPLEMENTED; + } + + if (str) + { + if (length < CFStringGetLength(str) + 1) + return STATUS_BUFFER_TOO_SMALL; + CFStringToWSTR(str, buffer, length); + } + else + { + if (!length) return STATUS_BUFFER_TOO_SMALL; + buffer[0] = 0; + } + + return STATUS_SUCCESS; }
static NTSTATUS begin_report_processing(DEVICE_OBJECT *device)