1 /* 2 * usbioctl.h 3 * 4 * USB IOCTL interface. 5 * 6 * This file is part of the ReactOS PSDK package. 7 * 8 * Contributors: 9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net> 10 * 11 * THIS SOFTWARE IS NOT COPYRIGHTED 12 * 13 * This source code is offered for use in the public domain. You may 14 * use, modify or distribute it freely. 15 * 16 * This code is distributed in the hope that it will be useful but 17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 18 * DISCLAIMED. This includes but is not limited to warranties of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 */ 22 23 #pragma once 24 25 #include "usb100.h" 26 #include "usbiodef.h" 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 32 #define IOCTL_INTERNAL_USB_SUBMIT_URB \ 33 CTL_CODE(FILE_DEVICE_USB, USB_SUBMIT_URB, METHOD_NEITHER, FILE_ANY_ACCESS) 34 35 #define IOCTL_INTERNAL_USB_RESET_PORT \ 36 CTL_CODE(FILE_DEVICE_USB, USB_RESET_PORT, METHOD_NEITHER, FILE_ANY_ACCESS) 37 38 #define IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO \ 39 CTL_CODE(FILE_DEVICE_USB, USB_GET_ROOTHUB_PDO, METHOD_NEITHER, FILE_ANY_ACCESS) 40 41 #define USBD_PORT_ENABLED 1 42 #define USBD_PORT_CONNECTED 2 43 44 #define IOCTL_INTERNAL_USB_GET_PORT_STATUS \ 45 CTL_CODE(FILE_DEVICE_USB, USB_GET_PORT_STATUS, METHOD_NEITHER, FILE_ANY_ACCESS) 46 47 #define IOCTL_INTERNAL_USB_ENABLE_PORT \ 48 CTL_CODE(FILE_DEVICE_USB, USB_ENABLE_PORT, METHOD_NEITHER, FILE_ANY_ACCESS) 49 50 #define IOCTL_INTERNAL_USB_GET_HUB_COUNT \ 51 CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_COUNT, METHOD_NEITHER, FILE_ANY_ACCESS) 52 53 #define IOCTL_INTERNAL_USB_CYCLE_PORT \ 54 CTL_CODE(FILE_DEVICE_USB, USB_CYCLE_PORT, METHOD_NEITHER, FILE_ANY_ACCESS) 55 56 #define IOCTL_INTERNAL_USB_GET_HUB_NAME \ 57 CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS) 58 59 #define IOCTL_INTERNAL_USB_GET_BUS_INFO \ 60 CTL_CODE(FILE_DEVICE_USB, USB_GET_BUS_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS) 61 62 #define IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME \ 63 CTL_CODE(FILE_DEVICE_USB, USB_GET_CONTROLLER_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS) 64 65 #define IOCTL_INTERNAL_USB_GET_BUSGUID_INFO \ 66 CTL_CODE(FILE_DEVICE_USB, USB_GET_BUSGUID_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS) 67 68 #define IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO \ 69 CTL_CODE(FILE_DEVICE_USB, USB_GET_PARENT_HUB_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS) 70 71 #if (_WIN32_WINNT >= 0x0501) 72 73 #define IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION \ 74 CTL_CODE(FILE_DEVICE_USB, USB_IDLE_NOTIFICATION, METHOD_NEITHER, FILE_ANY_ACCESS) 75 76 #define IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE \ 77 CTL_CODE(FILE_DEVICE_USB, USB_GET_DEVICE_HANDLE, METHOD_NEITHER, FILE_ANY_ACCESS) 78 79 #endif 80 81 #if (_WIN32_WINNT >= 0x0600) 82 83 #define IOCTL_INTERNAL_USB_NOTIFY_IDLE_READY \ 84 CTL_CODE(FILE_DEVICE_USB, USB_IDLE_NOTIFICATION_EX, METHOD_NEITHER, FILE_ANY_ACCESS) 85 86 #define IOCTL_INTERNAL_USB_REQ_GLOBAL_SUSPEND \ 87 CTL_CODE(FILE_DEVICE_USB, USB_REQ_GLOBAL_SUSPEND, METHOD_NEITHER, FILE_ANY_ACCESS) 88 89 #define IOCTL_INTERNAL_USB_REQ_GLOBAL_RESUME \ 90 CTL_CODE(FILE_DEVICE_USB, USB_REQ_GLOBAL_RESUME, METHOD_NEITHER, FILE_ANY_ACCESS) 91 92 #ifdef USB20_API 93 typedef struct _USB_START_FAILDATA { 94 ULONG LengthInBytes; 95 NTSTATUS NtStatus; 96 USBD_STATUS UsbdStatus; 97 ULONG ConnectStatus; 98 UCHAR DriverData[4]; 99 } USB_START_FAILDATA, *PUSB_START_FAILDATA; 100 #endif 101 102 #define IOCTL_INTERNAL_USB_RECORD_FAILURE \ 103 CTL_CODE(FILE_DEVICE_USB, USB_RECORD_FAILURE, METHOD_NEITHER, FILE_ANY_ACCESS) 104 105 #define IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE_EX \ 106 CTL_CODE(FILE_DEVICE_USB, USB_GET_DEVICE_HANDLE_EX, METHOD_NEITHER, FILE_ANY_ACCESS) 107 108 #define IOCTL_INTERNAL_USB_GET_TT_DEVICE_HANDLE \ 109 CTL_CODE(FILE_DEVICE_USB, USB_GET_TT_DEVICE_HANDLE, METHOD_NEITHER, FILE_ANY_ACCESS) 110 111 typedef struct _USB_TOPOLOGY_ADDRESS { 112 ULONG PciBusNumber; 113 ULONG PciDeviceNumber; 114 ULONG PciFunctionNumber; 115 ULONG Reserved; 116 USHORT RootHubPortNumber; 117 USHORT HubPortNumber[5]; 118 USHORT Reserved2; 119 } USB_TOPOLOGY_ADDRESS, *PUSB_TOPOLOGY_ADDRESS; 120 121 #define IOCTL_INTERNAL_USB_GET_TOPOLOGY_ADDRESS \ 122 CTL_CODE(FILE_DEVICE_USB, USB_GET_TOPOLOGY_ADDRESS, METHOD_NEITHER, FILE_ANY_ACCESS) 123 124 #define IOCTL_INTERNAL_USB_GET_DEVICE_CONFIG_INFO \ 125 CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_CONFIG_INFO, METHOD_NEITHER, FILE_ANY_ACCESS) 126 127 #endif 128 129 #ifndef USB_KERNEL_IOCTL 130 131 #define IOCTL_USB_HCD_GET_STATS_1 \ 132 CTL_CODE(FILE_DEVICE_USB, HCD_GET_STATS_1, METHOD_BUFFERED, FILE_ANY_ACCESS) 133 134 #define IOCTL_USB_HCD_GET_STATS_2 \ 135 CTL_CODE(FILE_DEVICE_USB, HCD_GET_STATS_2, METHOD_BUFFERED, FILE_ANY_ACCESS) 136 137 #define IOCTL_USB_HCD_DISABLE_PORT \ 138 CTL_CODE(FILE_DEVICE_USB, HCD_DISABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS) 139 140 #define IOCTL_USB_HCD_ENABLE_PORT \ 141 CTL_CODE(FILE_DEVICE_USB, HCD_ENABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS) 142 143 #define IOCTL_USB_HCD_DISABLE_PORT \ 144 CTL_CODE(FILE_DEVICE_USB, HCD_DISABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS) 145 146 #define IOCTL_USB_HCD_ENABLE_PORT \ 147 CTL_CODE(FILE_DEVICE_USB, HCD_ENABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS) 148 149 #ifndef IOCTL_USB_DIAGNOSTIC_MODE_OFF 150 #define IOCTL_USB_DIAGNOSTIC_MODE_OFF \ 151 CTL_CODE(FILE_DEVICE_USB, HCD_DIAGNOSTIC_MODE_OFF, METHOD_BUFFERED, FILE_ANY_ACCESS) 152 #endif 153 154 #ifndef IOCTL_USB_DIAGNOSTIC_MODE_ON 155 #define IOCTL_USB_DIAGNOSTIC_MODE_ON \ 156 CTL_CODE(FILE_DEVICE_USB, HCD_DIAGNOSTIC_MODE_ON, METHOD_BUFFERED, FILE_ANY_ACCESS) 157 #endif 158 159 #ifndef IOCTL_USB_GET_ROOT_HUB_NAME 160 #define IOCTL_USB_GET_ROOT_HUB_NAME \ 161 CTL_CODE(FILE_DEVICE_USB, HCD_GET_ROOT_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS) 162 #endif 163 164 #ifndef IOCTL_GET_HCD_DRIVERKEY_NAME 165 #define IOCTL_GET_HCD_DRIVERKEY_NAME \ 166 CTL_CODE(FILE_DEVICE_USB, HCD_GET_DRIVERKEY_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS) 167 #endif 168 169 #define IOCTL_USB_GET_NODE_INFORMATION \ 170 CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_INFORMATION, METHOD_BUFFERED, FILE_ANY_ACCESS) 171 172 #define IOCTL_USB_GET_NODE_CONNECTION_INFORMATION \ 173 CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION, METHOD_BUFFERED, FILE_ANY_ACCESS) 174 175 #define IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION \ 176 CTL_CODE(FILE_DEVICE_USB, USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, METHOD_BUFFERED, FILE_ANY_ACCESS) 177 178 #define IOCTL_USB_GET_NODE_CONNECTION_NAME \ 179 CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS) 180 181 #define IOCTL_USB_DIAG_IGNORE_HUBS_ON \ 182 CTL_CODE(FILE_DEVICE_USB, USB_DIAG_IGNORE_HUBS_ON, METHOD_BUFFERED, FILE_ANY_ACCESS) 183 184 #define IOCTL_USB_DIAG_IGNORE_HUBS_OFF \ 185 CTL_CODE(FILE_DEVICE_USB, USB_DIAG_IGNORE_HUBS_OFF, METHOD_BUFFERED, FILE_ANY_ACCESS) 186 187 #define IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME \ 188 CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS) 189 190 #if (_WIN32_WINNT >= 0x0501) 191 192 #define IOCTL_USB_GET_HUB_CAPABILITIES \ 193 CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES, METHOD_BUFFERED, FILE_ANY_ACCESS) 194 195 #define IOCTL_USB_HUB_CYCLE_PORT \ 196 CTL_CODE(FILE_DEVICE_USB, USB_HUB_CYCLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS) 197 198 #define IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES \ 199 CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_ATTRIBUTES, METHOD_BUFFERED, FILE_ANY_ACCESS) 200 201 #define IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX \ 202 CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION_EX, METHOD_BUFFERED, FILE_ANY_ACCESS) 203 204 #endif 205 206 #if (_WIN32_WINNT >= 0x0600) 207 208 #define IOCTL_USB_RESET_HUB \ 209 CTL_CODE(FILE_DEVICE_USB, USB_RESET_HUB, METHOD_BUFFERED, FILE_ANY_ACCESS) 210 211 #define IOCTL_USB_GET_HUB_CAPABILITIES_EX \ 212 CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES_EX, METHOD_BUFFERED, FILE_ANY_ACCESS) 213 214 #endif 215 216 #include <pshpack1.h> 217 218 typedef enum _USB_HUB_NODE { 219 UsbHub, 220 UsbMIParent 221 } USB_HUB_NODE; 222 223 typedef struct _USB_HUB_INFORMATION { 224 USB_HUB_DESCRIPTOR HubDescriptor; 225 BOOLEAN HubIsBusPowered; 226 } USB_HUB_INFORMATION, *PUSB_HUB_INFORMATION; 227 228 typedef struct _USB_MI_PARENT_INFORMATION { 229 ULONG NumberOfInterfaces; 230 } USB_MI_PARENT_INFORMATION, *PUSB_MI_PARENT_INFORMATION; 231 232 typedef struct _USB_NODE_INFORMATION { 233 USB_HUB_NODE NodeType; 234 union { 235 USB_HUB_INFORMATION HubInformation; 236 USB_MI_PARENT_INFORMATION MiParentInformation; 237 } u; 238 } USB_NODE_INFORMATION, *PUSB_NODE_INFORMATION; 239 240 typedef struct _USB_PIPE_INFO { 241 USB_ENDPOINT_DESCRIPTOR EndpointDescriptor; 242 ULONG ScheduleOffset; 243 } USB_PIPE_INFO, *PUSB_PIPE_INFO; 244 245 #if (_WIN32_WINNT >= 0x0600) 246 247 typedef enum _USB_CONNECTION_STATUS { 248 NoDeviceConnected, 249 DeviceConnected, 250 DeviceFailedEnumeration, 251 DeviceGeneralFailure, 252 DeviceCausedOvercurrent, 253 DeviceNotEnoughPower, 254 DeviceNotEnoughBandwidth, 255 DeviceHubNestedTooDeeply, 256 DeviceInLegacyHub, 257 DeviceEnumerating, 258 DeviceReset 259 } USB_CONNECTION_STATUS, *PUSB_CONNECTION_STATUS; 260 261 #elif (_WIN32_WINNT >= 0x0501) 262 263 typedef enum _USB_CONNECTION_STATUS { 264 NoDeviceConnected, 265 DeviceConnected, 266 DeviceFailedEnumeration, 267 DeviceGeneralFailure, 268 DeviceCausedOvercurrent, 269 DeviceNotEnoughPower, 270 DeviceNotEnoughBandwidth, 271 DeviceHubNestedTooDeeply, 272 DeviceInLegacyHub 273 } USB_CONNECTION_STATUS, *PUSB_CONNECTION_STATUS; 274 275 #else 276 277 typedef enum _USB_CONNECTION_STATUS { 278 NoDeviceConnected, 279 DeviceConnected, 280 DeviceFailedEnumeration, 281 DeviceGeneralFailure, 282 DeviceCausedOvercurrent, 283 DeviceNotEnoughPower, 284 DeviceNotEnoughBandwidth 285 } USB_CONNECTION_STATUS, *PUSB_CONNECTION_STATUS; 286 287 #endif 288 289 typedef struct _USB_NODE_CONNECTION_INFORMATION { 290 ULONG ConnectionIndex; 291 USB_DEVICE_DESCRIPTOR DeviceDescriptor; 292 UCHAR CurrentConfigurationValue; 293 BOOLEAN LowSpeed; 294 BOOLEAN DeviceIsHub; 295 USHORT DeviceAddress; 296 ULONG NumberOfOpenPipes; 297 USB_CONNECTION_STATUS ConnectionStatus; 298 USB_PIPE_INFO PipeList[ANYSIZE_ARRAY]; 299 } USB_NODE_CONNECTION_INFORMATION, *PUSB_NODE_CONNECTION_INFORMATION; 300 301 typedef struct _USB_NODE_CONNECTION_DRIVERKEY_NAME { 302 ULONG ConnectionIndex; 303 ULONG ActualLength; 304 WCHAR DriverKeyName[ANYSIZE_ARRAY]; 305 } USB_NODE_CONNECTION_DRIVERKEY_NAME, *PUSB_NODE_CONNECTION_DRIVERKEY_NAME; 306 307 typedef struct _USB_NODE_CONNECTION_NAME { 308 ULONG ConnectionIndex; 309 ULONG ActualLength; 310 WCHAR NodeName[ANYSIZE_ARRAY]; 311 } USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME; 312 313 typedef struct _USB_HUB_NAME { 314 ULONG ActualLength; 315 WCHAR HubName[ANYSIZE_ARRAY]; 316 } USB_HUB_NAME, *PUSB_HUB_NAME; 317 318 typedef struct _USB_ROOT_HUB_NAME { 319 ULONG ActualLength; 320 WCHAR RootHubName[ANYSIZE_ARRAY]; 321 } USB_ROOT_HUB_NAME, *PUSB_ROOT_HUB_NAME; 322 323 typedef struct _USB_HCD_DRIVERKEY_NAME { 324 ULONG ActualLength; 325 WCHAR DriverKeyName[ANYSIZE_ARRAY]; 326 } USB_HCD_DRIVERKEY_NAME, *PUSB_HCD_DRIVERKEY_NAME; 327 328 typedef struct _USB_DESCRIPTOR_REQUEST { 329 ULONG ConnectionIndex; 330 struct { 331 UCHAR bmRequest; 332 UCHAR bRequest; 333 USHORT wValue; 334 USHORT wIndex; 335 USHORT wLength; 336 } SetupPacket; 337 UCHAR Data[ANYSIZE_ARRAY]; 338 } USB_DESCRIPTOR_REQUEST, *PUSB_DESCRIPTOR_REQUEST; 339 340 #if (_WIN32_WINNT >= 0x0501) 341 342 typedef struct _USB_HUB_CAPABILITIES { 343 ULONG HubIs2xCapable:1; 344 } USB_HUB_CAPABILITIES, *PUSB_HUB_CAPABILITIES; 345 346 typedef struct _USB_NODE_CONNECTION_ATTRIBUTES { 347 ULONG ConnectionIndex; 348 USB_CONNECTION_STATUS ConnectionStatus; 349 ULONG PortAttributes; 350 } USB_NODE_CONNECTION_ATTRIBUTES, *PUSB_NODE_CONNECTION_ATTRIBUTES; 351 352 typedef struct _USB_NODE_CONNECTION_INFORMATION_EX { 353 ULONG ConnectionIndex; 354 USB_DEVICE_DESCRIPTOR DeviceDescriptor; 355 UCHAR CurrentConfigurationValue; 356 UCHAR Speed; 357 BOOLEAN DeviceIsHub; 358 USHORT DeviceAddress; 359 ULONG NumberOfOpenPipes; 360 USB_CONNECTION_STATUS ConnectionStatus; 361 USB_PIPE_INFO PipeList[ANYSIZE_ARRAY]; 362 } USB_NODE_CONNECTION_INFORMATION_EX, *PUSB_NODE_CONNECTION_INFORMATION_EX; 363 364 C_ASSERT(sizeof(USB_NODE_CONNECTION_INFORMATION_EX) == sizeof(USB_NODE_CONNECTION_INFORMATION)); 365 366 #endif 367 368 #if (_WIN32_WINNT >= 0x0600) 369 370 typedef union _USB_HUB_CAP_FLAGS { 371 ULONG ul; 372 struct { 373 ULONG HubIsHighSpeedCapable:1; 374 ULONG HubIsHighSpeed:1; 375 ULONG HubIsMultiTtCapable:1; 376 ULONG HubIsMultiTt:1; 377 ULONG HubIsRoot:1; 378 ULONG HubIsArmedWakeOnConnect:1; 379 ULONG HubIsBusPowered:1; 380 ULONG ReservedMBZ:25; 381 }; 382 } USB_HUB_CAP_FLAGS, *PUSB_HUB_CAP_FLAGS; 383 384 C_ASSERT(sizeof(USB_HUB_CAP_FLAGS) == sizeof(ULONG)); 385 386 typedef struct _USB_HUB_CAPABILITIES_EX { 387 USB_HUB_CAP_FLAGS CapabilityFlags; 388 } USB_HUB_CAPABILITIES_EX, *PUSB_HUB_CAPABILITIES_EX; 389 390 typedef struct _USB_CYCLE_PORT_PARAMS { 391 ULONG ConnectionIndex; 392 ULONG StatusReturned; 393 } USB_CYCLE_PORT_PARAMS, *PUSB_CYCLE_PORT_PARAMS; 394 395 typedef struct _USB_ID_STRING { 396 USHORT LanguageId; 397 USHORT Pad; 398 ULONG LengthInBytes; 399 PWCHAR Buffer; 400 } USB_ID_STRING, *PUSB_ID_STRING; 401 402 typedef struct _USB_HUB_DEVICE_UXD_SETTINGS { 403 ULONG Version; 404 GUID PnpGuid; 405 GUID OwnerGuid; 406 ULONG DeleteOnShutdown; 407 ULONG DeleteOnReload; 408 ULONG DeleteOnDisconnect; 409 ULONG Reserved[5]; 410 } USB_HUB_DEVICE_UXD_SETTINGS, *PUSB_HUB_DEVICE_UXD_SETTINGS; 411 412 typedef struct _HUB_DEVICE_CONFIG_INFO_V1 { 413 ULONG Version; 414 ULONG Length; 415 USB_HUB_CAP_FLAGS HubFlags; 416 USB_ID_STRING HardwareIds; 417 USB_ID_STRING CompatibleIds; 418 USB_ID_STRING DeviceDescription; 419 ULONG Reserved[19]; 420 USB_HUB_DEVICE_UXD_SETTINGS UxdSettings; 421 } HUB_DEVICE_CONFIG_INFO, *PHUB_DEVICE_CONFIG_INFO; 422 423 #endif 424 425 typedef struct _HCD_ISO_STAT_COUNTERS { 426 USHORT LateUrbs; 427 USHORT DoubleBufferedPackets; 428 USHORT TransfersCF_5ms; 429 USHORT TransfersCF_2ms; 430 USHORT TransfersCF_1ms; 431 USHORT MaxInterruptLatency; 432 USHORT BadStartFrame; 433 USHORT StaleUrbs; 434 USHORT IsoPacketNotAccesed; 435 USHORT IsoPacketHWError; 436 USHORT SmallestUrbPacketCount; 437 USHORT LargestUrbPacketCount; 438 USHORT IsoCRC_Error; 439 USHORT IsoOVERRUN_Error; 440 USHORT IsoINTERNAL_Error; 441 USHORT IsoUNKNOWN_Error; 442 ULONG IsoBytesTransferred; 443 USHORT LateMissedCount; 444 USHORT HWIsoMissedCount; 445 ULONG Reserved7[8]; 446 } HCD_ISO_STAT_COUNTERS, *PHCD_ISO_STAT_COUNTERS; 447 448 typedef struct _HCD_STAT_COUNTERS { 449 ULONG BytesTransferred; 450 USHORT IsoMissedCount; 451 USHORT DataOverrunErrorCount; 452 USHORT CrcErrorCount; 453 USHORT ScheduleOverrunCount; 454 USHORT TimeoutErrorCount; 455 USHORT InternalHcErrorCount; 456 USHORT BufferOverrunErrorCount; 457 USHORT SWErrorCount; 458 USHORT StallPidCount; 459 USHORT PortDisableCount; 460 } HCD_STAT_COUNTERS, *PHCD_STAT_COUNTERS; 461 462 typedef struct _HCD_STAT_INFORMATION_1 { 463 ULONG Reserved1; 464 ULONG Reserved2; 465 ULONG ResetCounters; 466 LARGE_INTEGER TimeRead; 467 HCD_STAT_COUNTERS Counters; 468 } HCD_STAT_INFORMATION_1, *PHCD_STAT_INFORMATION_1; 469 470 typedef struct _HCD_STAT_INFORMATION_2 { 471 ULONG Reserved1; 472 ULONG Reserved2; 473 ULONG ResetCounters; 474 LARGE_INTEGER TimeRead; 475 LONG LockedMemoryUsed; 476 HCD_STAT_COUNTERS Counters; 477 HCD_ISO_STAT_COUNTERS IsoCounters; 478 } HCD_STAT_INFORMATION_2, *PHCD_STAT_INFORMATION_2; 479 480 #define WMI_USB_DRIVER_INFORMATION 0 481 #define WMI_USB_DRIVER_NOTIFICATION 1 482 #define WMI_USB_POWER_DEVICE_ENABLE 2 483 #define WMI_USB_HUB_NODE_INFORMATION 4 484 485 #define WMI_USB_PERFORMANCE_INFORMATION 1 486 #define WMI_USB_DEVICE_NODE_INFORMATION 2 487 488 #if (_WIN32_WINNT >= 0x0501) 489 490 typedef enum _USB_NOTIFICATION_TYPE { 491 EnumerationFailure = 0, 492 InsufficentBandwidth, 493 InsufficentPower, 494 OverCurrent, 495 ResetOvercurrent, 496 AcquireBusInfo, 497 AcquireHubName, 498 AcquireControllerName, 499 HubOvercurrent, 500 HubPowerChange, 501 HubNestedTooDeeply, 502 ModernDeviceInLegacyHub 503 } USB_NOTIFICATION_TYPE; 504 505 #else 506 507 typedef enum _USB_NOTIFICATION_TYPE { 508 EnumerationFailure = 0, 509 InsufficentBandwidth, 510 InsufficentPower, 511 OverCurrent, 512 ResetOvercurrent, 513 AcquireBusInfo, 514 AcquireHubName, 515 AcquireControllerName, 516 HubOvercurrent, 517 HubPowerChange 518 } USB_NOTIFICATION_TYPE; 519 520 #endif 521 522 typedef struct _USB_NOTIFICATION { 523 USB_NOTIFICATION_TYPE NotificationType; 524 } USB_NOTIFICATION, *PUSB_NOTIFICATION; 525 526 typedef struct _USB_CONNECTION_NOTIFICATION { 527 USB_NOTIFICATION_TYPE NotificationType; 528 ULONG ConnectionNumber; 529 ULONG RequestedBandwidth; 530 ULONG EnumerationFailReason; 531 ULONG PowerRequested; 532 ULONG HubNameLength; 533 } USB_CONNECTION_NOTIFICATION, *PUSB_CONNECTION_NOTIFICATION; 534 535 typedef struct _USB_BUS_NOTIFICATION { 536 USB_NOTIFICATION_TYPE NotificationType; 537 ULONG TotalBandwidth; 538 ULONG ConsumedBandwidth; 539 ULONG ControllerNameLength; 540 } USB_BUS_NOTIFICATION, *PUSB_BUS_NOTIFICATION; 541 542 typedef struct _USB_ACQUIRE_INFO { 543 USB_NOTIFICATION_TYPE NotificationType; 544 ULONG TotalSize; 545 WCHAR Buffer[ANYSIZE_ARRAY]; 546 } USB_ACQUIRE_INFO, *PUSB_ACQUIRE_INFO; 547 548 #if (_WIN32_WINNT >= 0x0600) 549 550 #define USB_NODE_INFO_SIG 'USBN' 551 552 typedef enum _USB_WMI_DEVICE_NODE_TYPE { 553 UsbDevice, 554 HubDevice, 555 CompositeDevice, 556 UsbController 557 } USB_WMI_DEVICE_NODE_TYPE, *PUSB_WMI_DEVICE_NODE_TYPE; 558 559 typedef struct _USB_DEVICE_STATE { 560 ULONG DeviceConnected:1; 561 ULONG DeviceStarted:1; 562 } USB_DEVICE_STATE, *PUSB_DEVICE_STATE; 563 564 typedef struct _USB_HUB_PORT_INFORMATION { 565 USB_DEVICE_STATE DeviceState; 566 USHORT PortNumber; 567 USHORT DeviceAddress; 568 ULONG ConnectionIndex; 569 USB_CONNECTION_STATUS ConnectionStatus; 570 } USB_HUB_PORT_INFORMATION, *PUSB_HUB_PORT_INFORMATION; 571 572 typedef struct _USB_HUB_DEVICE_INFO { 573 USB_HUB_DESCRIPTOR HubDescriptor; 574 ULONG HubNumber; 575 USHORT DeviceAddress; 576 BOOLEAN HubIsSelfPowered; 577 BOOLEAN HubIsRootHub; 578 USB_HUB_CAPABILITIES HubCapabilities; 579 ULONG NumberOfHubPorts; 580 USB_HUB_PORT_INFORMATION PortInfo[ANYSIZE_ARRAY]; 581 } USB_HUB_DEVICE_INFO, *PUSB_HUB_DEVICE_INFO; 582 583 typedef struct _USB_COMPOSITE_FUNCTION_INFO { 584 UCHAR FunctionNumber; 585 UCHAR BaseInterfaceNumber; 586 UCHAR NumberOfInterfaces; 587 BOOLEAN FunctionIsIdle; 588 } USB_COMPOSITE_FUNCTION_INFO, *PUSB_COMPOSITE_FUNCTION_INFO; 589 590 typedef struct _USB_COMPOSITE_DEVICE_INFO { 591 USB_DEVICE_DESCRIPTOR DeviceDescriptor; 592 USB_CONFIGURATION_DESCRIPTOR CurrentConfigDescriptor; 593 UCHAR CurrentConfigurationValue; 594 UCHAR NumberOfFunctions; 595 USB_COMPOSITE_FUNCTION_INFO FunctionInfo[ANYSIZE_ARRAY]; 596 } USB_COMPOSITE_DEVICE_INFO, *PUSB_COMPOSITE_DEVICE_INFO; 597 598 typedef struct _USB_CONTROLLER_DEVICE_INFO { 599 ULONG PciVendorId; 600 ULONG PciDeviceId; 601 ULONG PciRevision; 602 ULONG NumberOfRootPorts; 603 ULONG HcFeatureFlags; 604 } USB_CONTROLLER_DEVICE_INFO, *PUSB_CONTROLLER_DEVICE_INFO; 605 606 typedef struct _USB_DEVICE_INFO { 607 USB_DEVICE_STATE DeviceState; 608 USHORT PortNumber; 609 USB_DEVICE_DESCRIPTOR DeviceDescriptor; 610 UCHAR CurrentConfigurationValue; 611 USB_DEVICE_SPEED Speed; 612 USHORT DeviceAddress; 613 ULONG ConnectionIndex; 614 USB_CONNECTION_STATUS ConnectionStatus; 615 WCHAR PnpHardwareId[128]; 616 WCHAR PnpCompatibleId[128]; 617 WCHAR SerialNumberId[128]; 618 WCHAR PnpDeviceDescription[128]; 619 ULONG NumberOfOpenPipes; 620 USB_PIPE_INFO PipeList[ANYSIZE_ARRAY]; 621 } USB_DEVICE_INFO, *PUSB_DEVICE_INFO; 622 623 typedef struct _USB_DEVICE_NODE_INFO { 624 ULONG Sig; 625 ULONG LengthInBytes; 626 WCHAR DeviceDescription[40]; 627 USB_WMI_DEVICE_NODE_TYPE NodeType; 628 USB_TOPOLOGY_ADDRESS BusAddress; 629 union{ 630 USB_DEVICE_INFO UsbDeviceInfo; 631 USB_HUB_DEVICE_INFO HubDeviceInfo; 632 USB_COMPOSITE_DEVICE_INFO CompositeDeviceInfo; 633 USB_CONTROLLER_DEVICE_INFO ControllerDeviceInfo; 634 UCHAR DeviceInformation[4]; 635 }; 636 } USB_DEVICE_NODE_INFO, *PUSB_DEVICE_NODE_INFO; 637 638 typedef struct _USB_DEVICE_PERFORMANCE_INFO { 639 ULONG BulkBytes; 640 ULONG ControlDataBytes; 641 ULONG IsoBytes; 642 ULONG InterruptBytes; 643 ULONG BulkUrbCount; 644 ULONG ControlUrbCount; 645 ULONG IsoUrbCount; 646 ULONG InterruptUrbCount; 647 ULONG AllocedInterrupt[6]; 648 ULONG AllocedIso; 649 ULONG Total32secBandwidth; 650 ULONG TotalTtBandwidth; 651 WCHAR DeviceDescription[60]; 652 USB_DEVICE_SPEED DeviceSpeed; 653 ULONG TotalIsoLatency; 654 ULONG DroppedIsoPackets; 655 ULONG TransferErrors; 656 ULONG PciInterruptCount; 657 ULONG HcIdleState; 658 ULONG HcAsyncIdleState; 659 ULONG HcAsyncCacheFlushCount; 660 ULONG HcPeriodicIdleState; 661 ULONG HcPeriodicCacheFlushCount; 662 } USB_DEVICE_PERFORMANCE_INFO, *PUSB_DEVICE_PERFORMANCE_INFO; 663 664 #endif 665 666 #include <poppack.h> 667 668 #endif /* USB_KERNEL_IOCTL */ 669 670 #ifdef __cplusplus 671 } 672 #endif 673