summaryrefslogtreecommitdiff
path: root/libusb/os/windows_usb.h
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-01-14 01:07:39 +0000
committerPete Batard <pbatard@gmail.com>2010-01-14 01:07:39 +0000
commiteb090e7c3a3ead5b9719f11bf43c5580efccdf1f (patch)
tree82423923f086aaf6d67d827d6fd2ba112054596c /libusb/os/windows_usb.h
parent58f65adc319aad44cc68851ad2441f224627fa88 (diff)
downloadlibusb-eb090e7c3a3ead5b9719f11bf43c5580efccdf1f.tar.gz
svn r7: initialize paths for non hub devices
Diffstat (limited to 'libusb/os/windows_usb.h')
-rw-r--r--libusb/os/windows_usb.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/libusb/os/windows_usb.h b/libusb/os/windows_usb.h
index 50dcf2b..1823ff9 100644
--- a/libusb/os/windows_usb.h
+++ b/libusb/os/windows_usb.h
@@ -46,11 +46,14 @@
#define safe_strncpy(dst, dst_max, src, count) strncpy(dst, src, min(count, dst_max - 1))
#define safe_strncat(dst, dst_max, src, count) strncat(dst, src, min(count, dst_max - strlen(dst) - 1))
#define safe_strcmp(str1, str2) strcmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2))
+#define safe_strncmp(str1, str2, count) strncmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2), count)
#define safe_strdup _strdup
#define safe_sprintf _snprintf
#define safe_unref_device(dev) do {if (dev != NULL) {libusb_unref_device(dev); dev = NULL;}} while(0)
#define ROOT_PREFIX "\\\\.\\"
+#define MAX_PATH_LENGTH 128
+#define MAX_KEY_LENGTH 64
#define wchar_to_utf8_ms(wstr, str, strlen) WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, strlen, NULL, NULL)
#define ERRNO GetLastError()
@@ -131,23 +134,26 @@ struct windows_transfer_priv {
/*
* Windows API structures (redefined for convenience)
*/
-#define USB_HCD_DRIVERKEY_NAME_FIXED_MAX 64
typedef struct _USB_HCD_DRIVERKEY_NAME_FIXED {
ULONG ActualLength;
- WCHAR DriverKeyName[USB_HCD_DRIVERKEY_NAME_FIXED_MAX];
+ WCHAR DriverKeyName[MAX_KEY_LENGTH];
} USB_HCD_DRIVERKEY_NAME_FIXED;
+typedef struct _USB_NODE_DRIVERKEY_NAME_FIXED {
+ ULONG ActualLength;
+ WCHAR DriverKeyName[MAX_KEY_LENGTH];
+} USB_NODE_DRIVERKEY_NAME_FIXED;
+
// Fixed length version of USB_ROOT_HUB_NAME & USB_NODE_CONNECTION_NAME
-#define USB_HUB_NAME_FIXED_MAX 128
typedef struct _USB_ROOT_HUB_NAME_FIXED {
ULONG ActualLength;
- WCHAR RootHubName[USB_HUB_NAME_FIXED_MAX];
+ WCHAR RootHubName[MAX_PATH_LENGTH];
} USB_ROOT_HUB_NAME_FIXED;
typedef struct _USB_NODE_CONNECTION_NAME_FIXED {
ULONG ConnectionIndex;
ULONG ActualLength;
- WCHAR NodeName[USB_HUB_NAME_FIXED_MAX];
+ WCHAR NodeName[MAX_PATH_LENGTH];
} USB_NODE_CONNECTION_NAME_FIXED;
typedef struct _USB_HUB_NAME_FIXED {