1 /*++ 2 3 Copyright (c) Microsoft Corporation. All rights reserved. 4 5 _WdfVersionBuild_ 6 7 Module Name: 8 9 WdfUsb.h 10 11 Abstract: 12 13 Contains prototypes for interfacing with a USB connected device 14 15 Environment: 16 17 kernel mode only 18 19 Revision History: 20 21 --*/ 22 23 // 24 // NOTE: This header is generated by stubwork. Please make any 25 // modifications to the corresponding template files 26 // (.x or .y) and use stubwork to regenerate the header 27 // 28 29 #ifndef _WDFUSB_H_ 30 #define _WDFUSB_H_ 31 32 #ifndef WDF_EXTERN_C 33 #ifdef __cplusplus 34 #define WDF_EXTERN_C extern "C" 35 #define WDF_EXTERN_C_START extern "C" { 36 #define WDF_EXTERN_C_END } 37 #else 38 #define WDF_EXTERN_C 39 #define WDF_EXTERN_C_START 40 #define WDF_EXTERN_C_END 41 #endif 42 #endif 43 44 WDF_EXTERN_C_START 45 46 47 48 #if (NTDDI_VERSION >= NTDDI_WIN2K) 49 50 #ifndef BMREQUEST_HOST_TO_DEVICE 51 #define BMREQUEST_HOST_TO_DEVICE 0 52 #endif // BMREQUEST_HOST_TO_DEVICE 53 54 #ifndef BMREQUEST_DEVICE_TO_HOST 55 #define BMREQUEST_DEVICE_TO_HOST 1 56 #endif // BMREQUEST_DEVICE_TO_HOST 57 58 #ifndef BMREQUEST_STANDARD 59 #define BMREQUEST_STANDARD 0 60 #endif // BMREQUEST_STANDARD 61 62 #ifndef BMREQUEST_CLASS 63 #define BMREQUEST_CLASS 1 64 #endif // BMREQUEST_CLASS 65 66 #ifndef BMREQUEST_VENDOR 67 #define BMREQUEST_VENDOR 2 68 #endif // BMREQUEST_VENDOR 69 70 #ifndef BMREQUEST_TO_DEVICE 71 #define BMREQUEST_TO_DEVICE 0 72 #endif // BMREQUEST_TO_DEVICE 73 74 #ifndef BMREQUEST_TO_INTERFACE 75 #define BMREQUEST_TO_INTERFACE 1 76 #endif // BMREQUEST_TO_INTERFACE 77 78 #ifndef BMREQUEST_TO_ENDPOINT 79 #define BMREQUEST_TO_ENDPOINT 2 80 #endif // BMREQUEST_TO_ENDPOINT 81 82 #ifndef BMREQUEST_TO_OTHER 83 #define BMREQUEST_TO_OTHER 3 84 #endif // BMREQUEST_TO_OTHER 85 86 typedef enum _WDF_USB_REQUEST_TYPE { 87 WdfUsbRequestTypeInvalid = 0, 88 WdfUsbRequestTypeNoFormat, 89 WdfUsbRequestTypeDeviceString, 90 WdfUsbRequestTypeDeviceControlTransfer, 91 WdfUsbRequestTypeDeviceUrb, 92 WdfUsbRequestTypePipeWrite, 93 WdfUsbRequestTypePipeRead, 94 WdfUsbRequestTypePipeAbort, 95 WdfUsbRequestTypePipeReset, 96 WdfUsbRequestTypePipeUrb, 97 } WDF_USB_REQUEST_TYPE, *PWDF_USB_REQUEST_TYPE; 98 99 typedef enum _WDF_USB_BMREQUEST_DIRECTION { 100 BmRequestHostToDevice = BMREQUEST_HOST_TO_DEVICE, 101 BmRequestDeviceToHost = BMREQUEST_DEVICE_TO_HOST, 102 } WDF_USB_BMREQUEST_DIRECTION; 103 104 typedef enum _WDF_USB_BMREQUEST_TYPE { 105 BmRequestStandard = BMREQUEST_STANDARD, 106 BmRequestClass = BMREQUEST_CLASS, 107 BmRequestVendor = BMREQUEST_VENDOR, 108 } WDF_USB_BMREQUEST_TYPE; 109 110 typedef enum _WDF_USB_BMREQUEST_RECIPIENT { 111 BmRequestToDevice = BMREQUEST_TO_DEVICE, 112 BmRequestToInterface = BMREQUEST_TO_INTERFACE, 113 BmRequestToEndpoint = BMREQUEST_TO_ENDPOINT, 114 BmRequestToOther = BMREQUEST_TO_OTHER, 115 } WDF_USB_BMREQUEST_RECIPIENT; 116 117 typedef enum _WDF_USB_PIPE_TYPE { 118 WdfUsbPipeTypeInvalid = 0, 119 WdfUsbPipeTypeControl, 120 WdfUsbPipeTypeIsochronous, 121 WdfUsbPipeTypeBulk, 122 WdfUsbPipeTypeInterrupt, 123 } WDF_USB_PIPE_TYPE; 124 125 typedef enum _WdfUsbTargetDeviceSelectConfigType { 126 WdfUsbTargetDeviceSelectConfigTypeInvalid = 0, 127 WdfUsbTargetDeviceSelectConfigTypeDeconfig = 1, 128 WdfUsbTargetDeviceSelectConfigTypeSingleInterface = 2, 129 WdfUsbTargetDeviceSelectConfigTypeMultiInterface = 3, 130 WdfUsbTargetDeviceSelectConfigTypeInterfacesPairs = 4, 131 WdfUsbTargetDeviceSelectConfigTypeInterfacesDescriptor = 5, 132 WdfUsbTargetDeviceSelectConfigTypeUrb = 6, 133 } WdfUsbTargetDeviceSelectConfigType; 134 135 typedef enum _WdfUsbTargetDeviceSelectSettingType { 136 WdfUsbInterfaceSelectSettingTypeDescriptor = 0x10, 137 WdfUsbInterfaceSelectSettingTypeSetting = 0x11, 138 WdfUsbInterfaceSelectSettingTypeUrb = 0x12, 139 } WdfUsbTargetDeviceSelectSettingType; 140 141 typedef enum _WDF_USB_DEVICE_TRAITS { 142 WDF_USB_DEVICE_TRAIT_SELF_POWERED = 0x00000001, 143 WDF_USB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE = 0x00000002, 144 WDF_USB_DEVICE_TRAIT_AT_HIGH_SPEED = 0x00000004, 145 } WDF_USB_DEVICE_TRAITS; 146 147 148 149 typedef union _WDF_USB_CONTROL_SETUP_PACKET { 150 struct { 151 union { 152 struct { 153 // 154 // Valid values are BMREQUEST_TO_DEVICE, BMREQUEST_TO_INTERFACE, 155 // BMREQUEST_TO_ENDPOINT, BMREQUEST_TO_OTHER 156 // 157 BYTE Recipient:2; 158 159 BYTE Reserved:3; 160 161 // 162 // Valid values are BMREQUEST_STANDARD, BMREQUEST_CLASS, 163 // BMREQUEST_VENDOR 164 // 165 BYTE Type:2; 166 167 // 168 // Valid values are BMREQUEST_HOST_TO_DEVICE, 169 // BMREQUEST_DEVICE_TO_HOST 170 // 171 BYTE Dir:1; 172 } Request; 173 BYTE Byte; 174 } bm; 175 176 BYTE bRequest; 177 178 union { 179 struct { 180 BYTE LowByte; 181 BYTE HiByte; 182 } Bytes; 183 USHORT Value; 184 } wValue; 185 186 union { 187 struct { 188 BYTE LowByte; 189 BYTE HiByte; 190 } Bytes; 191 USHORT Value; 192 } wIndex; 193 194 USHORT wLength; 195 } Packet; 196 197 struct { 198 BYTE Bytes[8]; 199 } Generic; 200 } WDF_USB_CONTROL_SETUP_PACKET, *PWDF_USB_CONTROL_SETUP_PACKET; 201 202 FORCEINLINE 203 VOID 204 WDF_USB_CONTROL_SETUP_PACKET_INIT( 205 _Out_ PWDF_USB_CONTROL_SETUP_PACKET Packet, 206 _In_ WDF_USB_BMREQUEST_DIRECTION Direction, 207 _In_ WDF_USB_BMREQUEST_RECIPIENT Recipient, 208 _In_ BYTE Request, 209 _In_ USHORT Value, 210 _In_ USHORT Index 211 ) 212 { 213 RtlZeroMemory(Packet, sizeof(WDF_USB_CONTROL_SETUP_PACKET)); 214 215 Packet->Packet.bm.Request.Dir = (BYTE) Direction; 216 Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard; 217 Packet->Packet.bm.Request.Recipient = (BYTE) Recipient; 218 219 Packet->Packet.bRequest = Request; 220 Packet->Packet.wValue.Value = Value; 221 Packet->Packet.wIndex.Value = Index; 222 223 // Packet->Packet.wLength will be set by the formatting function 224 } 225 226 FORCEINLINE 227 VOID 228 WDF_USB_CONTROL_SETUP_PACKET_INIT_CLASS( 229 _Out_ PWDF_USB_CONTROL_SETUP_PACKET Packet, 230 _In_ WDF_USB_BMREQUEST_DIRECTION Direction, 231 _In_ WDF_USB_BMREQUEST_RECIPIENT Recipient, 232 _In_ BYTE Request, 233 _In_ USHORT Value, 234 _In_ USHORT Index 235 ) 236 { 237 RtlZeroMemory(Packet, sizeof(WDF_USB_CONTROL_SETUP_PACKET)); 238 239 Packet->Packet.bm.Request.Dir = (BYTE) Direction; 240 Packet->Packet.bm.Request.Type = (BYTE) BmRequestClass; 241 Packet->Packet.bm.Request.Recipient = (BYTE) Recipient; 242 243 Packet->Packet.bRequest = Request; 244 Packet->Packet.wValue.Value = Value; 245 Packet->Packet.wIndex.Value = Index; 246 247 // Packet->Packet.wLength will be set by the formatting function 248 } 249 250 FORCEINLINE 251 VOID 252 WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR( 253 _Out_ PWDF_USB_CONTROL_SETUP_PACKET Packet, 254 _In_ WDF_USB_BMREQUEST_DIRECTION Direction, 255 _In_ WDF_USB_BMREQUEST_RECIPIENT Recipient, 256 _In_ BYTE Request, 257 _In_ USHORT Value, 258 _In_ USHORT Index 259 ) 260 { 261 RtlZeroMemory(Packet, sizeof(WDF_USB_CONTROL_SETUP_PACKET)); 262 263 Packet->Packet.bm.Request.Dir = (BYTE) Direction; 264 Packet->Packet.bm.Request.Type = (BYTE) BmRequestVendor; 265 Packet->Packet.bm.Request.Recipient = (BYTE) Recipient; 266 267 Packet->Packet.bRequest = Request; 268 Packet->Packet.wValue.Value = Value; 269 Packet->Packet.wIndex.Value = Index; 270 271 // Packet->Packet.wLength will be set by the formatting function 272 } 273 274 FORCEINLINE 275 VOID 276 WDF_USB_CONTROL_SETUP_PACKET_INIT_FEATURE( 277 _Out_ PWDF_USB_CONTROL_SETUP_PACKET Packet, 278 _In_ WDF_USB_BMREQUEST_RECIPIENT BmRequestRecipient, 279 _In_ USHORT FeatureSelector, 280 _In_ USHORT Index, 281 _In_ BOOLEAN SetFeature 282 ) 283 { 284 RtlZeroMemory(Packet, sizeof(WDF_USB_CONTROL_SETUP_PACKET)); 285 286 Packet->Packet.bm.Request.Dir = (BYTE) BmRequestHostToDevice; 287 Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard; 288 Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient; 289 290 if (SetFeature) { 291 Packet->Packet.bRequest = USB_REQUEST_SET_FEATURE; 292 } 293 else { 294 Packet->Packet.bRequest = USB_REQUEST_CLEAR_FEATURE; 295 } 296 297 Packet->Packet.wValue.Value = FeatureSelector; 298 Packet->Packet.wIndex.Value = Index; 299 300 // Packet->Packet.wLength will be set by the formatting function 301 } 302 303 FORCEINLINE 304 VOID 305 WDF_USB_CONTROL_SETUP_PACKET_INIT_GET_STATUS( 306 _Out_ PWDF_USB_CONTROL_SETUP_PACKET Packet, 307 _In_ WDF_USB_BMREQUEST_RECIPIENT BmRequestRecipient, 308 _In_ USHORT Index 309 ) 310 { 311 RtlZeroMemory(Packet, sizeof(WDF_USB_CONTROL_SETUP_PACKET)); 312 313 Packet->Packet.bm.Request.Dir = (BYTE) BmRequestDeviceToHost; 314 Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard; 315 Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient; 316 317 Packet->Packet.bRequest = USB_REQUEST_GET_STATUS; 318 Packet->Packet.wIndex.Value = Index; 319 Packet->Packet.wValue.Value = 0; 320 321 // Packet->Packet.wLength will be set by the formatting function 322 } 323 324 typedef struct _WDF_USB_REQUEST_COMPLETION_PARAMS { 325 USBD_STATUS UsbdStatus; 326 327 WDF_USB_REQUEST_TYPE Type; 328 329 union { 330 struct { 331 WDFMEMORY Buffer; 332 USHORT LangID; 333 UCHAR StringIndex; 334 335 // 336 // If STATUS_BUFFER_OVERFLOW is returned, this field will contain the 337 // number of bytes required to retrieve the entire string. 338 // 339 UCHAR RequiredSize; 340 } DeviceString; 341 342 struct { 343 WDFMEMORY Buffer; 344 WDF_USB_CONTROL_SETUP_PACKET SetupPacket; 345 ULONG Length; 346 } DeviceControlTransfer; 347 348 struct { 349 WDFMEMORY Buffer; 350 } DeviceUrb; 351 352 struct { 353 WDFMEMORY Buffer; 354 size_t Length; 355 size_t Offset; 356 } PipeWrite; 357 358 struct { 359 WDFMEMORY Buffer; 360 size_t Length; 361 size_t Offset; 362 } PipeRead; 363 364 struct { 365 WDFMEMORY Buffer; 366 } PipeUrb; 367 } Parameters; 368 369 } WDF_USB_REQUEST_COMPLETION_PARAMS, *PWDF_USB_REQUEST_COMPLETION_PARAMS; 370 371 typedef 372 _Function_class_(EVT_WDF_USB_READER_COMPLETION_ROUTINE) 373 _IRQL_requires_same_ 374 _IRQL_requires_max_(DISPATCH_LEVEL) 375 VOID 376 STDCALL 377 EVT_WDF_USB_READER_COMPLETION_ROUTINE( 378 _In_ 379 WDFUSBPIPE Pipe, 380 _In_ 381 WDFMEMORY Buffer, 382 _In_ 383 size_t NumBytesTransferred, 384 _In_ 385 WDFCONTEXT Context 386 ); 387 388 typedef EVT_WDF_USB_READER_COMPLETION_ROUTINE *PFN_WDF_USB_READER_COMPLETION_ROUTINE; 389 390 typedef 391 _Function_class_(EVT_WDF_USB_READERS_FAILED) 392 _IRQL_requires_same_ 393 _IRQL_requires_max_(PASSIVE_LEVEL) 394 BOOLEAN 395 STDCALL 396 EVT_WDF_USB_READERS_FAILED( 397 _In_ 398 WDFUSBPIPE Pipe, 399 _In_ 400 NTSTATUS Status, 401 _In_ 402 USBD_STATUS UsbdStatus 403 ); 404 405 typedef EVT_WDF_USB_READERS_FAILED *PFN_WDF_USB_READERS_FAILED; 406 407 typedef struct _WDF_USB_CONTINUOUS_READER_CONFIG { 408 // 409 // Size of the string in bytes 410 // 411 ULONG Size; 412 413 // 414 // Number of bytes to send ask for from the usb device. 415 // 416 size_t TransferLength; 417 418 // 419 // Number of bytes to allocate before the requested transfer length 420 // 421 size_t HeaderLength; 422 423 // 424 // Number of bytes to allocate after the requested transfer length 425 // 426 size_t TrailerLength; 427 428 // 429 // Number of reads to send to the device at once. If zero is specified, the 430 // default will be used. 431 // 432 UCHAR NumPendingReads; 433 434 // 435 // Optional attributes to apply to each WDFMEMORY allocated for each read 436 // 437 PWDF_OBJECT_ATTRIBUTES BufferAttributes; 438 439 // 440 // Event callback invoked when a read is completed 441 // 442 PFN_WDF_USB_READER_COMPLETION_ROUTINE EvtUsbTargetPipeReadComplete; 443 444 // 445 // Context to be passed to EvtUsbTargetPipeReadComplete 446 // 447 WDFCONTEXT EvtUsbTargetPipeReadCompleteContext; 448 449 // 450 // Event callback invoked when a reader fails. If TRUE is returned, the 451 // readers are restarted. 452 // 453 PFN_WDF_USB_READERS_FAILED EvtUsbTargetPipeReadersFailed; 454 455 } WDF_USB_CONTINUOUS_READER_CONFIG, *PWDF_USB_CONTINUOUS_READER_CONFIG; 456 457 458 FORCEINLINE 459 VOID 460 WDF_USB_CONTINUOUS_READER_CONFIG_INIT( 461 _Out_ PWDF_USB_CONTINUOUS_READER_CONFIG Config, 462 _In_ PFN_WDF_USB_READER_COMPLETION_ROUTINE EvtUsbTargetPipeReadComplete, 463 _In_ WDFCONTEXT EvtUsbTargetPipeReadCompleteContext, 464 _In_ size_t TransferLength 465 ) 466 467 { 468 RtlZeroMemory(Config, sizeof(WDF_USB_CONTINUOUS_READER_CONFIG)); 469 Config->Size = sizeof(WDF_USB_CONTINUOUS_READER_CONFIG); 470 471 Config->EvtUsbTargetPipeReadComplete = EvtUsbTargetPipeReadComplete; 472 Config->EvtUsbTargetPipeReadCompleteContext = EvtUsbTargetPipeReadCompleteContext; 473 Config->TransferLength = TransferLength; 474 } 475 476 FORCEINLINE 477 WDFIOTARGET 478 WdfUsbTargetDeviceGetIoTarget( 479 _In_ WDFUSBDEVICE UsbDevice 480 ) 481 { 482 return (WDFIOTARGET) UsbDevice; 483 } 484 485 typedef struct _WDF_USB_DEVICE_INFORMATION { 486 // 487 // Size of this structure in bytes 488 // 489 ULONG Size; 490 491 // 492 // USBD version information 493 // 494 USBD_VERSION_INFORMATION UsbdVersionInformation; 495 496 // 497 // Usb controller port capabilities 498 // 499 ULONG HcdPortCapabilities; 500 501 // 502 // Bitfield of WDF_USB_DEVICE_TRAITS values 503 // 504 ULONG Traits; 505 506 } WDF_USB_DEVICE_INFORMATION, *PWDF_USB_DEVICE_INFORMATION; 507 508 FORCEINLINE 509 VOID 510 WDF_USB_DEVICE_INFORMATION_INIT( 511 _Out_ PWDF_USB_DEVICE_INFORMATION Udi 512 ) 513 { 514 RtlZeroMemory(Udi, sizeof(WDF_USB_DEVICE_INFORMATION)); 515 Udi->Size = sizeof(WDF_USB_DEVICE_INFORMATION); 516 } 517 518 typedef struct _WDF_USB_INTERFACE_SETTING_PAIR { 519 // 520 // Interface to select 521 // 522 WDFUSBINTERFACE UsbInterface; 523 524 // 525 // Setting to select on UsbInterface 526 // 527 UCHAR SettingIndex; 528 529 } WDF_USB_INTERFACE_SETTING_PAIR, *PWDF_USB_INTERFACE_SETTING_PAIR; 530 531 typedef struct _WDF_USB_DEVICE_SELECT_CONFIG_PARAMS { 532 // 533 // Size of the structure in bytes 534 // 535 ULONG Size; 536 537 // 538 // Type of select config, one of WdfUsbTargetDeviceSelectConfigType values 539 // 540 WdfUsbTargetDeviceSelectConfigType Type; 541 542 543 union { 544 struct { 545 // 546 // Configuration descriptor to use 547 // 548 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; 549 550 // 551 // Array of interface descriptors pointers. 552 // 553 PUSB_INTERFACE_DESCRIPTOR * InterfaceDescriptors; 554 555 // 556 // Number of elements in the InterfaceDescrtiptors pointer array. 557 // 558 ULONG NumInterfaceDescriptors; 559 560 } Descriptor; 561 562 struct { 563 // 564 // Preallocated select config URB formatted by the caller. 565 // Will be used, as supplied without modification, as the select 566 // config request. 567 // 568 PURB Urb; 569 570 } Urb; 571 572 struct { 573 // 574 // Number of pipes configured on the single after. This value is 575 // returned to the caller after a succssful call. 576 // 577 UCHAR NumberConfiguredPipes; 578 579 // 580 // The interface which was configred. This value is returned to the 581 // caller after a successful call. 582 // 583 WDFUSBINTERFACE ConfiguredUsbInterface; 584 585 } SingleInterface; 586 587 struct { 588 // 589 // Number of interface pairs in the Pairs array 590 // 591 UCHAR NumberInterfaces; 592 593 // 594 // Array of interface + settings 595 // 596 PWDF_USB_INTERFACE_SETTING_PAIR Pairs; 597 598 // 599 // Number of interfaces which were configured after a successful call 600 // 601 UCHAR NumberOfConfiguredInterfaces; 602 603 } MultiInterface; 604 605 } Types; 606 607 } WDF_USB_DEVICE_SELECT_CONFIG_PARAMS, *PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS; 608 609 610 FORCEINLINE 611 VOID 612 WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE( 613 _Out_ PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params 614 ) 615 { 616 RtlZeroMemory(Params, sizeof(WDF_USB_DEVICE_SELECT_CONFIG_PARAMS)); 617 618 Params->Size = sizeof(WDF_USB_DEVICE_SELECT_CONFIG_PARAMS); 619 Params->Type = WdfUsbTargetDeviceSelectConfigTypeSingleInterface; 620 } 621 622 FORCEINLINE 623 VOID 624 WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_MULTIPLE_INTERFACES( 625 _Out_ PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params, 626 _In_opt_ UCHAR NumberInterfaces, 627 _In_opt_ PWDF_USB_INTERFACE_SETTING_PAIR SettingPairs 628 ) 629 { 630 RtlZeroMemory(Params, sizeof(WDF_USB_DEVICE_SELECT_CONFIG_PARAMS)); 631 632 Params->Size = sizeof(WDF_USB_DEVICE_SELECT_CONFIG_PARAMS); 633 634 if (SettingPairs != NULL && NumberInterfaces != 0) { 635 Params->Type = WdfUsbTargetDeviceSelectConfigTypeInterfacesPairs; 636 637 Params->Types.MultiInterface.NumberInterfaces = NumberInterfaces; 638 Params->Types.MultiInterface.Pairs = SettingPairs; 639 } 640 else { 641 Params->Type = WdfUsbTargetDeviceSelectConfigTypeMultiInterface; 642 } 643 } 644 645 FORCEINLINE 646 VOID 647 WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_INTERFACES_DESCRIPTORS( 648 _Out_ PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params, 649 _In_ PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor, 650 _In_ PUSB_INTERFACE_DESCRIPTOR* InterfaceDescriptors, 651 _In_ ULONG NumInterfaceDescriptors 652 ) 653 { 654 RtlZeroMemory(Params, sizeof(WDF_USB_DEVICE_SELECT_CONFIG_PARAMS)); 655 656 Params->Size = sizeof(WDF_USB_DEVICE_SELECT_CONFIG_PARAMS); 657 Params->Type = WdfUsbTargetDeviceSelectConfigTypeInterfacesDescriptor; 658 Params->Types.Descriptor.ConfigurationDescriptor = ConfigDescriptor; 659 Params->Types.Descriptor.InterfaceDescriptors = InterfaceDescriptors; 660 Params->Types.Descriptor.NumInterfaceDescriptors = NumInterfaceDescriptors; 661 } 662 663 FORCEINLINE 664 VOID 665 WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_URB( 666 _Out_ PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params, 667 _In_ PURB Urb 668 ) 669 { 670 RtlZeroMemory(Params, sizeof(WDF_USB_DEVICE_SELECT_CONFIG_PARAMS)); 671 672 Params->Size = sizeof(WDF_USB_DEVICE_SELECT_CONFIG_PARAMS); 673 Params->Type = WdfUsbTargetDeviceSelectConfigTypeUrb; 674 Params->Types.Urb.Urb = Urb; 675 } 676 677 678 VOID 679 FORCEINLINE 680 WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_DECONFIG( 681 _Out_ PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params 682 ) 683 { 684 RtlZeroMemory(Params, sizeof(WDF_USB_DEVICE_SELECT_CONFIG_PARAMS)); 685 686 Params->Size = sizeof(WDF_USB_DEVICE_SELECT_CONFIG_PARAMS); 687 Params->Type = WdfUsbTargetDeviceSelectConfigTypeDeconfig; 688 } 689 690 typedef struct _WDF_USB_INTERFACE_SELECT_SETTING_PARAMS { 691 // 692 // Size of this data structure in bytes 693 // 694 ULONG Size; 695 696 // 697 // Type of select interface as indicated by one of the 698 // WdfUsbTargetDeviceSelectSettingType values. 699 // 700 WdfUsbTargetDeviceSelectSettingType Type; 701 702 union { 703 704 struct { 705 // 706 // Interface descriptor that will be used in the interface selection 707 // 708 PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor; 709 710 } Descriptor; 711 712 struct { 713 // 714 // The setting index of the WDFUSBINTERFACE to use 715 // 716 UCHAR SettingIndex; 717 718 } Interface; 719 720 struct { 721 // 722 // Preformatted select interface URB which will be used in the 723 // select interface request. 724 // 725 PURB Urb; 726 727 } Urb; 728 729 } Types; 730 731 } WDF_USB_INTERFACE_SELECT_SETTING_PARAMS, *PWDF_USB_INTERFACE_SELECT_SETTING_PARAMS; 732 733 FORCEINLINE 734 VOID 735 WDF_USB_INTERFACE_SELECT_SETTING_PARAMS_INIT_DESCRIPTOR( 736 _Out_ PWDF_USB_INTERFACE_SELECT_SETTING_PARAMS Params, 737 _In_ PUSB_INTERFACE_DESCRIPTOR Interface 738 ) 739 { 740 RtlZeroMemory(Params, sizeof(WDF_USB_INTERFACE_SELECT_SETTING_PARAMS)); 741 742 Params->Size = sizeof(WDF_USB_INTERFACE_SELECT_SETTING_PARAMS); 743 Params->Type = WdfUsbInterfaceSelectSettingTypeDescriptor; 744 Params->Types.Descriptor.InterfaceDescriptor = Interface; 745 } 746 747 FORCEINLINE 748 VOID 749 WDF_USB_INTERFACE_SELECT_SETTING_PARAMS_INIT_URB( 750 _Out_ PWDF_USB_INTERFACE_SELECT_SETTING_PARAMS Params, 751 _In_ PURB Urb 752 ) 753 { 754 RtlZeroMemory(Params, sizeof(WDF_USB_INTERFACE_SELECT_SETTING_PARAMS)); 755 756 Params->Size = sizeof(WDF_USB_INTERFACE_SELECT_SETTING_PARAMS); 757 Params->Type = WdfUsbInterfaceSelectSettingTypeUrb; 758 Params->Types.Urb.Urb = Urb; 759 } 760 761 FORCEINLINE 762 VOID 763 WDF_USB_INTERFACE_SELECT_SETTING_PARAMS_INIT_SETTING( 764 _Out_ PWDF_USB_INTERFACE_SELECT_SETTING_PARAMS Params, 765 _In_ UCHAR SettingIndex 766 ) 767 { 768 RtlZeroMemory(Params, sizeof(WDF_USB_INTERFACE_SELECT_SETTING_PARAMS)); 769 770 Params->Size = sizeof(WDF_USB_INTERFACE_SELECT_SETTING_PARAMS); 771 Params->Type = WdfUsbInterfaceSelectSettingTypeSetting; 772 Params->Types.Interface.SettingIndex = SettingIndex; 773 } 774 775 FORCEINLINE 776 WDFIOTARGET 777 WdfUsbTargetPipeGetIoTarget( 778 _In_ WDFUSBPIPE Pipe 779 ) 780 { 781 return (WDFIOTARGET) Pipe; 782 } 783 784 typedef struct _WDF_USB_PIPE_INFORMATION { 785 // 786 // Size of the structure in bytes 787 // 788 ULONG Size; 789 790 // 791 // Maximum packet size this device is capable of 792 // 793 ULONG MaximumPacketSize; 794 795 // 796 // Raw endpoint address of the device as described by its descriptor 797 // 798 UCHAR EndpointAddress; 799 800 // 801 // Polling interval 802 // 803 UCHAR Interval; 804 805 // 806 // Which alternate setting this structure is relevant for 807 // 808 UCHAR SettingIndex; 809 810 // 811 // The type of the pipe 812 WDF_USB_PIPE_TYPE PipeType; 813 814 // 815 // Maximum size of one transfer which should be sent to the host controller 816 // 817 ULONG MaximumTransferSize; 818 819 } WDF_USB_PIPE_INFORMATION, *PWDF_USB_PIPE_INFORMATION; 820 821 FORCEINLINE 822 VOID 823 WDF_USB_PIPE_INFORMATION_INIT( 824 _Out_ PWDF_USB_PIPE_INFORMATION Info 825 ) 826 { 827 RtlZeroMemory(Info, sizeof(WDF_USB_PIPE_INFORMATION)); 828 829 Info->Size = sizeof(WDF_USB_PIPE_INFORMATION); 830 } 831 832 FORCEINLINE 833 BOOLEAN 834 WDF_USB_PIPE_DIRECTION_IN( 835 _In_ UCHAR EndpointAddress 836 ) 837 { 838 // 839 // If the high bit is set, we have an IN pipe 840 // 841 return (EndpointAddress & USB_ENDPOINT_DIRECTION_MASK) ? TRUE : FALSE; 842 } 843 844 FORCEINLINE 845 BOOLEAN 846 WDF_USB_PIPE_DIRECTION_OUT( 847 _In_ UCHAR EndpointAddress 848 ) 849 { 850 // 851 // If the high bit is clear, we have an OUT pipe 852 // 853 return (EndpointAddress & USB_ENDPOINT_DIRECTION_MASK) == 0x00 ? TRUE : FALSE; 854 } 855 856 typedef struct _WDF_USB_DEVICE_CREATE_CONFIG { 857 // 858 // Size of this structure in bytes 859 // 860 ULONG Size; 861 862 // 863 // USBD Client Contraction of the Wdf Client 864 // 865 ULONG USBDClientContractVersion; 866 867 } WDF_USB_DEVICE_CREATE_CONFIG, *PWDF_USB_DEVICE_CREATE_CONFIG; 868 869 FORCEINLINE 870 VOID 871 WDF_USB_DEVICE_CREATE_CONFIG_INIT( 872 _Out_ PWDF_USB_DEVICE_CREATE_CONFIG Config, 873 _In_ ULONG USBDClientContractVersion 874 ) 875 { 876 RtlZeroMemory(Config, sizeof(WDF_USB_DEVICE_CREATE_CONFIG)); 877 878 Config->Size = sizeof(WDF_USB_DEVICE_CREATE_CONFIG); 879 Config->USBDClientContractVersion = USBDClientContractVersion; 880 } 881 882 // 883 // For WdfUsbTargetDeviceCreateIsochUrb's typedef 884 // 885 #ifdef __MSC_VER 886 #pragma warning(disable:28285) 887 #endif 888 889 // 890 // WDF Function: WdfUsbTargetDeviceCreate 891 // 892 typedef 893 _Must_inspect_result_ 894 _IRQL_requires_max_(PASSIVE_LEVEL) 895 WDFAPI 896 NTSTATUS 897 (STDCALL *PFN_WDFUSBTARGETDEVICECREATE)( 898 _In_ 899 PWDF_DRIVER_GLOBALS DriverGlobals, 900 _In_ 901 WDFDEVICE Device, 902 _In_opt_ 903 PWDF_OBJECT_ATTRIBUTES Attributes, 904 _Out_ 905 WDFUSBDEVICE* UsbDevice 906 ); 907 908 _Must_inspect_result_ 909 _IRQL_requires_max_(PASSIVE_LEVEL) 910 FORCEINLINE 911 NTSTATUS 912 WdfUsbTargetDeviceCreate( 913 _In_ 914 WDFDEVICE Device, 915 _In_opt_ 916 PWDF_OBJECT_ATTRIBUTES Attributes, 917 _Out_ 918 WDFUSBDEVICE* UsbDevice 919 ) 920 { 921 return ((PFN_WDFUSBTARGETDEVICECREATE) WdfFunctions[WdfUsbTargetDeviceCreateTableIndex])(WdfDriverGlobals, Device, Attributes, UsbDevice); 922 } 923 924 // 925 // WDF Function: WdfUsbTargetDeviceCreateWithParameters 926 // 927 typedef 928 _Must_inspect_result_ 929 _IRQL_requires_max_(PASSIVE_LEVEL) 930 WDFAPI 931 NTSTATUS 932 (STDCALL *PFN_WDFUSBTARGETDEVICECREATEWITHPARAMETERS)( 933 _In_ 934 PWDF_DRIVER_GLOBALS DriverGlobals, 935 _In_ 936 WDFDEVICE Device, 937 _In_ 938 PWDF_USB_DEVICE_CREATE_CONFIG Config, 939 _In_opt_ 940 PWDF_OBJECT_ATTRIBUTES Attributes, 941 _Out_ 942 WDFUSBDEVICE* UsbDevice 943 ); 944 945 _Must_inspect_result_ 946 _IRQL_requires_max_(PASSIVE_LEVEL) 947 FORCEINLINE 948 NTSTATUS 949 WdfUsbTargetDeviceCreateWithParameters( 950 _In_ 951 WDFDEVICE Device, 952 _In_ 953 PWDF_USB_DEVICE_CREATE_CONFIG Config, 954 _In_opt_ 955 PWDF_OBJECT_ATTRIBUTES Attributes, 956 _Out_ 957 WDFUSBDEVICE* UsbDevice 958 ) 959 { 960 return ((PFN_WDFUSBTARGETDEVICECREATEWITHPARAMETERS) WdfFunctions[WdfUsbTargetDeviceCreateWithParametersTableIndex])(WdfDriverGlobals, Device, Config, Attributes, UsbDevice); 961 } 962 963 // 964 // WDF Function: WdfUsbTargetDeviceRetrieveInformation 965 // 966 typedef 967 _Must_inspect_result_ 968 _IRQL_requires_max_(DISPATCH_LEVEL) 969 WDFAPI 970 NTSTATUS 971 (STDCALL *PFN_WDFUSBTARGETDEVICERETRIEVEINFORMATION)( 972 _In_ 973 PWDF_DRIVER_GLOBALS DriverGlobals, 974 _In_ 975 WDFUSBDEVICE UsbDevice, 976 _Out_ 977 PWDF_USB_DEVICE_INFORMATION Information 978 ); 979 980 _Must_inspect_result_ 981 _IRQL_requires_max_(DISPATCH_LEVEL) 982 FORCEINLINE 983 NTSTATUS 984 WdfUsbTargetDeviceRetrieveInformation( 985 _In_ 986 WDFUSBDEVICE UsbDevice, 987 _Out_ 988 PWDF_USB_DEVICE_INFORMATION Information 989 ) 990 { 991 return ((PFN_WDFUSBTARGETDEVICERETRIEVEINFORMATION) WdfFunctions[WdfUsbTargetDeviceRetrieveInformationTableIndex])(WdfDriverGlobals, UsbDevice, Information); 992 } 993 994 // 995 // WDF Function: WdfUsbTargetDeviceGetDeviceDescriptor 996 // 997 typedef 998 _IRQL_requires_max_(PASSIVE_LEVEL) 999 WDFAPI 1000 VOID 1001 (STDCALL *PFN_WDFUSBTARGETDEVICEGETDEVICEDESCRIPTOR)( 1002 _In_ 1003 PWDF_DRIVER_GLOBALS DriverGlobals, 1004 _In_ 1005 WDFUSBDEVICE UsbDevice, 1006 _Out_ 1007 PUSB_DEVICE_DESCRIPTOR UsbDeviceDescriptor 1008 ); 1009 1010 _IRQL_requires_max_(PASSIVE_LEVEL) 1011 FORCEINLINE 1012 VOID 1013 WdfUsbTargetDeviceGetDeviceDescriptor( 1014 _In_ 1015 WDFUSBDEVICE UsbDevice, 1016 _Out_ 1017 PUSB_DEVICE_DESCRIPTOR UsbDeviceDescriptor 1018 ) 1019 { 1020 ((PFN_WDFUSBTARGETDEVICEGETDEVICEDESCRIPTOR) WdfFunctions[WdfUsbTargetDeviceGetDeviceDescriptorTableIndex])(WdfDriverGlobals, UsbDevice, UsbDeviceDescriptor); 1021 } 1022 1023 // 1024 // WDF Function: WdfUsbTargetDeviceRetrieveConfigDescriptor 1025 // 1026 typedef 1027 _Must_inspect_result_ 1028 _IRQL_requires_max_(PASSIVE_LEVEL) 1029 WDFAPI 1030 NTSTATUS 1031 (STDCALL *PFN_WDFUSBTARGETDEVICERETRIEVECONFIGDESCRIPTOR)( 1032 _In_ 1033 PWDF_DRIVER_GLOBALS DriverGlobals, 1034 _In_ 1035 WDFUSBDEVICE UsbDevice, 1036 _Out_writes_bytes_to_opt_(*ConfigDescriptorLength,*ConfigDescriptorLength) 1037 PVOID ConfigDescriptor, 1038 _Inout_ 1039 PUSHORT ConfigDescriptorLength 1040 ); 1041 1042 _Must_inspect_result_ 1043 _IRQL_requires_max_(PASSIVE_LEVEL) 1044 FORCEINLINE 1045 NTSTATUS 1046 WdfUsbTargetDeviceRetrieveConfigDescriptor( 1047 _In_ 1048 WDFUSBDEVICE UsbDevice, 1049 _Out_writes_bytes_to_opt_(*ConfigDescriptorLength,*ConfigDescriptorLength) 1050 PVOID ConfigDescriptor, 1051 _Inout_ 1052 PUSHORT ConfigDescriptorLength 1053 ) 1054 { 1055 return ((PFN_WDFUSBTARGETDEVICERETRIEVECONFIGDESCRIPTOR) WdfFunctions[WdfUsbTargetDeviceRetrieveConfigDescriptorTableIndex])(WdfDriverGlobals, UsbDevice, ConfigDescriptor, ConfigDescriptorLength); 1056 } 1057 1058 // 1059 // WDF Function: WdfUsbTargetDeviceQueryString 1060 // 1061 typedef 1062 _Must_inspect_result_ 1063 _IRQL_requires_max_(PASSIVE_LEVEL) 1064 WDFAPI 1065 NTSTATUS 1066 (STDCALL *PFN_WDFUSBTARGETDEVICEQUERYSTRING)( 1067 _In_ 1068 PWDF_DRIVER_GLOBALS DriverGlobals, 1069 _In_ 1070 WDFUSBDEVICE UsbDevice, 1071 _In_opt_ 1072 WDFREQUEST Request, 1073 _In_opt_ 1074 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 1075 _Out_writes_opt_(*NumCharacters) 1076 PUSHORT String, 1077 _Inout_ 1078 PUSHORT NumCharacters, 1079 _In_ 1080 UCHAR StringIndex, 1081 _In_opt_ 1082 USHORT LangID 1083 ); 1084 1085 _Must_inspect_result_ 1086 _IRQL_requires_max_(PASSIVE_LEVEL) 1087 FORCEINLINE 1088 NTSTATUS 1089 WdfUsbTargetDeviceQueryString( 1090 _In_ 1091 WDFUSBDEVICE UsbDevice, 1092 _In_opt_ 1093 WDFREQUEST Request, 1094 _In_opt_ 1095 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 1096 _Out_writes_opt_(*NumCharacters) 1097 PUSHORT String, 1098 _Inout_ 1099 PUSHORT NumCharacters, 1100 _In_ 1101 UCHAR StringIndex, 1102 _In_opt_ 1103 USHORT LangID 1104 ) 1105 { 1106 return ((PFN_WDFUSBTARGETDEVICEQUERYSTRING) WdfFunctions[WdfUsbTargetDeviceQueryStringTableIndex])(WdfDriverGlobals, UsbDevice, Request, RequestOptions, String, NumCharacters, StringIndex, LangID); 1107 } 1108 1109 // 1110 // WDF Function: WdfUsbTargetDeviceAllocAndQueryString 1111 // 1112 typedef 1113 _Must_inspect_result_ 1114 _IRQL_requires_max_(PASSIVE_LEVEL) 1115 WDFAPI 1116 NTSTATUS 1117 (STDCALL *PFN_WDFUSBTARGETDEVICEALLOCANDQUERYSTRING)( 1118 _In_ 1119 PWDF_DRIVER_GLOBALS DriverGlobals, 1120 _In_ 1121 WDFUSBDEVICE UsbDevice, 1122 _In_opt_ 1123 PWDF_OBJECT_ATTRIBUTES StringMemoryAttributes, 1124 _Out_ 1125 WDFMEMORY* StringMemory, 1126 _Out_opt_ 1127 PUSHORT NumCharacters, 1128 _In_ 1129 UCHAR StringIndex, 1130 _In_opt_ 1131 USHORT LangID 1132 ); 1133 1134 _Must_inspect_result_ 1135 _IRQL_requires_max_(PASSIVE_LEVEL) 1136 FORCEINLINE 1137 NTSTATUS 1138 WdfUsbTargetDeviceAllocAndQueryString( 1139 _In_ 1140 WDFUSBDEVICE UsbDevice, 1141 _In_opt_ 1142 PWDF_OBJECT_ATTRIBUTES StringMemoryAttributes, 1143 _Out_ 1144 WDFMEMORY* StringMemory, 1145 _Out_opt_ 1146 PUSHORT NumCharacters, 1147 _In_ 1148 UCHAR StringIndex, 1149 _In_opt_ 1150 USHORT LangID 1151 ) 1152 { 1153 return ((PFN_WDFUSBTARGETDEVICEALLOCANDQUERYSTRING) WdfFunctions[WdfUsbTargetDeviceAllocAndQueryStringTableIndex])(WdfDriverGlobals, UsbDevice, StringMemoryAttributes, StringMemory, NumCharacters, StringIndex, LangID); 1154 } 1155 1156 // 1157 // WDF Function: WdfUsbTargetDeviceFormatRequestForString 1158 // 1159 typedef 1160 _Must_inspect_result_ 1161 _IRQL_requires_max_(DISPATCH_LEVEL) 1162 WDFAPI 1163 NTSTATUS 1164 (STDCALL *PFN_WDFUSBTARGETDEVICEFORMATREQUESTFORSTRING)( 1165 _In_ 1166 PWDF_DRIVER_GLOBALS DriverGlobals, 1167 _In_ 1168 WDFUSBDEVICE UsbDevice, 1169 _In_ 1170 WDFREQUEST Request, 1171 _In_ 1172 WDFMEMORY Memory, 1173 _In_opt_ 1174 PWDFMEMORY_OFFSET Offset, 1175 _In_ 1176 UCHAR StringIndex, 1177 _In_opt_ 1178 USHORT LangID 1179 ); 1180 1181 _Must_inspect_result_ 1182 _IRQL_requires_max_(DISPATCH_LEVEL) 1183 FORCEINLINE 1184 NTSTATUS 1185 WdfUsbTargetDeviceFormatRequestForString( 1186 _In_ 1187 WDFUSBDEVICE UsbDevice, 1188 _In_ 1189 WDFREQUEST Request, 1190 _In_ 1191 WDFMEMORY Memory, 1192 _In_opt_ 1193 PWDFMEMORY_OFFSET Offset, 1194 _In_ 1195 UCHAR StringIndex, 1196 _In_opt_ 1197 USHORT LangID 1198 ) 1199 { 1200 return ((PFN_WDFUSBTARGETDEVICEFORMATREQUESTFORSTRING) WdfFunctions[WdfUsbTargetDeviceFormatRequestForStringTableIndex])(WdfDriverGlobals, UsbDevice, Request, Memory, Offset, StringIndex, LangID); 1201 } 1202 1203 // 1204 // WDF Function: WdfUsbTargetDeviceGetNumInterfaces 1205 // 1206 typedef 1207 _IRQL_requires_max_(DISPATCH_LEVEL) 1208 WDFAPI 1209 UCHAR 1210 (STDCALL *PFN_WDFUSBTARGETDEVICEGETNUMINTERFACES)( 1211 _In_ 1212 PWDF_DRIVER_GLOBALS DriverGlobals, 1213 _In_ 1214 WDFUSBDEVICE UsbDevice 1215 ); 1216 1217 _IRQL_requires_max_(DISPATCH_LEVEL) 1218 FORCEINLINE 1219 UCHAR 1220 WdfUsbTargetDeviceGetNumInterfaces( 1221 _In_ 1222 WDFUSBDEVICE UsbDevice 1223 ) 1224 { 1225 return ((PFN_WDFUSBTARGETDEVICEGETNUMINTERFACES) WdfFunctions[WdfUsbTargetDeviceGetNumInterfacesTableIndex])(WdfDriverGlobals, UsbDevice); 1226 } 1227 1228 // 1229 // WDF Function: WdfUsbTargetDeviceSelectConfig 1230 // 1231 typedef 1232 _Must_inspect_result_ 1233 _IRQL_requires_max_(PASSIVE_LEVEL) 1234 WDFAPI 1235 NTSTATUS 1236 (STDCALL *PFN_WDFUSBTARGETDEVICESELECTCONFIG)( 1237 _In_ 1238 PWDF_DRIVER_GLOBALS DriverGlobals, 1239 _In_ 1240 WDFUSBDEVICE UsbDevice, 1241 _In_opt_ 1242 PWDF_OBJECT_ATTRIBUTES PipeAttributes, 1243 _Inout_ 1244 PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params 1245 ); 1246 1247 _Must_inspect_result_ 1248 _IRQL_requires_max_(PASSIVE_LEVEL) 1249 FORCEINLINE 1250 NTSTATUS 1251 WdfUsbTargetDeviceSelectConfig( 1252 _In_ 1253 WDFUSBDEVICE UsbDevice, 1254 _In_opt_ 1255 PWDF_OBJECT_ATTRIBUTES PipeAttributes, 1256 _Inout_ 1257 PWDF_USB_DEVICE_SELECT_CONFIG_PARAMS Params 1258 ) 1259 { 1260 return ((PFN_WDFUSBTARGETDEVICESELECTCONFIG) WdfFunctions[WdfUsbTargetDeviceSelectConfigTableIndex])(WdfDriverGlobals, UsbDevice, PipeAttributes, Params); 1261 } 1262 1263 // 1264 // WDF Function: WdfUsbTargetDeviceWdmGetConfigurationHandle 1265 // 1266 typedef 1267 _IRQL_requires_max_(DISPATCH_LEVEL) 1268 WDFAPI 1269 USBD_CONFIGURATION_HANDLE 1270 (STDCALL *PFN_WDFUSBTARGETDEVICEWDMGETCONFIGURATIONHANDLE)( 1271 _In_ 1272 PWDF_DRIVER_GLOBALS DriverGlobals, 1273 _In_ 1274 WDFUSBDEVICE UsbDevice 1275 ); 1276 1277 _IRQL_requires_max_(DISPATCH_LEVEL) 1278 FORCEINLINE 1279 USBD_CONFIGURATION_HANDLE 1280 WdfUsbTargetDeviceWdmGetConfigurationHandle( 1281 _In_ 1282 WDFUSBDEVICE UsbDevice 1283 ) 1284 { 1285 return ((PFN_WDFUSBTARGETDEVICEWDMGETCONFIGURATIONHANDLE) WdfFunctions[WdfUsbTargetDeviceWdmGetConfigurationHandleTableIndex])(WdfDriverGlobals, UsbDevice); 1286 } 1287 1288 // 1289 // WDF Function: WdfUsbTargetDeviceRetrieveCurrentFrameNumber 1290 // 1291 typedef 1292 _Must_inspect_result_ 1293 _IRQL_requires_max_(DISPATCH_LEVEL) 1294 WDFAPI 1295 NTSTATUS 1296 (STDCALL *PFN_WDFUSBTARGETDEVICERETRIEVECURRENTFRAMENUMBER)( 1297 _In_ 1298 PWDF_DRIVER_GLOBALS DriverGlobals, 1299 _In_ 1300 WDFUSBDEVICE UsbDevice, 1301 _Out_ 1302 PULONG CurrentFrameNumber 1303 ); 1304 1305 _Must_inspect_result_ 1306 _IRQL_requires_max_(DISPATCH_LEVEL) 1307 FORCEINLINE 1308 NTSTATUS 1309 WdfUsbTargetDeviceRetrieveCurrentFrameNumber( 1310 _In_ 1311 WDFUSBDEVICE UsbDevice, 1312 _Out_ 1313 PULONG CurrentFrameNumber 1314 ) 1315 { 1316 return ((PFN_WDFUSBTARGETDEVICERETRIEVECURRENTFRAMENUMBER) WdfFunctions[WdfUsbTargetDeviceRetrieveCurrentFrameNumberTableIndex])(WdfDriverGlobals, UsbDevice, CurrentFrameNumber); 1317 } 1318 1319 // 1320 // WDF Function: WdfUsbTargetDeviceSendControlTransferSynchronously 1321 // 1322 typedef 1323 _Must_inspect_result_ 1324 _IRQL_requires_max_(PASSIVE_LEVEL) 1325 WDFAPI 1326 NTSTATUS 1327 (STDCALL *PFN_WDFUSBTARGETDEVICESENDCONTROLTRANSFERSYNCHRONOUSLY)( 1328 _In_ 1329 PWDF_DRIVER_GLOBALS DriverGlobals, 1330 _In_ 1331 WDFUSBDEVICE UsbDevice, 1332 _In_opt_ 1333 WDFREQUEST Request, 1334 _In_opt_ 1335 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 1336 _In_ 1337 PWDF_USB_CONTROL_SETUP_PACKET SetupPacket, 1338 _In_opt_ 1339 PWDF_MEMORY_DESCRIPTOR MemoryDescriptor, 1340 _Out_opt_ 1341 PULONG BytesTransferred 1342 ); 1343 1344 _Must_inspect_result_ 1345 _IRQL_requires_max_(PASSIVE_LEVEL) 1346 FORCEINLINE 1347 NTSTATUS 1348 WdfUsbTargetDeviceSendControlTransferSynchronously( 1349 _In_ 1350 WDFUSBDEVICE UsbDevice, 1351 _In_opt_ 1352 WDFREQUEST Request, 1353 _In_opt_ 1354 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 1355 _In_ 1356 PWDF_USB_CONTROL_SETUP_PACKET SetupPacket, 1357 _In_opt_ 1358 PWDF_MEMORY_DESCRIPTOR MemoryDescriptor, 1359 _Out_opt_ 1360 PULONG BytesTransferred 1361 ) 1362 { 1363 return ((PFN_WDFUSBTARGETDEVICESENDCONTROLTRANSFERSYNCHRONOUSLY) WdfFunctions[WdfUsbTargetDeviceSendControlTransferSynchronouslyTableIndex])(WdfDriverGlobals, UsbDevice, Request, RequestOptions, SetupPacket, MemoryDescriptor, BytesTransferred); 1364 } 1365 1366 // 1367 // WDF Function: WdfUsbTargetDeviceFormatRequestForControlTransfer 1368 // 1369 typedef 1370 _Must_inspect_result_ 1371 _IRQL_requires_max_(DISPATCH_LEVEL) 1372 WDFAPI 1373 NTSTATUS 1374 (STDCALL *PFN_WDFUSBTARGETDEVICEFORMATREQUESTFORCONTROLTRANSFER)( 1375 _In_ 1376 PWDF_DRIVER_GLOBALS DriverGlobals, 1377 _In_ 1378 WDFUSBDEVICE UsbDevice, 1379 _In_ 1380 WDFREQUEST Request, 1381 _In_ 1382 PWDF_USB_CONTROL_SETUP_PACKET SetupPacket, 1383 _In_opt_ 1384 WDFMEMORY TransferMemory, 1385 _In_opt_ 1386 PWDFMEMORY_OFFSET TransferOffset 1387 ); 1388 1389 _Must_inspect_result_ 1390 _IRQL_requires_max_(DISPATCH_LEVEL) 1391 FORCEINLINE 1392 NTSTATUS 1393 WdfUsbTargetDeviceFormatRequestForControlTransfer( 1394 _In_ 1395 WDFUSBDEVICE UsbDevice, 1396 _In_ 1397 WDFREQUEST Request, 1398 _In_ 1399 PWDF_USB_CONTROL_SETUP_PACKET SetupPacket, 1400 _In_opt_ 1401 WDFMEMORY TransferMemory, 1402 _In_opt_ 1403 PWDFMEMORY_OFFSET TransferOffset 1404 ) 1405 { 1406 return ((PFN_WDFUSBTARGETDEVICEFORMATREQUESTFORCONTROLTRANSFER) WdfFunctions[WdfUsbTargetDeviceFormatRequestForControlTransferTableIndex])(WdfDriverGlobals, UsbDevice, Request, SetupPacket, TransferMemory, TransferOffset); 1407 } 1408 1409 // 1410 // WDF Function: WdfUsbTargetDeviceIsConnectedSynchronous 1411 // 1412 typedef 1413 _Must_inspect_result_ 1414 _IRQL_requires_max_(PASSIVE_LEVEL) 1415 WDFAPI 1416 NTSTATUS 1417 (STDCALL *PFN_WDFUSBTARGETDEVICEISCONNECTEDSYNCHRONOUS)( 1418 _In_ 1419 PWDF_DRIVER_GLOBALS DriverGlobals, 1420 _In_ 1421 WDFUSBDEVICE UsbDevice 1422 ); 1423 1424 _Must_inspect_result_ 1425 _IRQL_requires_max_(PASSIVE_LEVEL) 1426 FORCEINLINE 1427 NTSTATUS 1428 WdfUsbTargetDeviceIsConnectedSynchronous( 1429 _In_ 1430 WDFUSBDEVICE UsbDevice 1431 ) 1432 { 1433 return ((PFN_WDFUSBTARGETDEVICEISCONNECTEDSYNCHRONOUS) WdfFunctions[WdfUsbTargetDeviceIsConnectedSynchronousTableIndex])(WdfDriverGlobals, UsbDevice); 1434 } 1435 1436 // 1437 // WDF Function: WdfUsbTargetDeviceResetPortSynchronously 1438 // 1439 typedef 1440 _Must_inspect_result_ 1441 _IRQL_requires_max_(PASSIVE_LEVEL) 1442 WDFAPI 1443 NTSTATUS 1444 (STDCALL *PFN_WDFUSBTARGETDEVICERESETPORTSYNCHRONOUSLY)( 1445 _In_ 1446 PWDF_DRIVER_GLOBALS DriverGlobals, 1447 _In_ 1448 WDFUSBDEVICE UsbDevice 1449 ); 1450 1451 _Must_inspect_result_ 1452 _IRQL_requires_max_(PASSIVE_LEVEL) 1453 FORCEINLINE 1454 NTSTATUS 1455 WdfUsbTargetDeviceResetPortSynchronously( 1456 _In_ 1457 WDFUSBDEVICE UsbDevice 1458 ) 1459 { 1460 return ((PFN_WDFUSBTARGETDEVICERESETPORTSYNCHRONOUSLY) WdfFunctions[WdfUsbTargetDeviceResetPortSynchronouslyTableIndex])(WdfDriverGlobals, UsbDevice); 1461 } 1462 1463 // 1464 // WDF Function: WdfUsbTargetDeviceCyclePortSynchronously 1465 // 1466 typedef 1467 _Must_inspect_result_ 1468 _IRQL_requires_max_(PASSIVE_LEVEL) 1469 WDFAPI 1470 NTSTATUS 1471 (STDCALL *PFN_WDFUSBTARGETDEVICECYCLEPORTSYNCHRONOUSLY)( 1472 _In_ 1473 PWDF_DRIVER_GLOBALS DriverGlobals, 1474 _In_ 1475 WDFUSBDEVICE UsbDevice 1476 ); 1477 1478 _Must_inspect_result_ 1479 _IRQL_requires_max_(PASSIVE_LEVEL) 1480 FORCEINLINE 1481 NTSTATUS 1482 WdfUsbTargetDeviceCyclePortSynchronously( 1483 _In_ 1484 WDFUSBDEVICE UsbDevice 1485 ) 1486 { 1487 return ((PFN_WDFUSBTARGETDEVICECYCLEPORTSYNCHRONOUSLY) WdfFunctions[WdfUsbTargetDeviceCyclePortSynchronouslyTableIndex])(WdfDriverGlobals, UsbDevice); 1488 } 1489 1490 // 1491 // WDF Function: WdfUsbTargetDeviceFormatRequestForCyclePort 1492 // 1493 typedef 1494 _Must_inspect_result_ 1495 _IRQL_requires_max_(DISPATCH_LEVEL) 1496 WDFAPI 1497 NTSTATUS 1498 (STDCALL *PFN_WDFUSBTARGETDEVICEFORMATREQUESTFORCYCLEPORT)( 1499 _In_ 1500 PWDF_DRIVER_GLOBALS DriverGlobals, 1501 _In_ 1502 WDFUSBDEVICE UsbDevice, 1503 _In_ 1504 WDFREQUEST Request 1505 ); 1506 1507 _Must_inspect_result_ 1508 _IRQL_requires_max_(DISPATCH_LEVEL) 1509 FORCEINLINE 1510 NTSTATUS 1511 WdfUsbTargetDeviceFormatRequestForCyclePort( 1512 _In_ 1513 WDFUSBDEVICE UsbDevice, 1514 _In_ 1515 WDFREQUEST Request 1516 ) 1517 { 1518 return ((PFN_WDFUSBTARGETDEVICEFORMATREQUESTFORCYCLEPORT) WdfFunctions[WdfUsbTargetDeviceFormatRequestForCyclePortTableIndex])(WdfDriverGlobals, UsbDevice, Request); 1519 } 1520 1521 // 1522 // WDF Function: WdfUsbTargetDeviceSendUrbSynchronously 1523 // 1524 typedef 1525 _Must_inspect_result_ 1526 _IRQL_requires_max_(PASSIVE_LEVEL) 1527 WDFAPI 1528 NTSTATUS 1529 (STDCALL *PFN_WDFUSBTARGETDEVICESENDURBSYNCHRONOUSLY)( 1530 _In_ 1531 PWDF_DRIVER_GLOBALS DriverGlobals, 1532 _In_ 1533 WDFUSBDEVICE UsbDevice, 1534 _In_opt_ 1535 WDFREQUEST Request, 1536 _In_opt_ 1537 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 1538 _In_reads_(_Inexpressible_("union bug in SAL")) 1539 PURB Urb 1540 ); 1541 1542 _Must_inspect_result_ 1543 _IRQL_requires_max_(PASSIVE_LEVEL) 1544 FORCEINLINE 1545 NTSTATUS 1546 WdfUsbTargetDeviceSendUrbSynchronously( 1547 _In_ 1548 WDFUSBDEVICE UsbDevice, 1549 _In_opt_ 1550 WDFREQUEST Request, 1551 _In_opt_ 1552 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 1553 _In_reads_(_Inexpressible_("union bug in SAL")) 1554 PURB Urb 1555 ) 1556 { 1557 return ((PFN_WDFUSBTARGETDEVICESENDURBSYNCHRONOUSLY) WdfFunctions[WdfUsbTargetDeviceSendUrbSynchronouslyTableIndex])(WdfDriverGlobals, UsbDevice, Request, RequestOptions, Urb); 1558 } 1559 1560 // 1561 // WDF Function: WdfUsbTargetDeviceFormatRequestForUrb 1562 // 1563 typedef 1564 _Must_inspect_result_ 1565 _IRQL_requires_max_(DISPATCH_LEVEL) 1566 WDFAPI 1567 NTSTATUS 1568 (STDCALL *PFN_WDFUSBTARGETDEVICEFORMATREQUESTFORURB)( 1569 _In_ 1570 PWDF_DRIVER_GLOBALS DriverGlobals, 1571 _In_ 1572 WDFUSBDEVICE UsbDevice, 1573 _In_ 1574 WDFREQUEST Request, 1575 _In_ 1576 WDFMEMORY UrbMemory, 1577 _In_opt_ 1578 PWDFMEMORY_OFFSET UrbMemoryOffset 1579 ); 1580 1581 _Must_inspect_result_ 1582 _IRQL_requires_max_(DISPATCH_LEVEL) 1583 FORCEINLINE 1584 NTSTATUS 1585 WdfUsbTargetDeviceFormatRequestForUrb( 1586 _In_ 1587 WDFUSBDEVICE UsbDevice, 1588 _In_ 1589 WDFREQUEST Request, 1590 _In_ 1591 WDFMEMORY UrbMemory, 1592 _In_opt_ 1593 PWDFMEMORY_OFFSET UrbMemoryOffset 1594 ) 1595 { 1596 return ((PFN_WDFUSBTARGETDEVICEFORMATREQUESTFORURB) WdfFunctions[WdfUsbTargetDeviceFormatRequestForUrbTableIndex])(WdfDriverGlobals, UsbDevice, Request, UrbMemory, UrbMemoryOffset); 1597 } 1598 1599 // 1600 // WDF Function: WdfUsbTargetDeviceQueryUsbCapability 1601 // 1602 typedef 1603 _Must_inspect_result_ 1604 _IRQL_requires_max_(PASSIVE_LEVEL) 1605 WDFAPI 1606 NTSTATUS 1607 (STDCALL *PFN_WDFUSBTARGETDEVICEQUERYUSBCAPABILITY)( 1608 _In_ 1609 PWDF_DRIVER_GLOBALS DriverGlobals, 1610 _In_ 1611 WDFUSBDEVICE UsbDevice, 1612 _In_ 1613 CONST GUID* CapabilityType, 1614 _In_ 1615 ULONG CapabilityBufferLength, 1616 _When_(CapabilityBufferLength == 0, _Out_opt_) 1617 _When_(CapabilityBufferLength != 0 && ResultLength == NULL, _Out_writes_bytes_(CapabilityBufferLength)) 1618 _When_(CapabilityBufferLength != 0 && ResultLength != NULL, _Out_writes_bytes_to_opt_(CapabilityBufferLength, *ResultLength)) 1619 PVOID CapabilityBuffer, 1620 _Out_opt_ 1621 _When_(ResultLength != NULL,_Deref_out_range_(<=,CapabilityBufferLength)) 1622 PULONG ResultLength 1623 ); 1624 1625 _Must_inspect_result_ 1626 _IRQL_requires_max_(PASSIVE_LEVEL) 1627 FORCEINLINE 1628 NTSTATUS 1629 WdfUsbTargetDeviceQueryUsbCapability( 1630 _In_ 1631 WDFUSBDEVICE UsbDevice, 1632 _In_ 1633 CONST GUID* CapabilityType, 1634 _In_ 1635 ULONG CapabilityBufferLength, 1636 _When_(CapabilityBufferLength == 0, _Out_opt_) 1637 _When_(CapabilityBufferLength != 0 && ResultLength == NULL, _Out_writes_bytes_(CapabilityBufferLength)) 1638 _When_(CapabilityBufferLength != 0 && ResultLength != NULL, _Out_writes_bytes_to_opt_(CapabilityBufferLength, *ResultLength)) 1639 PVOID CapabilityBuffer, 1640 _Out_opt_ 1641 _When_(ResultLength != NULL,_Deref_out_range_(<=,CapabilityBufferLength)) 1642 PULONG ResultLength 1643 ) 1644 { 1645 return ((PFN_WDFUSBTARGETDEVICEQUERYUSBCAPABILITY) WdfFunctions[WdfUsbTargetDeviceQueryUsbCapabilityTableIndex])(WdfDriverGlobals, UsbDevice, CapabilityType, CapabilityBufferLength, CapabilityBuffer, ResultLength); 1646 } 1647 1648 // 1649 // WDF Function: WdfUsbTargetDeviceCreateUrb 1650 // 1651 typedef 1652 _Must_inspect_result_ 1653 _IRQL_requires_max_(DISPATCH_LEVEL) 1654 WDFAPI 1655 NTSTATUS 1656 (STDCALL *PFN_WDFUSBTARGETDEVICECREATEURB)( 1657 _In_ 1658 PWDF_DRIVER_GLOBALS DriverGlobals, 1659 _In_ 1660 WDFUSBDEVICE UsbDevice, 1661 _In_opt_ 1662 PWDF_OBJECT_ATTRIBUTES Attributes, 1663 _Out_ 1664 WDFMEMORY* UrbMemory, 1665 _Outptr_opt_result_bytebuffer_(sizeof(URB)) 1666 PURB* Urb 1667 ); 1668 1669 _Must_inspect_result_ 1670 _IRQL_requires_max_(DISPATCH_LEVEL) 1671 FORCEINLINE 1672 NTSTATUS 1673 WdfUsbTargetDeviceCreateUrb( 1674 _In_ 1675 WDFUSBDEVICE UsbDevice, 1676 _In_opt_ 1677 PWDF_OBJECT_ATTRIBUTES Attributes, 1678 _Out_ 1679 WDFMEMORY* UrbMemory, 1680 _Outptr_opt_result_bytebuffer_(sizeof(URB)) 1681 PURB* Urb 1682 ) 1683 { 1684 return ((PFN_WDFUSBTARGETDEVICECREATEURB) WdfFunctions[WdfUsbTargetDeviceCreateUrbTableIndex])(WdfDriverGlobals, UsbDevice, Attributes, UrbMemory, Urb); 1685 } 1686 1687 // 1688 // WDF Function: WdfUsbTargetDeviceCreateIsochUrb 1689 // 1690 typedef 1691 _Must_inspect_result_ 1692 _IRQL_requires_max_(DISPATCH_LEVEL) 1693 WDFAPI 1694 NTSTATUS 1695 (STDCALL *PFN_WDFUSBTARGETDEVICECREATEISOCHURB)( 1696 _In_ 1697 PWDF_DRIVER_GLOBALS DriverGlobals, 1698 _In_ 1699 WDFUSBDEVICE UsbDevice, 1700 _In_opt_ 1701 PWDF_OBJECT_ATTRIBUTES Attributes, 1702 _In_ 1703 ULONG NumberOfIsochPackets, 1704 _Out_ 1705 WDFMEMORY* UrbMemory, 1706 _Outptr_opt_result_bytebuffer_(GET_ISO_URB_SIZE(NumberOfIsochPackets)) 1707 PURB* Urb 1708 ); 1709 1710 _Must_inspect_result_ 1711 _IRQL_requires_max_(DISPATCH_LEVEL) 1712 FORCEINLINE 1713 NTSTATUS 1714 WdfUsbTargetDeviceCreateIsochUrb( 1715 _In_ 1716 WDFUSBDEVICE UsbDevice, 1717 _In_opt_ 1718 PWDF_OBJECT_ATTRIBUTES Attributes, 1719 _In_ 1720 ULONG NumberOfIsochPackets, 1721 _Out_ 1722 WDFMEMORY* UrbMemory, 1723 _Outptr_opt_result_bytebuffer_(GET_ISO_URB_SIZE(NumberOfIsochPackets)) 1724 PURB* Urb 1725 ) 1726 { 1727 return ((PFN_WDFUSBTARGETDEVICECREATEISOCHURB) WdfFunctions[WdfUsbTargetDeviceCreateIsochUrbTableIndex])(WdfDriverGlobals, UsbDevice, Attributes, NumberOfIsochPackets, UrbMemory, Urb); 1728 } 1729 1730 // 1731 // WDF Function: WdfUsbTargetPipeGetInformation 1732 // 1733 typedef 1734 _IRQL_requires_max_(DISPATCH_LEVEL) 1735 WDFAPI 1736 VOID 1737 (STDCALL *PFN_WDFUSBTARGETPIPEGETINFORMATION)( 1738 _In_ 1739 PWDF_DRIVER_GLOBALS DriverGlobals, 1740 _In_ 1741 WDFUSBPIPE Pipe, 1742 _Out_ 1743 PWDF_USB_PIPE_INFORMATION PipeInformation 1744 ); 1745 1746 _IRQL_requires_max_(DISPATCH_LEVEL) 1747 FORCEINLINE 1748 VOID 1749 WdfUsbTargetPipeGetInformation( 1750 _In_ 1751 WDFUSBPIPE Pipe, 1752 _Out_ 1753 PWDF_USB_PIPE_INFORMATION PipeInformation 1754 ) 1755 { 1756 ((PFN_WDFUSBTARGETPIPEGETINFORMATION) WdfFunctions[WdfUsbTargetPipeGetInformationTableIndex])(WdfDriverGlobals, Pipe, PipeInformation); 1757 } 1758 1759 // 1760 // WDF Function: WdfUsbTargetPipeIsInEndpoint 1761 // 1762 typedef 1763 _IRQL_requires_max_(DISPATCH_LEVEL) 1764 WDFAPI 1765 BOOLEAN 1766 (STDCALL *PFN_WDFUSBTARGETPIPEISINENDPOINT)( 1767 _In_ 1768 PWDF_DRIVER_GLOBALS DriverGlobals, 1769 _In_ 1770 WDFUSBPIPE Pipe 1771 ); 1772 1773 _IRQL_requires_max_(DISPATCH_LEVEL) 1774 FORCEINLINE 1775 BOOLEAN 1776 WdfUsbTargetPipeIsInEndpoint( 1777 _In_ 1778 WDFUSBPIPE Pipe 1779 ) 1780 { 1781 return ((PFN_WDFUSBTARGETPIPEISINENDPOINT) WdfFunctions[WdfUsbTargetPipeIsInEndpointTableIndex])(WdfDriverGlobals, Pipe); 1782 } 1783 1784 // 1785 // WDF Function: WdfUsbTargetPipeIsOutEndpoint 1786 // 1787 typedef 1788 _IRQL_requires_max_(DISPATCH_LEVEL) 1789 WDFAPI 1790 BOOLEAN 1791 (STDCALL *PFN_WDFUSBTARGETPIPEISOUTENDPOINT)( 1792 _In_ 1793 PWDF_DRIVER_GLOBALS DriverGlobals, 1794 _In_ 1795 WDFUSBPIPE Pipe 1796 ); 1797 1798 _IRQL_requires_max_(DISPATCH_LEVEL) 1799 FORCEINLINE 1800 BOOLEAN 1801 WdfUsbTargetPipeIsOutEndpoint( 1802 _In_ 1803 WDFUSBPIPE Pipe 1804 ) 1805 { 1806 return ((PFN_WDFUSBTARGETPIPEISOUTENDPOINT) WdfFunctions[WdfUsbTargetPipeIsOutEndpointTableIndex])(WdfDriverGlobals, Pipe); 1807 } 1808 1809 // 1810 // WDF Function: WdfUsbTargetPipeGetType 1811 // 1812 typedef 1813 _IRQL_requires_max_(DISPATCH_LEVEL) 1814 WDFAPI 1815 WDF_USB_PIPE_TYPE 1816 (STDCALL *PFN_WDFUSBTARGETPIPEGETTYPE)( 1817 _In_ 1818 PWDF_DRIVER_GLOBALS DriverGlobals, 1819 _In_ 1820 WDFUSBPIPE Pipe 1821 ); 1822 1823 _IRQL_requires_max_(DISPATCH_LEVEL) 1824 FORCEINLINE 1825 WDF_USB_PIPE_TYPE 1826 WdfUsbTargetPipeGetType( 1827 _In_ 1828 WDFUSBPIPE Pipe 1829 ) 1830 { 1831 return ((PFN_WDFUSBTARGETPIPEGETTYPE) WdfFunctions[WdfUsbTargetPipeGetTypeTableIndex])(WdfDriverGlobals, Pipe); 1832 } 1833 1834 // 1835 // WDF Function: WdfUsbTargetPipeSetNoMaximumPacketSizeCheck 1836 // 1837 typedef 1838 _IRQL_requires_max_(DISPATCH_LEVEL) 1839 WDFAPI 1840 VOID 1841 (STDCALL *PFN_WDFUSBTARGETPIPESETNOMAXIMUMPACKETSIZECHECK)( 1842 _In_ 1843 PWDF_DRIVER_GLOBALS DriverGlobals, 1844 _In_ 1845 WDFUSBPIPE Pipe 1846 ); 1847 1848 _IRQL_requires_max_(DISPATCH_LEVEL) 1849 FORCEINLINE 1850 VOID 1851 WdfUsbTargetPipeSetNoMaximumPacketSizeCheck( 1852 _In_ 1853 WDFUSBPIPE Pipe 1854 ) 1855 { 1856 ((PFN_WDFUSBTARGETPIPESETNOMAXIMUMPACKETSIZECHECK) WdfFunctions[WdfUsbTargetPipeSetNoMaximumPacketSizeCheckTableIndex])(WdfDriverGlobals, Pipe); 1857 } 1858 1859 // 1860 // WDF Function: WdfUsbTargetPipeWriteSynchronously 1861 // 1862 typedef 1863 _Must_inspect_result_ 1864 _IRQL_requires_max_(PASSIVE_LEVEL) 1865 WDFAPI 1866 NTSTATUS 1867 (STDCALL *PFN_WDFUSBTARGETPIPEWRITESYNCHRONOUSLY)( 1868 _In_ 1869 PWDF_DRIVER_GLOBALS DriverGlobals, 1870 _In_ 1871 WDFUSBPIPE Pipe, 1872 _In_opt_ 1873 WDFREQUEST Request, 1874 _In_opt_ 1875 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 1876 _In_opt_ 1877 PWDF_MEMORY_DESCRIPTOR MemoryDescriptor, 1878 _Out_opt_ 1879 PULONG BytesWritten 1880 ); 1881 1882 _Must_inspect_result_ 1883 _IRQL_requires_max_(PASSIVE_LEVEL) 1884 FORCEINLINE 1885 NTSTATUS 1886 WdfUsbTargetPipeWriteSynchronously( 1887 _In_ 1888 WDFUSBPIPE Pipe, 1889 _In_opt_ 1890 WDFREQUEST Request, 1891 _In_opt_ 1892 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 1893 _In_opt_ 1894 PWDF_MEMORY_DESCRIPTOR MemoryDescriptor, 1895 _Out_opt_ 1896 PULONG BytesWritten 1897 ) 1898 { 1899 return ((PFN_WDFUSBTARGETPIPEWRITESYNCHRONOUSLY) WdfFunctions[WdfUsbTargetPipeWriteSynchronouslyTableIndex])(WdfDriverGlobals, Pipe, Request, RequestOptions, MemoryDescriptor, BytesWritten); 1900 } 1901 1902 // 1903 // WDF Function: WdfUsbTargetPipeFormatRequestForWrite 1904 // 1905 typedef 1906 _Must_inspect_result_ 1907 _IRQL_requires_max_(DISPATCH_LEVEL) 1908 WDFAPI 1909 NTSTATUS 1910 (STDCALL *PFN_WDFUSBTARGETPIPEFORMATREQUESTFORWRITE)( 1911 _In_ 1912 PWDF_DRIVER_GLOBALS DriverGlobals, 1913 _In_ 1914 WDFUSBPIPE Pipe, 1915 _In_ 1916 WDFREQUEST Request, 1917 _In_opt_ 1918 WDFMEMORY WriteMemory, 1919 _In_opt_ 1920 PWDFMEMORY_OFFSET WriteOffset 1921 ); 1922 1923 _Must_inspect_result_ 1924 _IRQL_requires_max_(DISPATCH_LEVEL) 1925 FORCEINLINE 1926 NTSTATUS 1927 WdfUsbTargetPipeFormatRequestForWrite( 1928 _In_ 1929 WDFUSBPIPE Pipe, 1930 _In_ 1931 WDFREQUEST Request, 1932 _In_opt_ 1933 WDFMEMORY WriteMemory, 1934 _In_opt_ 1935 PWDFMEMORY_OFFSET WriteOffset 1936 ) 1937 { 1938 return ((PFN_WDFUSBTARGETPIPEFORMATREQUESTFORWRITE) WdfFunctions[WdfUsbTargetPipeFormatRequestForWriteTableIndex])(WdfDriverGlobals, Pipe, Request, WriteMemory, WriteOffset); 1939 } 1940 1941 // 1942 // WDF Function: WdfUsbTargetPipeReadSynchronously 1943 // 1944 typedef 1945 _Must_inspect_result_ 1946 _IRQL_requires_max_(PASSIVE_LEVEL) 1947 WDFAPI 1948 NTSTATUS 1949 (STDCALL *PFN_WDFUSBTARGETPIPEREADSYNCHRONOUSLY)( 1950 _In_ 1951 PWDF_DRIVER_GLOBALS DriverGlobals, 1952 _In_ 1953 WDFUSBPIPE Pipe, 1954 _In_opt_ 1955 WDFREQUEST Request, 1956 _In_opt_ 1957 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 1958 _In_opt_ 1959 PWDF_MEMORY_DESCRIPTOR MemoryDescriptor, 1960 _Out_opt_ 1961 PULONG BytesRead 1962 ); 1963 1964 _Must_inspect_result_ 1965 _IRQL_requires_max_(PASSIVE_LEVEL) 1966 FORCEINLINE 1967 NTSTATUS 1968 WdfUsbTargetPipeReadSynchronously( 1969 _In_ 1970 WDFUSBPIPE Pipe, 1971 _In_opt_ 1972 WDFREQUEST Request, 1973 _In_opt_ 1974 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 1975 _In_opt_ 1976 PWDF_MEMORY_DESCRIPTOR MemoryDescriptor, 1977 _Out_opt_ 1978 PULONG BytesRead 1979 ) 1980 { 1981 return ((PFN_WDFUSBTARGETPIPEREADSYNCHRONOUSLY) WdfFunctions[WdfUsbTargetPipeReadSynchronouslyTableIndex])(WdfDriverGlobals, Pipe, Request, RequestOptions, MemoryDescriptor, BytesRead); 1982 } 1983 1984 // 1985 // WDF Function: WdfUsbTargetPipeFormatRequestForRead 1986 // 1987 typedef 1988 _Must_inspect_result_ 1989 _IRQL_requires_max_(DISPATCH_LEVEL) 1990 WDFAPI 1991 NTSTATUS 1992 (STDCALL *PFN_WDFUSBTARGETPIPEFORMATREQUESTFORREAD)( 1993 _In_ 1994 PWDF_DRIVER_GLOBALS DriverGlobals, 1995 _In_ 1996 WDFUSBPIPE Pipe, 1997 _In_ 1998 WDFREQUEST Request, 1999 _In_opt_ 2000 WDFMEMORY ReadMemory, 2001 _In_opt_ 2002 PWDFMEMORY_OFFSET ReadOffset 2003 ); 2004 2005 _Must_inspect_result_ 2006 _IRQL_requires_max_(DISPATCH_LEVEL) 2007 FORCEINLINE 2008 NTSTATUS 2009 WdfUsbTargetPipeFormatRequestForRead( 2010 _In_ 2011 WDFUSBPIPE Pipe, 2012 _In_ 2013 WDFREQUEST Request, 2014 _In_opt_ 2015 WDFMEMORY ReadMemory, 2016 _In_opt_ 2017 PWDFMEMORY_OFFSET ReadOffset 2018 ) 2019 { 2020 return ((PFN_WDFUSBTARGETPIPEFORMATREQUESTFORREAD) WdfFunctions[WdfUsbTargetPipeFormatRequestForReadTableIndex])(WdfDriverGlobals, Pipe, Request, ReadMemory, ReadOffset); 2021 } 2022 2023 // 2024 // WDF Function: WdfUsbTargetPipeConfigContinuousReader 2025 // 2026 typedef 2027 _Must_inspect_result_ 2028 _IRQL_requires_max_(DISPATCH_LEVEL) 2029 WDFAPI 2030 NTSTATUS 2031 (STDCALL *PFN_WDFUSBTARGETPIPECONFIGCONTINUOUSREADER)( 2032 _In_ 2033 PWDF_DRIVER_GLOBALS DriverGlobals, 2034 _In_ 2035 WDFUSBPIPE Pipe, 2036 _In_ 2037 PWDF_USB_CONTINUOUS_READER_CONFIG Config 2038 ); 2039 2040 _Must_inspect_result_ 2041 _IRQL_requires_max_(DISPATCH_LEVEL) 2042 FORCEINLINE 2043 NTSTATUS 2044 WdfUsbTargetPipeConfigContinuousReader( 2045 _In_ 2046 WDFUSBPIPE Pipe, 2047 _In_ 2048 PWDF_USB_CONTINUOUS_READER_CONFIG Config 2049 ) 2050 { 2051 return ((PFN_WDFUSBTARGETPIPECONFIGCONTINUOUSREADER) WdfFunctions[WdfUsbTargetPipeConfigContinuousReaderTableIndex])(WdfDriverGlobals, Pipe, Config); 2052 } 2053 2054 // 2055 // WDF Function: WdfUsbTargetPipeAbortSynchronously 2056 // 2057 typedef 2058 _Must_inspect_result_ 2059 _IRQL_requires_max_(PASSIVE_LEVEL) 2060 WDFAPI 2061 NTSTATUS 2062 (STDCALL *PFN_WDFUSBTARGETPIPEABORTSYNCHRONOUSLY)( 2063 _In_ 2064 PWDF_DRIVER_GLOBALS DriverGlobals, 2065 _In_ 2066 WDFUSBPIPE Pipe, 2067 _In_opt_ 2068 WDFREQUEST Request, 2069 _In_opt_ 2070 PWDF_REQUEST_SEND_OPTIONS RequestOptions 2071 ); 2072 2073 _Must_inspect_result_ 2074 _IRQL_requires_max_(PASSIVE_LEVEL) 2075 FORCEINLINE 2076 NTSTATUS 2077 WdfUsbTargetPipeAbortSynchronously( 2078 _In_ 2079 WDFUSBPIPE Pipe, 2080 _In_opt_ 2081 WDFREQUEST Request, 2082 _In_opt_ 2083 PWDF_REQUEST_SEND_OPTIONS RequestOptions 2084 ) 2085 { 2086 return ((PFN_WDFUSBTARGETPIPEABORTSYNCHRONOUSLY) WdfFunctions[WdfUsbTargetPipeAbortSynchronouslyTableIndex])(WdfDriverGlobals, Pipe, Request, RequestOptions); 2087 } 2088 2089 // 2090 // WDF Function: WdfUsbTargetPipeFormatRequestForAbort 2091 // 2092 typedef 2093 _Must_inspect_result_ 2094 _IRQL_requires_max_(DISPATCH_LEVEL) 2095 WDFAPI 2096 NTSTATUS 2097 (STDCALL *PFN_WDFUSBTARGETPIPEFORMATREQUESTFORABORT)( 2098 _In_ 2099 PWDF_DRIVER_GLOBALS DriverGlobals, 2100 _In_ 2101 WDFUSBPIPE Pipe, 2102 _In_ 2103 WDFREQUEST Request 2104 ); 2105 2106 _Must_inspect_result_ 2107 _IRQL_requires_max_(DISPATCH_LEVEL) 2108 FORCEINLINE 2109 NTSTATUS 2110 WdfUsbTargetPipeFormatRequestForAbort( 2111 _In_ 2112 WDFUSBPIPE Pipe, 2113 _In_ 2114 WDFREQUEST Request 2115 ) 2116 { 2117 return ((PFN_WDFUSBTARGETPIPEFORMATREQUESTFORABORT) WdfFunctions[WdfUsbTargetPipeFormatRequestForAbortTableIndex])(WdfDriverGlobals, Pipe, Request); 2118 } 2119 2120 // 2121 // WDF Function: WdfUsbTargetPipeResetSynchronously 2122 // 2123 typedef 2124 _Must_inspect_result_ 2125 _IRQL_requires_max_(PASSIVE_LEVEL) 2126 WDFAPI 2127 NTSTATUS 2128 (STDCALL *PFN_WDFUSBTARGETPIPERESETSYNCHRONOUSLY)( 2129 _In_ 2130 PWDF_DRIVER_GLOBALS DriverGlobals, 2131 _In_ 2132 WDFUSBPIPE Pipe, 2133 _In_opt_ 2134 WDFREQUEST Request, 2135 _In_opt_ 2136 PWDF_REQUEST_SEND_OPTIONS RequestOptions 2137 ); 2138 2139 _Must_inspect_result_ 2140 _IRQL_requires_max_(PASSIVE_LEVEL) 2141 FORCEINLINE 2142 NTSTATUS 2143 WdfUsbTargetPipeResetSynchronously( 2144 _In_ 2145 WDFUSBPIPE Pipe, 2146 _In_opt_ 2147 WDFREQUEST Request, 2148 _In_opt_ 2149 PWDF_REQUEST_SEND_OPTIONS RequestOptions 2150 ) 2151 { 2152 return ((PFN_WDFUSBTARGETPIPERESETSYNCHRONOUSLY) WdfFunctions[WdfUsbTargetPipeResetSynchronouslyTableIndex])(WdfDriverGlobals, Pipe, Request, RequestOptions); 2153 } 2154 2155 // 2156 // WDF Function: WdfUsbTargetPipeFormatRequestForReset 2157 // 2158 typedef 2159 _Must_inspect_result_ 2160 _IRQL_requires_max_(DISPATCH_LEVEL) 2161 WDFAPI 2162 NTSTATUS 2163 (STDCALL *PFN_WDFUSBTARGETPIPEFORMATREQUESTFORRESET)( 2164 _In_ 2165 PWDF_DRIVER_GLOBALS DriverGlobals, 2166 _In_ 2167 WDFUSBPIPE Pipe, 2168 _In_ 2169 WDFREQUEST Request 2170 ); 2171 2172 _Must_inspect_result_ 2173 _IRQL_requires_max_(DISPATCH_LEVEL) 2174 FORCEINLINE 2175 NTSTATUS 2176 WdfUsbTargetPipeFormatRequestForReset( 2177 _In_ 2178 WDFUSBPIPE Pipe, 2179 _In_ 2180 WDFREQUEST Request 2181 ) 2182 { 2183 return ((PFN_WDFUSBTARGETPIPEFORMATREQUESTFORRESET) WdfFunctions[WdfUsbTargetPipeFormatRequestForResetTableIndex])(WdfDriverGlobals, Pipe, Request); 2184 } 2185 2186 // 2187 // WDF Function: WdfUsbTargetPipeSendUrbSynchronously 2188 // 2189 typedef 2190 _Must_inspect_result_ 2191 _IRQL_requires_max_(PASSIVE_LEVEL) 2192 WDFAPI 2193 NTSTATUS 2194 (STDCALL *PFN_WDFUSBTARGETPIPESENDURBSYNCHRONOUSLY)( 2195 _In_ 2196 PWDF_DRIVER_GLOBALS DriverGlobals, 2197 _In_ 2198 WDFUSBPIPE Pipe, 2199 _In_opt_ 2200 WDFREQUEST Request, 2201 _In_opt_ 2202 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 2203 _In_reads_(_Inexpressible_("union bug in SAL")) 2204 PURB Urb 2205 ); 2206 2207 _Must_inspect_result_ 2208 _IRQL_requires_max_(PASSIVE_LEVEL) 2209 FORCEINLINE 2210 NTSTATUS 2211 WdfUsbTargetPipeSendUrbSynchronously( 2212 _In_ 2213 WDFUSBPIPE Pipe, 2214 _In_opt_ 2215 WDFREQUEST Request, 2216 _In_opt_ 2217 PWDF_REQUEST_SEND_OPTIONS RequestOptions, 2218 _In_reads_(_Inexpressible_("union bug in SAL")) 2219 PURB Urb 2220 ) 2221 { 2222 return ((PFN_WDFUSBTARGETPIPESENDURBSYNCHRONOUSLY) WdfFunctions[WdfUsbTargetPipeSendUrbSynchronouslyTableIndex])(WdfDriverGlobals, Pipe, Request, RequestOptions, Urb); 2223 } 2224 2225 // 2226 // WDF Function: WdfUsbTargetPipeFormatRequestForUrb 2227 // 2228 typedef 2229 _Must_inspect_result_ 2230 _IRQL_requires_max_(DISPATCH_LEVEL) 2231 WDFAPI 2232 NTSTATUS 2233 (STDCALL *PFN_WDFUSBTARGETPIPEFORMATREQUESTFORURB)( 2234 _In_ 2235 PWDF_DRIVER_GLOBALS DriverGlobals, 2236 _In_ 2237 WDFUSBPIPE PIPE, 2238 _In_ 2239 WDFREQUEST Request, 2240 _In_ 2241 WDFMEMORY UrbMemory, 2242 _In_opt_ 2243 PWDFMEMORY_OFFSET UrbMemoryOffset 2244 ); 2245 2246 _Must_inspect_result_ 2247 _IRQL_requires_max_(DISPATCH_LEVEL) 2248 FORCEINLINE 2249 NTSTATUS 2250 WdfUsbTargetPipeFormatRequestForUrb( 2251 _In_ 2252 WDFUSBPIPE PIPE, 2253 _In_ 2254 WDFREQUEST Request, 2255 _In_ 2256 WDFMEMORY UrbMemory, 2257 _In_opt_ 2258 PWDFMEMORY_OFFSET UrbMemoryOffset 2259 ) 2260 { 2261 return ((PFN_WDFUSBTARGETPIPEFORMATREQUESTFORURB) WdfFunctions[WdfUsbTargetPipeFormatRequestForUrbTableIndex])(WdfDriverGlobals, PIPE, Request, UrbMemory, UrbMemoryOffset); 2262 } 2263 2264 // 2265 // WDF Function: WdfUsbInterfaceGetInterfaceNumber 2266 // 2267 typedef 2268 _IRQL_requires_max_(DISPATCH_LEVEL) 2269 WDFAPI 2270 BYTE 2271 (STDCALL *PFN_WDFUSBINTERFACEGETINTERFACENUMBER)( 2272 _In_ 2273 PWDF_DRIVER_GLOBALS DriverGlobals, 2274 _In_ 2275 WDFUSBINTERFACE UsbInterface 2276 ); 2277 2278 _IRQL_requires_max_(DISPATCH_LEVEL) 2279 FORCEINLINE 2280 BYTE 2281 WdfUsbInterfaceGetInterfaceNumber( 2282 _In_ 2283 WDFUSBINTERFACE UsbInterface 2284 ) 2285 { 2286 return ((PFN_WDFUSBINTERFACEGETINTERFACENUMBER) WdfFunctions[WdfUsbInterfaceGetInterfaceNumberTableIndex])(WdfDriverGlobals, UsbInterface); 2287 } 2288 2289 // 2290 // WDF Function: WdfUsbInterfaceGetNumEndpoints 2291 // 2292 typedef 2293 _IRQL_requires_max_(DISPATCH_LEVEL) 2294 WDFAPI 2295 BYTE 2296 (STDCALL *PFN_WDFUSBINTERFACEGETNUMENDPOINTS)( 2297 _In_ 2298 PWDF_DRIVER_GLOBALS DriverGlobals, 2299 _In_ 2300 WDFUSBINTERFACE UsbInterface, 2301 _In_ 2302 UCHAR SettingIndex 2303 ); 2304 2305 _IRQL_requires_max_(DISPATCH_LEVEL) 2306 FORCEINLINE 2307 BYTE 2308 WdfUsbInterfaceGetNumEndpoints( 2309 _In_ 2310 WDFUSBINTERFACE UsbInterface, 2311 _In_ 2312 UCHAR SettingIndex 2313 ) 2314 { 2315 return ((PFN_WDFUSBINTERFACEGETNUMENDPOINTS) WdfFunctions[WdfUsbInterfaceGetNumEndpointsTableIndex])(WdfDriverGlobals, UsbInterface, SettingIndex); 2316 } 2317 2318 // 2319 // WDF Function: WdfUsbInterfaceGetDescriptor 2320 // 2321 typedef 2322 _IRQL_requires_max_(DISPATCH_LEVEL) 2323 WDFAPI 2324 VOID 2325 (STDCALL *PFN_WDFUSBINTERFACEGETDESCRIPTOR)( 2326 _In_ 2327 PWDF_DRIVER_GLOBALS DriverGlobals, 2328 _In_ 2329 WDFUSBINTERFACE UsbInterface, 2330 _In_ 2331 UCHAR SettingIndex, 2332 _Out_ 2333 PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor 2334 ); 2335 2336 _IRQL_requires_max_(DISPATCH_LEVEL) 2337 FORCEINLINE 2338 VOID 2339 WdfUsbInterfaceGetDescriptor( 2340 _In_ 2341 WDFUSBINTERFACE UsbInterface, 2342 _In_ 2343 UCHAR SettingIndex, 2344 _Out_ 2345 PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor 2346 ) 2347 { 2348 ((PFN_WDFUSBINTERFACEGETDESCRIPTOR) WdfFunctions[WdfUsbInterfaceGetDescriptorTableIndex])(WdfDriverGlobals, UsbInterface, SettingIndex, InterfaceDescriptor); 2349 } 2350 2351 // 2352 // WDF Function: WdfUsbInterfaceGetNumSettings 2353 // 2354 typedef 2355 _IRQL_requires_max_(DISPATCH_LEVEL) 2356 WDFAPI 2357 BYTE 2358 (STDCALL *PFN_WDFUSBINTERFACEGETNUMSETTINGS)( 2359 _In_ 2360 PWDF_DRIVER_GLOBALS DriverGlobals, 2361 _In_ 2362 WDFUSBINTERFACE UsbInterface 2363 ); 2364 2365 _IRQL_requires_max_(DISPATCH_LEVEL) 2366 FORCEINLINE 2367 BYTE 2368 WdfUsbInterfaceGetNumSettings( 2369 _In_ 2370 WDFUSBINTERFACE UsbInterface 2371 ) 2372 { 2373 return ((PFN_WDFUSBINTERFACEGETNUMSETTINGS) WdfFunctions[WdfUsbInterfaceGetNumSettingsTableIndex])(WdfDriverGlobals, UsbInterface); 2374 } 2375 2376 // 2377 // WDF Function: WdfUsbInterfaceSelectSetting 2378 // 2379 typedef 2380 _Must_inspect_result_ 2381 _IRQL_requires_max_(PASSIVE_LEVEL) 2382 WDFAPI 2383 NTSTATUS 2384 (STDCALL *PFN_WDFUSBINTERFACESELECTSETTING)( 2385 _In_ 2386 PWDF_DRIVER_GLOBALS DriverGlobals, 2387 _In_ 2388 WDFUSBINTERFACE UsbInterface, 2389 _In_opt_ 2390 PWDF_OBJECT_ATTRIBUTES PipesAttributes, 2391 _In_ 2392 PWDF_USB_INTERFACE_SELECT_SETTING_PARAMS Params 2393 ); 2394 2395 _Must_inspect_result_ 2396 _IRQL_requires_max_(PASSIVE_LEVEL) 2397 FORCEINLINE 2398 NTSTATUS 2399 WdfUsbInterfaceSelectSetting( 2400 _In_ 2401 WDFUSBINTERFACE UsbInterface, 2402 _In_opt_ 2403 PWDF_OBJECT_ATTRIBUTES PipesAttributes, 2404 _In_ 2405 PWDF_USB_INTERFACE_SELECT_SETTING_PARAMS Params 2406 ) 2407 { 2408 return ((PFN_WDFUSBINTERFACESELECTSETTING) WdfFunctions[WdfUsbInterfaceSelectSettingTableIndex])(WdfDriverGlobals, UsbInterface, PipesAttributes, Params); 2409 } 2410 2411 // 2412 // WDF Function: WdfUsbInterfaceGetEndpointInformation 2413 // 2414 typedef 2415 _IRQL_requires_max_(DISPATCH_LEVEL) 2416 WDFAPI 2417 VOID 2418 (STDCALL *PFN_WDFUSBINTERFACEGETENDPOINTINFORMATION)( 2419 _In_ 2420 PWDF_DRIVER_GLOBALS DriverGlobals, 2421 _In_ 2422 WDFUSBINTERFACE UsbInterface, 2423 _In_ 2424 UCHAR SettingIndex, 2425 _In_ 2426 UCHAR EndpointIndex, 2427 _Out_ 2428 PWDF_USB_PIPE_INFORMATION EndpointInfo 2429 ); 2430 2431 _IRQL_requires_max_(DISPATCH_LEVEL) 2432 FORCEINLINE 2433 VOID 2434 WdfUsbInterfaceGetEndpointInformation( 2435 _In_ 2436 WDFUSBINTERFACE UsbInterface, 2437 _In_ 2438 UCHAR SettingIndex, 2439 _In_ 2440 UCHAR EndpointIndex, 2441 _Out_ 2442 PWDF_USB_PIPE_INFORMATION EndpointInfo 2443 ) 2444 { 2445 ((PFN_WDFUSBINTERFACEGETENDPOINTINFORMATION) WdfFunctions[WdfUsbInterfaceGetEndpointInformationTableIndex])(WdfDriverGlobals, UsbInterface, SettingIndex, EndpointIndex, EndpointInfo); 2446 } 2447 2448 // 2449 // WDF Function: WdfUsbTargetDeviceGetInterface 2450 // 2451 typedef 2452 _IRQL_requires_max_(DISPATCH_LEVEL) 2453 WDFAPI 2454 WDFUSBINTERFACE 2455 (STDCALL *PFN_WDFUSBTARGETDEVICEGETINTERFACE)( 2456 _In_ 2457 PWDF_DRIVER_GLOBALS DriverGlobals, 2458 _In_ 2459 WDFUSBDEVICE UsbDevice, 2460 _In_ 2461 UCHAR InterfaceIndex 2462 ); 2463 2464 _IRQL_requires_max_(DISPATCH_LEVEL) 2465 FORCEINLINE 2466 WDFUSBINTERFACE 2467 WdfUsbTargetDeviceGetInterface( 2468 _In_ 2469 WDFUSBDEVICE UsbDevice, 2470 _In_ 2471 UCHAR InterfaceIndex 2472 ) 2473 { 2474 return ((PFN_WDFUSBTARGETDEVICEGETINTERFACE) WdfFunctions[WdfUsbTargetDeviceGetInterfaceTableIndex])(WdfDriverGlobals, UsbDevice, InterfaceIndex); 2475 } 2476 2477 // 2478 // WDF Function: WdfUsbInterfaceGetConfiguredSettingIndex 2479 // 2480 typedef 2481 _IRQL_requires_max_(DISPATCH_LEVEL) 2482 WDFAPI 2483 BYTE 2484 (STDCALL *PFN_WDFUSBINTERFACEGETCONFIGUREDSETTINGINDEX)( 2485 _In_ 2486 PWDF_DRIVER_GLOBALS DriverGlobals, 2487 _In_ 2488 WDFUSBINTERFACE Interface 2489 ); 2490 2491 _IRQL_requires_max_(DISPATCH_LEVEL) 2492 FORCEINLINE 2493 BYTE 2494 WdfUsbInterfaceGetConfiguredSettingIndex( 2495 _In_ 2496 WDFUSBINTERFACE Interface 2497 ) 2498 { 2499 return ((PFN_WDFUSBINTERFACEGETCONFIGUREDSETTINGINDEX) WdfFunctions[WdfUsbInterfaceGetConfiguredSettingIndexTableIndex])(WdfDriverGlobals, Interface); 2500 } 2501 2502 // 2503 // WDF Function: WdfUsbInterfaceGetNumConfiguredPipes 2504 // 2505 typedef 2506 _IRQL_requires_max_(DISPATCH_LEVEL) 2507 WDFAPI 2508 BYTE 2509 (STDCALL *PFN_WDFUSBINTERFACEGETNUMCONFIGUREDPIPES)( 2510 _In_ 2511 PWDF_DRIVER_GLOBALS DriverGlobals, 2512 _In_ 2513 WDFUSBINTERFACE UsbInterface 2514 ); 2515 2516 _IRQL_requires_max_(DISPATCH_LEVEL) 2517 FORCEINLINE 2518 BYTE 2519 WdfUsbInterfaceGetNumConfiguredPipes( 2520 _In_ 2521 WDFUSBINTERFACE UsbInterface 2522 ) 2523 { 2524 return ((PFN_WDFUSBINTERFACEGETNUMCONFIGUREDPIPES) WdfFunctions[WdfUsbInterfaceGetNumConfiguredPipesTableIndex])(WdfDriverGlobals, UsbInterface); 2525 } 2526 2527 // 2528 // WDF Function: WdfUsbInterfaceGetConfiguredPipe 2529 // 2530 typedef 2531 _IRQL_requires_max_(DISPATCH_LEVEL) 2532 WDFAPI 2533 WDFUSBPIPE 2534 (STDCALL *PFN_WDFUSBINTERFACEGETCONFIGUREDPIPE)( 2535 _In_ 2536 PWDF_DRIVER_GLOBALS DriverGlobals, 2537 _In_ 2538 WDFUSBINTERFACE UsbInterface, 2539 _In_ 2540 UCHAR PipeIndex, 2541 _Out_opt_ 2542 PWDF_USB_PIPE_INFORMATION PipeInfo 2543 ); 2544 2545 _IRQL_requires_max_(DISPATCH_LEVEL) 2546 FORCEINLINE 2547 WDFUSBPIPE 2548 WdfUsbInterfaceGetConfiguredPipe( 2549 _In_ 2550 WDFUSBINTERFACE UsbInterface, 2551 _In_ 2552 UCHAR PipeIndex, 2553 _Out_opt_ 2554 PWDF_USB_PIPE_INFORMATION PipeInfo 2555 ) 2556 { 2557 return ((PFN_WDFUSBINTERFACEGETCONFIGUREDPIPE) WdfFunctions[WdfUsbInterfaceGetConfiguredPipeTableIndex])(WdfDriverGlobals, UsbInterface, PipeIndex, PipeInfo); 2558 } 2559 2560 // 2561 // WDF Function: WdfUsbTargetPipeWdmGetPipeHandle 2562 // 2563 typedef 2564 _IRQL_requires_max_(DISPATCH_LEVEL) 2565 WDFAPI 2566 USBD_PIPE_HANDLE 2567 (STDCALL *PFN_WDFUSBTARGETPIPEWDMGETPIPEHANDLE)( 2568 _In_ 2569 PWDF_DRIVER_GLOBALS DriverGlobals, 2570 _In_ 2571 WDFUSBPIPE UsbPipe 2572 ); 2573 2574 _IRQL_requires_max_(DISPATCH_LEVEL) 2575 FORCEINLINE 2576 USBD_PIPE_HANDLE 2577 WdfUsbTargetPipeWdmGetPipeHandle( 2578 _In_ 2579 WDFUSBPIPE UsbPipe 2580 ) 2581 { 2582 return ((PFN_WDFUSBTARGETPIPEWDMGETPIPEHANDLE) WdfFunctions[WdfUsbTargetPipeWdmGetPipeHandleTableIndex])(WdfDriverGlobals, UsbPipe); 2583 } 2584 2585 2586 2587 #endif // (NTDDI_VERSION >= NTDDI_WIN2K) 2588 2589 2590 WDF_EXTERN_C_END 2591 2592 #endif // _WDFUSB_H_ 2593 2594