1 /* 2 * windows UsbDk backend for libusb 1.0 3 * Copyright © 2014 Red Hat, Inc. 4 5 * Authors: 6 * Dmitry Fleytman <dmitry@daynix.com> 7 * Pavel Gurvich <pavel@daynix.com> 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation; either 12 * version 2.1 of the License, or (at your option) any later version. 13 * 14 * This library is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this library; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 */ 23 24 #pragma once 25 26 #include "windows_nt_common.h" 27 28 typedef struct USB_DK_CONFIG_DESCRIPTOR_REQUEST { 29 USB_DK_DEVICE_ID ID; 30 ULONG64 Index; 31 } USB_DK_CONFIG_DESCRIPTOR_REQUEST, *PUSB_DK_CONFIG_DESCRIPTOR_REQUEST; 32 33 typedef enum { 34 TransferFailure = 0, 35 TransferSuccess, 36 TransferSuccessAsync 37 } TransferResult; 38 39 typedef enum { 40 NoSpeed = 0, 41 LowSpeed, 42 FullSpeed, 43 HighSpeed, 44 SuperSpeed 45 } USB_DK_DEVICE_SPEED; 46 47 typedef enum { 48 ControlTransferType, 49 BulkTransferType, 50 InterruptTransferType, 51 IsochronousTransferType 52 } USB_DK_TRANSFER_TYPE; 53 54 typedef BOOL (__cdecl *USBDK_GET_DEVICES_LIST)( 55 PUSB_DK_DEVICE_INFO *DeviceInfo, 56 PULONG DeviceNumber 57 ); 58 typedef void (__cdecl *USBDK_RELEASE_DEVICES_LIST)( 59 PUSB_DK_DEVICE_INFO DeviceInfo 60 ); 61 typedef HANDLE (__cdecl *USBDK_START_REDIRECT)( 62 PUSB_DK_DEVICE_ID DeviceId 63 ); 64 typedef BOOL (__cdecl *USBDK_STOP_REDIRECT)( 65 HANDLE DeviceHandle 66 ); 67 typedef BOOL (__cdecl *USBDK_GET_CONFIGURATION_DESCRIPTOR)( 68 PUSB_DK_CONFIG_DESCRIPTOR_REQUEST Request, 69 PUSB_CONFIGURATION_DESCRIPTOR *Descriptor, 70 PULONG Length 71 ); 72 typedef void (__cdecl *USBDK_RELEASE_CONFIGURATION_DESCRIPTOR)( 73 PUSB_CONFIGURATION_DESCRIPTOR Descriptor 74 ); 75 typedef TransferResult (__cdecl *USBDK_WRITE_PIPE)( 76 HANDLE DeviceHandle, 77 PUSB_DK_TRANSFER_REQUEST Request, 78 LPOVERLAPPED lpOverlapped 79 ); 80 typedef TransferResult (__cdecl *USBDK_READ_PIPE)( 81 HANDLE DeviceHandle, 82 PUSB_DK_TRANSFER_REQUEST Request, 83 LPOVERLAPPED lpOverlapped 84 ); 85 typedef BOOL (__cdecl *USBDK_ABORT_PIPE)( 86 HANDLE DeviceHandle, 87 ULONG64 PipeAddress 88 ); 89 typedef BOOL (__cdecl *USBDK_RESET_PIPE)( 90 HANDLE DeviceHandle, 91 ULONG64 PipeAddress 92 ); 93 typedef BOOL (__cdecl *USBDK_SET_ALTSETTING)( 94 HANDLE DeviceHandle, 95 ULONG64 InterfaceIdx, 96 ULONG64 AltSettingIdx 97 ); 98 typedef BOOL (__cdecl *USBDK_RESET_DEVICE)( 99 HANDLE DeviceHandle 100 ); 101 typedef HANDLE (__cdecl *USBDK_GET_REDIRECTOR_SYSTEM_HANDLE)( 102 HANDLE DeviceHandle 103 ); 104