1 #pragma once 2 3 #define _HUBBUSIF_ 4 5 #include "usbdi.h" 6 7 #if (NTDDI_VERSION >= NTDDI_WINXP) 8 9 #if !defined(_USBBUSIF_) 10 typedef PVOID PUSB_DEVICE_HANDLE; 11 #endif 12 13 typedef struct _ROOTHUB_PDO_EXTENSION { 14 ULONG Signature; 15 } ROOTHUB_PDO_EXTENSION, *PROOTHUB_PDO_EXTENSION; 16 17 #define USBD_DEVHACK_SLOW_ENUMERATION 0x00000001 18 #define USBD_DEVHACK_DISABLE_SN 0x00000002 19 #define USBD_DEVHACK_SET_DIAG_ID 0x00000004 20 21 #ifndef USB_BUSIFFN 22 #define USB_BUSIFFN __stdcall 23 #endif 24 25 #define CD_ERR_V1 0x00000001 26 27 #define ID_ERR_V1 0x00000001 28 29 #define USBD_KEEP_DEVICE_DATA 0x00000001 30 #define USBD_MARK_DEVICE_BUSY 0x00000002 31 32 #define USB_IDLE_NOT_READY 0 33 #define USB_IDLE_READY 1 34 35 _Function_class_(USB_BUSIFFN_CREATE_USB_DEVICE) 36 typedef NTSTATUS 37 USB_BUSIFFN 38 USB_BUSIFFN_CREATE_USB_DEVICE ( 39 _In_ PVOID BusContext, 40 _Outptr_ PUSB_DEVICE_HANDLE *NewDeviceHandle, 41 _In_ PUSB_DEVICE_HANDLE HubDeviceHandle, 42 _In_ USHORT PortStatus, 43 _In_ USHORT PortNumber); 44 typedef USB_BUSIFFN_CREATE_USB_DEVICE *PUSB_BUSIFFN_CREATE_USB_DEVICE; 45 46 typedef enum _USBPORT_CREATEDEV_ERROR { 47 CreateDevErrNotSet = 0, 48 CreateDevBadHubDevHandle, 49 CreateDevFailedAllocDevHandle, 50 CreateDevFailedOpenEndpoint, 51 CreateDevFailedAllocDsBuff, 52 CreateDevFailedGetDs, 53 CreateDevTtNotFound, 54 CreateDevBadDevHandlePtr 55 } USBPORT_CREATEDEV_ERROR; 56 57 typedef struct _USB_CD_ERROR_INFORMATION { 58 ULONG Version; 59 USBPORT_CREATEDEV_ERROR PathError; 60 ULONG UlongArg1; 61 ULONG UlongArg2; 62 NTSTATUS NtStatus; 63 UCHAR XtraInfo[64]; 64 } USB_CD_ERROR_INFORMATION, *PUSB_CD_ERROR_INFORMATION; 65 66 _Function_class_(USB_BUSIFFN_CREATE_USB_DEVICE_EX) 67 typedef NTSTATUS 68 USB_BUSIFFN 69 USB_BUSIFFN_CREATE_USB_DEVICE_EX ( 70 _In_ PVOID BusContext, 71 _Outptr_ PUSB_DEVICE_HANDLE *NewDeviceHandle, 72 _In_ PUSB_DEVICE_HANDLE HsHubDeviceHandle, 73 _In_ USHORT PortStatus, 74 _In_ USHORT PortNumber, 75 _Out_ PUSB_CD_ERROR_INFORMATION CdErrorInfo, 76 _In_ USHORT TtPortNumber); 77 typedef USB_BUSIFFN_CREATE_USB_DEVICE_EX *PUSB_BUSIFFN_CREATE_USB_DEVICE_EX; 78 79 typedef struct _USB_PORT_PATH { 80 ULONG PortPathDepth; 81 ULONG PortPath[6]; 82 } USB_PORT_PATH, *PUSB_PORT_PATH; 83 84 _Function_class_(USB_BUSIFFN_CREATE_USB_DEVICE_V7) 85 typedef NTSTATUS 86 USB_BUSIFFN 87 USB_BUSIFFN_CREATE_USB_DEVICE_V7 ( 88 _In_ PVOID BusContext, 89 _Outptr_ PUSB_DEVICE_HANDLE *NewDeviceHandle, 90 _In_ PUSB_DEVICE_HANDLE HsHubDeviceHandle, 91 _In_ USHORT PortStatus, 92 _In_ PUSB_PORT_PATH PortPath, 93 _Out_ PUSB_CD_ERROR_INFORMATION CdErrorInfo, 94 _In_ USHORT TtPortNumber, 95 _In_ PDEVICE_OBJECT PdoDeviceObject, 96 _In_ PUNICODE_STRING PhysicalDeviceObjectName); 97 typedef USB_BUSIFFN_CREATE_USB_DEVICE_V7 *PUSB_BUSIFFN_CREATE_USB_DEVICE_V7; 98 99 typedef enum _USBPORT_INITDEV_ERROR { 100 InitDevErrNotSet = 0, 101 InitDevFailedSetAddress, 102 InitDevFailedPokeEndpoint, 103 InitDevBadDeviceDescriptor 104 } USBPORT_INITDEV_ERROR; 105 106 typedef struct _USB_ID_ERROR_INFORMATION { 107 ULONG Version; 108 USBPORT_INITDEV_ERROR PathError; 109 ULONG Arg1; 110 ULONG UsbAddress; 111 NTSTATUS NtStatus; 112 USBD_STATUS UsbdStatus; 113 UCHAR XtraInfo[64]; 114 } USB_ID_ERROR_INFORMATION, *PUSB_ID_ERROR_INFORMATION; 115 116 _Function_class_(USB_BUSIFFN_INITIALIZE_USB_DEVICE) 117 typedef NTSTATUS 118 USB_BUSIFFN 119 USB_BUSIFFN_INITIALIZE_USB_DEVICE( 120 _In_ PVOID BusContext, 121 _Inout_ PUSB_DEVICE_HANDLE DeviceHandle); 122 typedef USB_BUSIFFN_INITIALIZE_USB_DEVICE *PUSB_BUSIFFN_INITIALIZE_USB_DEVICE; 123 124 _Function_class_(USB_BUSIFFN_INITIALIZE_USB_DEVICE_EX) 125 typedef NTSTATUS 126 USB_BUSIFFN 127 USB_BUSIFFN_INITIALIZE_USB_DEVICE_EX( 128 _In_ PVOID BusContext, 129 _Inout_ PUSB_DEVICE_HANDLE DeviceHandle, 130 _Out_ PUSB_ID_ERROR_INFORMATION IdErrInfo); 131 typedef USB_BUSIFFN_INITIALIZE_USB_DEVICE_EX *PUSB_BUSIFFN_INITIALIZE_USB_DEVICE_EX; 132 133 _Function_class_(USB_BUSIFFN_REMOVE_USB_DEVICE) 134 typedef NTSTATUS 135 USB_BUSIFFN 136 USB_BUSIFFN_REMOVE_USB_DEVICE( 137 _In_ PVOID BusContext, 138 _Inout_ PUSB_DEVICE_HANDLE DeviceHandle, 139 _In_ ULONG Flags); 140 typedef USB_BUSIFFN_REMOVE_USB_DEVICE *PUSB_BUSIFFN_REMOVE_USB_DEVICE; 141 142 _Function_class_(USB_BUSIFFN_GET_USB_DESCRIPTORS) 143 typedef NTSTATUS 144 USB_BUSIFFN 145 USB_BUSIFFN_GET_USB_DESCRIPTORS( 146 _In_ PVOID BusContext, 147 _Inout_ PUSB_DEVICE_HANDLE DeviceHandle, 148 _Out_writes_bytes_to_(*DeviceDescriptorBufferLength,*DeviceDescriptorBufferLength) 149 PUCHAR DeviceDescriptorBuffer, 150 _Inout_ PULONG DeviceDescriptorBufferLength, 151 _Out_writes_bytes_to_(*ConfigDescriptorBufferLength, *ConfigDescriptorBufferLength) 152 PUCHAR ConfigDescriptorBuffer, 153 _Inout_ PULONG ConfigDescriptorBufferLength); 154 typedef USB_BUSIFFN_GET_USB_DESCRIPTORS *PUSB_BUSIFFN_GET_USB_DESCRIPTORS; 155 156 _Function_class_(USB_BUSIFFN_RESTORE_DEVICE) 157 typedef NTSTATUS 158 USB_BUSIFFN 159 USB_BUSIFFN_RESTORE_DEVICE( 160 _In_ PVOID BusContext, 161 _Inout_ PUSB_DEVICE_HANDLE OldDeviceHandle, 162 _Inout_ PUSB_DEVICE_HANDLE NewDeviceHandle); 163 typedef USB_BUSIFFN_RESTORE_DEVICE *PUSB_BUSIFFN_RESTORE_DEVICE; 164 165 _Function_class_(USB_BUSIFFN_GET_POTRTHACK_FLAGS) 166 typedef NTSTATUS 167 USB_BUSIFFN 168 USB_BUSIFFN_GET_POTRTHACK_FLAGS( 169 _In_ PVOID BusContext, 170 _Inout_ PULONG Flags); 171 typedef USB_BUSIFFN_GET_POTRTHACK_FLAGS *PUSB_BUSIFFN_GET_POTRTHACK_FLAGS; 172 173 _Function_class_(USB_BUSIFFN_GET_DEVICE_INFORMATION) 174 typedef NTSTATUS 175 USB_BUSIFFN 176 USB_BUSIFFN_GET_DEVICE_INFORMATION( 177 _In_ PVOID BusContext, 178 _In_ PUSB_DEVICE_HANDLE DeviceHandle, 179 _Out_writes_bytes_to_(DeviceInformationBufferLength,*LengthOfDataCopied) 180 PVOID DeviceInformationBuffer, 181 _In_ ULONG DeviceInformationBufferLength, 182 _Inout_ PULONG LengthOfDataCopied); 183 typedef USB_BUSIFFN_GET_DEVICE_INFORMATION *PUSB_BUSIFFN_GET_DEVICE_INFORMATION; 184 185 _Function_class_(USB_BUSIFFN_GET_CONTROLLER_INFORMATION) 186 typedef NTSTATUS 187 USB_BUSIFFN 188 USB_BUSIFFN_GET_CONTROLLER_INFORMATION( 189 _In_ PVOID BusContext, 190 _Inout_updates_bytes_to_(ControllerInformationBufferLength, *LengthOfDataCopied) 191 PVOID ControllerInformationBuffer, 192 _In_ ULONG ControllerInformationBufferLength, 193 _Inout_ PULONG LengthOfDataCopied); 194 typedef USB_BUSIFFN_GET_CONTROLLER_INFORMATION *PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION; 195 196 _Function_class_(USB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND) 197 typedef NTSTATUS 198 USB_BUSIFFN 199 USB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND( 200 _In_ PVOID BusContext, 201 _In_ BOOLEAN Enable); 202 typedef USB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND *PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND; 203 204 _Function_class_(USB_BUSIFFN_GET_EXTENDED_HUB_INFO) 205 typedef NTSTATUS 206 USB_BUSIFFN 207 USB_BUSIFFN_GET_EXTENDED_HUB_INFO( 208 _In_ PVOID BusContext, 209 _In_ PDEVICE_OBJECT HubPhysicalDeviceObject, 210 _Inout_updates_bytes_to_(HubInformationBufferLength, *LengthOfDataCopied) 211 PVOID HubInformationBuffer, 212 _In_ ULONG HubInformationBufferLength, 213 _Out_ PULONG LengthOfDataCopied); 214 typedef USB_BUSIFFN_GET_EXTENDED_HUB_INFO *PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO; 215 216 _Function_class_(USB_BUSIFFN_GET_ROOTHUB_SYM_NAME) 217 typedef NTSTATUS 218 USB_BUSIFFN 219 USB_BUSIFFN_GET_ROOTHUB_SYM_NAME( 220 _In_ PVOID BusContext, 221 _Inout_updates_bytes_to_(HubSymNameBufferLength, *HubSymNameActualLength) PVOID HubSymNameBuffer, 222 _In_ ULONG HubSymNameBufferLength, 223 _Out_ PULONG HubSymNameActualLength); 224 typedef USB_BUSIFFN_GET_ROOTHUB_SYM_NAME *PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME; 225 226 _Function_class_(USB_BUSIFFN_GET_DEVICE_BUSCONTEXT) 227 typedef PVOID 228 USB_BUSIFFN 229 USB_BUSIFFN_GET_DEVICE_BUSCONTEXT( 230 _In_ PVOID HubBusContext, 231 _In_ PVOID DeviceHandle); 232 typedef USB_BUSIFFN_GET_DEVICE_BUSCONTEXT *PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT; 233 234 _Function_class_(USB_BUSIFFN_INITIALIZE_20HUB) 235 typedef NTSTATUS 236 USB_BUSIFFN 237 USB_BUSIFFN_INITIALIZE_20HUB( 238 _In_ PVOID BusContext, 239 _In_ PUSB_DEVICE_HANDLE HubDeviceHandle, 240 _In_ ULONG TtCount); 241 typedef USB_BUSIFFN_INITIALIZE_20HUB *PUSB_BUSIFFN_INITIALIZE_20HUB; 242 243 _Function_class_(USB_BUSIFFN_IS_ROOT) 244 typedef BOOLEAN 245 USB_BUSIFFN 246 USB_BUSIFFN_IS_ROOT( 247 _In_ PVOID BusContext, 248 _In_ PVOID DeviceObject); 249 typedef USB_BUSIFFN_IS_ROOT *PUSB_BUSIFFN_IS_ROOT; 250 251 _Function_class_(USB_BUSIFFN_ACQUIRE_SEMAPHORE) 252 typedef VOID 253 USB_BUSIFFN 254 USB_BUSIFFN_ACQUIRE_SEMAPHORE( 255 _In_ PVOID BusContext); 256 typedef USB_BUSIFFN_ACQUIRE_SEMAPHORE *PUSB_BUSIFFN_ACQUIRE_SEMAPHORE; 257 258 _Function_class_(USB_BUSIFFN_RELEASE_SEMAPHORE) 259 typedef VOID 260 USB_BUSIFFN 261 USB_BUSIFFN_RELEASE_SEMAPHORE( 262 _In_ PVOID BusContext); 263 typedef USB_BUSIFFN_RELEASE_SEMAPHORE *PUSB_BUSIFFN_RELEASE_SEMAPHORE; 264 265 _Function_class_(RH_INIT_CALLBACK) 266 typedef VOID 267 __stdcall 268 RH_INIT_CALLBACK( 269 _In_ PVOID CallBackContext); 270 typedef RH_INIT_CALLBACK *PRH_INIT_CALLBACK; 271 272 _Function_class_(USB_BUSIFFN_ROOTHUB_INIT_NOTIFY) 273 typedef NTSTATUS 274 USB_BUSIFFN 275 USB_BUSIFFN_ROOTHUB_INIT_NOTIFY( 276 _In_ PVOID BusContext, 277 _In_ PVOID CallbackContext, 278 _In_ PRH_INIT_CALLBACK CallbackRoutine); 279 typedef USB_BUSIFFN_ROOTHUB_INIT_NOTIFY *PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY; 280 281 _Function_class_(USB_BUSIFFN_FLUSH_TRANSFERS) 282 typedef VOID 283 USB_BUSIFFN 284 USB_BUSIFFN_FLUSH_TRANSFERS( 285 _In_ PVOID BusContext, 286 _In_ PVOID DeviceHandle); 287 typedef USB_BUSIFFN_FLUSH_TRANSFERS *PUSB_BUSIFFN_FLUSH_TRANSFERS; 288 289 _Function_class_(USB_BUSIFFN_CALC_PIPE_BANDWIDTH) 290 typedef ULONG 291 USB_BUSIFFN 292 USB_BUSIFFN_CALC_PIPE_BANDWIDTH( 293 _In_ PVOID BusContext, 294 _In_ PUSBD_PIPE_INFORMATION PipeInfo, 295 _In_ USB_DEVICE_SPEED DeviceSpeed); 296 typedef USB_BUSIFFN_CALC_PIPE_BANDWIDTH *PUSB_BUSIFFN_CALC_PIPE_BANDWIDTH; 297 298 _Function_class_(USB_BUSIFFN_SET_BUS_WAKE_MODE) 299 typedef VOID 300 USB_BUSIFFN 301 USB_BUSIFFN_SET_BUS_WAKE_MODE( 302 _In_ PVOID BusContext, 303 _In_ ULONG Mode); 304 typedef USB_BUSIFFN_SET_BUS_WAKE_MODE *PUSB_BUSIFFN_SET_BUS_WAKE_MODE; 305 306 _Function_class_(USB_BUSIFFN_SET_DEVICE_FLAG) 307 typedef VOID 308 USB_BUSIFFN 309 USB_BUSIFFN_SET_DEVICE_FLAG( 310 _In_ PVOID BusContext, 311 _In_ GUID *DeviceFlagGuid, 312 _In_ PVOID ValueData, 313 _In_ ULONG ValueLength); 314 typedef USB_BUSIFFN_SET_DEVICE_FLAG *PUSB_BUSIFFN_SET_DEVICE_FLAG; 315 316 _Function_class_(USB_BUSIFFN_SET_DEVHANDLE_DATA) 317 typedef VOID 318 USB_BUSIFFN 319 USB_BUSIFFN_SET_DEVHANDLE_DATA( 320 _In_ PVOID BusContext, 321 _In_ PVOID DeviceHandle, 322 _In_ PDEVICE_OBJECT UsbDevicePdo); 323 typedef USB_BUSIFFN_SET_DEVHANDLE_DATA *PUSB_BUSIFFN_SET_DEVHANDLE_DATA; 324 325 _Function_class_(USB_BUSIFFN_TEST_POINT) 326 typedef NTSTATUS 327 USB_BUSIFFN 328 USB_BUSIFFN_TEST_POINT( 329 _In_ PVOID BusContext, 330 _In_ PVOID DeviceHandle, 331 _In_ ULONG Opcode, 332 _In_ PVOID TestData); 333 typedef USB_BUSIFFN_TEST_POINT *PUSB_BUSIFFN_TEST_POINT; 334 335 _Function_class_(USB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO) 336 typedef NTSTATUS 337 USB_BUSIFFN 338 USB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO( 339 _In_ PVOID BusContext, 340 _In_ PUSB_DEVICE_HANDLE DeviceHandle, 341 _Out_writes_bytes_to_(DeviceInformationBufferLength,*LengthOfDataCopied) 342 PVOID DeviceInformationBuffer, 343 _In_ ULONG DeviceInformationBufferLength, 344 _Inout_ PULONG LengthOfDataCopied); 345 typedef USB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO *PUSB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO; 346 347 _Function_class_(USB_BUSIFFN_WAIT_ASYNC_POWERUP) 348 typedef NTSTATUS 349 USB_BUSIFFN 350 USB_BUSIFFN_WAIT_ASYNC_POWERUP( 351 _In_ PVOID BusContext); 352 typedef USB_BUSIFFN_WAIT_ASYNC_POWERUP *PUSB_BUSIFFN_WAIT_ASYNC_POWERUP; 353 354 _Function_class_(USB_BUSIFFN_GET_DEVICE_ADDRESS) 355 typedef NTSTATUS 356 USB_BUSIFFN 357 USB_BUSIFFN_GET_DEVICE_ADDRESS( 358 _In_ PVOID BusContext, 359 _In_ PUSB_DEVICE_HANDLE DeviceHandle, 360 _Out_ PUSHORT DeviceAddress); 361 typedef USB_BUSIFFN_GET_DEVICE_ADDRESS *PUSB_BUSIFFN_GET_DEVICE_ADDRESS; 362 363 _Function_class_(USB_BUSIFFN_DEREF_DEVICE_HANDLE) 364 typedef VOID 365 USB_BUSIFFN 366 USB_BUSIFFN_DEREF_DEVICE_HANDLE( 367 _In_ PVOID BusContext, 368 _In_ PUSB_DEVICE_HANDLE DeviceHandle, 369 _In_ PVOID Object, 370 _In_ ULONG Tag); 371 typedef USB_BUSIFFN_DEREF_DEVICE_HANDLE *PUSB_BUSIFFN_DEREF_DEVICE_HANDLE; 372 373 _Function_class_(USB_BUSIFFN_REF_DEVICE_HANDLE) 374 typedef NTSTATUS 375 USB_BUSIFFN 376 USB_BUSIFFN_REF_DEVICE_HANDLE( 377 _In_ PVOID BusContext, 378 _In_ PUSB_DEVICE_HANDLE DeviceHandle, 379 _In_ PVOID Object, 380 _In_ ULONG Tag); 381 typedef USB_BUSIFFN_REF_DEVICE_HANDLE *PUSB_BUSIFFN_REF_DEVICE_HANDLE; 382 383 _Function_class_(USB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE) 384 typedef ULONG 385 USB_BUSIFFN 386 USB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE( 387 _In_ PVOID BusContext, 388 _In_ PUSB_DEVICE_HANDLE DeviceHandle, 389 _In_ ULONG NewIdleReadyState); 390 typedef USB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE *PUSB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE; 391 392 _Function_class_(USB_BUSIFFN_GET_CONTAINER_ID_FOR_PORT) 393 typedef NTSTATUS 394 USB_BUSIFFN 395 USB_BUSIFFN_GET_CONTAINER_ID_FOR_PORT( 396 _In_ PVOID BusContext, 397 _In_ USHORT PortNumber, 398 _Out_ LPGUID ContainerId); 399 typedef USB_BUSIFFN_GET_CONTAINER_ID_FOR_PORT *PUSB_BUSIFFN_GET_CONTAINER_ID_FOR_PORT; 400 401 _Function_class_(USB_BUSIFFN_SET_CONTAINER_ID_FOR_PORT) 402 typedef VOID 403 USB_BUSIFFN 404 USB_BUSIFFN_SET_CONTAINER_ID_FOR_PORT( 405 _In_ PVOID BusContext, 406 _In_ USHORT PortNumber, 407 _In_ LPGUID ContainerId); 408 typedef USB_BUSIFFN_SET_CONTAINER_ID_FOR_PORT *PUSB_BUSIFFN_SET_CONTAINER_ID_FOR_PORT; 409 410 _Function_class_(USB_BUSIFFN_ABORT_ALL_DEVICE_PIPES) 411 typedef NTSTATUS 412 USB_BUSIFFN 413 USB_BUSIFFN_ABORT_ALL_DEVICE_PIPES( 414 _In_ PVOID BusContext, 415 _In_ PUSB_DEVICE_HANDLE DeviceHandle); 416 typedef USB_BUSIFFN_ABORT_ALL_DEVICE_PIPES *PUSB_BUSIFFN_ABORT_ALL_DEVICE_PIPES; 417 418 #define ERRATA_FLAG_RESET_TT_ON_CANCEL 1 419 #define ERRATA_FLAG_NO_CLEAR_TT_BUFFER_ON_CANCEL 2 420 421 #define USB_BUSIF_HUB_VERSION_0 0x0000 422 #define USB_BUSIF_HUB_VERSION_1 0x0001 423 #define USB_BUSIF_HUB_VERSION_2 0x0002 424 #define USB_BUSIF_HUB_VERSION_3 0x0003 425 #define USB_BUSIF_HUB_VERSION_4 0x0004 426 #define USB_BUSIF_HUB_VERSION_5 0x0005 427 #define USB_BUSIF_HUB_VERSION_6 0x0006 428 #define USB_BUSIF_HUB_VERSION_7 0x0007 429 430 #define USB_BUSIF_HUB_MIDUMP_VERSION_0 0x0000 431 432 #define USB_BUSIF_HUB_SS_VERSION_0 0x0000 433 434 _Function_class_(USB_BUSIFFN_SET_DEVICE_ERRATA_FLAG) 435 typedef VOID 436 USB_BUSIFFN 437 USB_BUSIFFN_SET_DEVICE_ERRATA_FLAG( 438 _In_ PVOID BusContext, 439 _In_ PUSB_DEVICE_HANDLE DeviceHandle, 440 _In_ ULONG DeviceErrataFlag); 441 typedef USB_BUSIFFN_SET_DEVICE_ERRATA_FLAG *PUSB_BUSIFFN_SET_DEVICE_ERRATA_FLAG; 442 443 DEFINE_GUID(USB_BUS_INTERFACE_HUB_GUID, 444 0xb2bb8c0a, 0x5ab4, 0x11d3, 0xa8, 0xcd, 0x0, 0xc0, 0x4f, 0x68, 0x74, 0x7a); 445 446 typedef struct _USB_BUS_INTERFACE_HUB_V0 { 447 USHORT Size; 448 USHORT Version; 449 PVOID BusContext; 450 PINTERFACE_REFERENCE InterfaceReference; 451 PINTERFACE_DEREFERENCE InterfaceDereference; 452 } USB_BUS_INTERFACE_HUB_V0, *PUSB_BUS_INTERFACE_HUB_V0; 453 454 typedef struct _USB_BUS_INTERFACE_HUB_V1 { 455 USHORT Size; 456 USHORT Version; 457 PVOID BusContext; 458 PINTERFACE_REFERENCE InterfaceReference; 459 PINTERFACE_DEREFERENCE InterfaceDereference; 460 PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice; 461 PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice; 462 PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; 463 PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; 464 PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; 465 PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; 466 PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; 467 } USB_BUS_INTERFACE_HUB_V1, *PUSB_BUS_INTERFACE_HUB_V1; 468 469 typedef struct _USB_BUS_INTERFACE_HUB_V2 { 470 USHORT Size; 471 USHORT Version; 472 PVOID BusContext; 473 PINTERFACE_REFERENCE InterfaceReference; 474 PINTERFACE_DEREFERENCE InterfaceDereference; 475 PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice; 476 PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice; 477 PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; 478 PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; 479 PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; 480 PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; 481 PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; 482 PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; 483 PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; 484 PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; 485 PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; 486 PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; 487 PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; 488 } USB_BUS_INTERFACE_HUB_V2, *PUSB_BUS_INTERFACE_HUB_V2; 489 490 typedef struct _USB_BUS_INTERFACE_HUB_V3 { 491 USHORT Size; 492 USHORT Version; 493 PVOID BusContext; 494 PINTERFACE_REFERENCE InterfaceReference; 495 PINTERFACE_DEREFERENCE InterfaceDereference; 496 PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice; 497 PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice; 498 PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; 499 PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; 500 PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; 501 PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; 502 PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; 503 PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; 504 PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; 505 PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; 506 PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; 507 PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; 508 PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; 509 PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification; 510 } USB_BUS_INTERFACE_HUB_V3, *PUSB_BUS_INTERFACE_HUB_V3; 511 512 typedef struct _USB_BUS_INTERFACE_HUB_V4 { 513 USHORT Size; 514 USHORT Version; 515 PVOID BusContext; 516 PINTERFACE_REFERENCE InterfaceReference; 517 PINTERFACE_DEREFERENCE InterfaceDereference; 518 PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice; 519 PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice; 520 PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; 521 PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; 522 PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; 523 PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; 524 PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; 525 PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; 526 PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; 527 PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; 528 PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; 529 PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; 530 PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; 531 PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification; 532 PUSB_BUSIFFN_FLUSH_TRANSFERS FlushTransfers; 533 } USB_BUS_INTERFACE_HUB_V4, *PUSB_BUS_INTERFACE_HUB_V4; 534 535 typedef struct _USB_BUS_INTERFACE_HUB_V5 { 536 USHORT Size; 537 USHORT Version; 538 PVOID BusContext; 539 PINTERFACE_REFERENCE InterfaceReference; 540 PINTERFACE_DEREFERENCE InterfaceDereference; 541 PUSB_BUSIFFN_CREATE_USB_DEVICE CreateUsbDevice; 542 PUSB_BUSIFFN_INITIALIZE_USB_DEVICE InitializeUsbDevice; 543 PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; 544 PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; 545 PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; 546 PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; 547 PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; 548 PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; 549 PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; 550 PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; 551 PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; 552 PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; 553 PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; 554 PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification; 555 PUSB_BUSIFFN_FLUSH_TRANSFERS FlushTransfers; 556 PUSB_BUSIFFN_SET_DEVHANDLE_DATA SetDeviceHandleData; 557 } USB_BUS_INTERFACE_HUB_V5, *PUSB_BUS_INTERFACE_HUB_V5; 558 559 typedef struct _USB_BUS_INTERFACE_HUB_V6 { 560 USHORT Size; 561 USHORT Version; 562 PVOID BusContext; 563 PINTERFACE_REFERENCE InterfaceReference; 564 PINTERFACE_DEREFERENCE InterfaceDereference; 565 PUSB_BUSIFFN_CREATE_USB_DEVICE_EX CreateUsbDevice; 566 PUSB_BUSIFFN_INITIALIZE_USB_DEVICE_EX InitializeUsbDevice; 567 PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; 568 PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; 569 PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; 570 PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; 571 PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; 572 PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; 573 PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; 574 PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; 575 PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; 576 PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; 577 PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; 578 PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification; 579 PUSB_BUSIFFN_FLUSH_TRANSFERS FlushTransfers; 580 PUSB_BUSIFFN_SET_DEVHANDLE_DATA SetDeviceHandleData; 581 PUSB_BUSIFFN_IS_ROOT HubIsRoot; 582 PUSB_BUSIFFN_ACQUIRE_SEMAPHORE AcquireBusSemaphore; 583 PUSB_BUSIFFN_RELEASE_SEMAPHORE ReleaseBusSemaphore; 584 PUSB_BUSIFFN_CALC_PIPE_BANDWIDTH CaculatePipeBandwidth; 585 PUSB_BUSIFFN_SET_BUS_WAKE_MODE SetBusSystemWakeMode; 586 PUSB_BUSIFFN_SET_DEVICE_FLAG SetDeviceFlag; 587 PUSB_BUSIFFN_TEST_POINT HubTestPoint; 588 PUSB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO GetDevicePerformanceInfo; 589 PUSB_BUSIFFN_WAIT_ASYNC_POWERUP WaitAsyncPowerUp; 590 PUSB_BUSIFFN_GET_DEVICE_ADDRESS GetDeviceAddress; 591 PUSB_BUSIFFN_REF_DEVICE_HANDLE RefDeviceHandle; 592 PUSB_BUSIFFN_DEREF_DEVICE_HANDLE DerefDeviceHandle; 593 PUSB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE SetDeviceHandleIdleReadyState; 594 } USB_BUS_INTERFACE_HUB_V6, *PUSB_BUS_INTERFACE_HUB_V6; 595 596 typedef struct _USB_BUS_INTERFACE_HUB_V7 { 597 USHORT Size; 598 USHORT Version; 599 PVOID BusContext; 600 PINTERFACE_REFERENCE InterfaceReference; 601 PINTERFACE_DEREFERENCE InterfaceDereference; 602 PUSB_BUSIFFN_CREATE_USB_DEVICE_EX CreateUsbDevice; 603 PUSB_BUSIFFN_INITIALIZE_USB_DEVICE_EX InitializeUsbDevice; 604 PUSB_BUSIFFN_GET_USB_DESCRIPTORS GetUsbDescriptors; 605 PUSB_BUSIFFN_REMOVE_USB_DEVICE RemoveUsbDevice; 606 PUSB_BUSIFFN_RESTORE_DEVICE RestoreUsbDevice; 607 PUSB_BUSIFFN_GET_POTRTHACK_FLAGS GetPortHackFlags; 608 PUSB_BUSIFFN_GET_DEVICE_INFORMATION QueryDeviceInformation; 609 PUSB_BUSIFFN_GET_CONTROLLER_INFORMATION GetControllerInformation; 610 PUSB_BUSIFFN_CONTROLLER_SELECTIVE_SUSPEND ControllerSelectiveSuspend; 611 PUSB_BUSIFFN_GET_EXTENDED_HUB_INFO GetExtendedHubInformation; 612 PUSB_BUSIFFN_GET_ROOTHUB_SYM_NAME GetRootHubSymbolicName; 613 PUSB_BUSIFFN_GET_DEVICE_BUSCONTEXT GetDeviceBusContext; 614 PUSB_BUSIFFN_INITIALIZE_20HUB Initialize20Hub; 615 PUSB_BUSIFFN_ROOTHUB_INIT_NOTIFY RootHubInitNotification; 616 PUSB_BUSIFFN_FLUSH_TRANSFERS FlushTransfers; 617 PUSB_BUSIFFN_SET_DEVHANDLE_DATA SetDeviceHandleData; 618 PUSB_BUSIFFN_IS_ROOT HubIsRoot; 619 PUSB_BUSIFFN_ACQUIRE_SEMAPHORE AcquireBusSemaphore; 620 PUSB_BUSIFFN_RELEASE_SEMAPHORE ReleaseBusSemaphore; 621 PUSB_BUSIFFN_CALC_PIPE_BANDWIDTH CaculatePipeBandwidth; 622 PUSB_BUSIFFN_SET_BUS_WAKE_MODE SetBusSystemWakeMode; 623 PUSB_BUSIFFN_SET_DEVICE_FLAG SetDeviceFlag; 624 PUSB_BUSIFFN_TEST_POINT HubTestPoint; 625 PUSB_BUSIFFN_GET_DEVICE_PERFORMANCE_INFO GetDevicePerformanceInfo; 626 PUSB_BUSIFFN_WAIT_ASYNC_POWERUP WaitAsyncPowerUp; 627 PUSB_BUSIFFN_GET_DEVICE_ADDRESS GetDeviceAddress; 628 PUSB_BUSIFFN_REF_DEVICE_HANDLE RefDeviceHandle; 629 PUSB_BUSIFFN_DEREF_DEVICE_HANDLE DerefDeviceHandle; 630 PUSB_BUSIFFN_SET_DEVICE_HANDLE_IDLE_READY_STATE SetDeviceHandleIdleReadyState; 631 PUSB_BUSIFFN_CREATE_USB_DEVICE_V7 CreateUsbDeviceV7; 632 PUSB_BUSIFFN_GET_CONTAINER_ID_FOR_PORT GetContainerIdForPort; 633 PUSB_BUSIFFN_SET_CONTAINER_ID_FOR_PORT SetContainerIdForPort; 634 PUSB_BUSIFFN_ABORT_ALL_DEVICE_PIPES AbortAllDevicePipes; 635 PUSB_BUSIFFN_SET_DEVICE_ERRATA_FLAG SetDeviceErrataFlag; 636 } USB_BUS_INTERFACE_HUB_V7, *PUSB_BUS_INTERFACE_HUB_V7; 637 638 DEFINE_GUID(USB_BUS_INTERFACE_HUB_MINIDUMP_GUID, 639 0xc5485f21, 0x4e81, 0x4a23, 0xa8, 0xf9, 0xd8, 0x51, 0x8a, 0xf4, 0x5c, 0x38); 640 641 typedef VOID 642 (USB_BUSIFFN *PUSB_BUSIFFN_SET_MINIDUMP_FLAGS) ( 643 IN PVOID); 644 645 typedef struct _USB_BUS_INTERFACE_HUB_MINIDUMP { 646 USHORT Size; 647 USHORT Version; 648 PVOID BusContext; 649 PINTERFACE_REFERENCE InterfaceReference; 650 PINTERFACE_DEREFERENCE InterfaceDereference; 651 PUSB_BUSIFFN_SET_MINIDUMP_FLAGS SetUsbPortMiniDumpFlags; 652 } USB_BUS_INTERFACE_HUB_MINIDUMP, *PUSB_BUS_INTERFACE_HUB_MINIDUMP; 653 654 DEFINE_GUID(USB_BUS_INTERFACE_HUB_SS_GUID, 655 0xbfc3f363, 0x8ba1, 0x4c7b, 0x97, 0xba, 0x9b, 0x12, 0xb1, 0xca, 0x13, 0x2f); 656 657 typedef NTSTATUS 658 (USB_BUSIFFN *PUSB_BUSIFFN_SUSPEND_HUB) ( 659 PDEVICE_OBJECT Pdo); 660 661 typedef NTSTATUS 662 (USB_BUSIFFN *PUSB_BUSIFFN_RESUME_HUB) ( 663 PDEVICE_OBJECT Pdo); 664 665 typedef struct _USB_BUS_INTERFACE_HUB_SELECTIVE_SUSPEND { 666 USHORT Size; 667 USHORT Version; 668 PVOID BusContext; 669 PINTERFACE_REFERENCE InterfaceReference; 670 PINTERFACE_DEREFERENCE InterfaceDereference; 671 PUSB_BUSIFFN_SUSPEND_HUB SuspendHub; 672 PUSB_BUSIFFN_RESUME_HUB ResumeHub; 673 } USB_BUS_INTERFACE_HUB_SELECTIVE_SUSPEND, *PUSB_BUS_INTERFACE_HUB_SELECTIVE_SUSPEND; 674 675 #include <pshpack1.h> 676 677 typedef struct _USB_PIPE_INFORMATION_0 { 678 USB_ENDPOINT_DESCRIPTOR EndpointDescriptor; 679 UCHAR ED_Pad[1]; 680 ULONG ScheduleOffset; 681 } USB_PIPE_INFORMATION_0, *PUSB_PIPE_INFORMATION_0; 682 683 typedef struct _USB_LEVEL_INFORMATION { 684 ULONG InformationLevel; 685 ULONG ActualLength; 686 } USB_LEVEL_INFORMATION, *PUSB_LEVEL_INFORMATION; 687 688 typedef struct _USB_DEVICE_INFORMATION_0 { 689 ULONG InformationLevel; 690 ULONG ActualLength; 691 ULONG PortNumber; 692 USB_DEVICE_DESCRIPTOR DeviceDescriptor; 693 UCHAR DD_pad[2]; 694 UCHAR CurrentConfigurationValue; 695 UCHAR ReservedMBZ; 696 USHORT DeviceAddress; 697 ULONG HubAddress; 698 USB_DEVICE_SPEED DeviceSpeed; 699 USB_DEVICE_TYPE DeviceType; 700 ULONG NumberOfOpenPipes; 701 USB_PIPE_INFORMATION_0 PipeList[1]; 702 } USB_DEVICE_INFORMATION_0, *PUSB_DEVICE_INFORMATION_0; 703 704 typedef struct _USB_CONTROLLER_INFORMATION_0 { 705 ULONG InformationLevel; 706 ULONG ActualLength; 707 BOOLEAN SelectiveSuspendEnabled; 708 BOOLEAN IsHighSpeedController; 709 } USB_CONTROLLER_INFORMATION_0, *PUSB_CONTROLLER_INFORMATION_0; 710 711 typedef struct _USB_CONTROLLER_INFORMATION_1 { 712 ULONG InformationLevel; 713 ULONG ActualLength; 714 BOOLEAN SelectiveSuspendEnabled; 715 BOOLEAN IsHighSpeedController; 716 ULONG HcBusNumber; 717 ULONG HcBusDevice; 718 ULONG HcBusFunction; 719 } USB_CONTROLLER_INFORMATION_1, *PUSB_CONTROLLER_INFORMATION_1; 720 721 typedef struct _USB_EXTPORT_INFORMATION_0 { 722 ULONG PhysicalPortNumber; 723 ULONG PortLabelNumber; 724 USHORT VidOverride; 725 USHORT PidOverride; 726 ULONG PortAttributes; 727 } USB_EXTPORT_INFORMATION_0, *PUSB_EXTPORT_INFORMATION; 728 729 typedef struct _USB_EXTHUB_INFORMATION_0 { 730 ULONG InformationLevel; 731 ULONG NumberOfPorts; 732 USB_EXTPORT_INFORMATION_0 Port[255]; 733 } USB_EXTHUB_INFORMATION_0, *PUSB_EXTHUB_INFORMATION_0; 734 735 typedef struct _USB_DEVICE_PERFORMANCE_INFO_0 { 736 ULONG InformationLevel; 737 ULONG ActualLength; 738 ULONG BulkBytes; 739 ULONG BulkUrbCount; 740 ULONG ControlDataBytes; 741 ULONG ControlUrbCount; 742 ULONG IsoBytes; 743 ULONG IsoUrbCount; 744 ULONG InterruptBytes; 745 ULONG InterruptUrbCount; 746 ULONG AllocedInterrupt[6]; 747 ULONG AllocedIso; 748 ULONG Total32secBandwidth; 749 ULONG TotalTtBandwidth; 750 ULONG TotalIsoLatency; 751 ULONG DroppedIsoPackets; 752 ULONG TransferErrors; 753 } USB_DEVICE_PERFORMANCE_INFO_0, *PUSB_DEVICE_PERFORMANCE_INFO_0; 754 755 #include <poppack.h> 756 757 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 758