1 /*++ 2 3 Copyright (c) Microsoft Corporation. All rights reserved. 4 5 _WdfVersionBuild_ 6 7 Module Name: 8 9 WdfFdo.h 10 11 Abstract: 12 13 This is the interface to the FDO functionality in the framework. This also 14 covers filters. 15 16 Environment: 17 18 kernel mode only 19 20 Revision History: 21 22 --*/ 23 24 // 25 // NOTE: This header is generated by stubwork. Please make any 26 // modifications to the corresponding template files 27 // (.x or .y) and use stubwork to regenerate the header 28 // 29 30 #ifndef _WDFFDO_H_ 31 #define _WDFFDO_H_ 32 33 #ifndef WDF_EXTERN_C 34 #ifdef __cplusplus 35 #define WDF_EXTERN_C extern "C" 36 #define WDF_EXTERN_C_START extern "C" { 37 #define WDF_EXTERN_C_END } 38 #else 39 #define WDF_EXTERN_C 40 #define WDF_EXTERN_C_START 41 #define WDF_EXTERN_C_END 42 #endif 43 #endif 44 45 WDF_EXTERN_C_START 46 47 48 49 #if (NTDDI_VERSION >= NTDDI_WIN2K) 50 51 52 53 typedef 54 _Function_class_(EVT_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS) 55 _IRQL_requires_same_ 56 _IRQL_requires_max_(PASSIVE_LEVEL) 57 NTSTATUS 58 STDCALL 59 EVT_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS( 60 _In_ 61 WDFDEVICE Device, 62 _In_ 63 WDFIORESREQLIST IoResourceRequirementsList 64 ); 65 66 typedef EVT_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS *PFN_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS; 67 68 typedef 69 _Function_class_(EVT_WDF_DEVICE_REMOVE_ADDED_RESOURCES) 70 _IRQL_requires_same_ 71 _IRQL_requires_max_(PASSIVE_LEVEL) 72 NTSTATUS 73 STDCALL 74 EVT_WDF_DEVICE_REMOVE_ADDED_RESOURCES( 75 _In_ 76 WDFDEVICE Device, 77 _In_ 78 WDFCMRESLIST ResourcesRaw, 79 _In_ 80 WDFCMRESLIST ResourcesTranslated 81 ); 82 83 typedef EVT_WDF_DEVICE_REMOVE_ADDED_RESOURCES *PFN_WDF_DEVICE_REMOVE_ADDED_RESOURCES; 84 85 typedef struct _WDF_FDO_EVENT_CALLBACKS { 86 // 87 // Size of this structure in bytes 88 // 89 ULONG Size; 90 91 PFN_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS EvtDeviceFilterAddResourceRequirements; 92 93 PFN_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS EvtDeviceFilterRemoveResourceRequirements; 94 95 PFN_WDF_DEVICE_REMOVE_ADDED_RESOURCES EvtDeviceRemoveAddedResources; 96 97 } WDF_FDO_EVENT_CALLBACKS, *PWDF_FDO_EVENT_CALLBACKS; 98 99 FORCEINLINE 100 VOID 101 WDF_FDO_EVENT_CALLBACKS_INIT( 102 _Out_ PWDF_FDO_EVENT_CALLBACKS Callbacks 103 ) 104 { 105 RtlZeroMemory(Callbacks, sizeof(WDF_FDO_EVENT_CALLBACKS)); 106 Callbacks->Size = sizeof(WDF_FDO_EVENT_CALLBACKS); 107 } 108 109 110 // 111 // WDF Function: WdfFdoInitWdmGetPhysicalDevice 112 // 113 typedef 114 _IRQL_requires_max_(DISPATCH_LEVEL) 115 WDFAPI 116 PDEVICE_OBJECT 117 (STDCALL *PFN_WDFFDOINITWDMGETPHYSICALDEVICE)( 118 _In_ 119 PWDF_DRIVER_GLOBALS DriverGlobals, 120 _In_ 121 PWDFDEVICE_INIT DeviceInit 122 ); 123 124 _IRQL_requires_max_(DISPATCH_LEVEL) 125 FORCEINLINE 126 PDEVICE_OBJECT 127 WdfFdoInitWdmGetPhysicalDevice( 128 _In_ 129 PWDFDEVICE_INIT DeviceInit 130 ) 131 { 132 return ((PFN_WDFFDOINITWDMGETPHYSICALDEVICE) WdfFunctions[WdfFdoInitWdmGetPhysicalDeviceTableIndex])(WdfDriverGlobals, DeviceInit); 133 } 134 135 // 136 // WDF Function: WdfFdoInitOpenRegistryKey 137 // 138 typedef 139 _Must_inspect_result_ 140 _IRQL_requires_max_(PASSIVE_LEVEL) 141 WDFAPI 142 NTSTATUS 143 (STDCALL *PFN_WDFFDOINITOPENREGISTRYKEY)( 144 _In_ 145 PWDF_DRIVER_GLOBALS DriverGlobals, 146 _In_ 147 PWDFDEVICE_INIT DeviceInit, 148 _In_ 149 ULONG DeviceInstanceKeyType, 150 _In_ 151 ACCESS_MASK DesiredAccess, 152 _In_opt_ 153 PWDF_OBJECT_ATTRIBUTES KeyAttributes, 154 _Out_ 155 WDFKEY* Key 156 ); 157 158 _Must_inspect_result_ 159 _IRQL_requires_max_(PASSIVE_LEVEL) 160 FORCEINLINE 161 NTSTATUS 162 WdfFdoInitOpenRegistryKey( 163 _In_ 164 PWDFDEVICE_INIT DeviceInit, 165 _In_ 166 ULONG DeviceInstanceKeyType, 167 _In_ 168 ACCESS_MASK DesiredAccess, 169 _In_opt_ 170 PWDF_OBJECT_ATTRIBUTES KeyAttributes, 171 _Out_ 172 WDFKEY* Key 173 ) 174 { 175 return ((PFN_WDFFDOINITOPENREGISTRYKEY) WdfFunctions[WdfFdoInitOpenRegistryKeyTableIndex])(WdfDriverGlobals, DeviceInit, DeviceInstanceKeyType, DesiredAccess, KeyAttributes, Key); 176 } 177 178 // 179 // WDF Function: WdfFdoInitQueryProperty 180 // 181 typedef 182 _Must_inspect_result_ 183 _IRQL_requires_max_(PASSIVE_LEVEL) 184 WDFAPI 185 NTSTATUS 186 (STDCALL *PFN_WDFFDOINITQUERYPROPERTY)( 187 _In_ 188 PWDF_DRIVER_GLOBALS DriverGlobals, 189 _In_ 190 PWDFDEVICE_INIT DeviceInit, 191 _In_ 192 DEVICE_REGISTRY_PROPERTY DeviceProperty, 193 _In_ 194 ULONG BufferLength, 195 _Out_writes_bytes_all_opt_(BufferLength) 196 PVOID PropertyBuffer, 197 _Out_ 198 PULONG ResultLength 199 ); 200 201 _Must_inspect_result_ 202 _IRQL_requires_max_(PASSIVE_LEVEL) 203 FORCEINLINE 204 NTSTATUS 205 WdfFdoInitQueryProperty( 206 _In_ 207 PWDFDEVICE_INIT DeviceInit, 208 _In_ 209 DEVICE_REGISTRY_PROPERTY DeviceProperty, 210 _In_ 211 ULONG BufferLength, 212 _Out_writes_bytes_all_opt_(BufferLength) 213 PVOID PropertyBuffer, 214 _Out_ 215 PULONG ResultLength 216 ) 217 { 218 return ((PFN_WDFFDOINITQUERYPROPERTY) WdfFunctions[WdfFdoInitQueryPropertyTableIndex])(WdfDriverGlobals, DeviceInit, DeviceProperty, BufferLength, PropertyBuffer, ResultLength); 219 } 220 221 // 222 // WDF Function: WdfFdoInitAllocAndQueryProperty 223 // 224 typedef 225 _Must_inspect_result_ 226 _IRQL_requires_max_(PASSIVE_LEVEL) 227 WDFAPI 228 NTSTATUS 229 (STDCALL *PFN_WDFFDOINITALLOCANDQUERYPROPERTY)( 230 _In_ 231 PWDF_DRIVER_GLOBALS DriverGlobals, 232 _In_ 233 PWDFDEVICE_INIT DeviceInit, 234 _In_ 235 DEVICE_REGISTRY_PROPERTY DeviceProperty, 236 _In_ 237 _Strict_type_match_ 238 POOL_TYPE PoolType, 239 _In_opt_ 240 PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes, 241 _Out_ 242 WDFMEMORY* PropertyMemory 243 ); 244 245 _Must_inspect_result_ 246 _IRQL_requires_max_(PASSIVE_LEVEL) 247 FORCEINLINE 248 NTSTATUS 249 WdfFdoInitAllocAndQueryProperty( 250 _In_ 251 PWDFDEVICE_INIT DeviceInit, 252 _In_ 253 DEVICE_REGISTRY_PROPERTY DeviceProperty, 254 _In_ 255 _Strict_type_match_ 256 POOL_TYPE PoolType, 257 _In_opt_ 258 PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes, 259 _Out_ 260 WDFMEMORY* PropertyMemory 261 ) 262 { 263 return ((PFN_WDFFDOINITALLOCANDQUERYPROPERTY) WdfFunctions[WdfFdoInitAllocAndQueryPropertyTableIndex])(WdfDriverGlobals, DeviceInit, DeviceProperty, PoolType, PropertyMemoryAttributes, PropertyMemory); 264 } 265 266 // 267 // WDF Function: WdfFdoInitQueryPropertyEx 268 // 269 typedef 270 _Must_inspect_result_ 271 _IRQL_requires_max_(PASSIVE_LEVEL) 272 WDFAPI 273 NTSTATUS 274 (STDCALL *PFN_WDFFDOINITQUERYPROPERTYEX)( 275 _In_ 276 PWDF_DRIVER_GLOBALS DriverGlobals, 277 _In_ 278 PWDFDEVICE_INIT DeviceInit, 279 _In_ 280 PWDF_DEVICE_PROPERTY_DATA DeviceProperty, 281 _In_ 282 ULONG BufferLength, 283 _Out_ 284 PVOID PropertyBuffer, 285 _Out_ 286 PULONG ResultLength, 287 _Out_ 288 PDEVPROPTYPE Type 289 ); 290 291 _Must_inspect_result_ 292 _IRQL_requires_max_(PASSIVE_LEVEL) 293 FORCEINLINE 294 NTSTATUS 295 WdfFdoInitQueryPropertyEx( 296 _In_ 297 PWDFDEVICE_INIT DeviceInit, 298 _In_ 299 PWDF_DEVICE_PROPERTY_DATA DeviceProperty, 300 _In_ 301 ULONG BufferLength, 302 _Out_ 303 PVOID PropertyBuffer, 304 _Out_ 305 PULONG ResultLength, 306 _Out_ 307 PDEVPROPTYPE Type 308 ) 309 { 310 return ((PFN_WDFFDOINITQUERYPROPERTYEX) WdfFunctions[WdfFdoInitQueryPropertyExTableIndex])(WdfDriverGlobals, DeviceInit, DeviceProperty, BufferLength, PropertyBuffer, ResultLength, Type); 311 } 312 313 // 314 // WDF Function: WdfFdoInitAllocAndQueryPropertyEx 315 // 316 typedef 317 _Must_inspect_result_ 318 _IRQL_requires_max_(PASSIVE_LEVEL) 319 WDFAPI 320 NTSTATUS 321 (STDCALL *PFN_WDFFDOINITALLOCANDQUERYPROPERTYEX)( 322 _In_ 323 PWDF_DRIVER_GLOBALS DriverGlobals, 324 _In_ 325 PWDFDEVICE_INIT DeviceInit, 326 _In_ 327 PWDF_DEVICE_PROPERTY_DATA DeviceProperty, 328 _In_ 329 _Strict_type_match_ 330 POOL_TYPE PoolType, 331 _In_opt_ 332 PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes, 333 _Out_ 334 WDFMEMORY* PropertyMemory, 335 _Out_ 336 PDEVPROPTYPE Type 337 ); 338 339 _Must_inspect_result_ 340 _IRQL_requires_max_(PASSIVE_LEVEL) 341 FORCEINLINE 342 NTSTATUS 343 WdfFdoInitAllocAndQueryPropertyEx( 344 _In_ 345 PWDFDEVICE_INIT DeviceInit, 346 _In_ 347 PWDF_DEVICE_PROPERTY_DATA DeviceProperty, 348 _In_ 349 _Strict_type_match_ 350 POOL_TYPE PoolType, 351 _In_opt_ 352 PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes, 353 _Out_ 354 WDFMEMORY* PropertyMemory, 355 _Out_ 356 PDEVPROPTYPE Type 357 ) 358 { 359 return ((PFN_WDFFDOINITALLOCANDQUERYPROPERTYEX) WdfFunctions[WdfFdoInitAllocAndQueryPropertyExTableIndex])(WdfDriverGlobals, DeviceInit, DeviceProperty, PoolType, PropertyMemoryAttributes, PropertyMemory, Type); 360 } 361 362 // 363 // WDF Function: WdfFdoInitSetEventCallbacks 364 // 365 typedef 366 _IRQL_requires_max_(PASSIVE_LEVEL) 367 WDFAPI 368 VOID 369 (STDCALL *PFN_WDFFDOINITSETEVENTCALLBACKS)( 370 _In_ 371 PWDF_DRIVER_GLOBALS DriverGlobals, 372 _In_ 373 PWDFDEVICE_INIT DeviceInit, 374 _In_ 375 PWDF_FDO_EVENT_CALLBACKS FdoEventCallbacks 376 ); 377 378 _IRQL_requires_max_(PASSIVE_LEVEL) 379 FORCEINLINE 380 VOID 381 WdfFdoInitSetEventCallbacks( 382 _In_ 383 PWDFDEVICE_INIT DeviceInit, 384 _In_ 385 PWDF_FDO_EVENT_CALLBACKS FdoEventCallbacks 386 ) 387 { 388 ((PFN_WDFFDOINITSETEVENTCALLBACKS) WdfFunctions[WdfFdoInitSetEventCallbacksTableIndex])(WdfDriverGlobals, DeviceInit, FdoEventCallbacks); 389 } 390 391 // 392 // WDF Function: WdfFdoInitSetFilter 393 // 394 typedef 395 _IRQL_requires_max_(PASSIVE_LEVEL) 396 WDFAPI 397 VOID 398 (STDCALL *PFN_WDFFDOINITSETFILTER)( 399 _In_ 400 PWDF_DRIVER_GLOBALS DriverGlobals, 401 _In_ 402 PWDFDEVICE_INIT DeviceInit 403 ); 404 405 _IRQL_requires_max_(PASSIVE_LEVEL) 406 FORCEINLINE 407 VOID 408 WdfFdoInitSetFilter( 409 _In_ 410 PWDFDEVICE_INIT DeviceInit 411 ) 412 { 413 ((PFN_WDFFDOINITSETFILTER) WdfFunctions[WdfFdoInitSetFilterTableIndex])(WdfDriverGlobals, DeviceInit); 414 } 415 416 // 417 // WDF Function: WdfFdoInitSetDefaultChildListConfig 418 // 419 typedef 420 _IRQL_requires_max_(PASSIVE_LEVEL) 421 WDFAPI 422 VOID 423 (STDCALL *PFN_WDFFDOINITSETDEFAULTCHILDLISTCONFIG)( 424 _In_ 425 PWDF_DRIVER_GLOBALS DriverGlobals, 426 _Inout_ 427 PWDFDEVICE_INIT DeviceInit, 428 _In_ 429 PWDF_CHILD_LIST_CONFIG Config, 430 _In_opt_ 431 PWDF_OBJECT_ATTRIBUTES DefaultChildListAttributes 432 ); 433 434 _IRQL_requires_max_(PASSIVE_LEVEL) 435 FORCEINLINE 436 VOID 437 WdfFdoInitSetDefaultChildListConfig( 438 _Inout_ 439 PWDFDEVICE_INIT DeviceInit, 440 _In_ 441 PWDF_CHILD_LIST_CONFIG Config, 442 _In_opt_ 443 PWDF_OBJECT_ATTRIBUTES DefaultChildListAttributes 444 ) 445 { 446 ((PFN_WDFFDOINITSETDEFAULTCHILDLISTCONFIG) WdfFunctions[WdfFdoInitSetDefaultChildListConfigTableIndex])(WdfDriverGlobals, DeviceInit, Config, DefaultChildListAttributes); 447 } 448 449 // 450 // WDF Function: WdfFdoQueryForInterface 451 // 452 typedef 453 _Must_inspect_result_ 454 _IRQL_requires_max_(PASSIVE_LEVEL) 455 WDFAPI 456 NTSTATUS 457 (STDCALL *PFN_WDFFDOQUERYFORINTERFACE)( 458 _In_ 459 PWDF_DRIVER_GLOBALS DriverGlobals, 460 _In_ 461 WDFDEVICE Fdo, 462 _In_ 463 LPCGUID InterfaceType, 464 _Out_ 465 PINTERFACE Interface, 466 _In_ 467 USHORT Size, 468 _In_ 469 USHORT Version, 470 _In_opt_ 471 PVOID InterfaceSpecificData 472 ); 473 474 _Must_inspect_result_ 475 _IRQL_requires_max_(PASSIVE_LEVEL) 476 FORCEINLINE 477 NTSTATUS 478 WdfFdoQueryForInterface( 479 _In_ 480 WDFDEVICE Fdo, 481 _In_ 482 LPCGUID InterfaceType, 483 _Out_ 484 PINTERFACE Interface, 485 _In_ 486 USHORT Size, 487 _In_ 488 USHORT Version, 489 _In_opt_ 490 PVOID InterfaceSpecificData 491 ) 492 { 493 return ((PFN_WDFFDOQUERYFORINTERFACE) WdfFunctions[WdfFdoQueryForInterfaceTableIndex])(WdfDriverGlobals, Fdo, InterfaceType, Interface, Size, Version, InterfaceSpecificData); 494 } 495 496 // 497 // WDF Function: WdfFdoGetDefaultChildList 498 // 499 typedef 500 _IRQL_requires_max_(DISPATCH_LEVEL) 501 WDFAPI 502 WDFCHILDLIST 503 (STDCALL *PFN_WDFFDOGETDEFAULTCHILDLIST)( 504 _In_ 505 PWDF_DRIVER_GLOBALS DriverGlobals, 506 _In_ 507 WDFDEVICE Fdo 508 ); 509 510 _IRQL_requires_max_(DISPATCH_LEVEL) 511 FORCEINLINE 512 WDFCHILDLIST 513 WdfFdoGetDefaultChildList( 514 _In_ 515 WDFDEVICE Fdo 516 ) 517 { 518 return ((PFN_WDFFDOGETDEFAULTCHILDLIST) WdfFunctions[WdfFdoGetDefaultChildListTableIndex])(WdfDriverGlobals, Fdo); 519 } 520 521 // 522 // WDF Function: WdfFdoAddStaticChild 523 // 524 typedef 525 _Must_inspect_result_ 526 _IRQL_requires_max_(DISPATCH_LEVEL) 527 WDFAPI 528 NTSTATUS 529 (STDCALL *PFN_WDFFDOADDSTATICCHILD)( 530 _In_ 531 PWDF_DRIVER_GLOBALS DriverGlobals, 532 _In_ 533 WDFDEVICE Fdo, 534 _In_ 535 WDFDEVICE Child 536 ); 537 538 _Must_inspect_result_ 539 _IRQL_requires_max_(DISPATCH_LEVEL) 540 FORCEINLINE 541 NTSTATUS 542 WdfFdoAddStaticChild( 543 _In_ 544 WDFDEVICE Fdo, 545 _In_ 546 WDFDEVICE Child 547 ) 548 { 549 return ((PFN_WDFFDOADDSTATICCHILD) WdfFunctions[WdfFdoAddStaticChildTableIndex])(WdfDriverGlobals, Fdo, Child); 550 } 551 552 // 553 // WDF Function: WdfFdoLockStaticChildListForIteration 554 // 555 typedef 556 _IRQL_requires_max_(DISPATCH_LEVEL) 557 WDFAPI 558 VOID 559 (STDCALL *PFN_WDFFDOLOCKSTATICCHILDLISTFORITERATION)( 560 _In_ 561 PWDF_DRIVER_GLOBALS DriverGlobals, 562 _In_ 563 WDFDEVICE Fdo 564 ); 565 566 _IRQL_requires_max_(DISPATCH_LEVEL) 567 FORCEINLINE 568 VOID 569 WdfFdoLockStaticChildListForIteration( 570 _In_ 571 WDFDEVICE Fdo 572 ) 573 { 574 ((PFN_WDFFDOLOCKSTATICCHILDLISTFORITERATION) WdfFunctions[WdfFdoLockStaticChildListForIterationTableIndex])(WdfDriverGlobals, Fdo); 575 } 576 577 // 578 // WDF Function: WdfFdoRetrieveNextStaticChild 579 // 580 typedef 581 _Must_inspect_result_ 582 _IRQL_requires_max_(DISPATCH_LEVEL) 583 WDFAPI 584 WDFDEVICE 585 (STDCALL *PFN_WDFFDORETRIEVENEXTSTATICCHILD)( 586 _In_ 587 PWDF_DRIVER_GLOBALS DriverGlobals, 588 _In_ 589 WDFDEVICE Fdo, 590 _In_opt_ 591 WDFDEVICE PreviousChild, 592 _In_ 593 ULONG Flags 594 ); 595 596 _Must_inspect_result_ 597 _IRQL_requires_max_(DISPATCH_LEVEL) 598 FORCEINLINE 599 WDFDEVICE 600 WdfFdoRetrieveNextStaticChild( 601 _In_ 602 WDFDEVICE Fdo, 603 _In_opt_ 604 WDFDEVICE PreviousChild, 605 _In_ 606 ULONG Flags 607 ) 608 { 609 return ((PFN_WDFFDORETRIEVENEXTSTATICCHILD) WdfFunctions[WdfFdoRetrieveNextStaticChildTableIndex])(WdfDriverGlobals, Fdo, PreviousChild, Flags); 610 } 611 612 // 613 // WDF Function: WdfFdoUnlockStaticChildListFromIteration 614 // 615 typedef 616 _IRQL_requires_max_(DISPATCH_LEVEL) 617 WDFAPI 618 VOID 619 (STDCALL *PFN_WDFFDOUNLOCKSTATICCHILDLISTFROMITERATION)( 620 _In_ 621 PWDF_DRIVER_GLOBALS DriverGlobals, 622 _In_ 623 WDFDEVICE Fdo 624 ); 625 626 _IRQL_requires_max_(DISPATCH_LEVEL) 627 FORCEINLINE 628 VOID 629 WdfFdoUnlockStaticChildListFromIteration( 630 _In_ 631 WDFDEVICE Fdo 632 ) 633 { 634 ((PFN_WDFFDOUNLOCKSTATICCHILDLISTFROMITERATION) WdfFunctions[WdfFdoUnlockStaticChildListFromIterationTableIndex])(WdfDriverGlobals, Fdo); 635 } 636 637 638 639 #endif // (NTDDI_VERSION >= NTDDI_WIN2K) 640 641 642 WDF_EXTERN_C_END 643 644 #endif // _WDFFDO_H_ 645 646