Rémi Bernon : hidclass.sys: Move HID_GET_COLLECTION_* handling inline.
Alexandre Julliard
julliard at winehq.org
Tue Apr 26 16:25:27 CDT 2022
Module: wine
Branch: master
Commit: ae212726f8efd6f01ca283d21807f88084d8e8f6
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ae212726f8efd6f01ca283d21807f88084d8e8f6
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Tue Apr 26 13:10:40 2022 +0200
hidclass.sys: Move HID_GET_COLLECTION_* handling inline.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/hidclass.sys/device.c | 55 ++++++++++++++++------------------------------
1 file changed, 19 insertions(+), 36 deletions(-)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index c252125d8eb..d742ea841e5 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -375,40 +375,6 @@ void HID_StartDeviceThread(DEVICE_OBJECT *device)
ext->u.pdo.thread = CreateThread(NULL, 0, hid_device_thread, device, 0, NULL);
}
-static void handle_IOCTL_HID_GET_COLLECTION_INFORMATION( IRP *irp, BASE_DEVICE_EXTENSION *ext )
-{
- IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp );
- if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(HID_COLLECTION_INFORMATION))
- {
- irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW;
- irp->IoStatus.Information = 0;
- }
- else
- {
- memcpy(irp->AssociatedIrp.SystemBuffer, &ext->u.pdo.information, sizeof(HID_COLLECTION_INFORMATION));
- irp->IoStatus.Information = sizeof(HID_COLLECTION_INFORMATION);
- irp->IoStatus.Status = STATUS_SUCCESS;
- }
-}
-
-static void handle_IOCTL_HID_GET_COLLECTION_DESCRIPTOR( IRP *irp, BASE_DEVICE_EXTENSION *ext )
-{
- HIDP_COLLECTION_DESC *desc = ext->u.pdo.device_desc.CollectionDesc;
- IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp );
-
- if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < desc->PreparsedDataLength)
- {
- irp->IoStatus.Status = STATUS_INVALID_BUFFER_SIZE;
- irp->IoStatus.Information = 0;
- }
- else
- {
- memcpy( irp->UserBuffer, desc->PreparsedData, desc->PreparsedDataLength );
- irp->IoStatus.Information = desc->PreparsedDataLength;
- irp->IoStatus.Status = STATUS_SUCCESS;
- }
-}
-
struct device_strings
{
const WCHAR *id;
@@ -619,12 +585,29 @@ NTSTATUS WINAPI pdo_ioctl(DEVICE_OBJECT *device, IRP *irp)
}
case IOCTL_HID_GET_COLLECTION_INFORMATION:
{
- handle_IOCTL_HID_GET_COLLECTION_INFORMATION( irp, ext );
+ irp->IoStatus.Information = sizeof(HID_COLLECTION_INFORMATION);
+ if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(HID_COLLECTION_INFORMATION))
+ irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW;
+ else
+ {
+ memcpy( irp->AssociatedIrp.SystemBuffer, &ext->u.pdo.information,
+ sizeof(HID_COLLECTION_INFORMATION) );
+ irp->IoStatus.Status = STATUS_SUCCESS;
+ }
break;
}
case IOCTL_HID_GET_COLLECTION_DESCRIPTOR:
{
- handle_IOCTL_HID_GET_COLLECTION_DESCRIPTOR( irp, ext );
+ HIDP_COLLECTION_DESC *desc = ext->u.pdo.device_desc.CollectionDesc;
+
+ irp->IoStatus.Information = desc->PreparsedDataLength;
+ if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < desc->PreparsedDataLength)
+ irp->IoStatus.Status = STATUS_INVALID_BUFFER_SIZE;
+ else
+ {
+ memcpy( irp->UserBuffer, desc->PreparsedData, desc->PreparsedDataLength );
+ irp->IoStatus.Status = STATUS_SUCCESS;
+ }
break;
}
case IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS:
More information about the wine-cvs
mailing list