summaryrefslogtreecommitdiff
path: root/libusb/os/windows_usbdk.h
diff options
context:
space:
mode:
authorChris Dickens <christopher.a.dickens@gmail.com>2018-01-08 10:17:26 -0800
committerChris Dickens <christopher.a.dickens@gmail.com>2018-01-08 10:17:26 -0800
commit54884e84d024e761450287ab56aca8fc69f45d01 (patch)
tree84209847fcee262dd4731e26a910940ca038b582 /libusb/os/windows_usbdk.h
parentd0779e93032affec1dcf04a5bba18f3968aa7922 (diff)
downloadlibusb-54884e84d024e761450287ab56aca8fc69f45d01.tar.gz
Windows: Enable dynamic selection between WinUSB and UsbDk backends
This commit unifies the two Windows backends into a single project and enables the user to switch to the UsbDk backend, if available, using the libusb_set_option() function. All contexts will use the WinUSB backend by default for backwards compatibility. With this change, the UsbDk-specific projects are no longer required. Closes #309 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb/os/windows_usbdk.h')
-rw-r--r--libusb/os/windows_usbdk.h47
1 files changed, 5 insertions, 42 deletions
diff --git a/libusb/os/windows_usbdk.h b/libusb/os/windows_usbdk.h
index e6eca8b..0de2675 100644
--- a/libusb/os/windows_usbdk.h
+++ b/libusb/os/windows_usbdk.h
@@ -23,56 +23,19 @@
#pragma once
-typedef struct tag_USB_DK_DEVICE_ID {
- WCHAR DeviceID[MAX_DEVICE_ID_LEN];
- WCHAR InstanceID[MAX_DEVICE_ID_LEN];
-} USB_DK_DEVICE_ID, *PUSB_DK_DEVICE_ID;
+#include "windows_nt_common.h"
-static inline void UsbDkFillIDStruct(USB_DK_DEVICE_ID *ID, PCWCHAR DeviceID, PCWCHAR InstanceID)
+static inline void UsbDkFillIDStruct(USB_DK_DEVICE_ID *ID, const WCHAR *DeviceID, const WCHAR *InstanceID)
{
- wcsncpy_s(ID->DeviceID, DeviceID, MAX_DEVICE_ID_LEN);
- wcsncpy_s(ID->InstanceID, InstanceID, MAX_DEVICE_ID_LEN);
+ wcsncpy(ID->DeviceID, DeviceID, MAX_DEVICE_ID_LEN);
+ wcsncpy(ID->InstanceID, InstanceID, MAX_DEVICE_ID_LEN);
}
-typedef struct tag_USB_DK_DEVICE_INFO {
- USB_DK_DEVICE_ID ID;
- ULONG64 FilterID;
- ULONG64 Port;
- ULONG64 Speed;
- USB_DEVICE_DESCRIPTOR DeviceDescriptor;
-} USB_DK_DEVICE_INFO, *PUSB_DK_DEVICE_INFO;
-
-typedef struct tag_USB_DK_CONFIG_DESCRIPTOR_REQUEST {
+typedef struct USB_DK_CONFIG_DESCRIPTOR_REQUEST {
USB_DK_DEVICE_ID ID;
ULONG64 Index;
} USB_DK_CONFIG_DESCRIPTOR_REQUEST, *PUSB_DK_CONFIG_DESCRIPTOR_REQUEST;
-typedef struct tag_USB_DK_ISO_TRANSFER_RESULT {
- ULONG64 ActualLength;
- ULONG64 TransferResult;
-} USB_DK_ISO_TRANSFER_RESULT, *PUSB_DK_ISO_TRANSFER_RESULT;
-
-typedef struct tag_USB_DK_GEN_TRANSFER_RESULT {
- ULONG64 BytesTransferred;
- ULONG64 UsbdStatus; // USBD_STATUS code
-} USB_DK_GEN_TRANSFER_RESULT, *PUSB_DK_GEN_TRANSFER_RESULT;
-
-typedef struct tag_USB_DK_TRANSFER_RESULT {
- USB_DK_GEN_TRANSFER_RESULT GenResult;
- PVOID64 IsochronousResultsArray; // array of USB_DK_ISO_TRANSFER_RESULT
-} USB_DK_TRANSFER_RESULT, *PUSB_DK_TRANSFER_RESULT;
-
-typedef struct tag_USB_DK_TRANSFER_REQUEST {
- ULONG64 EndpointAddress;
- PVOID64 Buffer;
- ULONG64 BufferLength;
- ULONG64 TransferType;
- ULONG64 IsochronousPacketsArraySize;
- PVOID64 IsochronousPacketsArray;
-
- USB_DK_TRANSFER_RESULT Result;
-} USB_DK_TRANSFER_REQUEST, *PUSB_DK_TRANSFER_REQUEST;
-
typedef enum {
TransferFailure = 0,
TransferSuccess,