Windows: Ignore any device interface GUIDs beyond the first
authorTormod Volden <debian.tormod@gmail.com>
Sat, 16 Oct 2021 22:13:44 +0000 (00:13 +0200)
committerTormod Volden <debian.tormod@gmail.com>
Sun, 7 Nov 2021 11:48:27 +0000 (12:48 +0100)
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 <debian.tormod@gmail.com>
libusb/os/windows_winusb.c
libusb/version_nano.h

index f6ed979..5c860ea 100644 (file)
@@ -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, &reg_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;
                                }
index 1033492..c65a80b 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 11671
+#define LIBUSB_NANO 11672