1 #pragma once 2 3 #define _USBBUSIF_ 4 5 #ifndef USB_BUSIFFN 6 #define USB_BUSIFFN __stdcall 7 #endif 8 9 #if (NTDDI_VERSION >= NTDDI_WINXP) 10 11 #if !defined(_HUBBUSIF_) 12 typedef PVOID PUSB_DEVICE_HANDLE; 13 #endif 14 15 typedef NTSTATUS 16 (USB_BUSIFFN *PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB) ( 17 IN PVOID, 18 IN PURB); 19 20 #define USB_HCD_CAPS_SUPPORTS_RT_THREADS 0x00000001 21 22 typedef VOID 23 (USB_BUSIFFN *PUSB_BUSIFFN_GETUSBDI_VERSION) ( 24 IN PVOID, 25 OUT PUSBD_VERSION_INFORMATION OPTIONAL, 26 OUT PULONG OPTIONAL); 27 28 typedef NTSTATUS 29 (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_TIME) ( 30 IN PVOID, 31 OUT PULONG OPTIONAL); 32 33 typedef NTSTATUS 34 (USB_BUSIFFN *PUSB_BUSIFFN_ENUM_LOG_ENTRY) ( 35 IN PVOID, 36 IN ULONG, 37 IN ULONG, 38 IN ULONG, 39 IN ULONG); 40 41 typedef struct _USB_BUS_INFORMATION_LEVEL_0 { 42 ULONG TotalBandwidth; 43 ULONG ConsumedBandwidth; 44 } USB_BUS_INFORMATION_LEVEL_0, *PUSB_BUS_INFORMATION_LEVEL_0; 45 46 typedef struct _USB_BUS_INFORMATION_LEVEL_1 { 47 ULONG TotalBandwidth; 48 ULONG ConsumedBandwidth; 49 ULONG ControllerNameLength; 50 WCHAR ControllerNameUnicodeString[1]; 51 } USB_BUS_INFORMATION_LEVEL_1, *PUSB_BUS_INFORMATION_LEVEL_1; 52 53 typedef NTSTATUS 54 (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_INFORMATION) ( 55 IN PVOID, 56 IN ULONG, 57 IN OUT PVOID, 58 OUT PULONG, 59 OUT PULONG OPTIONAL); 60 61 typedef BOOLEAN 62 (USB_BUSIFFN *PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED) ( 63 IN PVOID OPTIONAL); 64 65 #define USB_BUSIF_USBDI_VERSION_0 0x0000 66 #define USB_BUSIF_USBDI_VERSION_1 0x0001 67 #define USB_BUSIF_USBDI_VERSION_2 0x0002 68 #define USB_BUSIF_USBDI_VERSION_3 0x0003 69 70 DEFINE_GUID(USB_BUS_INTERFACE_USBDI_GUID, 71 0xb1a96a13, 0x3de0, 0x4574, 0x9b, 0x1, 0xc0, 0x8f, 0xea, 0xb3, 0x18, 0xd6); 72 73 typedef struct _USB_BUS_INTERFACE_USBDI_V0 { 74 USHORT Size; 75 USHORT Version; 76 PVOID BusContext; 77 PINTERFACE_REFERENCE InterfaceReference; 78 PINTERFACE_DEREFERENCE InterfaceDereference; 79 PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion; 80 PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime; 81 PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb; 82 PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation; 83 } USB_BUS_INTERFACE_USBDI_V0, *PUSB_BUS_INTERFACE_USBDI_V0; 84 85 typedef struct _USB_BUS_INTERFACE_USBDI_V1 { 86 USHORT Size; 87 USHORT Version; 88 PVOID BusContext; 89 PINTERFACE_REFERENCE InterfaceReference; 90 PINTERFACE_DEREFERENCE InterfaceDereference; 91 PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion; 92 PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime; 93 PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb; 94 PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation; 95 PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed; 96 } USB_BUS_INTERFACE_USBDI_V1, *PUSB_BUS_INTERFACE_USBDI_V1; 97 98 typedef struct _USB_BUS_INTERFACE_USBDI_V2 { 99 USHORT Size; 100 USHORT Version; 101 PVOID BusContext; 102 PINTERFACE_REFERENCE InterfaceReference; 103 PINTERFACE_DEREFERENCE InterfaceDereference; 104 PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion; 105 PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime; 106 PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb; 107 PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation; 108 PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed; 109 PUSB_BUSIFFN_ENUM_LOG_ENTRY EnumLogEntry; 110 } USB_BUS_INTERFACE_USBDI_V2, *PUSB_BUS_INTERFACE_USBDI_V2; 111 112 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 113 114 #if (NTDDI_VERSION >= NTDDI_VISTA) 115 116 typedef NTSTATUS 117 (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_TIME_EX) ( 118 IN PVOID OPTIONAL, 119 OUT PULONG OPTIONAL); 120 121 typedef NTSTATUS 122 (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_CONTROLLER_TYPE) ( 123 IN PVOID OPTIONAL, 124 OUT PULONG OPTIONAL, 125 OUT PUSHORT OPTIONAL, 126 OUT PUSHORT OPTIONAL, 127 OUT PUCHAR OPTIONAL, 128 OUT PUCHAR OPTIONAL, 129 OUT PUCHAR OPTIONAL, 130 OUT PUCHAR OPTIONAL); 131 132 typedef struct _USB_BUS_INTERFACE_USBDI_V3 { 133 USHORT Size; 134 USHORT Version; 135 PVOID BusContext; 136 PINTERFACE_REFERENCE InterfaceReference; 137 PINTERFACE_DEREFERENCE InterfaceDereference; 138 PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion; 139 PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime; 140 PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb; 141 PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation; 142 PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed; 143 PUSB_BUSIFFN_ENUM_LOG_ENTRY EnumLogEntry; 144 PUSB_BUSIFFN_QUERY_BUS_TIME_EX QueryBusTimeEx; 145 PUSB_BUSIFFN_QUERY_CONTROLLER_TYPE QueryControllerType; 146 } USB_BUS_INTERFACE_USBDI_V3, *PUSB_BUS_INTERFACE_USBDI_V3; 147 148 DEFINE_GUID(USB_BUS_INTERFACE_USBC_CONFIGURATION_GUID, 149 0x893b6a96, 0xb7f, 0x4d4d, 0xbd, 0xb4, 0xbb, 0xd4, 0xce, 0xeb, 0xb3, 0x1c); 150 151 #define USBC_FUNCTION_FLAG_APPEND_ID 0x1 152 153 typedef struct _USBC_FUNCTION_DESCRIPTOR{ 154 UCHAR FunctionNumber; 155 UCHAR NumberOfInterfaces; 156 PUSB_INTERFACE_DESCRIPTOR *InterfaceDescriptorList; 157 UNICODE_STRING HardwareId; 158 UNICODE_STRING CompatibleId; 159 UNICODE_STRING FunctionDescription; 160 ULONG FunctionFlags; 161 PVOID Reserved; 162 } USBC_FUNCTION_DESCRIPTOR, *PUSBC_FUNCTION_DESCRIPTOR; 163 164 typedef 165 NTSTATUS 166 (USB_BUSIFFN *USBC_START_DEVICE_CALLBACK)( 167 IN PUSB_DEVICE_DESCRIPTOR DeviceDescriptor, 168 IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, 169 OUT PUSBC_FUNCTION_DESCRIPTOR *FunctionDescriptorBuffer, 170 OUT PULONG FunctionDescriptorBufferLength, 171 IN PDEVICE_OBJECT FdoDeviceObject, 172 IN PDEVICE_OBJECT PdoDeviceObject); 173 174 typedef 175 BOOLEAN 176 (USB_BUSIFFN *USBC_PDO_ENABLE_CALLBACK)( 177 IN PVOID Context, 178 IN USHORT FirstInterfaceNumber, 179 IN USHORT NumberOfInterfaces, 180 IN UCHAR FunctionClass, 181 IN UCHAR FunctionSubClass, 182 IN UCHAR FunctionProtocol); 183 184 #define USBC_DEVICE_CONFIGURATION_INTERFACE_VERSION_1 0x0001 185 186 typedef struct _USBC_DEVICE_CONFIGURATION_INTERFACE_V1 { 187 USHORT Size; 188 USHORT Version; 189 PVOID Context; 190 PINTERFACE_REFERENCE InterfaceReference; 191 PINTERFACE_DEREFERENCE InterfaceDereference; 192 USBC_START_DEVICE_CALLBACK StartDeviceCallback; 193 USBC_PDO_ENABLE_CALLBACK PdoEnableCallback; 194 PVOID Reserved[7]; 195 } USBC_DEVICE_CONFIGURATION_INTERFACE_V1, *PUSBC_DEVICE_CONFIGURATION_INTERFACE_V1; 196 197 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ 198 199