summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-01-14 01:44:36 +0000
committerPete Batard <pbatard@gmail.com>2010-01-14 01:44:36 +0000
commit6cc0e6afc4ee0f66ff355ec76bee4f1828118b6e (patch)
tree62cf8f5857278cc85aee310b4cbddef018a308ed
parent48c56e26825928679057563d154283405aa84764 (diff)
downloadlibusb-6cc0e6afc4ee0f66ff355ec76bee4f1828118b6e.tar.gz
svn r70 (last import from svn): - fixed the non retrieval of interface #0 on some specific conditions (PROPER)
-rw-r--r--libusb/os/windows_usb.c8
-rw-r--r--libusb/os/windows_usb.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
index 3465958..3002787 100644
--- a/libusb/os/windows_usb.c
+++ b/libusb/os/windows_usb.c
@@ -821,7 +821,7 @@ static int set_composite_device(struct libusb_context *ctx, DEVINST devinst, str
SP_DEVINFO_DATA dev_info_data;
SP_DEVICE_INTERFACE_DETAIL_DATA *dev_interface_details = NULL;
HKEY key;
- WCHAR guid_string_w[40];
+ WCHAR guid_string_w[GUID_STRING_LENGTH];
GUID guid;
GUID guid_table[MAX_USB_DEVICES];
char* sanitized_path[MAX_USB_DEVICES];
@@ -849,7 +849,9 @@ static int set_composite_device(struct libusb_context *ctx, DEVINST devinst, str
continue;
}
- if (RegQueryValueExW(key, L"DeviceInterfaceGUIDs", NULL, &type, (BYTE*)guid_string_w, &size) != ERROR_SUCCESS) {
+ size = sizeof(guid_string_w);
+ if (RegQueryValueExW(key, L"DeviceInterfaceGUIDs", NULL, &type,
+ (BYTE*)guid_string_w, &size) != ERROR_SUCCESS) {
RegCloseKey(key);
continue;
}
@@ -895,7 +897,6 @@ static int set_composite_device(struct libusb_context *ctx, DEVINST devinst, str
usbi_warn(ctx, "could not retrieve info data: %s", windows_error_str(0));
continue;
}
- usbi_dbg("found path: %s", dev_interface_details->DevicePath);
if(!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_SERVICE,
NULL, (BYTE*)driver, MAX_KEY_LENGTH, &size)) {
@@ -912,7 +913,6 @@ static int set_composite_device(struct libusb_context *ctx, DEVINST devinst, str
}
}
}
- usbi_dbg("found %d paths", nb_paths);
// Finally, match the interface paths with the interfaces. We do that
// by looking at the children of the composite device
diff --git a/libusb/os/windows_usb.h b/libusb/os/windows_usb.h
index 1452224..5da4b9a 100644
--- a/libusb/os/windows_usb.h
+++ b/libusb/os/windows_usb.h
@@ -65,6 +65,7 @@ void inline upperize(char* str) {
#define MAX_PATH_LENGTH 128
#define MAX_KEY_LENGTH 256
#define ERR_BUFFER_SIZE 256
+#define GUID_STRING_LENGTH 40
#define wchar_to_utf8_ms(wstr, str, strlen) WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, strlen, NULL, NULL)
#define ERRNO GetLastError()