diff --git a/src/hidapi/windows/hid.c b/src/hidapi/windows/hid.c index aa67a466d3..7579978232 100644 --- a/src/hidapi/windows/hid.c +++ b/src/hidapi/windows/hid.c @@ -1027,6 +1027,12 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor continue; } +#ifdef HIDAPI_IGNORE_DEVICE + hid_bus_type bus_type = HID_API_BUS_UNKNOWN; + PHIDP_PREPARSED_DATA pp_data = NULL; + HIDP_CAPS caps = { 0 }; +#endif + /* Get the Vendor ID and Product ID for this device. */ attrib.Size = sizeof(HIDD_ATTRIBUTES); if (!HidD_GetAttributes(device_handle, &attrib)) { @@ -1035,9 +1041,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor #ifdef HIDAPI_IGNORE_DEVICE /* See if there are any devices we should skip in enumeration */ - hid_bus_type bus_type = get_bus_type(device_interface); - PHIDP_PREPARSED_DATA pp_data = NULL; - HIDP_CAPS caps = { 0 }; + bus_type = get_bus_type(device_interface); if (HidD_GetPreparsedData(device_handle, &pp_data)) { HidP_GetCaps(pp_data, &caps); HidD_FreePreparsedData(pp_data);