Commit a0a3b6b9 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

hid: Fix length argument to GetOverlappedResult().

parent e4e9d3a2
...@@ -38,15 +38,16 @@ ...@@ -38,15 +38,16 @@
WINE_DEFAULT_DEBUG_CHANNEL(hid); WINE_DEFAULT_DEBUG_CHANNEL(hid);
static BOOL sync_ioctl(HANDLE file, DWORD code, void *in_buf, DWORD in_len, void *out_buf, DWORD out_len, DWORD *ret_len) static BOOL sync_ioctl(HANDLE file, DWORD code, void *in_buf, DWORD in_len, void *out_buf, DWORD out_len)
{ {
OVERLAPPED ovl = {0}; OVERLAPPED ovl = {0};
DWORD ret_len;
BOOL ret; BOOL ret;
ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
ret = DeviceIoControl(file, code, in_buf, in_len, out_buf, out_len, ret_len, &ovl); ret = DeviceIoControl(file, code, in_buf, in_len, out_buf, out_len, &ret_len, &ovl);
if (!ret && GetLastError() == ERROR_IO_PENDING) if (!ret && GetLastError() == ERROR_IO_PENDING)
ret = GetOverlappedResult(file, &ovl, ret_len, TRUE); ret = GetOverlappedResult(file, &ovl, &ret_len, TRUE);
CloseHandle(ovl.hEvent); CloseHandle(ovl.hEvent);
return ret; return ret;
} }
...@@ -65,7 +66,7 @@ BOOLEAN WINAPI HidD_GetAttributes(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attr) ...@@ -65,7 +66,7 @@ BOOLEAN WINAPI HidD_GetAttributes(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attr)
TRACE("(%p %p)\n", HidDeviceObject, Attr); TRACE("(%p %p)\n", HidDeviceObject, Attr);
ret = sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0, &info, sizeof(HID_COLLECTION_INFORMATION), NULL); ret = sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0, &info, sizeof(HID_COLLECTION_INFORMATION));
if (ret) if (ret)
{ {
...@@ -79,7 +80,7 @@ BOOLEAN WINAPI HidD_GetAttributes(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attr) ...@@ -79,7 +80,7 @@ BOOLEAN WINAPI HidD_GetAttributes(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attr)
BOOLEAN WINAPI HidD_GetFeature(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength) BOOLEAN WINAPI HidD_GetFeature(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength)
{ {
TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength); TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength);
return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_FEATURE, NULL, 0, ReportBuffer, ReportBufferLength, NULL); return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_FEATURE, NULL, 0, ReportBuffer, ReportBufferLength);
} }
void WINAPI HidD_GetHidGuid(LPGUID guid) void WINAPI HidD_GetHidGuid(LPGUID guid)
...@@ -91,43 +92,43 @@ void WINAPI HidD_GetHidGuid(LPGUID guid) ...@@ -91,43 +92,43 @@ void WINAPI HidD_GetHidGuid(LPGUID guid)
BOOLEAN WINAPI HidD_GetInputReport(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength) BOOLEAN WINAPI HidD_GetInputReport(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength)
{ {
TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength); TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength);
return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_INPUT_REPORT, NULL, 0, ReportBuffer, ReportBufferLength, NULL); return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_INPUT_REPORT, NULL, 0, ReportBuffer, ReportBufferLength);
} }
BOOLEAN WINAPI HidD_GetManufacturerString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength) BOOLEAN WINAPI HidD_GetManufacturerString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength)
{ {
TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength); TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength);
return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_MANUFACTURER_STRING, NULL, 0, Buffer, BufferLength, NULL); return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_MANUFACTURER_STRING, NULL, 0, Buffer, BufferLength);
} }
BOOLEAN WINAPI HidD_GetNumInputBuffers(HANDLE HidDeviceObject, ULONG *NumberBuffers) BOOLEAN WINAPI HidD_GetNumInputBuffers(HANDLE HidDeviceObject, ULONG *NumberBuffers)
{ {
TRACE("(%p %p)\n", HidDeviceObject, NumberBuffers); TRACE("(%p %p)\n", HidDeviceObject, NumberBuffers);
return sync_ioctl(HidDeviceObject, IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS, NULL, 0, NumberBuffers, sizeof(*NumberBuffers), NULL); return sync_ioctl(HidDeviceObject, IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS, NULL, 0, NumberBuffers, sizeof(*NumberBuffers));
} }
BOOLEAN WINAPI HidD_SetFeature(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength) BOOLEAN WINAPI HidD_SetFeature(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength)
{ {
TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength); TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength);
return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_FEATURE, ReportBuffer, ReportBufferLength, NULL, 0, NULL); return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_FEATURE, ReportBuffer, ReportBufferLength, NULL, 0);
} }
BOOLEAN WINAPI HidD_SetNumInputBuffers(HANDLE HidDeviceObject, ULONG NumberBuffers) BOOLEAN WINAPI HidD_SetNumInputBuffers(HANDLE HidDeviceObject, ULONG NumberBuffers)
{ {
TRACE("(%p %i)\n", HidDeviceObject, NumberBuffers); TRACE("(%p %i)\n", HidDeviceObject, NumberBuffers);
return sync_ioctl(HidDeviceObject, IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS, &NumberBuffers, sizeof(NumberBuffers), NULL, 0, NULL); return sync_ioctl(HidDeviceObject, IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS, &NumberBuffers, sizeof(NumberBuffers), NULL, 0);
} }
BOOLEAN WINAPI HidD_GetProductString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength) BOOLEAN WINAPI HidD_GetProductString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength)
{ {
TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength); TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength);
return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_PRODUCT_STRING, NULL, 0, Buffer, BufferLength, NULL); return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_PRODUCT_STRING, NULL, 0, Buffer, BufferLength);
} }
BOOLEAN WINAPI HidD_GetSerialNumberString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength) BOOLEAN WINAPI HidD_GetSerialNumberString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength)
{ {
TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength); TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength);
return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_SERIALNUMBER_STRING, NULL, 0, Buffer, BufferLength, NULL); return sync_ioctl(HidDeviceObject, IOCTL_HID_GET_SERIALNUMBER_STRING, NULL, 0, Buffer, BufferLength);
} }
BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData) BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData)
...@@ -137,14 +138,12 @@ BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DAT ...@@ -137,14 +138,12 @@ BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DAT
TRACE("(%p %p)\n", HidDeviceObject, PreparsedData); TRACE("(%p %p)\n", HidDeviceObject, PreparsedData);
if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0, if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0, &info, sizeof(info)))
&info, sizeof(HID_COLLECTION_INFORMATION), NULL))
return FALSE; return FALSE;
if (!(data = HeapAlloc(GetProcessHeap(), 0, info.DescriptorSize))) return FALSE; if (!(data = HeapAlloc(GetProcessHeap(), 0, info.DescriptorSize))) return FALSE;
if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_DESCRIPTOR, NULL, 0, if (!sync_ioctl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_DESCRIPTOR, NULL, 0, data, info.DescriptorSize))
data, info.DescriptorSize, NULL))
{ {
HeapFree( GetProcessHeap(), 0, data ); HeapFree( GetProcessHeap(), 0, data );
return FALSE; return FALSE;
...@@ -156,5 +155,5 @@ BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DAT ...@@ -156,5 +155,5 @@ BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DAT
BOOLEAN WINAPI HidD_SetOutputReport(HANDLE HidDeviceObject, void *ReportBuffer, ULONG ReportBufferLength) BOOLEAN WINAPI HidD_SetOutputReport(HANDLE HidDeviceObject, void *ReportBuffer, ULONG ReportBufferLength)
{ {
TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength); TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength);
return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_OUTPUT_REPORT, ReportBuffer, ReportBufferLength, NULL, 0, NULL); return sync_ioctl(HidDeviceObject, IOCTL_HID_SET_OUTPUT_REPORT, ReportBuffer, ReportBufferLength, NULL, 0);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment