1 /****************************************************************************** 2 * I/O Manager Functions * 3 ******************************************************************************/ 4 5 $if (_WDMDDK_) 6 /* 7 * NTSTATUS 8 * IoAcquireRemoveLock( 9 * IN PIO_REMOVE_LOCK RemoveLock, 10 * IN OPTIONAL PVOID Tag) 11 */ 12 #if DBG 13 #define IoAcquireRemoveLock(RemoveLock, Tag) \ 14 IoAcquireRemoveLockEx(RemoveLock, Tag, __FILE__, __LINE__, sizeof (IO_REMOVE_LOCK)) 15 #else 16 #define IoAcquireRemoveLock(RemoveLock, Tag) \ 17 IoAcquireRemoveLockEx(RemoveLock, Tag, "", 1, sizeof (IO_REMOVE_LOCK)) 18 #endif 19 20 /* 21 * VOID 22 * IoAdjustPagingPathCount( 23 * IN PLONG Count, 24 * IN BOOLEAN Increment) 25 */ 26 #define IoAdjustPagingPathCount(_Count, \ 27 _Increment) \ 28 { \ 29 if (_Increment) \ 30 { \ 31 InterlockedIncrement(_Count); \ 32 } \ 33 else \ 34 { \ 35 InterlockedDecrement(_Count); \ 36 } \ 37 } 38 39 #if !defined(_M_AMD64) 40 NTHALAPI 41 VOID 42 NTAPI 43 READ_PORT_BUFFER_UCHAR( 44 IN PUCHAR Port, 45 IN PUCHAR Buffer, 46 IN ULONG Count); 47 48 NTHALAPI 49 VOID 50 NTAPI 51 READ_PORT_BUFFER_ULONG( 52 IN PULONG Port, 53 IN PULONG Buffer, 54 IN ULONG Count); 55 56 NTHALAPI 57 VOID 58 NTAPI 59 READ_PORT_BUFFER_USHORT( 60 IN PUSHORT Port, 61 IN PUSHORT Buffer, 62 IN ULONG Count); 63 64 NTHALAPI 65 UCHAR 66 NTAPI 67 READ_PORT_UCHAR( 68 IN PUCHAR Port); 69 70 NTHALAPI 71 ULONG 72 NTAPI 73 READ_PORT_ULONG( 74 IN PULONG Port); 75 76 NTHALAPI 77 USHORT 78 NTAPI 79 READ_PORT_USHORT( 80 IN PUSHORT Port); 81 82 NTKERNELAPI 83 VOID 84 NTAPI 85 READ_REGISTER_BUFFER_UCHAR( 86 IN PUCHAR Register, 87 IN PUCHAR Buffer, 88 IN ULONG Count); 89 90 NTKERNELAPI 91 VOID 92 NTAPI 93 READ_REGISTER_BUFFER_ULONG( 94 IN PULONG Register, 95 IN PULONG Buffer, 96 IN ULONG Count); 97 98 NTKERNELAPI 99 VOID 100 NTAPI 101 READ_REGISTER_BUFFER_USHORT( 102 IN PUSHORT Register, 103 IN PUSHORT Buffer, 104 IN ULONG Count); 105 106 NTKERNELAPI 107 UCHAR 108 NTAPI 109 READ_REGISTER_UCHAR( 110 IN PUCHAR Register); 111 112 NTKERNELAPI 113 ULONG 114 NTAPI 115 READ_REGISTER_ULONG( 116 IN PULONG Register); 117 118 NTKERNELAPI 119 USHORT 120 NTAPI 121 READ_REGISTER_USHORT( 122 IN PUSHORT Register); 123 124 NTHALAPI 125 VOID 126 NTAPI 127 WRITE_PORT_BUFFER_UCHAR( 128 IN PUCHAR Port, 129 IN PUCHAR Buffer, 130 IN ULONG Count); 131 132 NTHALAPI 133 VOID 134 NTAPI 135 WRITE_PORT_BUFFER_ULONG( 136 IN PULONG Port, 137 IN PULONG Buffer, 138 IN ULONG Count); 139 140 NTHALAPI 141 VOID 142 NTAPI 143 WRITE_PORT_BUFFER_USHORT( 144 IN PUSHORT Port, 145 IN PUSHORT Buffer, 146 IN ULONG Count); 147 148 NTHALAPI 149 VOID 150 NTAPI 151 WRITE_PORT_UCHAR( 152 IN PUCHAR Port, 153 IN UCHAR Value); 154 155 NTHALAPI 156 VOID 157 NTAPI 158 WRITE_PORT_ULONG( 159 IN PULONG Port, 160 IN ULONG Value); 161 162 NTHALAPI 163 VOID 164 NTAPI 165 WRITE_PORT_USHORT( 166 IN PUSHORT Port, 167 IN USHORT Value); 168 169 NTKERNELAPI 170 VOID 171 NTAPI 172 WRITE_REGISTER_BUFFER_UCHAR( 173 IN PUCHAR Register, 174 IN PUCHAR Buffer, 175 IN ULONG Count); 176 177 NTKERNELAPI 178 VOID 179 NTAPI 180 WRITE_REGISTER_BUFFER_ULONG( 181 IN PULONG Register, 182 IN PULONG Buffer, 183 IN ULONG Count); 184 185 NTKERNELAPI 186 VOID 187 NTAPI 188 WRITE_REGISTER_BUFFER_USHORT( 189 IN PUSHORT Register, 190 IN PUSHORT Buffer, 191 IN ULONG Count); 192 193 NTKERNELAPI 194 VOID 195 NTAPI 196 WRITE_REGISTER_UCHAR( 197 IN PUCHAR Register, 198 IN UCHAR Value); 199 200 NTKERNELAPI 201 VOID 202 NTAPI 203 WRITE_REGISTER_ULONG( 204 IN PULONG Register, 205 IN ULONG Value); 206 207 NTKERNELAPI 208 VOID 209 NTAPI 210 WRITE_REGISTER_USHORT( 211 IN PUSHORT Register, 212 IN USHORT Value); 213 214 #else 215 216 FORCEINLINE 217 VOID 218 READ_PORT_BUFFER_UCHAR( 219 IN PUCHAR Port, 220 IN PUCHAR Buffer, 221 IN ULONG Count) 222 { 223 __inbytestring((USHORT)(ULONG_PTR)Port, Buffer, Count); 224 } 225 226 FORCEINLINE 227 VOID 228 READ_PORT_BUFFER_ULONG( 229 IN PULONG Port, 230 IN PULONG Buffer, 231 IN ULONG Count) 232 { 233 __indwordstring((USHORT)(ULONG_PTR)Port, Buffer, Count); 234 } 235 236 FORCEINLINE 237 VOID 238 READ_PORT_BUFFER_USHORT( 239 IN PUSHORT Port, 240 IN PUSHORT Buffer, 241 IN ULONG Count) 242 { 243 __inwordstring((USHORT)(ULONG_PTR)Port, Buffer, Count); 244 } 245 246 FORCEINLINE 247 UCHAR 248 READ_PORT_UCHAR( 249 IN PUCHAR Port) 250 { 251 return __inbyte((USHORT)(ULONG_PTR)Port); 252 } 253 254 FORCEINLINE 255 ULONG 256 READ_PORT_ULONG( 257 IN PULONG Port) 258 { 259 return __indword((USHORT)(ULONG_PTR)Port); 260 } 261 262 FORCEINLINE 263 USHORT 264 READ_PORT_USHORT( 265 IN PUSHORT Port) 266 { 267 return __inword((USHORT)(ULONG_PTR)Port); 268 } 269 270 FORCEINLINE 271 VOID 272 READ_REGISTER_BUFFER_UCHAR( 273 IN PUCHAR Register, 274 IN PUCHAR Buffer, 275 IN ULONG Count) 276 { 277 __movsb(Register, Buffer, Count); 278 } 279 280 FORCEINLINE 281 VOID 282 READ_REGISTER_BUFFER_ULONG( 283 IN PULONG Register, 284 IN PULONG Buffer, 285 IN ULONG Count) 286 { 287 __movsd(Register, Buffer, Count); 288 } 289 290 FORCEINLINE 291 VOID 292 READ_REGISTER_BUFFER_USHORT( 293 IN PUSHORT Register, 294 IN PUSHORT Buffer, 295 IN ULONG Count) 296 { 297 __movsw(Register, Buffer, Count); 298 } 299 300 FORCEINLINE 301 UCHAR 302 READ_REGISTER_UCHAR( 303 IN volatile UCHAR *Register) 304 { 305 return *Register; 306 } 307 308 FORCEINLINE 309 ULONG 310 READ_REGISTER_ULONG( 311 IN volatile ULONG *Register) 312 { 313 return *Register; 314 } 315 316 FORCEINLINE 317 USHORT 318 READ_REGISTER_USHORT( 319 IN volatile USHORT *Register) 320 { 321 return *Register; 322 } 323 324 FORCEINLINE 325 VOID 326 WRITE_PORT_BUFFER_UCHAR( 327 IN PUCHAR Port, 328 IN PUCHAR Buffer, 329 IN ULONG Count) 330 { 331 __outbytestring((USHORT)(ULONG_PTR)Port, Buffer, Count); 332 } 333 334 FORCEINLINE 335 VOID 336 WRITE_PORT_BUFFER_ULONG( 337 IN PULONG Port, 338 IN PULONG Buffer, 339 IN ULONG Count) 340 { 341 __outdwordstring((USHORT)(ULONG_PTR)Port, Buffer, Count); 342 } 343 344 FORCEINLINE 345 VOID 346 WRITE_PORT_BUFFER_USHORT( 347 IN PUSHORT Port, 348 IN PUSHORT Buffer, 349 IN ULONG Count) 350 { 351 __outwordstring((USHORT)(ULONG_PTR)Port, Buffer, Count); 352 } 353 354 FORCEINLINE 355 VOID 356 WRITE_PORT_UCHAR( 357 IN PUCHAR Port, 358 IN UCHAR Value) 359 { 360 __outbyte((USHORT)(ULONG_PTR)Port, Value); 361 } 362 363 FORCEINLINE 364 VOID 365 WRITE_PORT_ULONG( 366 IN PULONG Port, 367 IN ULONG Value) 368 { 369 __outdword((USHORT)(ULONG_PTR)Port, Value); 370 } 371 372 FORCEINLINE 373 VOID 374 WRITE_PORT_USHORT( 375 IN PUSHORT Port, 376 IN USHORT Value) 377 { 378 __outword((USHORT)(ULONG_PTR)Port, Value); 379 } 380 381 FORCEINLINE 382 VOID 383 WRITE_REGISTER_BUFFER_UCHAR( 384 IN PUCHAR Register, 385 IN PUCHAR Buffer, 386 IN ULONG Count) 387 { 388 LONG Synch; 389 __movsb(Register, Buffer, Count); 390 InterlockedOr(&Synch, 1); 391 } 392 393 FORCEINLINE 394 VOID 395 WRITE_REGISTER_BUFFER_ULONG( 396 IN PULONG Register, 397 IN PULONG Buffer, 398 IN ULONG Count) 399 { 400 LONG Synch; 401 __movsd(Register, Buffer, Count); 402 InterlockedOr(&Synch, 1); 403 } 404 405 FORCEINLINE 406 VOID 407 WRITE_REGISTER_BUFFER_USHORT( 408 IN PUSHORT Register, 409 IN PUSHORT Buffer, 410 IN ULONG Count) 411 { 412 LONG Synch; 413 __movsw(Register, Buffer, Count); 414 InterlockedOr(&Synch, 1); 415 } 416 417 FORCEINLINE 418 VOID 419 WRITE_REGISTER_UCHAR( 420 IN volatile UCHAR *Register, 421 IN UCHAR Value) 422 { 423 LONG Synch; 424 *Register = Value; 425 InterlockedOr(&Synch, 1); 426 } 427 428 FORCEINLINE 429 VOID 430 WRITE_REGISTER_ULONG( 431 IN volatile ULONG *Register, 432 IN ULONG Value) 433 { 434 LONG Synch; 435 *Register = Value; 436 InterlockedOr(&Synch, 1); 437 } 438 439 FORCEINLINE 440 VOID 441 WRITE_REGISTER_USHORT( 442 IN volatile USHORT *Register, 443 IN USHORT Value) 444 { 445 LONG Sync; 446 *Register = Value; 447 InterlockedOr(&Sync, 1); 448 } 449 #endif 450 451 #if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && \ 452 (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_) 453 454 #define DMA_MACROS_DEFINED 455 456 _IRQL_requires_max_(DISPATCH_LEVEL) 457 _IRQL_requires_min_(DISPATCH_LEVEL) 458 FORCEINLINE 459 NTSTATUS 460 IoAllocateAdapterChannel( 461 _In_ PDMA_ADAPTER DmaAdapter, 462 _In_ PDEVICE_OBJECT DeviceObject, 463 _In_ ULONG NumberOfMapRegisters, 464 _In_ PDRIVER_CONTROL ExecutionRoutine, 465 _In_ PVOID Context) 466 { 467 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel; 468 AllocateAdapterChannel = 469 *(DmaAdapter)->DmaOperations->AllocateAdapterChannel; 470 ASSERT(AllocateAdapterChannel); 471 return AllocateAdapterChannel(DmaAdapter, 472 DeviceObject, 473 NumberOfMapRegisters, 474 ExecutionRoutine, 475 Context); 476 } 477 478 FORCEINLINE 479 BOOLEAN 480 NTAPI 481 IoFlushAdapterBuffers( 482 _In_ PDMA_ADAPTER DmaAdapter, 483 _In_ PMDL Mdl, 484 _In_ PVOID MapRegisterBase, 485 _In_ PVOID CurrentVa, 486 _In_ ULONG Length, 487 _In_ BOOLEAN WriteToDevice) 488 { 489 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers; 490 FlushAdapterBuffers = *(DmaAdapter)->DmaOperations->FlushAdapterBuffers; 491 ASSERT(FlushAdapterBuffers); 492 return FlushAdapterBuffers(DmaAdapter, 493 Mdl, 494 MapRegisterBase, 495 CurrentVa, 496 Length, 497 WriteToDevice); 498 } 499 500 FORCEINLINE 501 VOID 502 NTAPI 503 IoFreeAdapterChannel( 504 _In_ PDMA_ADAPTER DmaAdapter) 505 { 506 PFREE_ADAPTER_CHANNEL FreeAdapterChannel; 507 FreeAdapterChannel = *(DmaAdapter)->DmaOperations->FreeAdapterChannel; 508 ASSERT(FreeAdapterChannel); 509 FreeAdapterChannel(DmaAdapter); 510 } 511 512 FORCEINLINE 513 VOID 514 NTAPI 515 IoFreeMapRegisters( 516 _In_ PDMA_ADAPTER DmaAdapter, 517 _In_ PVOID MapRegisterBase, 518 _In_ ULONG NumberOfMapRegisters) 519 { 520 PFREE_MAP_REGISTERS FreeMapRegisters; 521 FreeMapRegisters = *(DmaAdapter)->DmaOperations->FreeMapRegisters; 522 ASSERT(FreeMapRegisters); 523 FreeMapRegisters(DmaAdapter, MapRegisterBase, NumberOfMapRegisters); 524 } 525 526 FORCEINLINE 527 PHYSICAL_ADDRESS 528 NTAPI 529 IoMapTransfer( 530 _In_ PDMA_ADAPTER DmaAdapter, 531 _In_ PMDL Mdl, 532 _In_ PVOID MapRegisterBase, 533 _In_ PVOID CurrentVa, 534 _Inout_ PULONG Length, 535 _In_ BOOLEAN WriteToDevice) 536 { 537 PMAP_TRANSFER MapTransfer; 538 539 MapTransfer = *(DmaAdapter)->DmaOperations->MapTransfer; 540 ASSERT(MapTransfer); 541 return MapTransfer(DmaAdapter, 542 Mdl, 543 MapRegisterBase, 544 CurrentVa, 545 Length, 546 WriteToDevice); 547 } 548 #endif 549 550 $endif (_WDMDDK_) 551 $if (_NTDDK_) 552 /* 553 * VOID IoAssignArcName( 554 * IN PUNICODE_STRING ArcName, 555 * IN PUNICODE_STRING DeviceName); 556 */ 557 #define IoAssignArcName(_ArcName, _DeviceName) ( \ 558 IoCreateSymbolicLink((_ArcName), (_DeviceName))) 559 560 /* 561 * VOID 562 * IoDeassignArcName( 563 * IN PUNICODE_STRING ArcName) 564 */ 565 #define IoDeassignArcName IoDeleteSymbolicLink 566 567 FORCEINLINE 568 VOID 569 NTAPI 570 IoInitializeDriverCreateContext( 571 PIO_DRIVER_CREATE_CONTEXT DriverContext) 572 { 573 RtlZeroMemory(DriverContext, sizeof(IO_DRIVER_CREATE_CONTEXT)); 574 DriverContext->Size = sizeof(IO_DRIVER_CREATE_CONTEXT); 575 } 576 577 $endif (_NTDDK_) 578 $if (_NTIFS_) 579 #define IoIsFileOpenedExclusively(FileObject) ( \ 580 (BOOLEAN) !( \ 581 (FileObject)->SharedRead || \ 582 (FileObject)->SharedWrite || \ 583 (FileObject)->SharedDelete \ 584 ) \ 585 ) 586 587 #if (NTDDI_VERSION == NTDDI_WIN2K) 588 NTKERNELAPI 589 NTSTATUS 590 NTAPI 591 IoRegisterFsRegistrationChangeEx( 592 _In_ PDRIVER_OBJECT DriverObject, 593 _In_ PDRIVER_FS_NOTIFICATION DriverNotificationRoutine); 594 #endif 595 $endif (_NTIFS_) 596 #if (NTDDI_VERSION >= NTDDI_WIN2K) 597 598 $if (_WDMDDK_) 599 _Acquires_lock_(_Global_cancel_spin_lock_) 600 _Requires_lock_not_held_(_Global_cancel_spin_lock_) 601 _IRQL_requires_max_(DISPATCH_LEVEL) 602 _IRQL_raises_(DISPATCH_LEVEL) 603 NTKERNELAPI 604 VOID 605 NTAPI 606 IoAcquireCancelSpinLock( 607 _Out_ _At_(*Irql, _IRQL_saves_) PKIRQL Irql); 608 609 _IRQL_requires_max_(DISPATCH_LEVEL) 610 NTKERNELAPI 611 NTSTATUS 612 NTAPI 613 IoAcquireRemoveLockEx( 614 _Inout_ PIO_REMOVE_LOCK RemoveLock, 615 _In_opt_ PVOID Tag, 616 _In_ PCSTR File, 617 _In_ ULONG Line, 618 _In_ ULONG RemlockSize); 619 620 _IRQL_requires_max_(DISPATCH_LEVEL) 621 _Ret_range_(<=, 0) 622 NTKERNELAPI 623 NTSTATUS 624 NTAPI 625 IoAllocateDriverObjectExtension( 626 _In_ PDRIVER_OBJECT DriverObject, 627 _In_ PVOID ClientIdentificationAddress, 628 _In_ ULONG DriverObjectExtensionSize, 629 _Post_ _At_(*DriverObjectExtension, _When_(return==0, 630 __drv_aliasesMem __drv_allocatesMem(Mem) _Post_notnull_)) 631 _When_(return == 0, _Outptr_result_bytebuffer_(DriverObjectExtensionSize)) 632 PVOID *DriverObjectExtension); 633 634 _IRQL_requires_max_(DISPATCH_LEVEL) 635 NTKERNELAPI 636 PVOID 637 NTAPI 638 IoAllocateErrorLogEntry( 639 _In_ PVOID IoObject, 640 _In_ UCHAR EntrySize); 641 642 _Must_inspect_result_ 643 _IRQL_requires_max_(DISPATCH_LEVEL) 644 NTKERNELAPI 645 PIRP 646 NTAPI 647 IoAllocateIrp( 648 _In_ CCHAR StackSize, 649 _In_ BOOLEAN ChargeQuota); 650 651 _IRQL_requires_max_(DISPATCH_LEVEL) 652 NTKERNELAPI 653 PMDL 654 NTAPI 655 IoAllocateMdl( 656 _In_opt_ __drv_aliasesMem PVOID VirtualAddress, 657 _In_ ULONG Length, 658 _In_ BOOLEAN SecondaryBuffer, 659 _In_ BOOLEAN ChargeQuota, 660 _Inout_opt_ PIRP Irp); 661 662 __drv_allocatesMem(Mem) 663 _IRQL_requires_max_(DISPATCH_LEVEL) 664 NTKERNELAPI 665 PIO_WORKITEM 666 NTAPI 667 IoAllocateWorkItem( 668 _In_ PDEVICE_OBJECT DeviceObject); 669 670 _IRQL_requires_max_(APC_LEVEL) 671 _Ret_range_(<=, 0) 672 NTKERNELAPI 673 NTSTATUS 674 NTAPI 675 IoAttachDevice( 676 _In_ _Kernel_requires_resource_held_(Memory) _When_(return==0, __drv_aliasesMem) 677 PDEVICE_OBJECT SourceDevice, 678 _In_ PUNICODE_STRING TargetDevice, 679 _Out_ PDEVICE_OBJECT *AttachedDevice); 680 681 _Must_inspect_result_ 682 _IRQL_requires_max_(DISPATCH_LEVEL) 683 NTKERNELAPI 684 PDEVICE_OBJECT 685 NTAPI 686 IoAttachDeviceToDeviceStack( 687 _In_ _Kernel_requires_resource_held_(Memory) _When_(return!=0, __drv_aliasesMem) 688 PDEVICE_OBJECT SourceDevice, 689 _In_ PDEVICE_OBJECT TargetDevice); 690 691 _Must_inspect_result_ 692 __drv_aliasesMem 693 _IRQL_requires_max_(DISPATCH_LEVEL) 694 NTKERNELAPI 695 PIRP 696 NTAPI 697 IoBuildAsynchronousFsdRequest( 698 _In_ ULONG MajorFunction, 699 _In_ PDEVICE_OBJECT DeviceObject, 700 _Inout_opt_ PVOID Buffer, 701 _In_opt_ ULONG Length, 702 _In_opt_ PLARGE_INTEGER StartingOffset, 703 _In_opt_ PIO_STATUS_BLOCK IoStatusBlock); 704 705 _Must_inspect_result_ 706 __drv_aliasesMem 707 _IRQL_requires_max_(PASSIVE_LEVEL) 708 NTKERNELAPI 709 PIRP 710 NTAPI 711 IoBuildDeviceIoControlRequest( 712 _In_ ULONG IoControlCode, 713 _In_ PDEVICE_OBJECT DeviceObject, 714 _In_opt_ PVOID InputBuffer, 715 _In_ ULONG InputBufferLength, 716 _Out_opt_ PVOID OutputBuffer, 717 _In_ ULONG OutputBufferLength, 718 _In_ BOOLEAN InternalDeviceIoControl, 719 _In_opt_ PKEVENT Event, 720 _Out_ PIO_STATUS_BLOCK IoStatusBlock); 721 722 _IRQL_requires_max_(DISPATCH_LEVEL) 723 NTKERNELAPI 724 VOID 725 NTAPI 726 IoBuildPartialMdl( 727 _In_ PMDL SourceMdl, 728 _Inout_ PMDL TargetMdl, 729 _In_ PVOID VirtualAddress, 730 _In_ ULONG Length); 731 732 _Must_inspect_result_ 733 __drv_aliasesMem 734 _IRQL_requires_max_(PASSIVE_LEVEL) 735 NTKERNELAPI 736 PIRP 737 NTAPI 738 IoBuildSynchronousFsdRequest( 739 _In_ ULONG MajorFunction, 740 _In_ PDEVICE_OBJECT DeviceObject, 741 _Inout_opt_ PVOID Buffer, 742 _In_opt_ ULONG Length, 743 _In_opt_ PLARGE_INTEGER StartingOffset, 744 _In_ PKEVENT Event, 745 _Out_ PIO_STATUS_BLOCK IoStatusBlock); 746 747 _IRQL_requires_max_(DISPATCH_LEVEL) 748 _Success_(TRUE) 749 NTKERNELAPI 750 NTSTATUS 751 FASTCALL 752 IofCallDriver( 753 _In_ PDEVICE_OBJECT DeviceObject, 754 _Inout_ __drv_aliasesMem PIRP Irp); 755 #define IoCallDriver IofCallDriver 756 757 _IRQL_requires_max_(DISPATCH_LEVEL) 758 NTKERNELAPI 759 VOID 760 FASTCALL 761 IofCompleteRequest( 762 _In_ PIRP Irp, 763 _In_ CCHAR PriorityBoost); 764 #define IoCompleteRequest IofCompleteRequest 765 766 _IRQL_requires_max_(DISPATCH_LEVEL) 767 NTKERNELAPI 768 BOOLEAN 769 NTAPI 770 IoCancelIrp( 771 _In_ PIRP Irp); 772 773 _IRQL_requires_max_(PASSIVE_LEVEL) 774 NTKERNELAPI 775 NTSTATUS 776 NTAPI 777 IoCheckShareAccess( 778 _In_ ACCESS_MASK DesiredAccess, 779 _In_ ULONG DesiredShareAccess, 780 _Inout_ PFILE_OBJECT FileObject, 781 _Inout_ PSHARE_ACCESS ShareAccess, 782 _In_ BOOLEAN Update); 783 784 _IRQL_requires_max_(DISPATCH_LEVEL) 785 NTKERNELAPI 786 VOID 787 FASTCALL 788 IofCompleteRequest( 789 _In_ PIRP Irp, 790 _In_ CCHAR PriorityBoost); 791 792 _IRQL_requires_max_(PASSIVE_LEVEL) 793 NTKERNELAPI 794 NTSTATUS 795 NTAPI 796 IoConnectInterrupt( 797 _Out_ PKINTERRUPT *InterruptObject, 798 _In_ PKSERVICE_ROUTINE ServiceRoutine, 799 _In_opt_ PVOID ServiceContext, 800 _In_opt_ PKSPIN_LOCK SpinLock, 801 _In_ ULONG Vector, 802 _In_ KIRQL Irql, 803 _In_ KIRQL SynchronizeIrql, 804 _In_ KINTERRUPT_MODE InterruptMode, 805 _In_ BOOLEAN ShareVector, 806 _In_ KAFFINITY ProcessorEnableMask, 807 _In_ BOOLEAN FloatingSave); 808 809 _IRQL_requires_max_(APC_LEVEL) 810 _Ret_range_(<=, 0) 811 NTKERNELAPI 812 NTSTATUS 813 NTAPI 814 IoCreateDevice( 815 _In_ PDRIVER_OBJECT DriverObject, 816 _In_ ULONG DeviceExtensionSize, 817 _In_opt_ PUNICODE_STRING DeviceName, 818 _In_ DEVICE_TYPE DeviceType, 819 _In_ ULONG DeviceCharacteristics, 820 _In_ BOOLEAN Exclusive, 821 _Outptr_result_nullonfailure_ 822 _At_(*DeviceObject, 823 __drv_allocatesMem(Mem) 824 _When_(((_In_function_class_(DRIVER_INITIALIZE)) 825 ||(_In_function_class_(DRIVER_DISPATCH))), 826 __drv_aliasesMem)) 827 PDEVICE_OBJECT *DeviceObject); 828 829 _IRQL_requires_max_(PASSIVE_LEVEL) 830 NTKERNELAPI 831 NTSTATUS 832 NTAPI 833 IoCreateFile( 834 _Out_ PHANDLE FileHandle, 835 _In_ ACCESS_MASK DesiredAccess, 836 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 837 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 838 _In_opt_ PLARGE_INTEGER AllocationSize, 839 _In_ ULONG FileAttributes, 840 _In_ ULONG ShareAccess, 841 _In_ ULONG Disposition, 842 _In_ ULONG CreateOptions, 843 _In_opt_ PVOID EaBuffer, 844 _In_ ULONG EaLength, 845 _In_ CREATE_FILE_TYPE CreateFileType, 846 _In_opt_ PVOID InternalParameters, 847 _In_ ULONG Options); 848 849 _IRQL_requires_max_(PASSIVE_LEVEL) 850 NTKERNELAPI 851 PKEVENT 852 NTAPI 853 IoCreateNotificationEvent( 854 _In_ PUNICODE_STRING EventName, 855 _Out_ PHANDLE EventHandle); 856 857 _IRQL_requires_max_(PASSIVE_LEVEL) 858 NTKERNELAPI 859 NTSTATUS 860 NTAPI 861 IoCreateSymbolicLink( 862 _In_ PUNICODE_STRING SymbolicLinkName, 863 _In_ PUNICODE_STRING DeviceName); 864 865 _IRQL_requires_max_(PASSIVE_LEVEL) 866 NTKERNELAPI 867 PKEVENT 868 NTAPI 869 IoCreateSynchronizationEvent( 870 _In_ PUNICODE_STRING EventName, 871 _Out_ PHANDLE EventHandle); 872 873 _IRQL_requires_max_(PASSIVE_LEVEL) 874 NTKERNELAPI 875 NTSTATUS 876 NTAPI 877 IoCreateUnprotectedSymbolicLink( 878 _In_ PUNICODE_STRING SymbolicLinkName, 879 _In_ PUNICODE_STRING DeviceName); 880 881 _IRQL_requires_max_(APC_LEVEL) 882 _Kernel_clear_do_init_(__yes) 883 NTKERNELAPI 884 VOID 885 NTAPI 886 IoDeleteDevice( 887 _In_ _Kernel_requires_resource_held_(Memory) __drv_freesMem(Mem) 888 PDEVICE_OBJECT DeviceObject); 889 890 _IRQL_requires_max_(PASSIVE_LEVEL) 891 NTKERNELAPI 892 NTSTATUS 893 NTAPI 894 IoDeleteSymbolicLink( 895 _In_ PUNICODE_STRING SymbolicLinkName); 896 897 _IRQL_requires_max_(PASSIVE_LEVEL) 898 NTKERNELAPI 899 VOID 900 NTAPI 901 IoDetachDevice( 902 _Inout_ PDEVICE_OBJECT TargetDevice); 903 904 _IRQL_requires_max_(PASSIVE_LEVEL) 905 NTKERNELAPI 906 VOID 907 NTAPI 908 IoDisconnectInterrupt( 909 _In_ PKINTERRUPT InterruptObject); 910 911 __drv_freesMem(Mem) 912 _IRQL_requires_max_(DISPATCH_LEVEL) 913 NTKERNELAPI 914 VOID 915 NTAPI 916 IoFreeIrp( 917 _In_ PIRP Irp); 918 919 _IRQL_requires_max_(DISPATCH_LEVEL) 920 NTKERNELAPI 921 VOID 922 NTAPI 923 IoFreeMdl( 924 PMDL Mdl); 925 926 _IRQL_requires_max_(DISPATCH_LEVEL) 927 NTKERNELAPI 928 VOID 929 NTAPI 930 IoFreeWorkItem( 931 _In_ __drv_freesMem(Mem) PIO_WORKITEM IoWorkItem); 932 933 NTKERNELAPI 934 PDEVICE_OBJECT 935 NTAPI 936 IoGetAttachedDevice( 937 IN PDEVICE_OBJECT DeviceObject); 938 939 _IRQL_requires_max_(DISPATCH_LEVEL) 940 NTKERNELAPI 941 PDEVICE_OBJECT 942 NTAPI 943 IoGetAttachedDeviceReference( 944 _In_ PDEVICE_OBJECT DeviceObject); 945 946 NTKERNELAPI 947 NTSTATUS 948 NTAPI 949 IoGetBootDiskInformation( 950 _Inout_ PBOOTDISK_INFORMATION BootDiskInformation, 951 _In_ ULONG Size); 952 953 _IRQL_requires_max_(PASSIVE_LEVEL) 954 _Must_inspect_result_ 955 NTKERNELAPI 956 NTSTATUS 957 NTAPI 958 IoGetDeviceInterfaceAlias( 959 _In_ PUNICODE_STRING SymbolicLinkName, 960 _In_ CONST GUID *AliasInterfaceClassGuid, 961 _Out_ 962 _When_(return==0, _At_(AliasSymbolicLinkName->Buffer, __drv_allocatesMem(Mem))) 963 PUNICODE_STRING AliasSymbolicLinkName); 964 965 NTKERNELAPI 966 PEPROCESS 967 NTAPI 968 IoGetCurrentProcess(VOID); 969 970 _IRQL_requires_max_(PASSIVE_LEVEL) 971 _Must_inspect_result_ 972 NTKERNELAPI 973 NTSTATUS 974 NTAPI 975 IoGetDeviceInterfaces( 976 _In_ CONST GUID *InterfaceClassGuid, 977 _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject, 978 _In_ ULONG Flags, 979 _Outptr_result_nullonfailure_ 980 _At_(*SymbolicLinkList, _When_(return==0, __drv_allocatesMem(Mem))) 981 PZZWSTR *SymbolicLinkList); 982 983 _IRQL_requires_max_(PASSIVE_LEVEL) 984 NTKERNELAPI 985 NTSTATUS 986 NTAPI 987 IoGetDeviceObjectPointer( 988 _In_ PUNICODE_STRING ObjectName, 989 _In_ ACCESS_MASK DesiredAccess, 990 _Out_ PFILE_OBJECT *FileObject, 991 _Out_ PDEVICE_OBJECT *DeviceObject); 992 993 _IRQL_requires_max_(PASSIVE_LEVEL) 994 _When_((DeviceProperty & __string_type), 995 _At_(PropertyBuffer, _Post_z_)) 996 _When_((DeviceProperty & __multiString_type), 997 _At_(PropertyBuffer, _Post_ _NullNull_terminated_)) 998 NTKERNELAPI 999 NTSTATUS 1000 NTAPI 1001 IoGetDeviceProperty( 1002 _In_ PDEVICE_OBJECT DeviceObject, 1003 _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, 1004 _In_ ULONG BufferLength, 1005 _Out_writes_bytes_opt_(BufferLength) PVOID PropertyBuffer, 1006 _Deref_out_range_(<=, BufferLength) PULONG ResultLength); 1007 1008 _Must_inspect_result_ 1009 _IRQL_requires_max_(PASSIVE_LEVEL) 1010 NTKERNELAPI 1011 PDMA_ADAPTER 1012 NTAPI 1013 IoGetDmaAdapter( 1014 _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject, 1015 _In_ PDEVICE_DESCRIPTION DeviceDescription, 1016 _Out_ _When_(return!=0, _Kernel_IoGetDmaAdapter_ _At_(*NumberOfMapRegisters, _Must_inspect_result_)) 1017 PULONG NumberOfMapRegisters); 1018 1019 __drv_aliasesMem 1020 _IRQL_requires_max_(DISPATCH_LEVEL) 1021 NTKERNELAPI 1022 PVOID 1023 NTAPI 1024 IoGetDriverObjectExtension( 1025 _In_ PDRIVER_OBJECT DriverObject, 1026 _In_ PVOID ClientIdentificationAddress); 1027 1028 _IRQL_requires_max_(APC_LEVEL) 1029 NTKERNELAPI 1030 PVOID 1031 NTAPI 1032 IoGetInitialStack(VOID); 1033 1034 NTKERNELAPI 1035 PDEVICE_OBJECT 1036 NTAPI 1037 IoGetRelatedDeviceObject( 1038 _In_ PFILE_OBJECT FileObject); 1039 1040 _IRQL_requires_max_(DISPATCH_LEVEL) 1041 NTKERNELAPI 1042 VOID 1043 NTAPI 1044 IoQueueWorkItem( 1045 _Inout_ PIO_WORKITEM IoWorkItem, 1046 _In_ PIO_WORKITEM_ROUTINE WorkerRoutine, 1047 _In_ WORK_QUEUE_TYPE QueueType, 1048 _In_opt_ __drv_aliasesMem PVOID Context); 1049 1050 _IRQL_requires_max_(DISPATCH_LEVEL) 1051 NTKERNELAPI 1052 VOID 1053 NTAPI 1054 IoInitializeIrp( 1055 _Inout_ PIRP Irp, 1056 _In_ USHORT PacketSize, 1057 _In_ CCHAR StackSize); 1058 1059 _IRQL_requires_max_(PASSIVE_LEVEL) 1060 NTKERNELAPI 1061 VOID 1062 NTAPI 1063 IoInitializeRemoveLockEx( 1064 _Out_ PIO_REMOVE_LOCK Lock, 1065 _In_ ULONG AllocateTag, 1066 _In_ ULONG MaxLockedMinutes, 1067 _In_ ULONG HighWatermark, 1068 _In_ ULONG RemlockSize); 1069 1070 _IRQL_requires_max_(PASSIVE_LEVEL) 1071 NTKERNELAPI 1072 NTSTATUS 1073 NTAPI 1074 IoInitializeTimer( 1075 _In_ PDEVICE_OBJECT DeviceObject, 1076 _In_ PIO_TIMER_ROUTINE TimerRoutine, 1077 _In_opt_ __drv_aliasesMem PVOID Context); 1078 1079 _IRQL_requires_max_(DISPATCH_LEVEL) 1080 NTKERNELAPI 1081 VOID 1082 NTAPI 1083 IoInvalidateDeviceRelations( 1084 _In_ PDEVICE_OBJECT DeviceObject, 1085 _In_ DEVICE_RELATION_TYPE Type); 1086 1087 _IRQL_requires_max_(DISPATCH_LEVEL) 1088 NTKERNELAPI 1089 VOID 1090 NTAPI 1091 IoInvalidateDeviceState( 1092 _In_ PDEVICE_OBJECT PhysicalDeviceObject); 1093 1094 _IRQL_requires_max_(PASSIVE_LEVEL) 1095 NTKERNELAPI 1096 BOOLEAN 1097 NTAPI 1098 IoIsWdmVersionAvailable( 1099 _When_(MajorVersion!=1&&MajorVersion!=6, _In_ __drv_reportError("MajorVersion must be 1 or 6")) 1100 UCHAR MajorVersion, 1101 _In_ _When_(MinorVersion!=0 && MinorVersion!=5 && 1102 MinorVersion!=16 && MinorVersion!=32 && 1103 MinorVersion!=48, __drv_reportError("MinorVersion must be 0, 0x5, 0x10, 0x20, or 0x30")) 1104 UCHAR MinorVersion); 1105 1106 _IRQL_requires_max_(PASSIVE_LEVEL) 1107 _Must_inspect_result_ 1108 NTKERNELAPI 1109 NTSTATUS 1110 NTAPI 1111 IoOpenDeviceInterfaceRegistryKey( 1112 _In_ PUNICODE_STRING SymbolicLinkName, 1113 _In_ ACCESS_MASK DesiredAccess, 1114 _Out_ PHANDLE DeviceInterfaceKey); 1115 1116 _IRQL_requires_max_(PASSIVE_LEVEL) 1117 _Must_inspect_result_ 1118 NTKERNELAPI 1119 NTSTATUS 1120 NTAPI 1121 IoOpenDeviceRegistryKey( 1122 _In_ PDEVICE_OBJECT DeviceObject, 1123 _In_ ULONG DevInstKeyType, 1124 _In_ ACCESS_MASK DesiredAccess, 1125 _Out_ PHANDLE DevInstRegKey); 1126 1127 _IRQL_requires_max_(PASSIVE_LEVEL) 1128 _Must_inspect_result_ 1129 NTKERNELAPI 1130 NTSTATUS 1131 NTAPI 1132 IoRegisterDeviceInterface( 1133 _In_ PDEVICE_OBJECT PhysicalDeviceObject, 1134 _In_ CONST GUID *InterfaceClassGuid, 1135 _In_opt_ PUNICODE_STRING ReferenceString, 1136 _Out_ _When_(return==0, _At_(SymbolicLinkName->Buffer, __drv_allocatesMem(Mem))) 1137 PUNICODE_STRING SymbolicLinkName); 1138 1139 _IRQL_requires_max_(PASSIVE_LEVEL) 1140 _Must_inspect_result_ 1141 NTKERNELAPI 1142 NTSTATUS 1143 NTAPI 1144 IoRegisterPlugPlayNotification( 1145 _In_ IO_NOTIFICATION_EVENT_CATEGORY EventCategory, 1146 _In_ ULONG EventCategoryFlags, 1147 _In_opt_ PVOID EventCategoryData, 1148 _In_ PDRIVER_OBJECT DriverObject, 1149 _In_ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, 1150 _Inout_opt_ __drv_aliasesMem PVOID Context, 1151 _Outptr_result_nullonfailure_ 1152 _At_(*NotificationEntry, _When_(return==0, __drv_allocatesMem(Mem))) 1153 PVOID *NotificationEntry); 1154 1155 _IRQL_requires_max_(PASSIVE_LEVEL) 1156 NTKERNELAPI 1157 NTSTATUS 1158 NTAPI 1159 IoRegisterShutdownNotification( 1160 _In_ PDEVICE_OBJECT DeviceObject); 1161 1162 _Requires_lock_held_(_Global_cancel_spin_lock_) 1163 _Releases_lock_(_Global_cancel_spin_lock_) 1164 _IRQL_requires_max_(DISPATCH_LEVEL) 1165 _IRQL_requires_min_(DISPATCH_LEVEL) 1166 NTKERNELAPI 1167 VOID 1168 NTAPI 1169 IoReleaseCancelSpinLock( 1170 _In_ _IRQL_restores_ _IRQL_uses_cancel_ KIRQL Irql); 1171 1172 _IRQL_requires_max_(PASSIVE_LEVEL) 1173 NTKERNELAPI 1174 VOID 1175 NTAPI 1176 IoReleaseRemoveLockAndWaitEx( 1177 _Inout_ PIO_REMOVE_LOCK RemoveLock, 1178 _In_opt_ PVOID Tag, 1179 _In_ ULONG RemlockSize); 1180 1181 NTKERNELAPI 1182 VOID 1183 NTAPI 1184 IoReleaseRemoveLockEx( 1185 _Inout_ PIO_REMOVE_LOCK RemoveLock, 1186 _In_opt_ PVOID Tag, 1187 _In_ ULONG RemlockSize); 1188 1189 _IRQL_requires_max_(PASSIVE_LEVEL) 1190 NTKERNELAPI 1191 VOID 1192 NTAPI 1193 IoRemoveShareAccess( 1194 _In_ PFILE_OBJECT FileObject, 1195 _Inout_ PSHARE_ACCESS ShareAccess); 1196 1197 _IRQL_requires_max_(PASSIVE_LEVEL) 1198 NTKERNELAPI 1199 NTSTATUS 1200 NTAPI 1201 IoReportTargetDeviceChange( 1202 _In_ PDEVICE_OBJECT PhysicalDeviceObject, 1203 _In_ PVOID NotificationStructure); 1204 1205 _IRQL_requires_max_(DISPATCH_LEVEL) 1206 NTKERNELAPI 1207 NTSTATUS 1208 NTAPI 1209 IoReportTargetDeviceChangeAsynchronous( 1210 _In_ PDEVICE_OBJECT PhysicalDeviceObject, 1211 _In_ PVOID NotificationStructure, 1212 _In_opt_ PDEVICE_CHANGE_COMPLETE_CALLBACK Callback, 1213 _In_opt_ PVOID Context); 1214 1215 _IRQL_requires_max_(DISPATCH_LEVEL) 1216 NTKERNELAPI 1217 VOID 1218 NTAPI 1219 IoRequestDeviceEject( 1220 _In_ PDEVICE_OBJECT PhysicalDeviceObject); 1221 1222 _IRQL_requires_max_(DISPATCH_LEVEL) 1223 NTKERNELAPI 1224 VOID 1225 NTAPI 1226 IoReuseIrp( 1227 _Inout_ PIRP Irp, 1228 _In_ NTSTATUS Status); 1229 1230 _IRQL_requires_max_(PASSIVE_LEVEL) 1231 _Must_inspect_result_ 1232 NTKERNELAPI 1233 NTSTATUS 1234 NTAPI 1235 IoSetDeviceInterfaceState( 1236 _In_ PUNICODE_STRING SymbolicLinkName, 1237 _In_ BOOLEAN Enable); 1238 1239 NTKERNELAPI 1240 VOID 1241 NTAPI 1242 IoSetShareAccess( 1243 _In_ ACCESS_MASK DesiredAccess, 1244 _In_ ULONG DesiredShareAccess, 1245 _Inout_ PFILE_OBJECT FileObject, 1246 _Out_ PSHARE_ACCESS ShareAccess); 1247 1248 _IRQL_requires_max_(DISPATCH_LEVEL) 1249 _IRQL_requires_min_(DISPATCH_LEVEL) 1250 NTKERNELAPI 1251 VOID 1252 NTAPI 1253 IoStartNextPacket( 1254 _In_ PDEVICE_OBJECT DeviceObject, 1255 _In_ BOOLEAN Cancelable); 1256 1257 _IRQL_requires_max_(DISPATCH_LEVEL) 1258 NTKERNELAPI 1259 VOID 1260 NTAPI 1261 IoStartNextPacketByKey( 1262 _In_ PDEVICE_OBJECT DeviceObject, 1263 _In_ BOOLEAN Cancelable, 1264 _In_ ULONG Key); 1265 1266 _IRQL_requires_max_(DISPATCH_LEVEL) 1267 NTKERNELAPI 1268 VOID 1269 NTAPI 1270 IoStartPacket( 1271 _In_ PDEVICE_OBJECT DeviceObject, 1272 _In_ PIRP Irp, 1273 _In_opt_ PULONG Key, 1274 _In_opt_ PDRIVER_CANCEL CancelFunction); 1275 1276 _IRQL_requires_max_(DISPATCH_LEVEL) 1277 NTKERNELAPI 1278 VOID 1279 NTAPI 1280 IoStartTimer( 1281 _In_ PDEVICE_OBJECT DeviceObject); 1282 1283 _IRQL_requires_max_(DISPATCH_LEVEL) 1284 NTKERNELAPI 1285 VOID 1286 NTAPI 1287 IoStopTimer( 1288 _In_ PDEVICE_OBJECT DeviceObject); 1289 1290 _IRQL_requires_max_(PASSIVE_LEVEL) 1291 __drv_freesMem(Pool) 1292 NTKERNELAPI 1293 NTSTATUS 1294 NTAPI 1295 IoUnregisterPlugPlayNotification( 1296 _In_ PVOID NotificationEntry); 1297 1298 _IRQL_requires_max_(PASSIVE_LEVEL) 1299 NTKERNELAPI 1300 VOID 1301 NTAPI 1302 IoUnregisterShutdownNotification( 1303 _In_ PDEVICE_OBJECT DeviceObject); 1304 1305 _IRQL_requires_max_(PASSIVE_LEVEL) 1306 NTKERNELAPI 1307 VOID 1308 NTAPI 1309 IoUpdateShareAccess( 1310 _In_ PFILE_OBJECT FileObject, 1311 _Inout_ PSHARE_ACCESS ShareAccess); 1312 1313 _IRQL_requires_max_(PASSIVE_LEVEL) 1314 NTKERNELAPI 1315 NTSTATUS 1316 NTAPI 1317 IoWMIAllocateInstanceIds( 1318 _In_ GUID *Guid, 1319 _In_ ULONG InstanceCount, 1320 _Out_ ULONG *FirstInstanceId); 1321 1322 NTKERNELAPI 1323 NTSTATUS 1324 NTAPI 1325 IoWMIQuerySingleInstanceMultiple( 1326 _In_reads_(ObjectCount) PVOID *DataBlockObjectList, 1327 _In_reads_(ObjectCount) PUNICODE_STRING InstanceNames, 1328 _In_ ULONG ObjectCount, 1329 _Inout_ ULONG *InOutBufferSize, 1330 _Out_writes_bytes_opt_(*InOutBufferSize) PVOID OutBuffer); 1331 1332 _IRQL_requires_max_(PASSIVE_LEVEL) 1333 NTKERNELAPI 1334 NTSTATUS 1335 NTAPI 1336 IoWMIRegistrationControl( 1337 _In_ PDEVICE_OBJECT DeviceObject, 1338 _In_ ULONG Action); 1339 1340 NTKERNELAPI 1341 NTSTATUS 1342 NTAPI 1343 IoWMISuggestInstanceName( 1344 _In_opt_ PDEVICE_OBJECT PhysicalDeviceObject, 1345 _In_opt_ PUNICODE_STRING SymbolicLinkName, 1346 _In_ BOOLEAN CombineNames, 1347 _Out_ PUNICODE_STRING SuggestedInstanceName); 1348 1349 _Must_inspect_result_ 1350 _IRQL_requires_max_(DISPATCH_LEVEL) 1351 _Ret_range_(<=, 0) 1352 NTKERNELAPI 1353 NTSTATUS 1354 NTAPI 1355 IoWMIWriteEvent( 1356 _Inout_ _When_(return==0, __drv_aliasesMem) PVOID WnodeEventItem); 1357 1358 _IRQL_requires_max_(DISPATCH_LEVEL) 1359 NTKERNELAPI 1360 VOID 1361 NTAPI 1362 IoWriteErrorLogEntry( 1363 _In_ PVOID ElEntry); 1364 1365 NTKERNELAPI 1366 PIRP 1367 NTAPI 1368 IoGetTopLevelIrp(VOID); 1369 1370 _IRQL_requires_max_(PASSIVE_LEVEL) 1371 NTKERNELAPI 1372 NTSTATUS 1373 NTAPI 1374 IoRegisterLastChanceShutdownNotification( 1375 _In_ PDEVICE_OBJECT DeviceObject); 1376 1377 NTKERNELAPI 1378 VOID 1379 NTAPI 1380 IoSetTopLevelIrp( 1381 _In_opt_ PIRP Irp); 1382 1383 $endif (_WDMDDK_) 1384 $if (_NTDDK_) 1385 #if !(defined(USE_DMA_MACROS) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)) 1386 _IRQL_requires_max_(DISPATCH_LEVEL) 1387 _IRQL_requires_min_(DISPATCH_LEVEL) 1388 NTKERNELAPI 1389 NTSTATUS 1390 NTAPI 1391 IoAllocateAdapterChannel( 1392 _In_ PADAPTER_OBJECT AdapterObject, 1393 _In_ PDEVICE_OBJECT DeviceObject, 1394 _In_ ULONG NumberOfMapRegisters, 1395 _In_ PDRIVER_CONTROL ExecutionRoutine, 1396 _In_ PVOID Context); 1397 #endif 1398 1399 #if !defined(DMA_MACROS_DEFINED) 1400 //DECLSPEC_DEPRECATED_DDK 1401 NTHALAPI 1402 PHYSICAL_ADDRESS 1403 NTAPI 1404 IoMapTransfer( 1405 _In_ PADAPTER_OBJECT AdapterObject, 1406 _In_ PMDL Mdl, 1407 _In_ PVOID MapRegisterBase, 1408 _In_ PVOID CurrentVa, 1409 _Inout_ PULONG Length, 1410 _In_ BOOLEAN WriteToDevice); 1411 #endif 1412 1413 _IRQL_requires_max_(DISPATCH_LEVEL) 1414 _IRQL_requires_min_(DISPATCH_LEVEL) 1415 NTKERNELAPI 1416 VOID 1417 NTAPI 1418 IoAllocateController( 1419 _In_ PCONTROLLER_OBJECT ControllerObject, 1420 _In_ PDEVICE_OBJECT DeviceObject, 1421 _In_ PDRIVER_CONTROL ExecutionRoutine, 1422 _In_opt_ PVOID Context); 1423 1424 _IRQL_requires_max_(PASSIVE_LEVEL) 1425 NTKERNELAPI 1426 PCONTROLLER_OBJECT 1427 NTAPI 1428 IoCreateController( 1429 _In_ ULONG Size); 1430 1431 _IRQL_requires_max_(PASSIVE_LEVEL) 1432 NTKERNELAPI 1433 VOID 1434 NTAPI 1435 IoDeleteController( 1436 _In_ PCONTROLLER_OBJECT ControllerObject); 1437 1438 _IRQL_requires_max_(DISPATCH_LEVEL) 1439 _IRQL_requires_min_(DISPATCH_LEVEL) 1440 NTKERNELAPI 1441 VOID 1442 NTAPI 1443 IoFreeController( 1444 _In_ PCONTROLLER_OBJECT ControllerObject); 1445 1446 _IRQL_requires_max_(PASSIVE_LEVEL) 1447 NTKERNELAPI 1448 PCONFIGURATION_INFORMATION 1449 NTAPI 1450 IoGetConfigurationInformation(VOID); 1451 1452 _IRQL_requires_max_(PASSIVE_LEVEL) 1453 NTKERNELAPI 1454 PDEVICE_OBJECT 1455 NTAPI 1456 IoGetDeviceToVerify( 1457 _In_ PETHREAD Thread); 1458 1459 NTKERNELAPI 1460 VOID 1461 NTAPI 1462 IoCancelFileOpen( 1463 _In_ PDEVICE_OBJECT DeviceObject, 1464 _In_ PFILE_OBJECT FileObject); 1465 1466 _IRQL_requires_max_(PASSIVE_LEVEL) 1467 NTKERNELAPI 1468 PGENERIC_MAPPING 1469 NTAPI 1470 IoGetFileObjectGenericMapping(VOID); 1471 1472 _IRQL_requires_max_(DISPATCH_LEVEL) 1473 NTKERNELAPI 1474 PIRP 1475 NTAPI 1476 IoMakeAssociatedIrp( 1477 _In_ PIRP Irp, 1478 _In_ CCHAR StackSize); 1479 1480 NTKERNELAPI 1481 NTSTATUS 1482 NTAPI 1483 IoQueryDeviceDescription( 1484 _In_opt_ PINTERFACE_TYPE BusType, 1485 _In_opt_ PULONG BusNumber, 1486 _In_opt_ PCONFIGURATION_TYPE ControllerType, 1487 _In_opt_ PULONG ControllerNumber, 1488 _In_opt_ PCONFIGURATION_TYPE PeripheralType, 1489 _In_opt_ PULONG PeripheralNumber, 1490 _In_ PIO_QUERY_DEVICE_ROUTINE CalloutRoutine, 1491 _Inout_opt_ PVOID Context); 1492 1493 _IRQL_requires_max_(APC_LEVEL) 1494 NTKERNELAPI 1495 VOID 1496 NTAPI 1497 IoRaiseHardError( 1498 _In_ PIRP Irp, 1499 _In_opt_ PVPB Vpb, 1500 _In_ PDEVICE_OBJECT RealDeviceObject); 1501 1502 _IRQL_requires_max_(APC_LEVEL) 1503 NTKERNELAPI 1504 BOOLEAN 1505 NTAPI 1506 IoRaiseInformationalHardError( 1507 _In_ NTSTATUS ErrorStatus, 1508 _In_opt_ PUNICODE_STRING String, 1509 _In_opt_ PKTHREAD Thread); 1510 1511 _IRQL_requires_max_(PASSIVE_LEVEL) 1512 NTKERNELAPI 1513 VOID 1514 NTAPI 1515 IoRegisterBootDriverReinitialization( 1516 _In_ PDRIVER_OBJECT DriverObject, 1517 _In_ PDRIVER_REINITIALIZE DriverReinitializationRoutine, 1518 _In_opt_ PVOID Context); 1519 1520 _IRQL_requires_max_(PASSIVE_LEVEL) 1521 NTKERNELAPI 1522 VOID 1523 NTAPI 1524 IoRegisterDriverReinitialization( 1525 _In_ PDRIVER_OBJECT DriverObject, 1526 _In_ PDRIVER_REINITIALIZE DriverReinitializationRoutine, 1527 _In_opt_ PVOID Context); 1528 1529 NTKERNELAPI 1530 NTSTATUS 1531 NTAPI 1532 IoAttachDeviceByPointer( 1533 _In_ PDEVICE_OBJECT SourceDevice, 1534 _In_ PDEVICE_OBJECT TargetDevice); 1535 1536 _IRQL_requires_max_(PASSIVE_LEVEL) 1537 _Must_inspect_result_ 1538 NTKERNELAPI 1539 NTSTATUS 1540 NTAPI 1541 IoReportDetectedDevice( 1542 _In_ PDRIVER_OBJECT DriverObject, 1543 _In_ INTERFACE_TYPE LegacyBusType, 1544 _In_ ULONG BusNumber, 1545 _In_ ULONG SlotNumber, 1546 _In_opt_ PCM_RESOURCE_LIST ResourceList, 1547 _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements, 1548 _In_ BOOLEAN ResourceAssigned, 1549 _Inout_ PDEVICE_OBJECT *DeviceObject); 1550 1551 NTKERNELAPI 1552 NTSTATUS 1553 NTAPI 1554 IoReportResourceForDetection( 1555 _In_ PDRIVER_OBJECT DriverObject, 1556 _In_reads_bytes_opt_(DriverListSize) PCM_RESOURCE_LIST DriverList, 1557 _In_opt_ ULONG DriverListSize, 1558 _In_opt_ PDEVICE_OBJECT DeviceObject, 1559 _In_reads_bytes_opt_(DeviceListSize) PCM_RESOURCE_LIST DeviceList, 1560 _In_opt_ ULONG DeviceListSize, 1561 _Out_ PBOOLEAN ConflictDetected); 1562 1563 NTKERNELAPI 1564 NTSTATUS 1565 NTAPI 1566 IoReportResourceUsage( 1567 _In_opt_ PUNICODE_STRING DriverClassName, 1568 _In_ PDRIVER_OBJECT DriverObject, 1569 _In_reads_bytes_opt_(DriverListSize) PCM_RESOURCE_LIST DriverList, 1570 _In_opt_ ULONG DriverListSize, 1571 _In_opt_ PDEVICE_OBJECT DeviceObject, 1572 _In_reads_bytes_opt_(DeviceListSize) PCM_RESOURCE_LIST DeviceList, 1573 _In_opt_ ULONG DeviceListSize, 1574 _In_ BOOLEAN OverrideConflict, 1575 _Out_ PBOOLEAN ConflictDetected); 1576 1577 _IRQL_requires_max_(DISPATCH_LEVEL) 1578 NTKERNELAPI 1579 VOID 1580 NTAPI 1581 IoSetHardErrorOrVerifyDevice( 1582 _In_ PIRP Irp, 1583 _In_ PDEVICE_OBJECT DeviceObject); 1584 1585 NTKERNELAPI 1586 NTSTATUS 1587 NTAPI 1588 IoAssignResources( 1589 _In_ PUNICODE_STRING RegistryPath, 1590 _In_opt_ PUNICODE_STRING DriverClassName, 1591 _In_ PDRIVER_OBJECT DriverObject, 1592 _In_opt_ PDEVICE_OBJECT DeviceObject, 1593 _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources, 1594 _Inout_ PCM_RESOURCE_LIST *AllocatedResources); 1595 1596 _IRQL_requires_max_(DISPATCH_LEVEL) 1597 NTKERNELAPI 1598 BOOLEAN 1599 NTAPI 1600 IoSetThreadHardErrorMode( 1601 _In_ BOOLEAN EnableHardErrors); 1602 1603 $endif (_NTDDK_) 1604 $if (_NTIFS_) 1605 1606 NTKERNELAPI 1607 VOID 1608 NTAPI 1609 IoAcquireVpbSpinLock( 1610 _Out_ PKIRQL Irql); 1611 1612 NTKERNELAPI 1613 NTSTATUS 1614 NTAPI 1615 IoCheckDesiredAccess( 1616 _Inout_ PACCESS_MASK DesiredAccess, 1617 _In_ ACCESS_MASK GrantedAccess); 1618 1619 NTKERNELAPI 1620 NTSTATUS 1621 NTAPI 1622 IoCheckEaBufferValidity( 1623 _In_ PFILE_FULL_EA_INFORMATION EaBuffer, 1624 _In_ ULONG EaLength, 1625 _Out_ PULONG ErrorOffset); 1626 1627 NTKERNELAPI 1628 NTSTATUS 1629 NTAPI 1630 IoCheckFunctionAccess( 1631 _In_ ACCESS_MASK GrantedAccess, 1632 _In_ UCHAR MajorFunction, 1633 _In_ UCHAR MinorFunction, 1634 _In_ ULONG IoControlCode, 1635 _In_opt_ PVOID Argument1, 1636 _In_opt_ PVOID Argument2); 1637 1638 NTKERNELAPI 1639 NTSTATUS 1640 NTAPI 1641 IoCheckQuerySetFileInformation( 1642 _In_ FILE_INFORMATION_CLASS FileInformationClass, 1643 _In_ ULONG Length, 1644 _In_ BOOLEAN SetOperation); 1645 1646 NTKERNELAPI 1647 NTSTATUS 1648 NTAPI 1649 IoCheckQuerySetVolumeInformation( 1650 _In_ FS_INFORMATION_CLASS FsInformationClass, 1651 _In_ ULONG Length, 1652 _In_ BOOLEAN SetOperation); 1653 1654 NTKERNELAPI 1655 NTSTATUS 1656 NTAPI 1657 IoCheckQuotaBufferValidity( 1658 _In_ PFILE_QUOTA_INFORMATION QuotaBuffer, 1659 _In_ ULONG QuotaLength, 1660 _Out_ PULONG ErrorOffset); 1661 1662 NTKERNELAPI 1663 PFILE_OBJECT 1664 NTAPI 1665 IoCreateStreamFileObject( 1666 _In_opt_ PFILE_OBJECT FileObject, 1667 _In_opt_ PDEVICE_OBJECT DeviceObject); 1668 1669 NTKERNELAPI 1670 PFILE_OBJECT 1671 NTAPI 1672 IoCreateStreamFileObjectLite( 1673 _In_opt_ PFILE_OBJECT FileObject, 1674 _In_opt_ PDEVICE_OBJECT DeviceObject); 1675 1676 NTKERNELAPI 1677 BOOLEAN 1678 NTAPI 1679 IoFastQueryNetworkAttributes( 1680 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 1681 _In_ ACCESS_MASK DesiredAccess, 1682 _In_ ULONG OpenOptions, 1683 _Out_ PIO_STATUS_BLOCK IoStatus, 1684 _Out_ PFILE_NETWORK_OPEN_INFORMATION Buffer); 1685 1686 NTKERNELAPI 1687 NTSTATUS 1688 NTAPI 1689 IoPageRead( 1690 _In_ PFILE_OBJECT FileObject, 1691 _In_ PMDL Mdl, 1692 _In_ PLARGE_INTEGER Offset, 1693 _In_ PKEVENT Event, 1694 _Out_ PIO_STATUS_BLOCK IoStatusBlock); 1695 1696 NTKERNELAPI 1697 PDEVICE_OBJECT 1698 NTAPI 1699 IoGetBaseFileSystemDeviceObject( 1700 _In_ PFILE_OBJECT FileObject); 1701 1702 _IRQL_requires_max_(PASSIVE_LEVEL) 1703 NTKERNELAPI 1704 PCONFIGURATION_INFORMATION 1705 NTAPI 1706 IoGetConfigurationInformation(VOID); 1707 1708 NTKERNELAPI 1709 ULONG 1710 NTAPI 1711 IoGetRequestorProcessId( 1712 _In_ PIRP Irp); 1713 1714 NTKERNELAPI 1715 PEPROCESS 1716 NTAPI 1717 IoGetRequestorProcess( 1718 _In_ PIRP Irp); 1719 1720 NTKERNELAPI 1721 PIRP 1722 NTAPI 1723 IoGetTopLevelIrp(VOID); 1724 1725 NTKERNELAPI 1726 BOOLEAN 1727 NTAPI 1728 IoIsOperationSynchronous( 1729 _In_ PIRP Irp); 1730 1731 NTKERNELAPI 1732 BOOLEAN 1733 NTAPI 1734 IoIsSystemThread( 1735 _In_ PETHREAD Thread); 1736 1737 NTKERNELAPI 1738 BOOLEAN 1739 NTAPI 1740 IoIsValidNameGraftingBuffer( 1741 _In_ PIRP Irp, 1742 _In_ PREPARSE_DATA_BUFFER ReparseBuffer); 1743 1744 NTKERNELAPI 1745 NTSTATUS 1746 NTAPI 1747 IoQueryFileInformation( 1748 _In_ PFILE_OBJECT FileObject, 1749 _In_ FILE_INFORMATION_CLASS FileInformationClass, 1750 _In_ ULONG Length, 1751 _Out_ PVOID FileInformation, 1752 _Out_ PULONG ReturnedLength); 1753 1754 NTKERNELAPI 1755 NTSTATUS 1756 NTAPI 1757 IoQueryVolumeInformation( 1758 _In_ PFILE_OBJECT FileObject, 1759 _In_ FS_INFORMATION_CLASS FsInformationClass, 1760 _In_ ULONG Length, 1761 _Out_ PVOID FsInformation, 1762 _Out_ PULONG ReturnedLength); 1763 1764 NTKERNELAPI 1765 VOID 1766 NTAPI 1767 IoQueueThreadIrp( 1768 _In_ PIRP Irp); 1769 1770 NTKERNELAPI 1771 VOID 1772 NTAPI 1773 IoRegisterFileSystem( 1774 _In_ __drv_aliasesMem PDEVICE_OBJECT DeviceObject); 1775 1776 NTKERNELAPI 1777 NTSTATUS 1778 NTAPI 1779 IoRegisterFsRegistrationChange( 1780 _In_ PDRIVER_OBJECT DriverObject, 1781 _In_ PDRIVER_FS_NOTIFICATION DriverNotificationRoutine); 1782 1783 NTKERNELAPI 1784 VOID 1785 NTAPI 1786 IoReleaseVpbSpinLock( 1787 _In_ KIRQL Irql); 1788 1789 NTKERNELAPI 1790 VOID 1791 NTAPI 1792 IoSetDeviceToVerify( 1793 _In_ PETHREAD Thread, 1794 _In_opt_ PDEVICE_OBJECT DeviceObject); 1795 1796 NTKERNELAPI 1797 NTSTATUS 1798 NTAPI 1799 IoSetInformation( 1800 _In_ PFILE_OBJECT FileObject, 1801 _In_ FILE_INFORMATION_CLASS FileInformationClass, 1802 _In_ ULONG Length, 1803 _In_ PVOID FileInformation); 1804 1805 NTKERNELAPI 1806 VOID 1807 NTAPI 1808 IoSetTopLevelIrp( 1809 _In_opt_ PIRP Irp); 1810 1811 NTKERNELAPI 1812 NTSTATUS 1813 NTAPI 1814 IoSynchronousPageWrite( 1815 _In_ PFILE_OBJECT FileObject, 1816 _In_ PMDL Mdl, 1817 _In_ PLARGE_INTEGER FileOffset, 1818 _In_ PKEVENT Event, 1819 _Out_ PIO_STATUS_BLOCK IoStatusBlock); 1820 1821 NTKERNELAPI 1822 PEPROCESS 1823 NTAPI 1824 IoThreadToProcess( 1825 _In_ PETHREAD Thread); 1826 1827 NTKERNELAPI 1828 VOID 1829 NTAPI 1830 IoUnregisterFileSystem( 1831 _In_ PDEVICE_OBJECT DeviceObject); 1832 1833 NTKERNELAPI 1834 VOID 1835 NTAPI 1836 IoUnregisterFsRegistrationChange( 1837 _In_ PDRIVER_OBJECT DriverObject, 1838 _In_ PDRIVER_FS_NOTIFICATION DriverNotificationRoutine); 1839 1840 NTKERNELAPI 1841 NTSTATUS 1842 NTAPI 1843 IoVerifyVolume( 1844 _In_ PDEVICE_OBJECT DeviceObject, 1845 _In_ BOOLEAN AllowRawMount); 1846 1847 NTKERNELAPI 1848 NTSTATUS 1849 NTAPI 1850 IoGetRequestorSessionId( 1851 _In_ PIRP Irp, 1852 _Out_ PULONG pSessionId); 1853 $endif (_NTIFS_) 1854 1855 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 1856 1857 $if (_NTDDK_) 1858 #if (NTDDI_VERSION >= NTDDI_WIN2KSP3) 1859 1860 NTKERNELAPI 1861 BOOLEAN 1862 NTAPI 1863 IoIsFileOriginRemote( 1864 _In_ PFILE_OBJECT FileObject); 1865 1866 NTKERNELAPI 1867 NTSTATUS 1868 NTAPI 1869 IoSetFileOrigin( 1870 _In_ PFILE_OBJECT FileObject, 1871 _In_ BOOLEAN Remote); 1872 1873 #endif /* (NTDDI_VERSION >= NTDDI_WIN2KSP3) */ 1874 $endif (_NTDDK_) 1875 1876 #if (NTDDI_VERSION >= NTDDI_WINXP) 1877 1878 $if (_WDMDDK_) 1879 NTKERNELAPI 1880 NTSTATUS 1881 NTAPI 1882 IoCsqInitialize( 1883 _Out_ PIO_CSQ Csq, 1884 _In_ PIO_CSQ_INSERT_IRP CsqInsertIrp, 1885 _In_ PIO_CSQ_REMOVE_IRP CsqRemoveIrp, 1886 _In_ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp, 1887 _In_ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock, 1888 _In_ PIO_CSQ_RELEASE_LOCK CsqReleaseLock, 1889 _In_ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp); 1890 1891 NTKERNELAPI 1892 VOID 1893 NTAPI 1894 IoCsqInsertIrp( 1895 _Inout_ PIO_CSQ Csq, 1896 _Inout_ PIRP Irp, 1897 _Out_opt_ PIO_CSQ_IRP_CONTEXT Context); 1898 1899 NTKERNELAPI 1900 PIRP 1901 NTAPI 1902 IoCsqRemoveIrp( 1903 _Inout_ PIO_CSQ Csq, 1904 _Inout_ PIO_CSQ_IRP_CONTEXT Context); 1905 1906 NTKERNELAPI 1907 PIRP 1908 NTAPI 1909 IoCsqRemoveNextIrp( 1910 _Inout_ PIO_CSQ Csq, 1911 _In_opt_ PVOID PeekContext); 1912 1913 NTKERNELAPI 1914 BOOLEAN 1915 NTAPI 1916 IoForwardIrpSynchronously( 1917 _In_ PDEVICE_OBJECT DeviceObject, 1918 _In_ PIRP Irp); 1919 1920 #define IoForwardAndCatchIrp IoForwardIrpSynchronously 1921 1922 NTKERNELAPI 1923 VOID 1924 NTAPI 1925 IoFreeErrorLogEntry( 1926 _In_ PVOID ElEntry); 1927 1928 _IRQL_requires_max_(DISPATCH_LEVEL) 1929 _Must_inspect_result_ 1930 NTKERNELAPI 1931 NTSTATUS 1932 NTAPI 1933 IoSetCompletionRoutineEx( 1934 _In_ PDEVICE_OBJECT DeviceObject, 1935 _In_ PIRP Irp, 1936 _In_ PIO_COMPLETION_ROUTINE CompletionRoutine, 1937 _In_opt_ PVOID Context, 1938 _In_ BOOLEAN InvokeOnSuccess, 1939 _In_ BOOLEAN InvokeOnError, 1940 _In_ BOOLEAN InvokeOnCancel); 1941 1942 VOID 1943 NTAPI 1944 IoSetStartIoAttributes( 1945 _In_ PDEVICE_OBJECT DeviceObject, 1946 _In_ BOOLEAN DeferredStartIo, 1947 _In_ BOOLEAN NonCancelable); 1948 1949 NTKERNELAPI 1950 NTSTATUS 1951 NTAPI 1952 IoWMIDeviceObjectToInstanceName( 1953 _In_ PVOID DataBlockObject, 1954 _In_ PDEVICE_OBJECT DeviceObject, 1955 _Out_ PUNICODE_STRING InstanceName); 1956 1957 NTKERNELAPI 1958 NTSTATUS 1959 NTAPI 1960 IoWMIExecuteMethod( 1961 _In_ PVOID DataBlockObject, 1962 _In_ PUNICODE_STRING InstanceName, 1963 _In_ ULONG MethodId, 1964 _In_ ULONG InBufferSize, 1965 _Inout_ PULONG OutBufferSize, 1966 _Inout_updates_bytes_to_opt_(*OutBufferSize, InBufferSize) PUCHAR InOutBuffer); 1967 1968 NTKERNELAPI 1969 NTSTATUS 1970 NTAPI 1971 IoWMIHandleToInstanceName( 1972 _In_ PVOID DataBlockObject, 1973 _In_ HANDLE FileHandle, 1974 _Out_ PUNICODE_STRING InstanceName); 1975 1976 NTKERNELAPI 1977 NTSTATUS 1978 NTAPI 1979 IoWMIOpenBlock( 1980 _In_ LPCGUID DataBlockGuid, 1981 _In_ ULONG DesiredAccess, 1982 _Out_ PVOID *DataBlockObject); 1983 1984 NTKERNELAPI 1985 NTSTATUS 1986 NTAPI 1987 IoWMIQueryAllData( 1988 _In_ PVOID DataBlockObject, 1989 _Inout_ ULONG *InOutBufferSize, 1990 _Out_writes_bytes_opt_(*InOutBufferSize) PVOID OutBuffer); 1991 1992 NTKERNELAPI 1993 NTSTATUS 1994 NTAPI 1995 IoWMIQueryAllDataMultiple( 1996 _In_reads_(ObjectCount) PVOID *DataBlockObjectList, 1997 _In_ ULONG ObjectCount, 1998 _Inout_ ULONG *InOutBufferSize, 1999 _Out_writes_bytes_opt_(*InOutBufferSize) PVOID OutBuffer); 2000 2001 NTKERNELAPI 2002 NTSTATUS 2003 NTAPI 2004 IoWMIQuerySingleInstance( 2005 _In_ PVOID DataBlockObject, 2006 _In_ PUNICODE_STRING InstanceName, 2007 _Inout_ ULONG *InOutBufferSize, 2008 _Out_writes_bytes_opt_(*InOutBufferSize) PVOID OutBuffer); 2009 2010 NTKERNELAPI 2011 NTSTATUS 2012 NTAPI 2013 IoWMISetNotificationCallback( 2014 _Inout_ PVOID Object, 2015 _In_ WMI_NOTIFICATION_CALLBACK Callback, 2016 _In_opt_ PVOID Context); 2017 2018 NTKERNELAPI 2019 NTSTATUS 2020 NTAPI 2021 IoWMISetSingleInstance( 2022 _In_ PVOID DataBlockObject, 2023 _In_ PUNICODE_STRING InstanceName, 2024 _In_ ULONG Version, 2025 _In_ ULONG ValueBufferSize, 2026 _In_reads_bytes_(ValueBufferSize) PVOID ValueBuffer); 2027 2028 NTKERNELAPI 2029 NTSTATUS 2030 NTAPI 2031 IoWMISetSingleItem( 2032 _In_ PVOID DataBlockObject, 2033 _In_ PUNICODE_STRING InstanceName, 2034 _In_ ULONG DataItemId, 2035 _In_ ULONG Version, 2036 _In_ ULONG ValueBufferSize, 2037 _In_reads_bytes_(ValueBufferSize) PVOID ValueBuffer); 2038 $endif (_WDMDDK_) 2039 $if (_NTDDK_) 2040 _IRQL_requires_max_(PASSIVE_LEVEL) 2041 NTKERNELAPI 2042 NTSTATUS 2043 FASTCALL 2044 IoReadPartitionTable( 2045 _In_ PDEVICE_OBJECT DeviceObject, 2046 _In_ ULONG SectorSize, 2047 _In_ BOOLEAN ReturnRecognizedPartitions, 2048 _Out_ struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer); 2049 2050 _IRQL_requires_max_(PASSIVE_LEVEL) 2051 NTKERNELAPI 2052 NTSTATUS 2053 FASTCALL 2054 IoSetPartitionInformation( 2055 _In_ PDEVICE_OBJECT DeviceObject, 2056 _In_ ULONG SectorSize, 2057 _In_ ULONG PartitionNumber, 2058 _In_ ULONG PartitionType); 2059 2060 _IRQL_requires_max_(PASSIVE_LEVEL) 2061 NTKERNELAPI 2062 NTSTATUS 2063 FASTCALL 2064 IoWritePartitionTable( 2065 _In_ PDEVICE_OBJECT DeviceObject, 2066 _In_ ULONG SectorSize, 2067 _In_ ULONG SectorsPerTrack, 2068 _In_ ULONG NumberOfHeads, 2069 _In_ struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer); 2070 2071 NTKERNELAPI 2072 NTSTATUS 2073 NTAPI 2074 IoCreateDisk( 2075 _In_ PDEVICE_OBJECT DeviceObject, 2076 _In_opt_ struct _CREATE_DISK* Disk); 2077 2078 NTKERNELAPI 2079 NTSTATUS 2080 NTAPI 2081 IoReadDiskSignature( 2082 _In_ PDEVICE_OBJECT DeviceObject, 2083 _In_ ULONG BytesPerSector, 2084 _Out_ PDISK_SIGNATURE Signature); 2085 2086 _IRQL_requires_max_(PASSIVE_LEVEL) 2087 NTKERNELAPI 2088 NTSTATUS 2089 NTAPI 2090 IoReadPartitionTableEx( 2091 _In_ PDEVICE_OBJECT DeviceObject, 2092 _Out_ struct _DRIVE_LAYOUT_INFORMATION_EX **PartitionBuffer); 2093 2094 _IRQL_requires_max_(PASSIVE_LEVEL) 2095 NTKERNELAPI 2096 NTSTATUS 2097 NTAPI 2098 IoSetPartitionInformationEx( 2099 _In_ PDEVICE_OBJECT DeviceObject, 2100 _In_ ULONG PartitionNumber, 2101 _In_ struct _SET_PARTITION_INFORMATION_EX *PartitionInfo); 2102 2103 NTKERNELAPI 2104 NTSTATUS 2105 NTAPI 2106 IoSetSystemPartition( 2107 _In_ PUNICODE_STRING VolumeNameString); 2108 2109 NTKERNELAPI 2110 NTSTATUS 2111 NTAPI 2112 IoVerifyPartitionTable( 2113 _In_ PDEVICE_OBJECT DeviceObject, 2114 _In_ BOOLEAN FixErrors); 2115 2116 NTKERNELAPI 2117 NTSTATUS 2118 NTAPI 2119 IoVolumeDeviceToDosName( 2120 _In_ PVOID VolumeDeviceObject, 2121 _Out_ _When_(return==0, 2122 _At_(DosName->Buffer, __drv_allocatesMem(Mem))) 2123 PUNICODE_STRING DosName); 2124 2125 _IRQL_requires_max_(PASSIVE_LEVEL) 2126 NTKERNELAPI 2127 NTSTATUS 2128 NTAPI 2129 IoWritePartitionTableEx( 2130 _In_ PDEVICE_OBJECT DeviceObject, 2131 _In_reads_(_Inexpressible_(FIELD_OFFSET(DRIVE_LAYOUT_INFORMATION_EX, PartitionEntry[0]))) 2132 struct _DRIVE_LAYOUT_INFORMATION_EX *DriveLayout); 2133 2134 NTKERNELAPI 2135 NTSTATUS 2136 NTAPI 2137 IoCreateFileSpecifyDeviceObjectHint( 2138 _Out_ PHANDLE FileHandle, 2139 _In_ ACCESS_MASK DesiredAccess, 2140 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 2141 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 2142 _In_opt_ PLARGE_INTEGER AllocationSize, 2143 _In_ ULONG FileAttributes, 2144 _In_ ULONG ShareAccess, 2145 _In_ ULONG Disposition, 2146 _In_ ULONG CreateOptions, 2147 _In_opt_ PVOID EaBuffer, 2148 _In_ ULONG EaLength, 2149 _In_ CREATE_FILE_TYPE CreateFileType, 2150 _In_opt_ PVOID InternalParameters, 2151 _In_ ULONG Options, 2152 _In_opt_ PVOID DeviceObject); 2153 2154 NTKERNELAPI 2155 NTSTATUS 2156 NTAPI 2157 IoAttachDeviceToDeviceStackSafe( 2158 _In_ PDEVICE_OBJECT SourceDevice, 2159 _In_ PDEVICE_OBJECT TargetDevice, 2160 _Outptr_ PDEVICE_OBJECT *AttachedToDeviceObject); 2161 2162 $endif (_NTDDK_) 2163 $if (_NTIFS_) 2164 2165 NTKERNELAPI 2166 PFILE_OBJECT 2167 NTAPI 2168 IoCreateStreamFileObjectEx( 2169 _In_opt_ PFILE_OBJECT FileObject, 2170 _In_opt_ PDEVICE_OBJECT DeviceObject, 2171 _Out_opt_ PHANDLE FileObjectHandle); 2172 2173 NTKERNELAPI 2174 NTSTATUS 2175 NTAPI 2176 IoQueryFileDosDeviceName( 2177 _In_ PFILE_OBJECT FileObject, 2178 _Out_ POBJECT_NAME_INFORMATION *ObjectNameInformation); 2179 2180 NTKERNELAPI 2181 NTSTATUS 2182 NTAPI 2183 IoEnumerateDeviceObjectList( 2184 _In_ PDRIVER_OBJECT DriverObject, 2185 _Out_writes_bytes_to_opt_(DeviceObjectListSize,(*ActualNumberDeviceObjects)*sizeof(PDEVICE_OBJECT)) 2186 PDEVICE_OBJECT *DeviceObjectList, 2187 _In_ ULONG DeviceObjectListSize, 2188 _Out_ PULONG ActualNumberDeviceObjects); 2189 2190 NTKERNELAPI 2191 PDEVICE_OBJECT 2192 NTAPI 2193 IoGetLowerDeviceObject( 2194 _In_ PDEVICE_OBJECT DeviceObject); 2195 2196 NTKERNELAPI 2197 PDEVICE_OBJECT 2198 NTAPI 2199 IoGetDeviceAttachmentBaseRef( 2200 _In_ PDEVICE_OBJECT DeviceObject); 2201 2202 NTKERNELAPI 2203 NTSTATUS 2204 NTAPI 2205 IoGetDiskDeviceObject( 2206 _In_ PDEVICE_OBJECT FileSystemDeviceObject, 2207 _Out_ PDEVICE_OBJECT *DiskDeviceObject); 2208 $endif (_NTIFS_) 2209 2210 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 2211 2212 $if (_WDMDDK_) 2213 #if (NTDDI_VERSION >= NTDDI_WINXPSP1) 2214 NTKERNELAPI 2215 NTSTATUS 2216 NTAPI 2217 IoValidateDeviceIoControlAccess( 2218 _In_ PIRP Irp, 2219 _In_ ULONG RequiredAccess); 2220 #endif 2221 2222 $endif (_WDMDDK_) 2223 $if (_WDMDDK_ || _NTDDK_) 2224 #if (NTDDI_VERSION >= NTDDI_WS03) 2225 $endif (_WDMDDK_ || _NTDDK_) 2226 $if (_NTDDK_) 2227 NTKERNELAPI 2228 IO_PAGING_PRIORITY 2229 FASTCALL 2230 IoGetPagingIoPriority( 2231 _In_ PIRP Irp); 2232 2233 $endif (_NTDDK_) 2234 $if (_WDMDDK_) 2235 NTKERNELAPI 2236 NTSTATUS 2237 NTAPI 2238 IoCsqInitializeEx( 2239 _Out_ PIO_CSQ Csq, 2240 _In_ PIO_CSQ_INSERT_IRP_EX CsqInsertIrp, 2241 _In_ PIO_CSQ_REMOVE_IRP CsqRemoveIrp, 2242 _In_ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp, 2243 _In_ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock, 2244 _In_ PIO_CSQ_RELEASE_LOCK CsqReleaseLock, 2245 _In_ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp); 2246 2247 NTKERNELAPI 2248 NTSTATUS 2249 NTAPI 2250 IoCsqInsertIrpEx( 2251 _Inout_ PIO_CSQ Csq, 2252 _Inout_ PIRP Irp, 2253 _Out_opt_ PIO_CSQ_IRP_CONTEXT Context, 2254 _In_opt_ PVOID InsertContext); 2255 $endif (_WDMDDK_) 2256 $if (_WDMDDK_ || _NTDDK_) 2257 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */ 2258 $endif (_WDMDDK_ || _NTDDK_) 2259 $if (_NTDDK_ || _NTIFS_) 2260 #if (NTDDI_VERSION >= NTDDI_WS03SP1) 2261 $endif (_NTDDK_ || _NTIFS_) 2262 2263 $if (_NTDDK_) 2264 BOOLEAN 2265 NTAPI 2266 IoTranslateBusAddress( 2267 _In_ INTERFACE_TYPE InterfaceType, 2268 _In_ ULONG BusNumber, 2269 _In_ PHYSICAL_ADDRESS BusAddress, 2270 _Inout_ PULONG AddressSpace, 2271 _Out_ PPHYSICAL_ADDRESS TranslatedAddress); 2272 $endif (_NTDDK_) 2273 $if (_NTIFS_) 2274 2275 NTKERNELAPI 2276 NTSTATUS 2277 NTAPI 2278 IoEnumerateRegisteredFiltersList( 2279 _Out_writes_bytes_to_opt_(DriverObjectListSize,(*ActualNumberDriverObjects)*sizeof(PDRIVER_OBJECT)) 2280 PDRIVER_OBJECT *DriverObjectList, 2281 _In_ ULONG DriverObjectListSize, 2282 _Out_ PULONG ActualNumberDriverObjects); 2283 $endif (_NTIFS_) 2284 $if (_NTDDK_ || _NTIFS_) 2285 #endif /* (NTDDI_VERSION >= NTDDI_WS03SP1) */ 2286 $endif (_NTDDK_ || _NTIFS_) 2287 2288 #if (NTDDI_VERSION >= NTDDI_VISTA) 2289 $if (_WDMDDK_) 2290 NTKERNELAPI 2291 NTSTATUS 2292 NTAPI 2293 IoGetBootDiskInformationLite( 2294 _Outptr_ PBOOTDISK_INFORMATION_LITE *BootDiskInformation); 2295 2296 NTKERNELAPI 2297 NTSTATUS 2298 NTAPI 2299 IoCheckShareAccessEx( 2300 _In_ ACCESS_MASK DesiredAccess, 2301 _In_ ULONG DesiredShareAccess, 2302 _Inout_ PFILE_OBJECT FileObject, 2303 _Inout_ PSHARE_ACCESS ShareAccess, 2304 _In_ BOOLEAN Update, 2305 _In_ PBOOLEAN WritePermission); 2306 2307 NTKERNELAPI 2308 NTSTATUS 2309 NTAPI 2310 IoConnectInterruptEx( 2311 _Inout_ PIO_CONNECT_INTERRUPT_PARAMETERS Parameters); 2312 2313 NTKERNELAPI 2314 VOID 2315 NTAPI 2316 IoDisconnectInterruptEx( 2317 _In_ PIO_DISCONNECT_INTERRUPT_PARAMETERS Parameters); 2318 2319 LOGICAL 2320 NTAPI 2321 IoWithinStackLimits( 2322 _In_ ULONG_PTR RegionStart, 2323 _In_ SIZE_T RegionSize); 2324 2325 NTKERNELAPI 2326 VOID 2327 NTAPI 2328 IoSetShareAccessEx( 2329 _In_ ACCESS_MASK DesiredAccess, 2330 _In_ ULONG DesiredShareAccess, 2331 _Inout_ PFILE_OBJECT FileObject, 2332 _Out_ PSHARE_ACCESS ShareAccess, 2333 _In_ PBOOLEAN WritePermission); 2334 2335 ULONG 2336 NTAPI 2337 IoSizeofWorkItem(VOID); 2338 2339 VOID 2340 NTAPI 2341 IoInitializeWorkItem( 2342 _In_ PVOID IoObject, 2343 _Out_ PIO_WORKITEM IoWorkItem); 2344 2345 VOID 2346 NTAPI 2347 IoUninitializeWorkItem( 2348 _Inout_ PIO_WORKITEM IoWorkItem); 2349 2350 _IRQL_requires_max_(DISPATCH_LEVEL) 2351 NTKRNLVISTAAPI 2352 VOID 2353 NTAPI 2354 IoQueueWorkItemEx( 2355 _Inout_ PIO_WORKITEM IoWorkItem, 2356 _In_ PIO_WORKITEM_ROUTINE_EX WorkerRoutine, 2357 _In_ WORK_QUEUE_TYPE QueueType, 2358 _In_opt_ __drv_aliasesMem PVOID Context); 2359 2360 NTKRNLVISTAAPI 2361 IO_PRIORITY_HINT 2362 NTAPI 2363 IoGetIoPriorityHint( 2364 _In_ PIRP Irp); 2365 2366 NTSTATUS 2367 NTAPI 2368 IoSetIoPriorityHint( 2369 _In_ PIRP Irp, 2370 _In_ IO_PRIORITY_HINT PriorityHint); 2371 2372 NTSTATUS 2373 NTAPI 2374 IoAllocateSfioStreamIdentifier( 2375 _In_ PFILE_OBJECT FileObject, 2376 _In_ ULONG Length, 2377 _In_ PVOID Signature, 2378 _Out_ PVOID *StreamIdentifier); 2379 2380 PVOID 2381 NTAPI 2382 IoGetSfioStreamIdentifier( 2383 _In_ PFILE_OBJECT FileObject, 2384 _In_ PVOID Signature); 2385 2386 NTSTATUS 2387 NTAPI 2388 IoFreeSfioStreamIdentifier( 2389 _In_ PFILE_OBJECT FileObject, 2390 _In_ PVOID Signature); 2391 2392 _IRQL_requires_max_(DISPATCH_LEVEL) 2393 _Must_inspect_result_ 2394 NTKERNELAPI 2395 NTSTATUS 2396 NTAPI 2397 IoRequestDeviceEjectEx( 2398 _In_ PDEVICE_OBJECT PhysicalDeviceObject, 2399 _In_opt_ PIO_DEVICE_EJECT_CALLBACK Callback, 2400 _In_opt_ PVOID Context, 2401 _In_opt_ PDRIVER_OBJECT DriverObject); 2402 2403 _IRQL_requires_max_(PASSIVE_LEVEL) 2404 _Must_inspect_result_ 2405 NTKRNLVISTAAPI 2406 NTSTATUS 2407 NTAPI 2408 IoSetDevicePropertyData( 2409 _In_ PDEVICE_OBJECT Pdo, 2410 _In_ CONST DEVPROPKEY *PropertyKey, 2411 _In_ LCID Lcid, 2412 _In_ ULONG Flags, 2413 _In_ DEVPROPTYPE Type, 2414 _In_ ULONG Size, 2415 _In_opt_ PVOID Data); 2416 2417 _IRQL_requires_max_(PASSIVE_LEVEL) 2418 _Must_inspect_result_ 2419 NTKRNLVISTAAPI 2420 NTSTATUS 2421 NTAPI 2422 IoGetDevicePropertyData( 2423 _In_ PDEVICE_OBJECT Pdo, 2424 _In_ CONST DEVPROPKEY *PropertyKey, 2425 _In_ LCID Lcid, 2426 _Reserved_ ULONG Flags, 2427 _In_ ULONG Size, 2428 _Out_ PVOID Data, 2429 _Out_ PULONG RequiredSize, 2430 _Out_ PDEVPROPTYPE Type); 2431 2432 $endif (_WDMDDK_) 2433 $if (_NTDDK_) 2434 NTKERNELAPI 2435 NTSTATUS 2436 NTAPI 2437 IoUpdateDiskGeometry( 2438 _In_ PDEVICE_OBJECT DeviceObject, 2439 _In_ struct _DISK_GEOMETRY_EX* OldDiskGeometry, 2440 _In_ struct _DISK_GEOMETRY_EX* NewDiskGeometry); 2441 2442 PTXN_PARAMETER_BLOCK 2443 NTAPI 2444 IoGetTransactionParameterBlock( 2445 _In_ PFILE_OBJECT FileObject); 2446 2447 NTKERNELAPI 2448 NTSTATUS 2449 NTAPI 2450 IoCreateFileEx( 2451 _Out_ PHANDLE FileHandle, 2452 _In_ ACCESS_MASK DesiredAccess, 2453 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 2454 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 2455 _In_opt_ PLARGE_INTEGER AllocationSize, 2456 _In_ ULONG FileAttributes, 2457 _In_ ULONG ShareAccess, 2458 _In_ ULONG Disposition, 2459 _In_ ULONG CreateOptions, 2460 _In_opt_ PVOID EaBuffer, 2461 _In_ ULONG EaLength, 2462 _In_ CREATE_FILE_TYPE CreateFileType, 2463 _In_opt_ PVOID InternalParameters, 2464 _In_ ULONG Options, 2465 _In_opt_ PIO_DRIVER_CREATE_CONTEXT DriverContext); 2466 2467 NTSTATUS 2468 NTAPI 2469 IoSetIrpExtraCreateParameter( 2470 _Inout_ PIRP Irp, 2471 _In_ struct _ECP_LIST *ExtraCreateParameter); 2472 2473 VOID 2474 NTAPI 2475 IoClearIrpExtraCreateParameter( 2476 _Inout_ PIRP Irp); 2477 2478 NTKRNLVISTAAPI 2479 NTSTATUS 2480 NTAPI 2481 IoGetIrpExtraCreateParameter( 2482 _In_ PIRP Irp, 2483 _Outptr_result_maybenull_ struct _ECP_LIST **ExtraCreateParameter); 2484 2485 BOOLEAN 2486 NTAPI 2487 IoIsFileObjectIgnoringSharing( 2488 _In_ PFILE_OBJECT FileObject); 2489 2490 $endif (_NTDDK_) 2491 $if (_NTIFS_) 2492 2493 FORCEINLINE 2494 VOID 2495 NTAPI 2496 IoInitializePriorityInfo( 2497 _In_ PIO_PRIORITY_INFO PriorityInfo) 2498 { 2499 PriorityInfo->Size = sizeof(IO_PRIORITY_INFO); 2500 PriorityInfo->ThreadPriority = 0xffff; 2501 PriorityInfo->IoPriority = IoPriorityNormal; 2502 PriorityInfo->PagePriority = 0; 2503 } 2504 $endif (_NTIFS_) 2505 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ 2506 2507 $if (_WDMDDK_) 2508 #define IoCallDriverStackSafeDefault(a, b) IoCallDriver(a, b) 2509 2510 #if (NTDDI_VERSION >= NTDDI_WS08) 2511 _IRQL_requires_max_(PASSIVE_LEVEL) 2512 _Must_inspect_result_ 2513 NTKERNELAPI 2514 NTSTATUS 2515 NTAPI 2516 IoReplacePartitionUnit( 2517 _In_ PDEVICE_OBJECT TargetPdo, 2518 _In_ PDEVICE_OBJECT SparePdo, 2519 _In_ ULONG Flags); 2520 #endif 2521 2522 $endif (_WDMDDK_) 2523 #if (NTDDI_VERSION >= NTDDI_WIN7) 2524 2525 $if (_WDMDDK_) 2526 NTKERNELAPI 2527 NTSTATUS 2528 NTAPI 2529 IoGetAffinityInterrupt( 2530 _In_ PKINTERRUPT InterruptObject, 2531 _Out_ PGROUP_AFFINITY GroupAffinity); 2532 2533 NTSTATUS 2534 NTAPI 2535 IoGetContainerInformation( 2536 _In_ IO_CONTAINER_INFORMATION_CLASS InformationClass, 2537 _In_opt_ PVOID ContainerObject, 2538 _Inout_updates_bytes_opt_(BufferLength) PVOID Buffer, 2539 _In_ ULONG BufferLength); 2540 2541 NTSTATUS 2542 NTAPI 2543 IoRegisterContainerNotification( 2544 _In_ IO_CONTAINER_NOTIFICATION_CLASS NotificationClass, 2545 _In_ PIO_CONTAINER_NOTIFICATION_FUNCTION CallbackFunction, 2546 _In_reads_bytes_opt_(NotificationInformationLength) PVOID NotificationInformation, 2547 _In_ ULONG NotificationInformationLength, 2548 _Out_ PVOID CallbackRegistration); 2549 2550 VOID 2551 NTAPI 2552 IoUnregisterContainerNotification( 2553 _In_ PVOID CallbackRegistration); 2554 2555 _IRQL_requires_max_(PASSIVE_LEVEL) 2556 __drv_freesMem(Pool) 2557 NTKERNELAPI 2558 NTSTATUS 2559 NTAPI 2560 IoUnregisterPlugPlayNotificationEx( 2561 _In_ PVOID NotificationEntry); 2562 2563 _IRQL_requires_max_(PASSIVE_LEVEL) 2564 _Must_inspect_result_ 2565 NTKERNELAPI 2566 NTSTATUS 2567 NTAPI 2568 IoGetDeviceNumaNode( 2569 _In_ PDEVICE_OBJECT Pdo, 2570 _Out_ PUSHORT NodeNumber); 2571 2572 $endif (_WDMDDK_) 2573 $if (_NTDDK_) 2574 NTSTATUS 2575 NTAPI 2576 IoSetFileObjectIgnoreSharing( 2577 _In_ PFILE_OBJECT FileObject); 2578 2579 $endif (_NTDDK_) 2580 $if (_NTIFS_) 2581 2582 NTKERNELAPI 2583 NTSTATUS 2584 NTAPI 2585 IoRegisterFsRegistrationChangeMountAware( 2586 _In_ PDRIVER_OBJECT DriverObject, 2587 _In_ PDRIVER_FS_NOTIFICATION DriverNotificationRoutine, 2588 _In_ BOOLEAN SynchronizeWithMounts); 2589 2590 NTKERNELAPI 2591 NTSTATUS 2592 NTAPI 2593 IoReplaceFileObjectName( 2594 _In_ PFILE_OBJECT FileObject, 2595 _In_reads_bytes_(FileNameLength) PWSTR NewFileName, 2596 _In_ USHORT FileNameLength); 2597 $endif (_NTIFS_) 2598 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 2599 2600 #if (NTDDI_VERSION >= NTDDI_WIN8) 2601 2602 $if (_WDMDDK_) 2603 _IRQL_requires_max_(PASSIVE_LEVEL) 2604 _Must_inspect_result_ 2605 NTKRNLVISTAAPI 2606 NTSTATUS 2607 IoSetDeviceInterfacePropertyData( 2608 _In_ PUNICODE_STRING SymbolicLinkName, 2609 _In_ CONST DEVPROPKEY *PropertyKey, 2610 _In_ LCID Lcid, 2611 _In_ ULONG Flags, 2612 _In_ DEVPROPTYPE Type, 2613 _In_ ULONG Size, 2614 _In_reads_bytes_opt_(Size) PVOID Data); 2615 2616 _IRQL_requires_max_(PASSIVE_LEVEL) 2617 _Must_inspect_result_ 2618 NTKERNELAPI 2619 NTSTATUS 2620 IoGetDeviceInterfacePropertyData ( 2621 _In_ PUNICODE_STRING SymbolicLinkName, 2622 _In_ CONST DEVPROPKEY *PropertyKey, 2623 _In_ LCID Lcid, 2624 _Reserved_ ULONG Flags, 2625 _In_ ULONG Size, 2626 _Out_writes_bytes_to_(Size, *RequiredSize) PVOID Data, 2627 _Out_ PULONG RequiredSize, 2628 _Out_ PDEVPROPTYPE Type); 2629 $endif (_WDMDDK_) 2630 $if (_NTDDK_) 2631 2632 NTKRNLVISTAAPI 2633 VOID 2634 IoSetMasterIrpStatus( 2635 _Inout_ PIRP MasterIrp, 2636 _In_ NTSTATUS Status); 2637 $endif (_NTDDK_) 2638 2639 #endif /* (NTDDI_VERSION >= NTDDI_WIN8) */ 2640 2641 $if (_WDMDDK_) 2642 #if defined(_WIN64) 2643 NTKERNELAPI 2644 ULONG 2645 NTAPI 2646 IoWMIDeviceObjectToProviderId( 2647 _In_ PDEVICE_OBJECT DeviceObject); 2648 #else 2649 #define IoWMIDeviceObjectToProviderId(DeviceObject) ((ULONG)(DeviceObject)) 2650 #endif 2651 2652 /* 2653 * USHORT 2654 * IoSizeOfIrp( 2655 * IN CCHAR StackSize) 2656 */ 2657 #define IoSizeOfIrp(_StackSize) \ 2658 ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION))))) 2659 2660 FORCEINLINE 2661 VOID 2662 IoSkipCurrentIrpStackLocation( 2663 _Inout_ PIRP Irp) 2664 { 2665 ASSERT(Irp->CurrentLocation <= Irp->StackCount); 2666 Irp->CurrentLocation++; 2667 #ifdef NONAMELESSUNION 2668 Irp->Tail.Overlay.s.u.CurrentStackLocation++; 2669 #else 2670 Irp->Tail.Overlay.CurrentStackLocation++; 2671 #endif 2672 } 2673 2674 FORCEINLINE 2675 VOID 2676 IoSetNextIrpStackLocation( 2677 _Inout_ PIRP Irp) 2678 { 2679 ASSERT(Irp->CurrentLocation > 0); 2680 Irp->CurrentLocation--; 2681 #ifdef NONAMELESSUNION 2682 Irp->Tail.Overlay.s.u.CurrentStackLocation--; 2683 #else 2684 Irp->Tail.Overlay.CurrentStackLocation--; 2685 #endif 2686 } 2687 2688 __drv_aliasesMem 2689 FORCEINLINE 2690 PIO_STACK_LOCATION 2691 IoGetNextIrpStackLocation( 2692 _In_ PIRP Irp) 2693 { 2694 ASSERT(Irp->CurrentLocation > 0); 2695 #ifdef NONAMELESSUNION 2696 return ((Irp)->Tail.Overlay.s.u.CurrentStackLocation - 1 ); 2697 #else 2698 return ((Irp)->Tail.Overlay.CurrentStackLocation - 1 ); 2699 #endif 2700 } 2701 2702 _IRQL_requires_max_(DISPATCH_LEVEL) 2703 FORCEINLINE 2704 VOID 2705 IoSetCompletionRoutine( 2706 _In_ PIRP Irp, 2707 _In_opt_ PIO_COMPLETION_ROUTINE CompletionRoutine, 2708 _In_opt_ __drv_aliasesMem PVOID Context, 2709 _In_ BOOLEAN InvokeOnSuccess, 2710 _In_ BOOLEAN InvokeOnError, 2711 _In_ BOOLEAN InvokeOnCancel) 2712 { 2713 PIO_STACK_LOCATION irpSp; 2714 ASSERT( (InvokeOnSuccess || InvokeOnError || InvokeOnCancel) ? (CompletionRoutine != NULL) : TRUE ); 2715 irpSp = IoGetNextIrpStackLocation(Irp); 2716 irpSp->CompletionRoutine = CompletionRoutine; 2717 irpSp->Context = Context; 2718 irpSp->Control = 0; 2719 2720 if (InvokeOnSuccess) { 2721 irpSp->Control = SL_INVOKE_ON_SUCCESS; 2722 } 2723 2724 if (InvokeOnError) { 2725 irpSp->Control |= SL_INVOKE_ON_ERROR; 2726 } 2727 2728 if (InvokeOnCancel) { 2729 irpSp->Control |= SL_INVOKE_ON_CANCEL; 2730 } 2731 } 2732 2733 _IRQL_requires_max_(DISPATCH_LEVEL) 2734 _Ret_maybenull_ 2735 FORCEINLINE 2736 PDRIVER_CANCEL 2737 IoSetCancelRoutine( 2738 _Inout_ PIRP Irp, 2739 _In_opt_ PDRIVER_CANCEL CancelRoutine) 2740 { 2741 return (PDRIVER_CANCEL)(ULONG_PTR) InterlockedExchangePointer((PVOID *)&(Irp)->CancelRoutine, (PVOID)(ULONG_PTR)(CancelRoutine)); 2742 } 2743 2744 FORCEINLINE 2745 VOID 2746 IoRequestDpc( 2747 _Inout_ PDEVICE_OBJECT DeviceObject, 2748 _In_opt_ PIRP Irp, 2749 _In_opt_ __drv_aliasesMem PVOID Context) 2750 { 2751 KeInsertQueueDpc(&DeviceObject->Dpc, Irp, Context); 2752 } 2753 2754 /* 2755 * VOID 2756 * IoReleaseRemoveLock( 2757 * IN PIO_REMOVE_LOCK RemoveLock, 2758 * IN PVOID Tag) 2759 */ 2760 #define IoReleaseRemoveLock(_RemoveLock, \ 2761 _Tag) \ 2762 IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK)) 2763 2764 /* 2765 * VOID 2766 * IoReleaseRemoveLockAndWait( 2767 * IN PIO_REMOVE_LOCK RemoveLock, 2768 * IN PVOID Tag) 2769 */ 2770 #define IoReleaseRemoveLockAndWait(_RemoveLock, \ 2771 _Tag) \ 2772 IoReleaseRemoveLockAndWaitEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK)) 2773 2774 #if defined(_WIN64) 2775 _IRQL_requires_max_(DISPATCH_LEVEL) 2776 NTKERNELAPI 2777 BOOLEAN 2778 IoIs32bitProcess( 2779 _In_opt_ PIRP Irp); 2780 #endif 2781 2782 #define PLUGPLAY_REGKEY_DEVICE 1 2783 #define PLUGPLAY_REGKEY_DRIVER 2 2784 #define PLUGPLAY_REGKEY_CURRENT_HWPROFILE 4 2785 2786 __drv_aliasesMem 2787 FORCEINLINE 2788 PIO_STACK_LOCATION 2789 IoGetCurrentIrpStackLocation( 2790 _In_ PIRP Irp) 2791 { 2792 ASSERT(Irp->CurrentLocation <= Irp->StackCount + 1); 2793 #ifdef NONAMELESSUNION 2794 return Irp->Tail.Overlay.s.u.CurrentStackLocation; 2795 #else 2796 return Irp->Tail.Overlay.CurrentStackLocation; 2797 #endif 2798 } 2799 2800 FORCEINLINE 2801 VOID 2802 IoMarkIrpPending( 2803 _Inout_ PIRP Irp) 2804 { 2805 IoGetCurrentIrpStackLocation((Irp))->Control |= SL_PENDING_RETURNED; 2806 } 2807 2808 /* 2809 * BOOLEAN 2810 * IoIsErrorUserInduced( 2811 * IN NTSTATUS Status); 2812 */ 2813 #define IoIsErrorUserInduced(Status) \ 2814 ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \ 2815 ((Status) == STATUS_IO_TIMEOUT) || \ 2816 ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \ 2817 ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \ 2818 ((Status) == STATUS_VERIFY_REQUIRED) || \ 2819 ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \ 2820 ((Status) == STATUS_WRONG_VOLUME))) 2821 2822 /* VOID 2823 * IoInitializeRemoveLock( 2824 * IN PIO_REMOVE_LOCK Lock, 2825 * IN ULONG AllocateTag, 2826 * IN ULONG MaxLockedMinutes, 2827 * IN ULONG HighWatermark) 2828 */ 2829 #define IoInitializeRemoveLock( \ 2830 Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \ 2831 IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \ 2832 HighWatermark, sizeof(IO_REMOVE_LOCK)) 2833 2834 FORCEINLINE 2835 VOID 2836 IoInitializeDpcRequest( 2837 _In_ PDEVICE_OBJECT DeviceObject, 2838 _In_ PIO_DPC_ROUTINE DpcRoutine) 2839 { 2840 #ifdef _MSC_VER 2841 #pragma warning(push) 2842 #pragma warning(disable:28024) 2843 #endif 2844 KeInitializeDpc(&DeviceObject->Dpc, 2845 (PKDEFERRED_ROUTINE) DpcRoutine, 2846 DeviceObject); 2847 #ifdef _MSC_VER 2848 #pragma warning(pop) 2849 #endif 2850 } 2851 2852 #define DEVICE_INTERFACE_INCLUDE_NONACTIVE 0x00000001 2853 2854 /* 2855 * ULONG 2856 * IoGetFunctionCodeFromCtlCode( 2857 * IN ULONG ControlCode) 2858 */ 2859 #define IoGetFunctionCodeFromCtlCode(_ControlCode) \ 2860 (((_ControlCode) >> 2) & 0x00000FFF) 2861 2862 FORCEINLINE 2863 VOID 2864 IoCopyCurrentIrpStackLocationToNext( 2865 _Inout_ PIRP Irp) 2866 { 2867 PIO_STACK_LOCATION irpSp; 2868 PIO_STACK_LOCATION nextIrpSp; 2869 irpSp = IoGetCurrentIrpStackLocation(Irp); 2870 nextIrpSp = IoGetNextIrpStackLocation(Irp); 2871 RtlCopyMemory(nextIrpSp, irpSp, FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); 2872 nextIrpSp->Control = 0; 2873 } 2874 2875 _IRQL_requires_max_(APC_LEVEL) 2876 NTKERNELAPI 2877 VOID 2878 NTAPI 2879 IoGetStackLimits( 2880 _Out_ PULONG_PTR LowLimit, 2881 _Out_ PULONG_PTR HighLimit); 2882 2883 _IRQL_requires_max_(APC_LEVEL) 2884 FORCEINLINE 2885 ULONG_PTR 2886 IoGetRemainingStackSize(VOID) 2887 { 2888 ULONG_PTR End, Begin; 2889 ULONG_PTR Result; 2890 2891 IoGetStackLimits(&Begin, &End); 2892 Result = (ULONG_PTR)(&End) - Begin; 2893 return Result; 2894 } 2895 2896 #if (NTDDI_VERSION >= NTDDI_WS03) 2897 FORCEINLINE 2898 VOID 2899 IoInitializeThreadedDpcRequest( 2900 _In_ PDEVICE_OBJECT DeviceObject, 2901 _In_ PIO_DPC_ROUTINE DpcRoutine) 2902 { 2903 #ifdef _MSC_VER 2904 #pragma warning(push) 2905 #pragma warning(disable:28024) 2906 #pragma warning(disable:28128) 2907 #endif 2908 KeInitializeThreadedDpc(&DeviceObject->Dpc, 2909 (PKDEFERRED_ROUTINE) DpcRoutine, 2910 DeviceObject ); 2911 #ifdef _MSC_VER 2912 #pragma warning(pop) 2913 #endif 2914 } 2915 #endif 2916 2917 $endif (_WDMDDK_) 2918