Rémi Bernon : hidclass.sys: Pass output buffer directly in handle_minidriver_string.
Module: wine Branch: master Commit: db3e59227039c5208d975962a6eab110f9d57be0 URL: https://source.winehq.org/git/wine.git/?a=commit;h=db3e59227039c5208d975962a... Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Oct 5 09:11:53 2021 +0200 hidclass.sys: Pass output buffer directly in handle_minidriver_string. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/hidclass.sys/device.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index cebdc3e1e65..2e618df2927 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -404,25 +404,14 @@ static void handle_IOCTL_HID_GET_COLLECTION_DESCRIPTOR( IRP *irp, BASE_DEVICE_EX } } -static void handle_minidriver_string( BASE_DEVICE_EXTENSION *ext, IRP *irp, SHORT index ) +static void handle_minidriver_string( BASE_DEVICE_EXTENSION *ext, IRP *irp, ULONG index ) { - IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp ); - WCHAR buffer[127]; - ULONG InputBuffer; - - InputBuffer = MAKELONG(index, 0); - - call_minidriver( IOCTL_HID_GET_STRING, ext->u.pdo.parent_fdo, ULongToPtr( InputBuffer ), - sizeof(InputBuffer), buffer, sizeof(buffer), &irp->IoStatus ); + IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation( irp ); + WCHAR *output_buf = MmGetSystemAddressForMdlSafe( irp->MdlAddress, NormalPagePriority ); + ULONG output_len = stack->Parameters.DeviceIoControl.OutputBufferLength; - if (irp->IoStatus.Status == STATUS_SUCCESS) - { - WCHAR *out_buffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress, NormalPagePriority); - int length = irpsp->Parameters.DeviceIoControl.OutputBufferLength/sizeof(WCHAR); - TRACE("got string %s from minidriver\n",debugstr_w(buffer)); - lstrcpynW(out_buffer, buffer, length); - irp->IoStatus.Information = (lstrlenW(buffer)+1) * sizeof(WCHAR); - } + call_minidriver( IOCTL_HID_GET_STRING, ext->u.pdo.parent_fdo, ULongToPtr( index ), + sizeof(index), output_buf, output_len, &irp->IoStatus ); } static void hid_device_xfer_report( BASE_DEVICE_EXTENSION *ext, ULONG code, IRP *irp )
participants (1)
-
Alexandre Julliard