From 3178abb79093231f46d7fa544335a58ddd58a324 Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Sun, 17 Oct 2021 00:13:44 +0200 Subject: [PATCH] Windows: Ignore any device interface GUIDs beyond the first The NZXT Kraken Z73 device has been reported to brokenly have two identical device interface GUIDs registered. Accept such cases by treating the ERROR_MORE_DATA return value as success and processing the first returned GUID as if it would be the only one. If one day we see legitimate cases of multiple GUIDs we will need to deal with them properly. References jdkvision/libusb#1 Closes #1010 Signed-off-by: Tormod Volden --- libusb/os/windows_winusb.c | 3 ++- libusb/version_nano.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libusb/os/windows_winusb.c b/libusb/os/windows_winusb.c index f6ed979..5c860ea 100644 --- a/libusb/os/windows_winusb.c +++ b/libusb/os/windows_winusb.c @@ -1619,6 +1619,7 @@ static int winusb_get_device_list(struct libusb_context *ctx, struct discovered_ if (key == INVALID_HANDLE_VALUE) break; // Look for both DeviceInterfaceGUIDs *and* DeviceInterfaceGUID, in that order + // If multiple GUIDs just process the first and ignore the others size = sizeof(guid_string); s = pRegQueryValueExA(key, "DeviceInterfaceGUIDs", NULL, ®_type, (LPBYTE)guid_string, &size); @@ -1628,7 +1629,7 @@ static int winusb_get_device_list(struct libusb_context *ctx, struct discovered_ pRegCloseKey(key); if (s == ERROR_FILE_NOT_FOUND) { break; /* no DeviceInterfaceGUID registered */ - } else if (s != ERROR_SUCCESS) { + } else if (s != ERROR_SUCCESS && s != ERROR_MORE_DATA) { usbi_warn(ctx, "unexpected error from pRegQueryValueExA for '%s'", dev_id); break; } diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 1033492..c65a80b 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11671 +#define LIBUSB_NANO 11672 -- 2.7.4