[PATCH resend 3/7] winebus.sys: IOCTL_HID_GET_DEVICE_DESCRIPTOR for iohid

Sebastian Lackner sebastian at fds-team.de
Mon Nov 7 10:10:53 CST 2016


On 04.11.2016 13:46, Aric Stewart wrote:
> Signed-off-by: Aric Stewart <aric at codeweavers.com>
> ---
>  dlls/winebus.sys/bus_iohid.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> 
> 
> v2-0003-winebus.sys-IOCTL_HID_GET_DEVICE_DESCRIPTOR-for-ioh.txt
> 
> 
> diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c
> index 3cd0b19..380cdb4 100644
> --- a/dlls/winebus.sys/bus_iohid.c
> +++ b/dlls/winebus.sys/bus_iohid.c
> @@ -127,7 +127,18 @@ static int compare_platform_device(DEVICE_OBJECT *device, void *platform_dev)
>  
>  static NTSTATUS get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length)
>  {
> -    return STATUS_NOT_IMPLEMENTED;
> +    IOHIDDeviceRef dev = *(IOHIDDeviceRef*)get_platform_private(device);
> +    CFDataRef data = IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDReportDescriptorKey));

Is it always guaranteed that this returns valid data? If not, it might be better to
check the returned CFTypeRef.

> +    int data_length = CFDataGetLength(data);
> +    const UInt8 *ptr;
> +
> +    *out_length = data_length;
> +    if (length < data_length)
> +        return STATUS_BUFFER_TOO_SMALL;
> +
> +    ptr = CFDataGetBytePtr(data);
> +    memcpy(buffer, ptr, data_length);
> +    return STATUS_SUCCESS;
>  }
>  
>  static NTSTATUS get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length)
> 
> 
> 




More information about the wine-devel mailing list