From 21d7d2d208ca918bc1b9047835752854843a204d Mon Sep 17 00:00:00 2001 From: Chris Serio Date: Tue, 15 May 2012 15:15:28 -0400 Subject: [PATCH] Windows: Fixed an incorrect return type on HidP_GetCaps() Addresses an issue with the return type of HidP_GetCaps() which was returning the wrong status code because of the invalid return type of BOOLEAN which is a UCHAR. The return code is supposed to be 0x110000 which obviously doesn't fit in a UCHAR so it was being rounded to 0x0. Basically, no return codes were ever making it through that call. --- windows/hid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/hid.c b/windows/hid.c index 8f086ef..cb718d9 100755 --- a/windows/hid.c +++ b/windows/hid.c @@ -94,7 +94,7 @@ extern "C" { USHORT fields_not_used_by_hidapi[10]; } HIDP_CAPS, *PHIDP_CAPS; typedef void* PHIDP_PREPARSED_DATA; - #define HIDP_STATUS_SUCCESS 0x0 + #define HIDP_STATUS_SUCCESS 0x110000 typedef BOOLEAN (__stdcall *HidD_GetAttributes_)(HANDLE device, PHIDD_ATTRIBUTES attrib); typedef BOOLEAN (__stdcall *HidD_GetSerialNumberString_)(HANDLE device, PVOID buffer, ULONG buffer_len); @@ -105,7 +105,7 @@ extern "C" { typedef BOOLEAN (__stdcall *HidD_GetIndexedString_)(HANDLE handle, ULONG string_index, PVOID buffer, ULONG buffer_len); typedef BOOLEAN (__stdcall *HidD_GetPreparsedData_)(HANDLE handle, PHIDP_PREPARSED_DATA *preparsed_data); typedef BOOLEAN (__stdcall *HidD_FreePreparsedData_)(PHIDP_PREPARSED_DATA preparsed_data); - typedef BOOLEAN (__stdcall *HidP_GetCaps_)(PHIDP_PREPARSED_DATA preparsed_data, HIDP_CAPS *caps); + typedef NTSTATUS (__stdcall *HidP_GetCaps_)(PHIDP_PREPARSED_DATA preparsed_data, HIDP_CAPS *caps); static HidD_GetAttributes_ HidD_GetAttributes; static HidD_GetSerialNumberString_ HidD_GetSerialNumberString;