1 $if (_NTIFS_) 2 /* FSRTL Functions */ 3 4 #define FsRtlEnterFileSystem KeEnterCriticalRegion 5 #define FsRtlExitFileSystem KeLeaveCriticalRegion 6 7 #if (NTDDI_VERSION >= NTDDI_WIN2K) 8 9 _Must_inspect_result_ 10 _IRQL_requires_max_(PASSIVE_LEVEL) 11 NTKERNELAPI 12 BOOLEAN 13 NTAPI 14 FsRtlCopyRead( 15 _In_ PFILE_OBJECT FileObject, 16 _In_ PLARGE_INTEGER FileOffset, 17 _In_ ULONG Length, 18 _In_ BOOLEAN Wait, 19 _In_ ULONG LockKey, 20 _Out_writes_bytes_(Length) PVOID Buffer, 21 _Out_ PIO_STATUS_BLOCK IoStatus, 22 _In_ PDEVICE_OBJECT DeviceObject); 23 24 _Must_inspect_result_ 25 _IRQL_requires_max_(PASSIVE_LEVEL) 26 NTKERNELAPI 27 BOOLEAN 28 NTAPI 29 FsRtlCopyWrite( 30 _In_ PFILE_OBJECT FileObject, 31 _In_ PLARGE_INTEGER FileOffset, 32 _In_ ULONG Length, 33 _In_ BOOLEAN Wait, 34 _In_ ULONG LockKey, 35 _In_reads_bytes_(Length) PVOID Buffer, 36 _Out_ PIO_STATUS_BLOCK IoStatus, 37 _In_ PDEVICE_OBJECT DeviceObject); 38 39 _Must_inspect_result_ 40 _IRQL_requires_max_(APC_LEVEL) 41 NTKERNELAPI 42 BOOLEAN 43 NTAPI 44 FsRtlMdlReadDev( 45 _In_ PFILE_OBJECT FileObject, 46 _In_ PLARGE_INTEGER FileOffset, 47 _In_ ULONG Length, 48 _In_ ULONG LockKey, 49 _Outptr_ PMDL *MdlChain, 50 _Out_ PIO_STATUS_BLOCK IoStatus, 51 _In_opt_ PDEVICE_OBJECT DeviceObject); 52 53 _IRQL_requires_max_(PASSIVE_LEVEL) 54 NTKERNELAPI 55 BOOLEAN 56 NTAPI 57 FsRtlMdlReadCompleteDev( 58 _In_ PFILE_OBJECT FileObject, 59 _In_ PMDL MdlChain, 60 _In_opt_ PDEVICE_OBJECT DeviceObject); 61 62 _Must_inspect_result_ 63 _IRQL_requires_max_(APC_LEVEL) 64 NTKERNELAPI 65 BOOLEAN 66 NTAPI 67 FsRtlPrepareMdlWriteDev( 68 _In_ PFILE_OBJECT FileObject, 69 _In_ PLARGE_INTEGER FileOffset, 70 _In_ ULONG Length, 71 _In_ ULONG LockKey, 72 _Outptr_ PMDL *MdlChain, 73 _Out_ PIO_STATUS_BLOCK IoStatus, 74 _In_ PDEVICE_OBJECT DeviceObject); 75 76 _Must_inspect_result_ 77 _IRQL_requires_max_(PASSIVE_LEVEL) 78 NTKERNELAPI 79 BOOLEAN 80 NTAPI 81 FsRtlMdlWriteCompleteDev( 82 _In_ PFILE_OBJECT FileObject, 83 _In_ PLARGE_INTEGER FileOffset, 84 _In_ PMDL MdlChain, 85 _In_opt_ PDEVICE_OBJECT DeviceObject); 86 87 _IRQL_requires_max_(PASSIVE_LEVEL) 88 NTKERNELAPI 89 VOID 90 NTAPI 91 FsRtlAcquireFileExclusive( 92 _In_ PFILE_OBJECT FileObject); 93 94 _IRQL_requires_max_(APC_LEVEL) 95 NTKERNELAPI 96 VOID 97 NTAPI 98 FsRtlReleaseFile( 99 _In_ PFILE_OBJECT FileObject); 100 101 _Must_inspect_result_ 102 _IRQL_requires_max_(PASSIVE_LEVEL) 103 NTKERNELAPI 104 NTSTATUS 105 NTAPI 106 FsRtlGetFileSize( 107 _In_ PFILE_OBJECT FileObject, 108 _Out_ PLARGE_INTEGER FileSize); 109 110 _Must_inspect_result_ 111 NTKERNELAPI 112 BOOLEAN 113 NTAPI 114 FsRtlIsTotalDeviceFailure( 115 _In_ NTSTATUS Status); 116 117 _Must_inspect_result_ 118 _IRQL_requires_max_(APC_LEVEL) 119 NTKERNELAPI 120 PFILE_LOCK 121 NTAPI 122 FsRtlAllocateFileLock( 123 _In_opt_ PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine, 124 _In_opt_ PUNLOCK_ROUTINE UnlockRoutine); 125 126 _IRQL_requires_max_(APC_LEVEL) 127 NTKERNELAPI 128 VOID 129 NTAPI 130 FsRtlFreeFileLock( 131 _In_ PFILE_LOCK FileLock); 132 133 _IRQL_requires_max_(APC_LEVEL) 134 NTKERNELAPI 135 VOID 136 NTAPI 137 FsRtlInitializeFileLock( 138 _Out_ PFILE_LOCK FileLock, 139 _In_opt_ PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine, 140 _In_opt_ PUNLOCK_ROUTINE UnlockRoutine); 141 142 _IRQL_requires_max_(APC_LEVEL) 143 NTKERNELAPI 144 VOID 145 NTAPI 146 FsRtlUninitializeFileLock( 147 _Inout_ PFILE_LOCK FileLock); 148 149 /* 150 FsRtlProcessFileLock: 151 152 ret: 153 -STATUS_INVALID_DEVICE_REQUEST 154 -STATUS_RANGE_NOT_LOCKED from unlock routines. 155 -STATUS_PENDING, STATUS_LOCK_NOT_GRANTED from FsRtlPrivateLock 156 (redirected IoStatus->Status). 157 158 Internals: 159 -switch ( Irp->CurrentStackLocation->MinorFunction ) 160 lock: return FsRtlPrivateLock; 161 unlocksingle: return FsRtlFastUnlockSingle; 162 unlockall: return FsRtlFastUnlockAll; 163 unlockallbykey: return FsRtlFastUnlockAllByKey; 164 default: IofCompleteRequest with STATUS_INVALID_DEVICE_REQUEST; 165 return STATUS_INVALID_DEVICE_REQUEST; 166 167 -'AllwaysZero' is passed thru as 'AllwaysZero' to lock / unlock routines. 168 -'Irp' is passet thru as 'Irp' to FsRtlPrivateLock. 169 */ 170 _Must_inspect_result_ 171 _IRQL_requires_max_(APC_LEVEL) 172 NTKERNELAPI 173 NTSTATUS 174 NTAPI 175 FsRtlProcessFileLock( 176 _In_ PFILE_LOCK FileLock, 177 _In_ PIRP Irp, 178 _In_opt_ PVOID Context); 179 180 /* 181 FsRtlCheckLockForReadAccess: 182 183 All this really does is pick out the lock parameters from the irp (io stack 184 location?), get IoGetRequestorProcess, and pass values on to 185 FsRtlFastCheckLockForRead. 186 */ 187 _Must_inspect_result_ 188 _IRQL_requires_max_(APC_LEVEL) 189 NTKERNELAPI 190 BOOLEAN 191 NTAPI 192 FsRtlCheckLockForReadAccess( 193 _In_ PFILE_LOCK FileLock, 194 _In_ PIRP Irp); 195 196 /* 197 FsRtlCheckLockForWriteAccess: 198 199 All this really does is pick out the lock parameters from the irp (io stack 200 location?), get IoGetRequestorProcess, and pass values on to 201 FsRtlFastCheckLockForWrite. 202 */ 203 _Must_inspect_result_ 204 _IRQL_requires_max_(APC_LEVEL) 205 NTKERNELAPI 206 BOOLEAN 207 NTAPI 208 FsRtlCheckLockForWriteAccess( 209 _In_ PFILE_LOCK FileLock, 210 _In_ PIRP Irp); 211 212 _Must_inspect_result_ 213 _IRQL_requires_max_(APC_LEVEL) 214 NTKERNELAPI 215 BOOLEAN 216 NTAPI 217 FsRtlFastCheckLockForRead( 218 _In_ PFILE_LOCK FileLock, 219 _In_ PLARGE_INTEGER FileOffset, 220 _In_ PLARGE_INTEGER Length, 221 _In_ ULONG Key, 222 _In_ PFILE_OBJECT FileObject, 223 _In_ PVOID Process); 224 225 _Must_inspect_result_ 226 _IRQL_requires_max_(APC_LEVEL) 227 NTKERNELAPI 228 BOOLEAN 229 NTAPI 230 FsRtlFastCheckLockForWrite( 231 _In_ PFILE_LOCK FileLock, 232 _In_ PLARGE_INTEGER FileOffset, 233 _In_ PLARGE_INTEGER Length, 234 _In_ ULONG Key, 235 _In_ PFILE_OBJECT FileObject, 236 _In_ PVOID Process); 237 238 /* 239 FsRtlGetNextFileLock: 240 241 ret: NULL if no more locks 242 243 Internals: 244 FsRtlGetNextFileLock uses FileLock->LastReturnedLockInfo and 245 FileLock->LastReturnedLock as storage. 246 LastReturnedLock is a pointer to the 'raw' lock inkl. double linked 247 list, and FsRtlGetNextFileLock needs this to get next lock on subsequent 248 calls with Restart = FALSE. 249 */ 250 _Must_inspect_result_ 251 _IRQL_requires_max_(APC_LEVEL) 252 NTKERNELAPI 253 PFILE_LOCK_INFO 254 NTAPI 255 FsRtlGetNextFileLock( 256 _In_ PFILE_LOCK FileLock, 257 _In_ BOOLEAN Restart); 258 259 _IRQL_requires_max_(APC_LEVEL) 260 NTKERNELAPI 261 NTSTATUS 262 NTAPI 263 FsRtlFastUnlockSingle( 264 _In_ PFILE_LOCK FileLock, 265 _In_ PFILE_OBJECT FileObject, 266 _In_ PLARGE_INTEGER FileOffset, 267 _In_ PLARGE_INTEGER Length, 268 _In_ PEPROCESS Process, 269 _In_ ULONG Key, 270 _In_opt_ PVOID Context, 271 _In_ BOOLEAN AlreadySynchronized); 272 273 _IRQL_requires_max_(APC_LEVEL) 274 NTKERNELAPI 275 NTSTATUS 276 NTAPI 277 FsRtlFastUnlockAll( 278 _In_ PFILE_LOCK FileLock, 279 _In_ PFILE_OBJECT FileObject, 280 _In_ PEPROCESS Process, 281 _In_opt_ PVOID Context); 282 283 _IRQL_requires_max_(APC_LEVEL) 284 NTKERNELAPI 285 NTSTATUS 286 NTAPI 287 FsRtlFastUnlockAllByKey( 288 _In_ PFILE_LOCK FileLock, 289 _In_ PFILE_OBJECT FileObject, 290 _In_ PEPROCESS Process, 291 _In_ ULONG Key, 292 _In_opt_ PVOID Context); 293 294 /* 295 FsRtlPrivateLock: 296 297 ret: IoStatus->Status: STATUS_PENDING, STATUS_LOCK_NOT_GRANTED 298 299 Internals: 300 -Calls IoCompleteRequest if Irp 301 -Uses exception handling / ExRaiseStatus with STATUS_INSUFFICIENT_RESOURCES 302 */ 303 _Must_inspect_result_ 304 _IRQL_requires_max_(APC_LEVEL) 305 __drv_preferredFunction(FsRtlFastLock, "Obsolete") 306 NTKERNELAPI 307 BOOLEAN 308 NTAPI 309 FsRtlPrivateLock( 310 _In_ PFILE_LOCK FileLock, 311 _In_ PFILE_OBJECT FileObject, 312 _In_ PLARGE_INTEGER FileOffset, 313 _In_ PLARGE_INTEGER Length, 314 _In_ PEPROCESS Process, 315 _In_ ULONG Key, 316 _In_ BOOLEAN FailImmediately, 317 _In_ BOOLEAN ExclusiveLock, 318 _Out_ PIO_STATUS_BLOCK IoStatus, 319 _In_opt_ PIRP Irp, 320 _In_opt_ __drv_aliasesMem PVOID Context, 321 _In_ BOOLEAN AlreadySynchronized); 322 323 _IRQL_requires_max_(APC_LEVEL) 324 NTKERNELAPI 325 VOID 326 NTAPI 327 FsRtlInitializeTunnelCache( 328 _In_ PTUNNEL Cache); 329 330 _IRQL_requires_max_(APC_LEVEL) 331 NTKERNELAPI 332 VOID 333 NTAPI 334 FsRtlAddToTunnelCache( 335 _In_ PTUNNEL Cache, 336 _In_ ULONGLONG DirectoryKey, 337 _In_ PUNICODE_STRING ShortName, 338 _In_ PUNICODE_STRING LongName, 339 _In_ BOOLEAN KeyByShortName, 340 _In_ ULONG DataLength, 341 _In_reads_bytes_(DataLength) PVOID Data); 342 343 _Must_inspect_result_ 344 _IRQL_requires_max_(APC_LEVEL) 345 NTKERNELAPI 346 BOOLEAN 347 NTAPI 348 FsRtlFindInTunnelCache( 349 _In_ PTUNNEL Cache, 350 _In_ ULONGLONG DirectoryKey, 351 _In_ PUNICODE_STRING Name, 352 _Out_ PUNICODE_STRING ShortName, 353 _Out_ PUNICODE_STRING LongName, 354 _Inout_ PULONG DataLength, 355 _Out_writes_bytes_to_(*DataLength, *DataLength) PVOID Data); 356 357 _IRQL_requires_max_(APC_LEVEL) 358 NTKERNELAPI 359 VOID 360 NTAPI 361 FsRtlDeleteKeyFromTunnelCache( 362 _In_ PTUNNEL Cache, 363 _In_ ULONGLONG DirectoryKey); 364 365 _IRQL_requires_max_(APC_LEVEL) 366 NTKERNELAPI 367 VOID 368 NTAPI 369 FsRtlDeleteTunnelCache( 370 _In_ PTUNNEL Cache); 371 372 _IRQL_requires_max_(APC_LEVEL) 373 NTKERNELAPI 374 VOID 375 NTAPI 376 FsRtlDissectDbcs( 377 _In_ ANSI_STRING Name, 378 _Out_ PANSI_STRING FirstPart, 379 _Out_ PANSI_STRING RemainingPart); 380 381 _Must_inspect_result_ 382 _IRQL_requires_max_(APC_LEVEL) 383 NTKERNELAPI 384 BOOLEAN 385 NTAPI 386 FsRtlDoesDbcsContainWildCards( 387 _In_ PANSI_STRING Name); 388 389 _Must_inspect_result_ 390 _IRQL_requires_max_(APC_LEVEL) 391 NTKERNELAPI 392 BOOLEAN 393 NTAPI 394 FsRtlIsDbcsInExpression( 395 _In_ PANSI_STRING Expression, 396 _In_ PANSI_STRING Name); 397 398 _Must_inspect_result_ 399 _IRQL_requires_max_(APC_LEVEL) 400 NTKERNELAPI 401 BOOLEAN 402 NTAPI 403 FsRtlIsFatDbcsLegal( 404 _In_ ANSI_STRING DbcsName, 405 _In_ BOOLEAN WildCardsPermissible, 406 _In_ BOOLEAN PathNamePermissible, 407 _In_ BOOLEAN LeadingBackslashPermissible); 408 409 _Must_inspect_result_ 410 _IRQL_requires_max_(APC_LEVEL) 411 NTKERNELAPI 412 BOOLEAN 413 NTAPI 414 FsRtlIsHpfsDbcsLegal( 415 _In_ ANSI_STRING DbcsName, 416 _In_ BOOLEAN WildCardsPermissible, 417 _In_ BOOLEAN PathNamePermissible, 418 _In_ BOOLEAN LeadingBackslashPermissible); 419 420 NTKERNELAPI 421 NTSTATUS 422 NTAPI 423 FsRtlNormalizeNtstatus( 424 _In_ NTSTATUS Exception, 425 _In_ NTSTATUS GenericException); 426 427 _Must_inspect_result_ 428 NTKERNELAPI 429 BOOLEAN 430 NTAPI 431 FsRtlIsNtstatusExpected( 432 _In_ NTSTATUS Ntstatus); 433 434 _IRQL_requires_max_(APC_LEVEL) 435 __drv_preferredFunction(ExAllocateFromNPagedLookasideList, "The FsRtlAllocateResource routine is obsolete, but is exported to support existing driver binaries. Use ExAllocateFromNPagedLookasideList and ExInitializeResourceLite instead.") 436 NTKERNELAPI 437 PERESOURCE 438 NTAPI 439 FsRtlAllocateResource(VOID); 440 441 _IRQL_requires_max_(APC_LEVEL) 442 NTKERNELAPI 443 VOID 444 NTAPI 445 FsRtlInitializeLargeMcb( 446 _Out_ PLARGE_MCB Mcb, 447 _In_ POOL_TYPE PoolType); 448 449 _IRQL_requires_max_(APC_LEVEL) 450 NTKERNELAPI 451 VOID 452 NTAPI 453 FsRtlUninitializeLargeMcb( 454 _Inout_ PLARGE_MCB Mcb); 455 456 _IRQL_requires_max_(APC_LEVEL) 457 NTKERNELAPI 458 VOID 459 NTAPI 460 FsRtlResetLargeMcb( 461 _Inout_ PLARGE_MCB Mcb, 462 _In_ BOOLEAN SelfSynchronized); 463 464 _IRQL_requires_max_(APC_LEVEL) 465 NTKERNELAPI 466 VOID 467 NTAPI 468 FsRtlTruncateLargeMcb( 469 _Inout_ PLARGE_MCB Mcb, 470 _In_ LONGLONG Vbn); 471 472 _Must_inspect_result_ 473 _IRQL_requires_max_(APC_LEVEL) 474 NTKERNELAPI 475 BOOLEAN 476 NTAPI 477 FsRtlAddLargeMcbEntry( 478 _Inout_ PLARGE_MCB Mcb, 479 _In_ LONGLONG Vbn, 480 _In_ LONGLONG Lbn, 481 _In_ LONGLONG SectorCount); 482 483 _IRQL_requires_max_(APC_LEVEL) 484 NTKERNELAPI 485 VOID 486 NTAPI 487 FsRtlRemoveLargeMcbEntry( 488 _Inout_ PLARGE_MCB Mcb, 489 _In_ LONGLONG Vbn, 490 _In_ LONGLONG SectorCount); 491 492 _IRQL_requires_max_(APC_LEVEL) 493 NTKERNELAPI 494 BOOLEAN 495 NTAPI 496 FsRtlLookupLargeMcbEntry( 497 _In_ PLARGE_MCB Mcb, 498 _In_ LONGLONG Vbn, 499 _Out_opt_ PLONGLONG Lbn, 500 _Out_opt_ PLONGLONG SectorCountFromLbn, 501 _Out_opt_ PLONGLONG StartingLbn, 502 _Out_opt_ PLONGLONG SectorCountFromStartingLbn, 503 _Out_opt_ PULONG Index); 504 505 _IRQL_requires_max_(APC_LEVEL) 506 NTKERNELAPI 507 BOOLEAN 508 NTAPI 509 FsRtlLookupLastLargeMcbEntry( 510 _In_ PLARGE_MCB Mcb, 511 _Out_ PLONGLONG Vbn, 512 _Out_ PLONGLONG Lbn); 513 514 _IRQL_requires_max_(APC_LEVEL) 515 NTKERNELAPI 516 BOOLEAN 517 NTAPI 518 FsRtlLookupLastLargeMcbEntryAndIndex( 519 _In_ PLARGE_MCB OpaqueMcb, 520 _Out_ PLONGLONG LargeVbn, 521 _Out_ PLONGLONG LargeLbn, 522 _Out_ PULONG Index); 523 524 _IRQL_requires_max_(APC_LEVEL) 525 NTKERNELAPI 526 ULONG 527 NTAPI 528 FsRtlNumberOfRunsInLargeMcb( 529 _In_ PLARGE_MCB Mcb); 530 531 _Must_inspect_result_ 532 _IRQL_requires_max_(APC_LEVEL) 533 NTKERNELAPI 534 BOOLEAN 535 NTAPI 536 FsRtlGetNextLargeMcbEntry( 537 _In_ PLARGE_MCB Mcb, 538 _In_ ULONG RunIndex, 539 _Out_ PLONGLONG Vbn, 540 _Out_ PLONGLONG Lbn, 541 _Out_ PLONGLONG SectorCount); 542 543 _Must_inspect_result_ 544 _IRQL_requires_max_(APC_LEVEL) 545 NTKERNELAPI 546 BOOLEAN 547 NTAPI 548 FsRtlSplitLargeMcb( 549 _Inout_ PLARGE_MCB Mcb, 550 _In_ LONGLONG Vbn, 551 _In_ LONGLONG Amount); 552 553 _IRQL_requires_max_(APC_LEVEL) 554 __drv_preferredFunction(FsRtlInitializeLargeMcb, "Obsolete") 555 NTKERNELAPI 556 VOID 557 NTAPI 558 FsRtlInitializeMcb( 559 _Out_ PMCB Mcb, 560 _In_ POOL_TYPE PoolType); 561 562 _IRQL_requires_max_(APC_LEVEL) 563 NTKERNELAPI 564 VOID 565 NTAPI 566 FsRtlUninitializeMcb( 567 _Inout_ PMCB Mcb); 568 569 _IRQL_requires_max_(APC_LEVEL) 570 NTKERNELAPI 571 VOID 572 NTAPI 573 FsRtlTruncateMcb( 574 _Inout_ PMCB Mcb, 575 _In_ VBN Vbn); 576 577 _IRQL_requires_max_(APC_LEVEL) 578 NTKERNELAPI 579 BOOLEAN 580 NTAPI 581 FsRtlAddMcbEntry( 582 _Inout_ PMCB Mcb, 583 _In_ VBN Vbn, 584 _In_ LBN Lbn, 585 _In_ ULONG SectorCount); 586 587 _IRQL_requires_max_(APC_LEVEL) 588 NTKERNELAPI 589 VOID 590 NTAPI 591 FsRtlRemoveMcbEntry( 592 _Inout_ PMCB Mcb, 593 _In_ VBN Vbn, 594 _In_ ULONG SectorCount); 595 596 _IRQL_requires_max_(APC_LEVEL) 597 NTKERNELAPI 598 BOOLEAN 599 NTAPI 600 FsRtlLookupMcbEntry( 601 _In_ PMCB Mcb, 602 _In_ VBN Vbn, 603 _Out_ PLBN Lbn, 604 _Out_opt_ PULONG SectorCount, 605 _Out_ PULONG Index); 606 607 _IRQL_requires_max_(APC_LEVEL) 608 NTKERNELAPI 609 BOOLEAN 610 NTAPI 611 FsRtlLookupLastMcbEntry( 612 _In_ PMCB Mcb, 613 _Out_ PVBN Vbn, 614 _Out_ PLBN Lbn); 615 616 _IRQL_requires_max_(APC_LEVEL) 617 NTKERNELAPI 618 ULONG 619 NTAPI 620 FsRtlNumberOfRunsInMcb( 621 _In_ PMCB Mcb); 622 623 _Must_inspect_result_ 624 _IRQL_requires_max_(APC_LEVEL) 625 NTKERNELAPI 626 BOOLEAN 627 NTAPI 628 FsRtlGetNextMcbEntry( 629 _In_ PMCB Mcb, 630 _In_ ULONG RunIndex, 631 _Out_ PVBN Vbn, 632 _Out_ PLBN Lbn, 633 _Out_ PULONG SectorCount); 634 635 _IRQL_requires_max_(PASSIVE_LEVEL) 636 NTKERNELAPI 637 NTSTATUS 638 NTAPI 639 FsRtlBalanceReads( 640 _In_ PDEVICE_OBJECT TargetDevice); 641 642 _IRQL_requires_max_(APC_LEVEL) 643 NTKERNELAPI 644 VOID 645 NTAPI 646 FsRtlInitializeOplock( 647 _Inout_ POPLOCK Oplock); 648 649 _IRQL_requires_max_(APC_LEVEL) 650 NTKERNELAPI 651 VOID 652 NTAPI 653 FsRtlUninitializeOplock( 654 _Inout_ POPLOCK Oplock); 655 656 _Must_inspect_result_ 657 _IRQL_requires_max_(APC_LEVEL) 658 NTKERNELAPI 659 NTSTATUS 660 NTAPI 661 FsRtlOplockFsctrl( 662 _In_ POPLOCK Oplock, 663 _In_ PIRP Irp, 664 _In_ ULONG OpenCount); 665 666 _When_(CompletionRoutine != NULL, _Must_inspect_result_) 667 _IRQL_requires_max_(APC_LEVEL) 668 NTKERNELAPI 669 NTSTATUS 670 NTAPI 671 FsRtlCheckOplock( 672 _In_ POPLOCK Oplock, 673 _In_ PIRP Irp, 674 _In_opt_ PVOID Context, 675 _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine, 676 _In_opt_ POPLOCK_FS_PREPOST_IRP PostIrpRoutine); 677 678 _Must_inspect_result_ 679 _IRQL_requires_max_(APC_LEVEL) 680 NTKERNELAPI 681 BOOLEAN 682 NTAPI 683 FsRtlOplockIsFastIoPossible( 684 _In_ POPLOCK Oplock); 685 686 _Must_inspect_result_ 687 _IRQL_requires_max_(APC_LEVEL) 688 NTKERNELAPI 689 BOOLEAN 690 NTAPI 691 FsRtlCurrentBatchOplock( 692 _In_ POPLOCK Oplock); 693 694 _IRQL_requires_max_(APC_LEVEL) 695 NTKERNELAPI 696 NTSTATUS 697 NTAPI 698 FsRtlNotifyVolumeEvent( 699 _In_ PFILE_OBJECT FileObject, 700 _In_ ULONG EventCode); 701 702 _IRQL_requires_max_(APC_LEVEL) 703 NTKERNELAPI 704 VOID 705 NTAPI 706 FsRtlNotifyInitializeSync( 707 _In_ PNOTIFY_SYNC *NotifySync); 708 709 _IRQL_requires_max_(APC_LEVEL) 710 NTKERNELAPI 711 VOID 712 NTAPI 713 FsRtlNotifyUninitializeSync( 714 _In_ PNOTIFY_SYNC *NotifySync); 715 716 _IRQL_requires_max_(PASSIVE_LEVEL) 717 NTKERNELAPI 718 VOID 719 NTAPI 720 FsRtlNotifyFullChangeDirectory( 721 _In_ PNOTIFY_SYNC NotifySync, 722 _In_ PLIST_ENTRY NotifyList, 723 _In_ PVOID FsContext, 724 _In_ PSTRING FullDirectoryName, 725 _In_ BOOLEAN WatchTree, 726 _In_ BOOLEAN IgnoreBuffer, 727 _In_ ULONG CompletionFilter, 728 _In_opt_ PIRP NotifyIrp, 729 _In_opt_ PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback, 730 _In_opt_ PSECURITY_SUBJECT_CONTEXT SubjectContext); 731 732 _IRQL_requires_max_(PASSIVE_LEVEL) 733 NTKERNELAPI 734 VOID 735 NTAPI 736 FsRtlNotifyFilterReportChange( 737 _In_ PNOTIFY_SYNC NotifySync, 738 _In_ PLIST_ENTRY NotifyList, 739 _In_ PSTRING FullTargetName, 740 _In_ USHORT TargetNameOffset, 741 _In_opt_ PSTRING StreamName, 742 _In_opt_ PSTRING NormalizedParentName, 743 _In_ ULONG FilterMatch, 744 _In_ ULONG Action, 745 _In_opt_ PVOID TargetContext, 746 _In_opt_ PVOID FilterContext); 747 748 _IRQL_requires_max_(PASSIVE_LEVEL) 749 NTKERNELAPI 750 VOID 751 NTAPI 752 FsRtlNotifyFullReportChange( 753 _In_ PNOTIFY_SYNC NotifySync, 754 _In_ PLIST_ENTRY NotifyList, 755 _In_ PSTRING FullTargetName, 756 _In_ USHORT TargetNameOffset, 757 _In_opt_ PSTRING StreamName, 758 _In_opt_ PSTRING NormalizedParentName, 759 _In_ ULONG FilterMatch, 760 _In_ ULONG Action, 761 _In_opt_ PVOID TargetContext); 762 763 _IRQL_requires_max_(APC_LEVEL) 764 NTKERNELAPI 765 VOID 766 NTAPI 767 FsRtlNotifyCleanup( 768 _In_ PNOTIFY_SYNC NotifySync, 769 _In_ PLIST_ENTRY NotifyList, 770 _In_ PVOID FsContext); 771 772 _IRQL_requires_max_(PASSIVE_LEVEL) 773 NTKERNELAPI 774 VOID 775 NTAPI 776 FsRtlDissectName( 777 _In_ UNICODE_STRING Name, 778 _Out_ PUNICODE_STRING FirstPart, 779 _Out_ PUNICODE_STRING RemainingPart); 780 781 _Must_inspect_result_ 782 _IRQL_requires_max_(PASSIVE_LEVEL) 783 NTKERNELAPI 784 BOOLEAN 785 NTAPI 786 FsRtlDoesNameContainWildCards( 787 _In_ PUNICODE_STRING Name); 788 789 _Must_inspect_result_ 790 _IRQL_requires_max_(PASSIVE_LEVEL) 791 NTKERNELAPI 792 BOOLEAN 793 NTAPI 794 FsRtlAreNamesEqual( 795 _In_ PCUNICODE_STRING Name1, 796 _In_ PCUNICODE_STRING Name2, 797 _In_ BOOLEAN IgnoreCase, 798 _In_reads_opt_(0x10000) PCWCH UpcaseTable); 799 800 _Must_inspect_result_ 801 _IRQL_requires_max_(PASSIVE_LEVEL) 802 NTKERNELAPI 803 BOOLEAN 804 NTAPI 805 FsRtlIsNameInExpression( 806 _In_ PUNICODE_STRING Expression, 807 _In_ PUNICODE_STRING Name, 808 _In_ BOOLEAN IgnoreCase, 809 _In_opt_ PWCHAR UpcaseTable); 810 811 _IRQL_requires_max_(DISPATCH_LEVEL) 812 NTKERNELAPI 813 VOID 814 NTAPI 815 FsRtlPostPagingFileStackOverflow( 816 _In_ PVOID Context, 817 _In_ PKEVENT Event, 818 _In_ PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine); 819 820 _IRQL_requires_max_(DISPATCH_LEVEL) 821 NTKERNELAPI 822 VOID 823 NTAPI 824 FsRtlPostStackOverflow ( 825 _In_ PVOID Context, 826 _In_ PKEVENT Event, 827 _In_ PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine); 828 829 _Must_inspect_result_ 830 _IRQL_requires_max_(PASSIVE_LEVEL) 831 NTKERNELAPI 832 NTSTATUS 833 NTAPI 834 FsRtlRegisterUncProvider( 835 _Out_ PHANDLE MupHandle, 836 _In_ PCUNICODE_STRING RedirectorDeviceName, 837 _In_ BOOLEAN MailslotsSupported); 838 839 _IRQL_requires_max_(PASSIVE_LEVEL) 840 NTKERNELAPI 841 VOID 842 NTAPI 843 FsRtlDeregisterUncProvider( 844 _In_ HANDLE Handle); 845 846 _IRQL_requires_max_(APC_LEVEL) 847 NTKERNELAPI 848 VOID 849 NTAPI 850 FsRtlTeardownPerStreamContexts( 851 _In_ PFSRTL_ADVANCED_FCB_HEADER AdvancedHeader); 852 853 _Must_inspect_result_ 854 _IRQL_requires_max_(APC_LEVEL) 855 NTKERNELAPI 856 NTSTATUS 857 NTAPI 858 FsRtlCreateSectionForDataScan( 859 _Out_ PHANDLE SectionHandle, 860 _Outptr_ PVOID *SectionObject, 861 _Out_opt_ PLARGE_INTEGER SectionFileSize, 862 _In_ PFILE_OBJECT FileObject, 863 _In_ ACCESS_MASK DesiredAccess, 864 _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes, 865 _In_opt_ PLARGE_INTEGER MaximumSize, 866 _In_ ULONG SectionPageProtection, 867 _In_ ULONG AllocationAttributes, 868 _In_ ULONG Flags); 869 870 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ 871 872 #if (NTDDI_VERSION >= NTDDI_WINXP) 873 874 _IRQL_requires_max_(PASSIVE_LEVEL) 875 NTKERNELAPI 876 VOID 877 NTAPI 878 FsRtlNotifyFilterChangeDirectory( 879 _In_ PNOTIFY_SYNC NotifySync, 880 _In_ PLIST_ENTRY NotifyList, 881 _In_ PVOID FsContext, 882 _In_ PSTRING FullDirectoryName, 883 _In_ BOOLEAN WatchTree, 884 _In_ BOOLEAN IgnoreBuffer, 885 _In_ ULONG CompletionFilter, 886 _In_opt_ PIRP NotifyIrp, 887 _In_opt_ PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback, 888 _In_opt_ PSECURITY_SUBJECT_CONTEXT SubjectContext, 889 _In_opt_ PFILTER_REPORT_CHANGE FilterCallback); 890 891 _Must_inspect_result_ 892 _IRQL_requires_max_(APC_LEVEL) 893 NTKERNELAPI 894 NTSTATUS 895 NTAPI 896 FsRtlInsertPerStreamContext( 897 _In_ PFSRTL_ADVANCED_FCB_HEADER PerStreamContext, 898 _In_ PFSRTL_PER_STREAM_CONTEXT Ptr); 899 900 _Must_inspect_result_ 901 _IRQL_requires_max_(APC_LEVEL) 902 NTKERNELAPI 903 PFSRTL_PER_STREAM_CONTEXT 904 NTAPI 905 FsRtlLookupPerStreamContextInternal( 906 _In_ PFSRTL_ADVANCED_FCB_HEADER StreamContext, 907 _In_opt_ PVOID OwnerId, 908 _In_opt_ PVOID InstanceId); 909 910 _Must_inspect_result_ 911 _IRQL_requires_max_(APC_LEVEL) 912 NTKERNELAPI 913 PFSRTL_PER_STREAM_CONTEXT 914 NTAPI 915 FsRtlRemovePerStreamContext( 916 _In_ PFSRTL_ADVANCED_FCB_HEADER StreamContext, 917 _In_opt_ PVOID OwnerId, 918 _In_opt_ PVOID InstanceId); 919 920 NTKERNELAPI 921 VOID 922 NTAPI 923 FsRtlIncrementCcFastReadNotPossible( 924 VOID); 925 926 NTKERNELAPI 927 VOID 928 NTAPI 929 FsRtlIncrementCcFastReadWait(VOID); 930 931 NTKERNELAPI 932 VOID 933 NTAPI 934 FsRtlIncrementCcFastReadNoWait(VOID); 935 936 NTKERNELAPI 937 VOID 938 NTAPI 939 FsRtlIncrementCcFastReadResourceMiss(VOID); 940 941 _IRQL_requires_max_(APC_LEVEL) 942 NTKERNELAPI 943 LOGICAL 944 NTAPI 945 FsRtlIsPagingFile( 946 _In_ PFILE_OBJECT FileObject); 947 948 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ 949 950 #if (NTDDI_VERSION >= NTDDI_WS03) 951 952 _IRQL_requires_max_(APC_LEVEL) 953 NTKERNELAPI 954 VOID 955 NTAPI 956 FsRtlInitializeBaseMcb( 957 _Out_ PBASE_MCB Mcb, 958 _In_ POOL_TYPE PoolType); 959 960 _IRQL_requires_max_(APC_LEVEL) 961 NTKERNELAPI 962 VOID 963 NTAPI 964 FsRtlUninitializeBaseMcb( 965 _In_ PBASE_MCB Mcb); 966 967 _IRQL_requires_max_(APC_LEVEL) 968 NTKERNELAPI 969 VOID 970 NTAPI 971 FsRtlResetBaseMcb( 972 _Out_ PBASE_MCB Mcb); 973 974 _IRQL_requires_max_(APC_LEVEL) 975 NTKERNELAPI 976 VOID 977 NTAPI 978 FsRtlTruncateBaseMcb( 979 _Inout_ PBASE_MCB Mcb, 980 _In_ LONGLONG Vbn); 981 982 _IRQL_requires_max_(APC_LEVEL) 983 NTKERNELAPI 984 BOOLEAN 985 NTAPI 986 FsRtlAddBaseMcbEntry( 987 _Inout_ PBASE_MCB Mcb, 988 _In_ LONGLONG Vbn, 989 _In_ LONGLONG Lbn, 990 _In_ LONGLONG SectorCount); 991 992 _IRQL_requires_max_(APC_LEVEL) 993 NTKERNELAPI 994 BOOLEAN 995 NTAPI 996 FsRtlRemoveBaseMcbEntry( 997 _Inout_ PBASE_MCB Mcb, 998 _In_ LONGLONG Vbn, 999 _In_ LONGLONG SectorCount); 1000 1001 _IRQL_requires_max_(APC_LEVEL) 1002 NTKERNELAPI 1003 BOOLEAN 1004 NTAPI 1005 FsRtlLookupBaseMcbEntry( 1006 _In_ PBASE_MCB Mcb, 1007 _In_ LONGLONG Vbn, 1008 _Out_opt_ PLONGLONG Lbn, 1009 _Out_opt_ PLONGLONG SectorCountFromLbn, 1010 _Out_opt_ PLONGLONG StartingLbn, 1011 _Out_opt_ PLONGLONG SectorCountFromStartingLbn, 1012 _Out_opt_ PULONG Index); 1013 1014 _IRQL_requires_max_(APC_LEVEL) 1015 NTKERNELAPI 1016 BOOLEAN 1017 NTAPI 1018 FsRtlLookupLastBaseMcbEntry( 1019 _In_ PBASE_MCB Mcb, 1020 _Out_ PLONGLONG Vbn, 1021 _Out_ PLONGLONG Lbn); 1022 1023 _IRQL_requires_max_(APC_LEVEL) 1024 NTKERNELAPI 1025 BOOLEAN 1026 NTAPI 1027 FsRtlLookupLastBaseMcbEntryAndIndex( 1028 _In_ PBASE_MCB OpaqueMcb, 1029 _Inout_ PLONGLONG LargeVbn, 1030 _Inout_ PLONGLONG LargeLbn, 1031 _Inout_ PULONG Index); 1032 1033 _IRQL_requires_max_(APC_LEVEL) 1034 NTKERNELAPI 1035 ULONG 1036 NTAPI 1037 FsRtlNumberOfRunsInBaseMcb( 1038 _In_ PBASE_MCB Mcb); 1039 1040 _IRQL_requires_max_(APC_LEVEL) 1041 NTKERNELAPI 1042 BOOLEAN 1043 NTAPI 1044 FsRtlGetNextBaseMcbEntry( 1045 _In_ PBASE_MCB Mcb, 1046 _In_ ULONG RunIndex, 1047 _Out_ PLONGLONG Vbn, 1048 _Out_ PLONGLONG Lbn, 1049 _Out_ PLONGLONG SectorCount); 1050 1051 _IRQL_requires_max_(APC_LEVEL) 1052 NTKERNELAPI 1053 BOOLEAN 1054 NTAPI 1055 FsRtlSplitBaseMcb( 1056 _Inout_ PBASE_MCB Mcb, 1057 _In_ LONGLONG Vbn, 1058 _In_ LONGLONG Amount); 1059 1060 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */ 1061 1062 #if (NTDDI_VERSION >= NTDDI_VISTA) 1063 1064 _When_(!Flags & MCB_FLAG_RAISE_ON_ALLOCATION_FAILURE, _Must_inspect_result_) 1065 _IRQL_requires_max_(APC_LEVEL) 1066 BOOLEAN 1067 NTAPI 1068 FsRtlInitializeBaseMcbEx( 1069 _Out_ PBASE_MCB Mcb, 1070 _In_ POOL_TYPE PoolType, 1071 _In_ USHORT Flags); 1072 1073 _Must_inspect_result_ 1074 _IRQL_requires_max_(APC_LEVEL) 1075 NTSTATUS 1076 NTAPI 1077 FsRtlAddBaseMcbEntryEx( 1078 _Inout_ PBASE_MCB Mcb, 1079 _In_ LONGLONG Vbn, 1080 _In_ LONGLONG Lbn, 1081 _In_ LONGLONG SectorCount); 1082 1083 _Must_inspect_result_ 1084 _IRQL_requires_max_(APC_LEVEL) 1085 NTKERNELAPI 1086 BOOLEAN 1087 NTAPI 1088 FsRtlCurrentOplock( 1089 _In_ POPLOCK Oplock); 1090 1091 _Must_inspect_result_ 1092 _IRQL_requires_max_(APC_LEVEL) 1093 NTKERNELAPI 1094 NTSTATUS 1095 NTAPI 1096 FsRtlOplockBreakToNone( 1097 _Inout_ POPLOCK Oplock, 1098 _In_opt_ PIO_STACK_LOCATION IrpSp, 1099 _In_ PIRP Irp, 1100 _In_opt_ PVOID Context, 1101 _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine, 1102 _In_opt_ POPLOCK_FS_PREPOST_IRP PostIrpRoutine); 1103 1104 _IRQL_requires_max_(DISPATCH_LEVEL) 1105 NTKERNELAPI 1106 NTSTATUS 1107 NTAPI 1108 FsRtlNotifyVolumeEventEx( 1109 _In_ PFILE_OBJECT FileObject, 1110 _In_ ULONG EventCode, 1111 _In_ PTARGET_DEVICE_CUSTOM_NOTIFICATION Event); 1112 1113 _IRQL_requires_max_(APC_LEVEL) 1114 NTKERNELAPI 1115 VOID 1116 NTAPI 1117 FsRtlNotifyCleanupAll( 1118 _In_ PNOTIFY_SYNC NotifySync, 1119 _In_ PLIST_ENTRY NotifyList); 1120 1121 _Must_inspect_result_ 1122 _IRQL_requires_max_(PASSIVE_LEVEL) 1123 NTSTATUS 1124 NTAPI 1125 FsRtlRegisterUncProviderEx( 1126 _Out_ PHANDLE MupHandle, 1127 _In_ PUNICODE_STRING RedirDevName, 1128 _In_ PDEVICE_OBJECT DeviceObject, 1129 _In_ ULONG Flags); 1130 1131 _Must_inspect_result_ 1132 _When_(Irp!=NULL, _IRQL_requires_max_(PASSIVE_LEVEL)) 1133 _When_(Irp==NULL, _IRQL_requires_max_(APC_LEVEL)) 1134 NTKERNELAPI 1135 NTSTATUS 1136 NTAPI 1137 FsRtlCancellableWaitForSingleObject( 1138 _In_ PVOID Object, 1139 _In_opt_ PLARGE_INTEGER Timeout, 1140 _In_opt_ PIRP Irp); 1141 1142 _Must_inspect_result_ 1143 _When_(Irp != NULL, _IRQL_requires_max_(PASSIVE_LEVEL)) 1144 _When_(Irp == NULL, _IRQL_requires_max_(APC_LEVEL)) 1145 NTKERNELAPI 1146 NTSTATUS 1147 NTAPI 1148 FsRtlCancellableWaitForMultipleObjects( 1149 _In_ ULONG Count, 1150 _In_reads_(Count) PVOID ObjectArray[], 1151 _In_ WAIT_TYPE WaitType, 1152 _In_opt_ PLARGE_INTEGER Timeout, 1153 _In_opt_ PKWAIT_BLOCK WaitBlockArray, 1154 _In_opt_ PIRP Irp); 1155 1156 _Must_inspect_result_ 1157 _IRQL_requires_max_(APC_LEVEL) 1158 NTKERNELAPI 1159 NTSTATUS 1160 NTAPI 1161 FsRtlMupGetProviderInfoFromFileObject( 1162 _In_ PFILE_OBJECT pFileObject, 1163 _In_ ULONG Level, 1164 _Out_writes_bytes_(*pBufferSize) PVOID pBuffer, 1165 _Inout_ PULONG pBufferSize); 1166 1167 _Must_inspect_result_ 1168 _IRQL_requires_max_(APC_LEVEL) 1169 NTKERNELAPI 1170 NTSTATUS 1171 NTAPI 1172 FsRtlMupGetProviderIdFromName( 1173 _In_ PUNICODE_STRING pProviderName, 1174 _Out_ PULONG32 pProviderId); 1175 1176 NTKERNELAPI 1177 VOID 1178 NTAPI 1179 FsRtlIncrementCcFastMdlReadWait(VOID); 1180 1181 _Must_inspect_result_ 1182 _IRQL_requires_max_(PASSIVE_LEVEL) 1183 NTKERNELAPI 1184 NTSTATUS 1185 NTAPI 1186 FsRtlValidateReparsePointBuffer( 1187 _In_ ULONG BufferLength, 1188 _In_reads_bytes_(BufferLength) PREPARSE_DATA_BUFFER ReparseBuffer); 1189 1190 _Must_inspect_result_ 1191 _IRQL_requires_max_(PASSIVE_LEVEL) 1192 NTKERNELAPI 1193 NTSTATUS 1194 NTAPI 1195 FsRtlRemoveDotsFromPath( 1196 _Inout_updates_bytes_(PathLength) PWSTR OriginalString, 1197 _In_ USHORT PathLength, 1198 _Out_ USHORT *NewLength); 1199 1200 _Must_inspect_result_ 1201 _IRQL_requires_max_(APC_LEVEL) 1202 NTKERNELAPI 1203 NTSTATUS 1204 NTAPI 1205 FsRtlAllocateExtraCreateParameterList( 1206 _In_ FSRTL_ALLOCATE_ECPLIST_FLAGS Flags, 1207 _Outptr_ PECP_LIST *EcpList); 1208 1209 _IRQL_requires_max_(APC_LEVEL) 1210 NTKERNELAPI 1211 VOID 1212 NTAPI 1213 FsRtlFreeExtraCreateParameterList( 1214 _In_ PECP_LIST EcpList); 1215 1216 _Must_inspect_result_ 1217 _IRQL_requires_max_(APC_LEVEL) 1218 NTKERNELAPI 1219 NTSTATUS 1220 NTAPI 1221 FsRtlAllocateExtraCreateParameter( 1222 _In_ LPCGUID EcpType, 1223 _In_ ULONG SizeOfContext, 1224 _In_ FSRTL_ALLOCATE_ECP_FLAGS Flags, 1225 _In_opt_ PFSRTL_EXTRA_CREATE_PARAMETER_CLEANUP_CALLBACK CleanupCallback, 1226 _In_ ULONG PoolTag, 1227 _Outptr_result_bytebuffer_(SizeOfContext) PVOID *EcpContext); 1228 1229 _IRQL_requires_max_(APC_LEVEL) 1230 NTKERNELAPI 1231 VOID 1232 NTAPI 1233 FsRtlFreeExtraCreateParameter( 1234 _In_ PVOID EcpContext); 1235 1236 _When_(Flags|FSRTL_ECP_LOOKASIDE_FLAG_NONPAGED_POOL, _IRQL_requires_max_(DISPATCH_LEVEL)) 1237 _When_(!(Flags|FSRTL_ECP_LOOKASIDE_FLAG_NONPAGED_POOL), _IRQL_requires_max_(APC_LEVEL)) 1238 NTKERNELAPI 1239 VOID 1240 NTAPI 1241 FsRtlInitExtraCreateParameterLookasideList( 1242 _Inout_ PVOID Lookaside, 1243 _In_ FSRTL_ECP_LOOKASIDE_FLAGS Flags, 1244 _In_ SIZE_T Size, 1245 _In_ ULONG Tag); 1246 1247 _When_(Flags|FSRTL_ECP_LOOKASIDE_FLAG_NONPAGED_POOL, _IRQL_requires_max_(DISPATCH_LEVEL)) 1248 _When_(!(Flags|FSRTL_ECP_LOOKASIDE_FLAG_NONPAGED_POOL), _IRQL_requires_max_(APC_LEVEL)) 1249 VOID 1250 NTAPI 1251 FsRtlDeleteExtraCreateParameterLookasideList( 1252 _Inout_ PVOID Lookaside, 1253 _In_ FSRTL_ECP_LOOKASIDE_FLAGS Flags); 1254 1255 _Must_inspect_result_ 1256 _IRQL_requires_max_(APC_LEVEL) 1257 NTKERNELAPI 1258 NTSTATUS 1259 NTAPI 1260 FsRtlAllocateExtraCreateParameterFromLookasideList( 1261 _In_ LPCGUID EcpType, 1262 ULONG SizeOfContext, 1263 _In_ FSRTL_ALLOCATE_ECP_FLAGS Flags, 1264 _In_opt_ PFSRTL_EXTRA_CREATE_PARAMETER_CLEANUP_CALLBACK CleanupCallback, 1265 _Inout_ PVOID LookasideList, 1266 _Outptr_ PVOID *EcpContext); 1267 1268 _Must_inspect_result_ 1269 _IRQL_requires_max_(APC_LEVEL) 1270 NTKERNELAPI 1271 NTSTATUS 1272 NTAPI 1273 FsRtlInsertExtraCreateParameter( 1274 _Inout_ PECP_LIST EcpList, 1275 _Inout_ PVOID EcpContext); 1276 1277 _Must_inspect_result_ 1278 _IRQL_requires_max_(APC_LEVEL) 1279 NTKERNELAPI 1280 NTSTATUS 1281 NTAPI 1282 FsRtlFindExtraCreateParameter( 1283 _In_ PECP_LIST EcpList, 1284 _In_ LPCGUID EcpType, 1285 _Outptr_opt_ PVOID *EcpContext, 1286 _Out_opt_ ULONG *EcpContextSize); 1287 1288 _Must_inspect_result_ 1289 _IRQL_requires_max_(APC_LEVEL) 1290 NTKERNELAPI 1291 NTSTATUS 1292 NTAPI 1293 FsRtlRemoveExtraCreateParameter( 1294 _Inout_ PECP_LIST EcpList, 1295 _In_ LPCGUID EcpType, 1296 _Outptr_ PVOID *EcpContext, 1297 _Out_opt_ ULONG *EcpContextSize); 1298 1299 _Must_inspect_result_ 1300 _IRQL_requires_max_(APC_LEVEL) 1301 NTKERNELAPI 1302 NTSTATUS 1303 NTAPI 1304 FsRtlGetEcpListFromIrp( 1305 _In_ PIRP Irp, 1306 _Outptr_result_maybenull_ PECP_LIST *EcpList); 1307 1308 _Must_inspect_result_ 1309 _IRQL_requires_max_(APC_LEVEL) 1310 NTKERNELAPI 1311 NTSTATUS 1312 NTAPI 1313 FsRtlSetEcpListIntoIrp( 1314 _Inout_ PIRP Irp, 1315 _In_ PECP_LIST EcpList); 1316 1317 _Must_inspect_result_ 1318 _IRQL_requires_max_(APC_LEVEL) 1319 NTKERNELAPI 1320 NTSTATUS 1321 NTAPI 1322 FsRtlGetNextExtraCreateParameter( 1323 _In_ PECP_LIST EcpList, 1324 _In_opt_ PVOID CurrentEcpContext, 1325 _Out_opt_ LPGUID NextEcpType, 1326 _Outptr_opt_ PVOID *NextEcpContext, 1327 _Out_opt_ ULONG *NextEcpContextSize); 1328 1329 _IRQL_requires_max_(APC_LEVEL) 1330 NTKERNELAPI 1331 VOID 1332 NTAPI 1333 FsRtlAcknowledgeEcp( 1334 _In_ PVOID EcpContext); 1335 1336 _IRQL_requires_max_(APC_LEVEL) 1337 NTKERNELAPI 1338 BOOLEAN 1339 NTAPI 1340 FsRtlIsEcpAcknowledged( 1341 _In_ PVOID EcpContext); 1342 1343 _IRQL_requires_max_(APC_LEVEL) 1344 NTKERNELAPI 1345 BOOLEAN 1346 NTAPI 1347 FsRtlIsEcpFromUserMode( 1348 _In_ PVOID EcpContext); 1349 1350 _Must_inspect_result_ 1351 _IRQL_requires_max_(PASSIVE_LEVEL) 1352 NTKERNELAPI 1353 NTSTATUS 1354 NTAPI 1355 FsRtlChangeBackingFileObject( 1356 _In_opt_ PFILE_OBJECT CurrentFileObject, 1357 _In_ PFILE_OBJECT NewFileObject, 1358 _In_ FSRTL_CHANGE_BACKING_TYPE ChangeBackingType, 1359 _In_ ULONG Flags); 1360 1361 _Must_inspect_result_ 1362 _IRQL_requires_max_(APC_LEVEL) 1363 NTKERNELAPI 1364 NTSTATUS 1365 NTAPI 1366 FsRtlLogCcFlushError( 1367 _In_ PUNICODE_STRING FileName, 1368 _In_ PDEVICE_OBJECT DeviceObject, 1369 _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer, 1370 _In_ NTSTATUS FlushError, 1371 _In_ ULONG Flags); 1372 1373 _IRQL_requires_max_(APC_LEVEL) 1374 NTKERNELAPI 1375 BOOLEAN 1376 NTAPI 1377 FsRtlAreVolumeStartupApplicationsComplete(VOID); 1378 1379 NTKERNELAPI 1380 ULONG 1381 NTAPI 1382 FsRtlQueryMaximumVirtualDiskNestingLevel(VOID); 1383 1384 NTKERNELAPI 1385 NTSTATUS 1386 NTAPI 1387 FsRtlGetVirtualDiskNestingLevel( 1388 _In_ PDEVICE_OBJECT DeviceObject, 1389 _Out_ PULONG NestingLevel, 1390 _Out_opt_ PULONG NestingFlags); 1391 1392 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ 1393 1394 #if (NTDDI_VERSION >= NTDDI_VISTASP1) 1395 _When_(Flags | OPLOCK_FLAG_BACK_OUT_ATOMIC_OPLOCK, _Must_inspect_result_) 1396 _IRQL_requires_max_(APC_LEVEL) 1397 NTKERNELAPI 1398 NTSTATUS 1399 NTAPI 1400 FsRtlCheckOplockEx( 1401 _In_ POPLOCK Oplock, 1402 _In_ PIRP Irp, 1403 _In_ ULONG Flags, 1404 _In_opt_ PVOID Context, 1405 _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine, 1406 _In_opt_ POPLOCK_FS_PREPOST_IRP PostIrpRoutine); 1407 1408 #endif 1409 1410 #if (NTDDI_VERSION >= NTDDI_WIN7) 1411 1412 _IRQL_requires_max_(APC_LEVEL) 1413 NTKERNELAPI 1414 BOOLEAN 1415 NTAPI 1416 FsRtlAreThereCurrentOrInProgressFileLocks( 1417 _In_ PFILE_LOCK FileLock); 1418 1419 _Must_inspect_result_ 1420 _IRQL_requires_max_(APC_LEVEL) 1421 NTKERNELAPI 1422 BOOLEAN 1423 NTAPI 1424 FsRtlOplockIsSharedRequest( 1425 _In_ PIRP Irp); 1426 1427 _Must_inspect_result_ 1428 _IRQL_requires_max_(APC_LEVEL) 1429 NTKERNELAPI 1430 NTSTATUS 1431 NTAPI 1432 FsRtlOplockBreakH( 1433 _In_ POPLOCK Oplock, 1434 _In_ PIRP Irp, 1435 _In_ ULONG Flags, 1436 _In_opt_ PVOID Context, 1437 _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine, 1438 _In_opt_ POPLOCK_FS_PREPOST_IRP PostIrpRoutine); 1439 1440 _IRQL_requires_max_(APC_LEVEL) 1441 NTKERNELAPI 1442 BOOLEAN 1443 NTAPI 1444 FsRtlCurrentOplockH( 1445 _In_ POPLOCK Oplock); 1446 1447 _Must_inspect_result_ 1448 _IRQL_requires_max_(APC_LEVEL) 1449 NTKERNELAPI 1450 NTSTATUS 1451 NTAPI 1452 FsRtlOplockBreakToNoneEx( 1453 _Inout_ POPLOCK Oplock, 1454 _In_ PIRP Irp, 1455 _In_ ULONG Flags, 1456 _In_opt_ PVOID Context, 1457 _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine, 1458 _In_opt_ POPLOCK_FS_PREPOST_IRP PostIrpRoutine); 1459 1460 _Must_inspect_result_ 1461 _IRQL_requires_max_(APC_LEVEL) 1462 NTKERNELAPI 1463 NTSTATUS 1464 NTAPI 1465 FsRtlOplockFsctrlEx( 1466 _In_ POPLOCK Oplock, 1467 _In_ PIRP Irp, 1468 _In_ ULONG OpenCount, 1469 _In_ ULONG Flags); 1470 1471 _IRQL_requires_max_(APC_LEVEL) 1472 NTKERNELAPI 1473 BOOLEAN 1474 NTAPI 1475 FsRtlOplockKeysEqual( 1476 _In_opt_ PFILE_OBJECT Fo1, 1477 _In_opt_ PFILE_OBJECT Fo2); 1478 1479 NTKERNELAPI 1480 NTSTATUS 1481 NTAPI 1482 FsRtlInitializeExtraCreateParameterList( 1483 _Inout_ PECP_LIST EcpList); 1484 1485 NTKERNELAPI 1486 VOID 1487 NTAPI 1488 FsRtlInitializeExtraCreateParameter( 1489 _Out_ PECP_HEADER Ecp, 1490 _In_ ULONG EcpFlags, 1491 _In_opt_ PFSRTL_EXTRA_CREATE_PARAMETER_CLEANUP_CALLBACK CleanupCallback, 1492 _In_ ULONG TotalSize, 1493 _In_ LPCGUID EcpType, 1494 _In_opt_ PVOID ListAllocatedFrom); 1495 1496 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */ 1497 1498 _Must_inspect_result_ 1499 _IRQL_requires_max_(APC_LEVEL) 1500 NTKERNELAPI 1501 NTSTATUS 1502 NTAPI 1503 FsRtlInsertPerFileContext( 1504 _In_ PVOID* PerFileContextPointer, 1505 _In_ PFSRTL_PER_FILE_CONTEXT Ptr); 1506 1507 _Must_inspect_result_ 1508 _IRQL_requires_max_(APC_LEVEL) 1509 NTKERNELAPI 1510 PFSRTL_PER_FILE_CONTEXT 1511 NTAPI 1512 FsRtlLookupPerFileContext( 1513 _In_ PVOID* PerFileContextPointer, 1514 _In_opt_ PVOID OwnerId, 1515 _In_opt_ PVOID InstanceId); 1516 1517 _Must_inspect_result_ 1518 _IRQL_requires_max_(APC_LEVEL) 1519 NTKERNELAPI 1520 PFSRTL_PER_FILE_CONTEXT 1521 NTAPI 1522 FsRtlRemovePerFileContext( 1523 _In_ PVOID* PerFileContextPointer, 1524 _In_opt_ PVOID OwnerId, 1525 _In_opt_ PVOID InstanceId); 1526 1527 _IRQL_requires_max_(APC_LEVEL) 1528 NTKERNELAPI 1529 VOID 1530 NTAPI 1531 FsRtlTeardownPerFileContexts( 1532 _In_ PVOID* PerFileContextPointer); 1533 1534 _Must_inspect_result_ 1535 _IRQL_requires_max_(APC_LEVEL) 1536 NTKERNELAPI 1537 NTSTATUS 1538 NTAPI 1539 FsRtlInsertPerFileObjectContext( 1540 _In_ PFILE_OBJECT FileObject, 1541 _In_ PFSRTL_PER_FILEOBJECT_CONTEXT Ptr); 1542 1543 _Must_inspect_result_ 1544 _IRQL_requires_max_(APC_LEVEL) 1545 NTKERNELAPI 1546 PFSRTL_PER_FILEOBJECT_CONTEXT 1547 NTAPI 1548 FsRtlLookupPerFileObjectContext( 1549 _In_ PFILE_OBJECT FileObject, 1550 _In_opt_ PVOID OwnerId, 1551 _In_opt_ PVOID InstanceId); 1552 1553 _Must_inspect_result_ 1554 _IRQL_requires_max_(APC_LEVEL) 1555 NTKERNELAPI 1556 PFSRTL_PER_FILEOBJECT_CONTEXT 1557 NTAPI 1558 FsRtlRemovePerFileObjectContext( 1559 _In_ PFILE_OBJECT FileObject, 1560 _In_opt_ PVOID OwnerId, 1561 _In_opt_ PVOID InstanceId); 1562 1563 NTKERNELAPI 1564 NTSTATUS 1565 NTAPI 1566 FsRtlRegisterFileSystemFilterCallbacks( 1567 _In_ struct _DRIVER_OBJECT *FilterDriverObject, 1568 _In_ PFS_FILTER_CALLBACKS Callbacks); 1569 1570 #if (NTDDI_VERSION >= NTDDI_VISTA) 1571 NTKERNELAPI 1572 NTSTATUS 1573 NTAPI 1574 FsRtlNotifyStreamFileObject( 1575 _In_ struct _FILE_OBJECT * StreamFileObject, 1576 _In_opt_ struct _DEVICE_OBJECT *DeviceObjectHint, 1577 _In_ FS_FILTER_STREAM_FO_NOTIFICATION_TYPE NotificationType, 1578 _In_ BOOLEAN SafeToRecurse); 1579 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ 1580 1581 #define FsRtlFastLock(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) \ 1582 FsRtlPrivateLock(A1, A2, A3, A4, A5, A6, A7, A8, A9, NULL, A10, A11) 1583 1584 #define FsRtlAreThereCurrentFileLocks(FL) \ 1585 ((FL)->FastIoIsQuestionable) 1586 1587 #define FsRtlIncrementLockRequestsInProgress(FL) { \ 1588 ASSERT((FL)->LockRequestsInProgress >= 0); \ 1589 (void) \ 1590 (InterlockedIncrement((LONG volatile *)&((FL)->LockRequestsInProgress))); \ 1591 } 1592 1593 #define FsRtlDecrementLockRequestsInProgress(FL) { \ 1594 ASSERT((FL)->LockRequestsInProgress > 0); \ 1595 (void) \ 1596 (InterlockedDecrement((LONG volatile *)&((FL)->LockRequestsInProgress))); \ 1597 } 1598 1599 #ifdef _NTSYSTEM_ 1600 extern const UCHAR * const FsRtlLegalAnsiCharacterArray; 1601 #define LEGAL_ANSI_CHARACTER_ARRAY FsRtlLegalAnsiCharacterArray 1602 #else 1603 __CREATE_NTOS_DATA_IMPORT_ALIAS(FsRtlLegalAnsiCharacterArray) 1604 extern const UCHAR * const *FsRtlLegalAnsiCharacterArray; 1605 #define LEGAL_ANSI_CHARACTER_ARRAY (*FsRtlLegalAnsiCharacterArray) 1606 #endif 1607 1608 #define FsRtlIsAnsiCharacterWild(C) \ 1609 FsRtlTestAnsiCharacter((C), FALSE, FALSE, FSRTL_WILD_CHARACTER) 1610 1611 #define FsRtlIsAnsiCharacterLegalFat(C, WILD) \ 1612 FsRtlTestAnsiCharacter((C), TRUE, (WILD), FSRTL_FAT_LEGAL) 1613 1614 #define FsRtlIsAnsiCharacterLegalHpfs(C, WILD) \ 1615 FsRtlTestAnsiCharacter((C), TRUE, (WILD), FSRTL_HPFS_LEGAL) 1616 1617 #define FsRtlIsAnsiCharacterLegalNtfs(C, WILD) \ 1618 FsRtlTestAnsiCharacter((C), TRUE, (WILD), FSRTL_NTFS_LEGAL) 1619 1620 #define FsRtlIsAnsiCharacterLegalNtfsStream(C,WILD_OK) \ 1621 FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_NTFS_STREAM_LEGAL) 1622 1623 #define FsRtlIsAnsiCharacterLegal(C,FLAGS) \ 1624 FsRtlTestAnsiCharacter((C), TRUE, FALSE, (FLAGS)) 1625 1626 #define FsRtlTestAnsiCharacter(C, DEFAULT_RET, WILD_OK, FLAGS) \ 1627 (((SCHAR)(C) < 0) ? DEFAULT_RET : \ 1628 FlagOn(LEGAL_ANSI_CHARACTER_ARRAY[(C)], \ 1629 (FLAGS) | ((WILD_OK) ? FSRTL_WILD_CHARACTER : 0))) 1630 1631 #define FsRtlIsLeadDbcsCharacter(DBCS_CHAR) \ 1632 ((BOOLEAN)((UCHAR)(DBCS_CHAR) < 0x80 ? FALSE : \ 1633 (NLS_MB_CODE_PAGE_TAG && \ 1634 (NLS_OEM_LEAD_BYTE_INFO[(UCHAR)(DBCS_CHAR)] != 0)))) 1635 1636 #define FsRtlIsUnicodeCharacterWild(C) \ 1637 ((((C) >= 0x40) ? FALSE : \ 1638 FlagOn(LEGAL_ANSI_CHARACTER_ARRAY[(C)], FSRTL_WILD_CHARACTER ))) 1639 1640 #define FsRtlInitPerFileContext(_fc, _owner, _inst, _cb) \ 1641 ((_fc)->OwnerId = (_owner), \ 1642 (_fc)->InstanceId = (_inst), \ 1643 (_fc)->FreeCallback = (_cb)) 1644 1645 #define FsRtlGetPerFileContextPointer(_fo) \ 1646 (FsRtlSupportsPerFileContexts(_fo) ? \ 1647 FsRtlGetPerStreamContextPointer(_fo)->FileContextSupportPointer : NULL) 1648 1649 #define FsRtlSupportsPerFileContexts(_fo) \ 1650 ((FsRtlGetPerStreamContextPointer(_fo) != NULL) && \ 1651 (FsRtlGetPerStreamContextPointer(_fo)->Version >= FSRTL_FCB_HEADER_V1) && \ 1652 (FsRtlGetPerStreamContextPointer(_fo)->FileContextSupportPointer != NULL)) 1653 1654 #define FsRtlSetupAdvancedHeaderEx(_advhdr, _fmutx, _fctxptr) \ 1655 { \ 1656 FsRtlSetupAdvancedHeader( _advhdr, _fmutx ); \ 1657 if ((_fctxptr) != NULL) { \ 1658 (_advhdr)->FileContextSupportPointer = (_fctxptr); \ 1659 } \ 1660 } 1661 1662 #define FsRtlGetPerStreamContextPointer(FO) \ 1663 ((PFSRTL_ADVANCED_FCB_HEADER)(FO)->FsContext) 1664 1665 #define FsRtlInitPerStreamContext(PSC, O, I, FC) \ 1666 ((PSC)->OwnerId = (O), \ 1667 (PSC)->InstanceId = (I), \ 1668 (PSC)->FreeCallback = (FC)) 1669 1670 #define FsRtlSupportsPerStreamContexts(FO) \ 1671 ((BOOLEAN)((NULL != FsRtlGetPerStreamContextPointer(FO) && \ 1672 FlagOn(FsRtlGetPerStreamContextPointer(FO)->Flags2, \ 1673 FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS))) 1674 1675 #define FsRtlLookupPerStreamContext(_sc, _oid, _iid) \ 1676 (((NULL != (_sc)) && \ 1677 FlagOn((_sc)->Flags2,FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS) && \ 1678 !IsListEmpty(&(_sc)->FilterContexts)) ? \ 1679 FsRtlLookupPerStreamContextInternal((_sc), (_oid), (_iid)) : NULL) 1680 1681 _IRQL_requires_max_(APC_LEVEL) 1682 FORCEINLINE 1683 VOID 1684 NTAPI 1685 FsRtlSetupAdvancedHeader( 1686 _In_ PVOID AdvHdr, 1687 _In_ PFAST_MUTEX FMutex ) 1688 { 1689 PFSRTL_ADVANCED_FCB_HEADER localAdvHdr = (PFSRTL_ADVANCED_FCB_HEADER)AdvHdr; 1690 1691 localAdvHdr->Flags |= FSRTL_FLAG_ADVANCED_HEADER; 1692 localAdvHdr->Flags2 |= FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS; 1693 #if (NTDDI_VERSION >= NTDDI_VISTA) 1694 localAdvHdr->Version = FSRTL_FCB_HEADER_V1; 1695 #else 1696 localAdvHdr->Version = FSRTL_FCB_HEADER_V0; 1697 #endif 1698 InitializeListHead( &localAdvHdr->FilterContexts ); 1699 if (FMutex != NULL) { 1700 localAdvHdr->FastMutex = FMutex; 1701 } 1702 #if (NTDDI_VERSION >= NTDDI_VISTA) 1703 *((PULONG_PTR)(&localAdvHdr->PushLock)) = 0; 1704 localAdvHdr->FileContextSupportPointer = NULL; 1705 #endif 1706 } 1707 1708 #define FsRtlInitPerFileObjectContext(_fc, _owner, _inst) \ 1709 ((_fc)->OwnerId = (_owner), (_fc)->InstanceId = (_inst)) 1710 1711 #define FsRtlCompleteRequest(IRP, STATUS) { \ 1712 (IRP)->IoStatus.Status = (STATUS); \ 1713 IoCompleteRequest( (IRP), IO_DISK_INCREMENT ); \ 1714 } 1715 $endif (_NTIFS_) 1716