1 /* 2 * usb.h 3 * 4 * This file is part of the ReactOS PSDK package. 5 * 6 * Contributors: 7 * Created by Casper S. Hornstrup <chorns (at) users.sourceforge.net> 8 * 9 * THIS SOFTWARE IS NOT COPYRIGHTED 10 * 11 * This source code is offered for use in the public domain. You may 12 * use, modify or distribute it freely. 13 * 14 * This code is distributed in the hope that it will be useful but 15 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 16 * DISCLAIMED. This includes but is not limited to warranties of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 * 19 */ 20 21 #pragma once 22 23 #ifdef OSR21_COMPAT 24 #pragma message("WARNING: OSR21_COMPAT SWITCH NOT SUPPORTED") 25 #endif 26 27 #ifndef _NTDDK_ 28 #ifndef _WDMDDK_ 29 typedef PVOID PIRP; 30 typedef PVOID PMDL; 31 #endif 32 #endif 33 34 #define USBDI_VERSION 0x00000600 35 36 #include "usb200.h" 37 38 #define USB_PORTATTR_NO_CONNECTOR 0x00000001 39 #define USB_PORTATTR_SHARED_USB2 0x00000002 40 #define USB_PORTATTR_MINI_CONNECTOR 0x00000004 41 #define USB_PORTATTR_OEM_CONNECTOR 0x00000008 42 #define USB_PORTATTR_OWNED_BY_CC 0x01000000 43 #define USB_PORTATTR_NO_OVERCURRENT_UI 0x02000000 44 45 typedef enum _USB_CONTROLLER_FLAVOR { 46 USB_HcGeneric = 0, 47 OHCI_Generic = 100, 48 OHCI_Hydra, 49 OHCI_NEC, 50 UHCI_Generic = 200, 51 UHCI_Piix4 = 201, 52 UHCI_Piix3 = 202, 53 UHCI_Ich2 = 203, 54 UHCI_Reserved204 = 204, 55 UHCI_Ich1 = 205, 56 UHCI_Ich3m = 206, 57 UHCI_Ich4 = 207, 58 UHCI_Ich5 = 208, 59 UHCI_Ich6 = 209, 60 UHCI_Intel = 249, 61 UHCI_VIA = 250, 62 UHCI_VIA_x01 = 251, 63 UHCI_VIA_x02 = 252, 64 UHCI_VIA_x03 = 253, 65 UHCI_VIA_x04 = 254, 66 UHCI_VIA_x0E_FIFO = 264, 67 EHCI_Generic = 1000, 68 EHCI_NEC = 2000, 69 EHCI_Lucent = 3000 70 } USB_CONTROLLER_FLAVOR; 71 72 73 #define USB_DEFAULT_DEVICE_ADDRESS 0 74 #define USB_DEFAULT_ENDPOINT_ADDRESS 0 75 #define USB_DEFAULT_MAX_PACKET 64 76 #define URB_FROM_IRP(Irp) ((IoGetCurrentIrpStackLocation(Irp))->Parameters.Others.Argument1) 77 #define URB_FUNCTION_SELECT_CONFIGURATION 0x0000 78 #define URB_FUNCTION_SELECT_INTERFACE 0x0001 79 #define URB_FUNCTION_ABORT_PIPE 0x0002 80 #define URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL 0x0003 81 #define URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL 0x0004 82 #define URB_FUNCTION_GET_FRAME_LENGTH 0x0005 83 #define URB_FUNCTION_SET_FRAME_LENGTH 0x0006 84 #define URB_FUNCTION_GET_CURRENT_FRAME_NUMBER 0x0007 85 #define URB_FUNCTION_CONTROL_TRANSFER 0x0008 86 #define URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER 0x0009 87 #define URB_FUNCTION_ISOCH_TRANSFER 0x000A 88 #define URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE 0x000B 89 #define URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE 0x000C 90 #define URB_FUNCTION_SET_FEATURE_TO_DEVICE 0x000D 91 #define URB_FUNCTION_SET_FEATURE_TO_INTERFACE 0x000E 92 #define URB_FUNCTION_SET_FEATURE_TO_ENDPOINT 0x000F 93 #define URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE 0x0010 94 #define URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE 0x0011 95 #define URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT 0x0012 96 #define URB_FUNCTION_GET_STATUS_FROM_DEVICE 0x0013 97 #define URB_FUNCTION_GET_STATUS_FROM_INTERFACE 0x0014 98 #define URB_FUNCTION_GET_STATUS_FROM_ENDPOINT 0x0015 99 #define URB_FUNCTION_RESERVED_0X0016 0x0016 100 #define URB_FUNCTION_VENDOR_DEVICE 0x0017 101 #define URB_FUNCTION_VENDOR_INTERFACE 0x0018 102 #define URB_FUNCTION_VENDOR_ENDPOINT 0x0019 103 #define URB_FUNCTION_CLASS_DEVICE 0x001A 104 #define URB_FUNCTION_CLASS_INTERFACE 0x001B 105 #define URB_FUNCTION_CLASS_ENDPOINT 0x001C 106 #define URB_FUNCTION_RESERVE_0X001D 0x001D 107 #define URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL 0x001E 108 #define URB_FUNCTION_CLASS_OTHER 0x001F 109 #define URB_FUNCTION_VENDOR_OTHER 0x0020 110 #define URB_FUNCTION_GET_STATUS_FROM_OTHER 0x0021 111 #define URB_FUNCTION_CLEAR_FEATURE_TO_OTHER 0x0022 112 #define URB_FUNCTION_SET_FEATURE_TO_OTHER 0x0023 113 #define URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT 0x0024 114 #define URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT 0x0025 115 #define URB_FUNCTION_GET_CONFIGURATION 0x0026 116 #define URB_FUNCTION_GET_INTERFACE 0x0027 117 #define URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE 0x0028 118 #define URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE 0x0029 119 120 #if (_WIN32_WINNT >= 0x0501) 121 122 #define URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR 0x002A 123 #define URB_FUNCTION_SYNC_RESET_PIPE 0x0030 124 #define URB_FUNCTION_SYNC_CLEAR_STALL 0x0031 125 126 #endif 127 128 #if (_WIN32_WINNT >= 0x0600) 129 130 #define URB_FUNCTION_CONTROL_TRANSFER_EX 0x0032 131 #define URB_FUNCTION_RESERVE_0X0033 0x0033 132 #define URB_FUNCTION_RESERVE_0X0034 0x0034 133 134 #endif 135 136 #define URB_FUNCTION_RESERVE_0X002B 0x002B 137 #define URB_FUNCTION_RESERVE_0X002C 0x002C 138 #define URB_FUNCTION_RESERVE_0X002D 0x002D 139 #define URB_FUNCTION_RESERVE_0X002E 0x002E 140 #define URB_FUNCTION_RESERVE_0X002F 0x002F 141 142 #define URB_FUNCTION_RESET_PIPE URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL 143 144 #define USBD_TRANSFER_DIRECTION 0x00000001 145 #define USBD_SHORT_TRANSFER_OK 0x00000002 146 #define USBD_START_ISO_TRANSFER_ASAP 0x00000004 147 #define USBD_DEFAULT_PIPE_TRANSFER 0x00000008 148 #define USBD_TRANSFER_DIRECTION_FLAG(flags) ((flags) & USBD_TRANSFER_DIRECTION) 149 150 #define USBD_TRANSFER_DIRECTION_OUT 0 151 #define USBD_TRANSFER_DIRECTION_IN 1 152 #define VALID_TRANSFER_FLAGS_MASK (USBD_SHORT_TRANSFER_OK | USBD_TRANSFER_DIRECTION | \ 153 USBD_START_ISO_TRANSFER_ASAP | USBD_DEFAULT_PIPE_TRANSFER) 154 #define USBD_ISO_START_FRAME_RANGE 1024 155 156 typedef LONG USBD_STATUS; 157 158 #define USBD_SUCCESS(Status) ((USBD_STATUS)(Status) >= 0) 159 #define USBD_PENDING(Status) ((ULONG)(Status) >> 30 == 1) 160 #define USBD_ERROR(Status) ((USBD_STATUS)(Status) < 0) 161 #define USBD_STATUS_SUCCESS ((USBD_STATUS)0x00000000) 162 #define USBD_STATUS_PENDING ((USBD_STATUS)0x40000000) 163 #define USBD_STATUS_CRC ((USBD_STATUS)0xC0000001) 164 #define USBD_STATUS_BTSTUFF ((USBD_STATUS)0xC0000002) 165 #define USBD_STATUS_DATA_TOGGLE_MISMATCH ((USBD_STATUS)0xC0000003) 166 #define USBD_STATUS_STALL_PID ((USBD_STATUS)0xC0000004) 167 #define USBD_STATUS_DEV_NOT_RESPONDING ((USBD_STATUS)0xC0000005) 168 #define USBD_STATUS_PID_CHECK_FAILURE ((USBD_STATUS)0xC0000006) 169 #define USBD_STATUS_UNEXPECTED_PID ((USBD_STATUS)0xC0000007) 170 #define USBD_STATUS_DATA_OVERRUN ((USBD_STATUS)0xC0000008) 171 #define USBD_STATUS_DATA_UNDERRUN ((USBD_STATUS)0xC0000009) 172 #define USBD_STATUS_RESERVED1 ((USBD_STATUS)0xC000000A) 173 #define USBD_STATUS_RESERVED2 ((USBD_STATUS)0xC000000B) 174 #define USBD_STATUS_BUFFER_OVERRUN ((USBD_STATUS)0xC000000C) 175 #define USBD_STATUS_BUFFER_UNDERRUN ((USBD_STATUS)0xC000000D) 176 #define USBD_STATUS_NOT_ACCESSED ((USBD_STATUS)0xC000000F) 177 #define USBD_STATUS_FIFO ((USBD_STATUS)0xC0000010) 178 #define USBD_STATUS_XACT_ERROR ((USBD_STATUS)0xC0000011) 179 #define USBD_STATUS_BABBLE_DETECTED ((USBD_STATUS)0xC0000012) 180 #define USBD_STATUS_DATA_BUFFER_ERROR ((USBD_STATUS)0xC0000013) 181 #define USBD_STATUS_ENDPOINT_HALTED ((USBD_STATUS)0xC0000030) 182 #define USBD_STATUS_INVALID_URB_FUNCTION ((USBD_STATUS)0x80000200) 183 #define USBD_STATUS_INVALID_PARAMETER ((USBD_STATUS)0x80000300) 184 #define USBD_STATUS_ERROR_BUSY ((USBD_STATUS)0x80000400) 185 #define USBD_STATUS_INVALID_PIPE_HANDLE ((USBD_STATUS)0x80000600) 186 #define USBD_STATUS_NO_BANDWIDTH ((USBD_STATUS)0x80000700) 187 #define USBD_STATUS_INTERNAL_HC_ERROR ((USBD_STATUS)0x80000800) 188 #define USBD_STATUS_ERROR_SHORT_TRANSFER ((USBD_STATUS)0x80000900) 189 #define USBD_STATUS_BAD_START_FRAME ((USBD_STATUS)0xC0000A00) 190 #define USBD_STATUS_ISOCH_REQUEST_FAILED ((USBD_STATUS)0xC0000B00) 191 #define USBD_STATUS_FRAME_CONTROL_OWNED ((USBD_STATUS)0xC0000C00) 192 #define USBD_STATUS_FRAME_CONTROL_NOT_OWNED ((USBD_STATUS)0xC0000D00) 193 #define USBD_STATUS_NOT_SUPPORTED ((USBD_STATUS)0xC0000E00) 194 #define USBD_STATUS_INAVLID_CONFIGURATION_DESCRIPTOR ((USBD_STATUS)0xC0000F00) 195 #define USBD_STATUS_INSUFFICIENT_RESOURCES ((USBD_STATUS)0xC0001000) 196 #define USBD_STATUS_SET_CONFIG_FAILED ((USBD_STATUS)0xC0002000) 197 #define USBD_STATUS_BUFFER_TOO_SMALL ((USBD_STATUS)0xC0003000) 198 #define USBD_STATUS_INTERFACE_NOT_FOUND ((USBD_STATUS)0xC0004000) 199 #define USBD_STATUS_INAVLID_PIPE_FLAGS ((USBD_STATUS)0xC0005000) 200 #define USBD_STATUS_TIMEOUT ((USBD_STATUS)0xC0006000) 201 #define USBD_STATUS_DEVICE_GONE ((USBD_STATUS)0xC0007000) 202 #define USBD_STATUS_STATUS_NOT_MAPPED ((USBD_STATUS)0xC0008000) 203 #define USBD_STATUS_HUB_INTERNAL_ERROR ((USBD_STATUS)0xC0009000) 204 #define USBD_STATUS_CANCELED ((USBD_STATUS)0xC0010000) 205 #define USBD_STATUS_ISO_NOT_ACCESSED_BY_HW ((USBD_STATUS)0xC0020000) 206 #define USBD_STATUS_ISO_TD_ERROR ((USBD_STATUS)0xC0030000) 207 #define USBD_STATUS_ISO_NA_LATE_USBPORT ((USBD_STATUS)0xC0040000) 208 #define USBD_STATUS_ISO_NOT_ACCESSED_LATE ((USBD_STATUS)0xC0050000) 209 #define USBD_STATUS_BAD_DESCRIPTOR ((USBD_STATUS)0xC0100000) 210 #define USBD_STATUS_BAD_DESCRIPTOR_BLEN ((USBD_STATUS)0xC0100001) 211 #define USBD_STATUS_BAD_DESCRIPTOR_TYPE ((USBD_STATUS)0xC0100002) 212 #define USBD_STATUS_BAD_INTERFACE_DESCRIPTOR ((USBD_STATUS)0xC0100003) 213 #define USBD_STATUS_BAD_ENDPOINT_DESCRIPTOR ((USBD_STATUS)0xC0100004) 214 #define USBD_STATUS_BAD_INTERFACE_ASSOC_DESCRIPTOR ((USBD_STATUS)0xC0100005) 215 #define USBD_STATUS_BAD_CONFIG_DESC_LENGTH ((USBD_STATUS)0xC0100006) 216 #define USBD_STATUS_BAD_NUMBER_OF_INTERFACES ((USBD_STATUS)0xC0100007) 217 #define USBD_STATUS_BAD_NUMBER_OF_ENDPOINTS ((USBD_STATUS)0xC0100008) 218 #define USBD_STATUS_BAD_ENDPOINT_ADDRESS ((USBD_STATUS)0xC0100009) 219 220 typedef PVOID USBD_PIPE_HANDLE; 221 typedef PVOID USBD_CONFIGURATION_HANDLE; 222 typedef PVOID USBD_INTERFACE_HANDLE; 223 224 #if (_WIN32_WINNT >= 0x0501) 225 #define USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE 0xFFFFFFFF 226 #else 227 #define USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE PAGE_SIZE 228 #endif 229 230 typedef struct _USBD_VERSION_INFORMATION { 231 ULONG USBDI_Version; 232 ULONG Supported_USB_Version; 233 } USBD_VERSION_INFORMATION, *PUSBD_VERSION_INFORMATION; 234 235 typedef enum _USBD_PIPE_TYPE { 236 UsbdPipeTypeControl, 237 UsbdPipeTypeIsochronous, 238 UsbdPipeTypeBulk, 239 UsbdPipeTypeInterrupt 240 } USBD_PIPE_TYPE; 241 242 #define USBD_PIPE_DIRECTION_IN(pipeInformation) ((pipeInformation)->EndpointAddress & USB_ENDPOINT_DIRECTION_MASK) 243 244 typedef struct _USBD_DEVICE_INFORMATION { 245 ULONG OffsetNext; 246 PVOID UsbdDeviceHandle; 247 USB_DEVICE_DESCRIPTOR DeviceDescriptor; 248 } USBD_DEVICE_INFORMATION, *PUSBD_DEVICE_INFORMATION; 249 250 typedef struct _USBD_PIPE_INFORMATION { 251 USHORT MaximumPacketSize; 252 UCHAR EndpointAddress; 253 UCHAR Interval; 254 USBD_PIPE_TYPE PipeType; 255 USBD_PIPE_HANDLE PipeHandle; 256 ULONG MaximumTransferSize; 257 ULONG PipeFlags; 258 } USBD_PIPE_INFORMATION, *PUSBD_PIPE_INFORMATION; 259 260 #define USBD_PF_CHANGE_MAX_PACKET 0x00000001 261 #define USBD_PF_SHORT_PACKET_OPT 0x00000002 262 #define USBD_PF_ENABLE_RT_THREAD_ACCESS 0x00000004 263 #define USBD_PF_MAP_ADD_TRANSFERS 0x00000008 264 #define USBD_PF_VALID_MASK (USBD_PF_CHANGE_MAX_PACKET | USBD_PF_SHORT_PACKET_OPT | \ 265 USBD_PF_ENABLE_RT_THREAD_ACCESS | USBD_PF_MAP_ADD_TRANSFERS) 266 267 typedef struct _USBD_INTERFACE_INFORMATION { 268 USHORT Length; 269 UCHAR InterfaceNumber; 270 UCHAR AlternateSetting; 271 UCHAR Class; 272 UCHAR SubClass; 273 UCHAR Protocol; 274 UCHAR Reserved; 275 USBD_INTERFACE_HANDLE InterfaceHandle; 276 ULONG NumberOfPipes; 277 USBD_PIPE_INFORMATION Pipes[1]; 278 } USBD_INTERFACE_INFORMATION, *PUSBD_INTERFACE_INFORMATION; 279 280 struct _URB_HCD_AREA { 281 PVOID Reserved8[8]; 282 }; 283 284 struct _URB_HEADER { 285 USHORT Length; 286 USHORT Function; 287 USBD_STATUS Status; 288 PVOID UsbdDeviceHandle; 289 ULONG UsbdFlags; 290 }; 291 292 struct _URB_SELECT_INTERFACE { 293 struct _URB_HEADER Hdr; 294 USBD_CONFIGURATION_HANDLE ConfigurationHandle; 295 USBD_INTERFACE_INFORMATION Interface; 296 }; 297 298 struct _URB_SELECT_CONFIGURATION { 299 struct _URB_HEADER Hdr; 300 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; 301 USBD_CONFIGURATION_HANDLE ConfigurationHandle; 302 USBD_INTERFACE_INFORMATION Interface; 303 }; 304 305 struct _URB_PIPE_REQUEST { 306 struct _URB_HEADER Hdr; 307 USBD_PIPE_HANDLE PipeHandle; 308 ULONG Reserved; 309 }; 310 311 struct _URB_FRAME_LENGTH_CONTROL { 312 struct _URB_HEADER Hdr; 313 }; 314 315 struct _URB_GET_FRAME_LENGTH { 316 struct _URB_HEADER Hdr; 317 ULONG FrameLength; 318 ULONG FrameNumber; 319 }; 320 321 struct _URB_SET_FRAME_LENGTH { 322 struct _URB_HEADER Hdr; 323 LONG FrameLengthDelta; 324 }; 325 326 struct _URB_GET_CURRENT_FRAME_NUMBER { 327 struct _URB_HEADER Hdr; 328 ULONG FrameNumber; 329 }; 330 331 struct _URB_CONTROL_DESCRIPTOR_REQUEST { 332 struct _URB_HEADER Hdr; 333 PVOID Reserved; 334 ULONG Reserved0; 335 ULONG TransferBufferLength; 336 PVOID TransferBuffer; 337 PMDL TransferBufferMDL; 338 struct _URB *UrbLink; 339 struct _URB_HCD_AREA hca; 340 USHORT Reserved1; 341 UCHAR Index; 342 UCHAR DescriptorType; 343 USHORT LanguageId; 344 USHORT Reserved2; 345 }; 346 347 struct _URB_CONTROL_GET_STATUS_REQUEST { 348 struct _URB_HEADER Hdr; 349 PVOID Reserved; 350 ULONG Reserved0; 351 ULONG TransferBufferLength; 352 PVOID TransferBuffer; 353 PMDL TransferBufferMDL; 354 struct _URB *UrbLink; 355 struct _URB_HCD_AREA hca; 356 UCHAR Reserved1[4]; 357 USHORT Index; 358 USHORT Reserved2; 359 }; 360 361 struct _URB_CONTROL_FEATURE_REQUEST { 362 struct _URB_HEADER Hdr; 363 PVOID Reserved; 364 ULONG Reserved2; 365 ULONG Reserved3; 366 PVOID Reserved4; 367 PMDL Reserved5; 368 struct _URB *UrbLink; 369 struct _URB_HCD_AREA hca; 370 USHORT Reserved0; 371 USHORT FeatureSelector; 372 USHORT Index; 373 USHORT Reserved1; 374 }; 375 376 struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST { 377 struct _URB_HEADER Hdr; 378 PVOID Reserved; 379 ULONG TransferFlags; 380 ULONG TransferBufferLength; 381 PVOID TransferBuffer; 382 PMDL TransferBufferMDL; 383 struct _URB *UrbLink; 384 struct _URB_HCD_AREA hca; 385 UCHAR RequestTypeReservedBits; 386 UCHAR Request; 387 USHORT Value; 388 USHORT Index; 389 USHORT Reserved1; 390 }; 391 392 struct _URB_CONTROL_GET_INTERFACE_REQUEST { 393 struct _URB_HEADER Hdr; 394 PVOID Reserved; 395 ULONG Reserved0; 396 ULONG TransferBufferLength; 397 PVOID TransferBuffer; 398 PMDL TransferBufferMDL; 399 struct _URB *UrbLink; 400 struct _URB_HCD_AREA hca; 401 UCHAR Reserved1[4]; 402 USHORT Interface; 403 USHORT Reserved2; 404 }; 405 406 struct _URB_CONTROL_GET_CONFIGURATION_REQUEST { 407 struct _URB_HEADER Hdr; 408 PVOID Reserved; 409 ULONG Reserved0; 410 ULONG TransferBufferLength; 411 PVOID TransferBuffer; 412 PMDL TransferBufferMDL; 413 struct _URB *UrbLink; 414 struct _URB_HCD_AREA hca; 415 UCHAR Reserved1[8]; 416 }; 417 418 #if (_WIN32_WINNT >= 0x0501) 419 420 #define OS_STRING_DESCRIPTOR_INDEX 0xEE 421 #define MS_GENRE_DESCRIPTOR_INDEX 0x0001 422 #define MS_POWER_DESCRIPTOR_INDEX 0x0002 423 #define MS_OS_STRING_SIGNATURE L"MSFT100" 424 #define MS_OS_FLAGS_CONTAINERID 0x02 425 426 typedef struct _OS_STRING { 427 UCHAR bLength; 428 UCHAR bDescriptorType; 429 WCHAR MicrosoftString[7]; 430 UCHAR bVendorCode; 431 __C89_NAMELESS union { 432 UCHAR bPad; 433 UCHAR bFlags; 434 }; 435 } OS_STRING, *POS_STRING; 436 437 struct _URB_OS_FEATURE_DESCRIPTOR_REQUEST { 438 struct _URB_HEADER Hdr; 439 PVOID Reserved; 440 ULONG Reserved0; 441 ULONG TransferBufferLength; 442 PVOID TransferBuffer; 443 PMDL TransferBufferMDL; 444 struct _URB *UrbLink; 445 struct _URB_HCD_AREA hca; 446 UCHAR Recipient:5; 447 UCHAR Reserved1:3; 448 UCHAR Reserved2; 449 UCHAR InterfaceNumber; 450 UCHAR MS_PageIndex; 451 USHORT MS_FeatureDescriptorIndex; 452 USHORT Reserved3; 453 }; 454 455 #endif 456 457 struct _URB_CONTROL_TRANSFER { 458 struct _URB_HEADER Hdr; 459 USBD_PIPE_HANDLE PipeHandle; 460 ULONG TransferFlags; 461 ULONG TransferBufferLength; 462 PVOID TransferBuffer; 463 PMDL TransferBufferMDL; 464 struct _URB *UrbLink; 465 struct _URB_HCD_AREA hca; 466 UCHAR SetupPacket[8]; 467 }; 468 469 #if (_WIN32_WINNT >= 0x0600) 470 471 struct _URB_CONTROL_TRANSFER_EX { 472 struct _URB_HEADER Hdr; 473 USBD_PIPE_HANDLE PipeHandle; 474 ULONG TransferFlags; 475 ULONG TransferBufferLength; 476 PVOID TransferBuffer; 477 PMDL TransferBufferMDL; 478 ULONG Timeout; 479 #ifdef _WIN64 480 ULONG Pad; 481 #endif 482 struct _URB_HCD_AREA hca; 483 UCHAR SetupPacket[8]; 484 }; 485 486 #endif 487 488 struct _URB_BULK_OR_INTERRUPT_TRANSFER { 489 struct _URB_HEADER Hdr; 490 USBD_PIPE_HANDLE PipeHandle; 491 ULONG TransferFlags; 492 ULONG TransferBufferLength; 493 PVOID TransferBuffer; 494 PMDL TransferBufferMDL; 495 struct _URB *UrbLink; 496 struct _URB_HCD_AREA hca; 497 }; 498 499 typedef struct _USBD_ISO_PACKET_DESCRIPTOR { 500 ULONG Offset; 501 ULONG Length; 502 USBD_STATUS Status; 503 } USBD_ISO_PACKET_DESCRIPTOR, *PUSBD_ISO_PACKET_DESCRIPTOR; 504 505 struct _URB_ISOCH_TRANSFER { 506 struct _URB_HEADER Hdr; 507 USBD_PIPE_HANDLE PipeHandle; 508 ULONG TransferFlags; 509 ULONG TransferBufferLength; 510 PVOID TransferBuffer; 511 PMDL TransferBufferMDL; 512 struct _URB *UrbLink; 513 struct _URB_HCD_AREA hca; 514 ULONG StartFrame; 515 ULONG NumberOfPackets; 516 ULONG ErrorCount; 517 USBD_ISO_PACKET_DESCRIPTOR IsoPacket[1]; 518 }; 519 520 typedef struct _URB { 521 __C89_NAMELESS union { 522 struct _URB_HEADER UrbHeader; 523 struct _URB_SELECT_INTERFACE UrbSelectInterface; 524 struct _URB_SELECT_CONFIGURATION UrbSelectConfiguration; 525 struct _URB_PIPE_REQUEST UrbPipeRequest; 526 struct _URB_FRAME_LENGTH_CONTROL UrbFrameLengthControl; 527 struct _URB_GET_FRAME_LENGTH UrbGetFrameLength; 528 struct _URB_SET_FRAME_LENGTH UrbSetFrameLength; 529 struct _URB_GET_CURRENT_FRAME_NUMBER UrbGetCurrentFrameNumber; 530 struct _URB_CONTROL_TRANSFER UrbControlTransfer; 531 #if (_WIN32_WINNT >= 0x0600) 532 struct _URB_CONTROL_TRANSFER_EX UrbControlTransferEx; 533 #endif 534 struct _URB_BULK_OR_INTERRUPT_TRANSFER UrbBulkOrInterruptTransfer; 535 struct _URB_ISOCH_TRANSFER UrbIsochronousTransfer; 536 struct _URB_CONTROL_DESCRIPTOR_REQUEST UrbControlDescriptorRequest; 537 struct _URB_CONTROL_GET_STATUS_REQUEST UrbControlGetStatusRequest; 538 struct _URB_CONTROL_FEATURE_REQUEST UrbControlFeatureRequest; 539 struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST UrbControlVendorClassRequest; 540 struct _URB_CONTROL_GET_INTERFACE_REQUEST UrbControlGetInterfaceRequest; 541 struct _URB_CONTROL_GET_CONFIGURATION_REQUEST UrbControlGetConfigurationRequest; 542 #if (_WIN32_WINNT >= 0x0501) 543 struct _URB_OS_FEATURE_DESCRIPTOR_REQUEST UrbOSFeatureDescriptorRequest; 544 #endif 545 }; 546 } URB, *PURB; 547 548