4 #define FsRtlEnterFileSystem KeEnterCriticalRegion
5 #define FsRtlExitFileSystem KeLeaveCriticalRegion
7 #if (NTDDI_VERSION >= NTDDI_WIN2K)
10 _IRQL_requires_max_(PASSIVE_LEVEL
)
15 _In_ PFILE_OBJECT FileObject
,
16 _In_ PLARGE_INTEGER FileOffset
,
20 _Out_writes_bytes_(Length
) PVOID Buffer
,
21 _Out_ PIO_STATUS_BLOCK IoStatus
,
22 _In_ PDEVICE_OBJECT DeviceObject
);
25 _IRQL_requires_max_(PASSIVE_LEVEL
)
30 _In_ PFILE_OBJECT FileObject
,
31 _In_ PLARGE_INTEGER FileOffset
,
35 _In_reads_bytes_(Length
) PVOID Buffer
,
36 _Out_ PIO_STATUS_BLOCK IoStatus
,
37 _In_ PDEVICE_OBJECT DeviceObject
);
40 _IRQL_requires_max_(APC_LEVEL
)
45 _In_ PFILE_OBJECT FileObject
,
46 _In_ PLARGE_INTEGER FileOffset
,
49 _Outptr_ PMDL
*MdlChain
,
50 _Out_ PIO_STATUS_BLOCK IoStatus
,
51 _In_opt_ PDEVICE_OBJECT DeviceObject
);
53 _IRQL_requires_max_(PASSIVE_LEVEL
)
57 FsRtlMdlReadCompleteDev(
58 _In_ PFILE_OBJECT FileObject
,
60 _In_opt_ PDEVICE_OBJECT DeviceObject
);
63 _IRQL_requires_max_(APC_LEVEL
)
67 FsRtlPrepareMdlWriteDev(
68 _In_ PFILE_OBJECT FileObject
,
69 _In_ PLARGE_INTEGER FileOffset
,
72 _Outptr_ PMDL
*MdlChain
,
73 _Out_ PIO_STATUS_BLOCK IoStatus
,
74 _In_ PDEVICE_OBJECT DeviceObject
);
77 _IRQL_requires_max_(PASSIVE_LEVEL
)
81 FsRtlMdlWriteCompleteDev(
82 _In_ PFILE_OBJECT FileObject
,
83 _In_ PLARGE_INTEGER FileOffset
,
85 _In_opt_ PDEVICE_OBJECT DeviceObject
);
87 _IRQL_requires_max_(PASSIVE_LEVEL
)
91 FsRtlAcquireFileExclusive(
92 _In_ PFILE_OBJECT FileObject
);
94 _IRQL_requires_max_(APC_LEVEL
)
99 _In_ PFILE_OBJECT FileObject
);
101 _Must_inspect_result_
102 _IRQL_requires_max_(PASSIVE_LEVEL
)
107 _In_ PFILE_OBJECT FileObject
,
108 _Out_ PLARGE_INTEGER FileSize
);
110 _Must_inspect_result_
114 FsRtlIsTotalDeviceFailure(
115 _In_ NTSTATUS Status
);
117 _Must_inspect_result_
118 _IRQL_requires_max_(APC_LEVEL
)
122 FsRtlAllocateFileLock(
123 _In_opt_ PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine
,
124 _In_opt_ PUNLOCK_ROUTINE UnlockRoutine
);
126 _IRQL_requires_max_(APC_LEVEL
)
131 _In_ PFILE_LOCK FileLock
);
133 _IRQL_requires_max_(APC_LEVEL
)
137 FsRtlInitializeFileLock(
138 _Out_ PFILE_LOCK FileLock
,
139 _In_opt_ PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine
,
140 _In_opt_ PUNLOCK_ROUTINE UnlockRoutine
);
142 _IRQL_requires_max_(APC_LEVEL
)
146 FsRtlUninitializeFileLock(
147 _Inout_ PFILE_LOCK FileLock
);
150 FsRtlProcessFileLock:
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).
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;
167 -'AllwaysZero' is passed thru as 'AllwaysZero' to lock / unlock routines.
168 -'Irp' is passet thru as 'Irp' to FsRtlPrivateLock.
170 _Must_inspect_result_
171 _IRQL_requires_max_(APC_LEVEL
)
175 FsRtlProcessFileLock(
176 _In_ PFILE_LOCK FileLock
,
178 _In_opt_ PVOID Context
);
181 FsRtlCheckLockForReadAccess:
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.
187 _Must_inspect_result_
188 _IRQL_requires_max_(APC_LEVEL
)
192 FsRtlCheckLockForReadAccess(
193 _In_ PFILE_LOCK FileLock
,
197 FsRtlCheckLockForWriteAccess:
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.
203 _Must_inspect_result_
204 _IRQL_requires_max_(APC_LEVEL
)
208 FsRtlCheckLockForWriteAccess(
209 _In_ PFILE_LOCK FileLock
,
212 _Must_inspect_result_
213 _IRQL_requires_max_(APC_LEVEL
)
217 FsRtlFastCheckLockForRead(
218 _In_ PFILE_LOCK FileLock
,
219 _In_ PLARGE_INTEGER FileOffset
,
220 _In_ PLARGE_INTEGER Length
,
222 _In_ PFILE_OBJECT FileObject
,
225 _Must_inspect_result_
226 _IRQL_requires_max_(APC_LEVEL
)
230 FsRtlFastCheckLockForWrite(
231 _In_ PFILE_LOCK FileLock
,
232 _In_ PLARGE_INTEGER FileOffset
,
233 _In_ PLARGE_INTEGER Length
,
235 _In_ PFILE_OBJECT FileObject
,
239 FsRtlGetNextFileLock:
241 ret: NULL if no more locks
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.
250 _Must_inspect_result_
251 _IRQL_requires_max_(APC_LEVEL
)
255 FsRtlGetNextFileLock(
256 _In_ PFILE_LOCK FileLock
,
257 _In_ BOOLEAN Restart
);
259 _IRQL_requires_max_(APC_LEVEL
)
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
,
270 _In_opt_ PVOID Context
,
271 _In_ BOOLEAN AlreadySynchronized
);
273 _IRQL_requires_max_(APC_LEVEL
)
278 _In_ PFILE_LOCK FileLock
,
279 _In_ PFILE_OBJECT FileObject
,
280 _In_ PEPROCESS Process
,
281 _In_opt_ PVOID Context
);
283 _IRQL_requires_max_(APC_LEVEL
)
287 FsRtlFastUnlockAllByKey(
288 _In_ PFILE_LOCK FileLock
,
289 _In_ PFILE_OBJECT FileObject
,
290 _In_ PEPROCESS Process
,
292 _In_opt_ PVOID Context
);
297 ret: IoStatus->Status: STATUS_PENDING, STATUS_LOCK_NOT_GRANTED
300 -Calls IoCompleteRequest if Irp
301 -Uses exception handling / ExRaiseStatus with STATUS_INSUFFICIENT_RESOURCES
303 _Must_inspect_result_
304 _IRQL_requires_max_(APC_LEVEL
)
305 __drv_preferredFunction(FsRtlFastLock
, "Obsolete")
310 _In_ PFILE_LOCK FileLock
,
311 _In_ PFILE_OBJECT FileObject
,
312 _In_ PLARGE_INTEGER FileOffset
,
313 _In_ PLARGE_INTEGER Length
,
314 _In_ PEPROCESS Process
,
316 _In_ BOOLEAN FailImmediately
,
317 _In_ BOOLEAN ExclusiveLock
,
318 _Out_ PIO_STATUS_BLOCK IoStatus
,
320 _In_opt_ __drv_aliasesMem PVOID Context
,
321 _In_ BOOLEAN AlreadySynchronized
);
323 _IRQL_requires_max_(APC_LEVEL
)
327 FsRtlInitializeTunnelCache(
330 _IRQL_requires_max_(APC_LEVEL
)
334 FsRtlAddToTunnelCache(
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
);
343 _Must_inspect_result_
344 _IRQL_requires_max_(APC_LEVEL
)
348 FsRtlFindInTunnelCache(
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
);
357 _IRQL_requires_max_(APC_LEVEL
)
361 FsRtlDeleteKeyFromTunnelCache(
363 _In_ ULONGLONG DirectoryKey
);
365 _IRQL_requires_max_(APC_LEVEL
)
369 FsRtlDeleteTunnelCache(
372 _IRQL_requires_max_(APC_LEVEL
)
377 _In_ ANSI_STRING Name
,
378 _Out_ PANSI_STRING FirstPart
,
379 _Out_ PANSI_STRING RemainingPart
);
381 _Must_inspect_result_
382 _IRQL_requires_max_(APC_LEVEL
)
386 FsRtlDoesDbcsContainWildCards(
387 _In_ PANSI_STRING Name
);
389 _Must_inspect_result_
390 _IRQL_requires_max_(APC_LEVEL
)
394 FsRtlIsDbcsInExpression(
395 _In_ PANSI_STRING Expression
,
396 _In_ PANSI_STRING Name
);
398 _Must_inspect_result_
399 _IRQL_requires_max_(APC_LEVEL
)
404 _In_ ANSI_STRING DbcsName
,
405 _In_ BOOLEAN WildCardsPermissible
,
406 _In_ BOOLEAN PathNamePermissible
,
407 _In_ BOOLEAN LeadingBackslashPermissible
);
409 _Must_inspect_result_
410 _IRQL_requires_max_(APC_LEVEL
)
414 FsRtlIsHpfsDbcsLegal(
415 _In_ ANSI_STRING DbcsName
,
416 _In_ BOOLEAN WildCardsPermissible
,
417 _In_ BOOLEAN PathNamePermissible
,
418 _In_ BOOLEAN LeadingBackslashPermissible
);
423 FsRtlNormalizeNtstatus(
424 _In_ NTSTATUS Exception
,
425 _In_ NTSTATUS GenericException
);
427 _Must_inspect_result_
431 FsRtlIsNtstatusExpected(
432 _In_ NTSTATUS Ntstatus
);
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.")
439 FsRtlAllocateResource(VOID
);
441 _IRQL_requires_max_(APC_LEVEL
)
445 FsRtlInitializeLargeMcb(
446 _Out_ PLARGE_MCB Mcb
,
447 _In_ POOL_TYPE PoolType
);
449 _IRQL_requires_max_(APC_LEVEL
)
453 FsRtlUninitializeLargeMcb(
454 _Inout_ PLARGE_MCB Mcb
);
456 _IRQL_requires_max_(APC_LEVEL
)
461 _Inout_ PLARGE_MCB Mcb
,
462 _In_ BOOLEAN SelfSynchronized
);
464 _IRQL_requires_max_(APC_LEVEL
)
468 FsRtlTruncateLargeMcb(
469 _Inout_ PLARGE_MCB Mcb
,
472 _Must_inspect_result_
473 _IRQL_requires_max_(APC_LEVEL
)
477 FsRtlAddLargeMcbEntry(
478 _Inout_ PLARGE_MCB Mcb
,
481 _In_ LONGLONG SectorCount
);
483 _IRQL_requires_max_(APC_LEVEL
)
487 FsRtlRemoveLargeMcbEntry(
488 _Inout_ PLARGE_MCB Mcb
,
490 _In_ LONGLONG SectorCount
);
492 _IRQL_requires_max_(APC_LEVEL
)
496 FsRtlLookupLargeMcbEntry(
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
);
505 _IRQL_requires_max_(APC_LEVEL
)
509 FsRtlLookupLastLargeMcbEntry(
512 _Out_ PLONGLONG Lbn
);
514 _IRQL_requires_max_(APC_LEVEL
)
518 FsRtlLookupLastLargeMcbEntryAndIndex(
519 _In_ PLARGE_MCB OpaqueMcb
,
520 _Out_ PLONGLONG LargeVbn
,
521 _Out_ PLONGLONG LargeLbn
,
524 _IRQL_requires_max_(APC_LEVEL
)
528 FsRtlNumberOfRunsInLargeMcb(
529 _In_ PLARGE_MCB Mcb
);
531 _Must_inspect_result_
532 _IRQL_requires_max_(APC_LEVEL
)
536 FsRtlGetNextLargeMcbEntry(
541 _Out_ PLONGLONG SectorCount
);
543 _Must_inspect_result_
544 _IRQL_requires_max_(APC_LEVEL
)
549 _Inout_ PLARGE_MCB Mcb
,
551 _In_ LONGLONG Amount
);
553 _IRQL_requires_max_(APC_LEVEL
)
554 __drv_preferredFunction(FsRtlInitializeLargeMcb
, "Obsolete")
560 _In_ POOL_TYPE PoolType
);
562 _IRQL_requires_max_(APC_LEVEL
)
566 FsRtlUninitializeMcb(
569 _IRQL_requires_max_(APC_LEVEL
)
577 _IRQL_requires_max_(APC_LEVEL
)
585 _In_ ULONG SectorCount
);
587 _IRQL_requires_max_(APC_LEVEL
)
594 _In_ ULONG SectorCount
);
596 _IRQL_requires_max_(APC_LEVEL
)
604 _Out_opt_ PULONG SectorCount
,
607 _IRQL_requires_max_(APC_LEVEL
)
611 FsRtlLookupLastMcbEntry(
616 _IRQL_requires_max_(APC_LEVEL
)
620 FsRtlNumberOfRunsInMcb(
623 _Must_inspect_result_
624 _IRQL_requires_max_(APC_LEVEL
)
628 FsRtlGetNextMcbEntry(
633 _Out_ PULONG SectorCount
);
635 _IRQL_requires_max_(PASSIVE_LEVEL
)
640 _In_ PDEVICE_OBJECT TargetDevice
);
642 _IRQL_requires_max_(APC_LEVEL
)
646 FsRtlInitializeOplock(
647 _Inout_ POPLOCK Oplock
);
649 _IRQL_requires_max_(APC_LEVEL
)
653 FsRtlUninitializeOplock(
654 _Inout_ POPLOCK Oplock
);
656 _Must_inspect_result_
657 _IRQL_requires_max_(APC_LEVEL
)
664 _In_ ULONG OpenCount
);
666 _When_(CompletionRoutine
!= NULL
, _Must_inspect_result_
)
667 _IRQL_requires_max_(APC_LEVEL
)
674 _In_opt_ PVOID Context
,
675 _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine
,
676 _In_opt_ POPLOCK_FS_PREPOST_IRP PostIrpRoutine
);
678 _Must_inspect_result_
679 _IRQL_requires_max_(APC_LEVEL
)
683 FsRtlOplockIsFastIoPossible(
684 _In_ POPLOCK Oplock
);
686 _Must_inspect_result_
687 _IRQL_requires_max_(APC_LEVEL
)
691 FsRtlCurrentBatchOplock(
692 _In_ POPLOCK Oplock
);
694 _IRQL_requires_max_(APC_LEVEL
)
698 FsRtlNotifyVolumeEvent(
699 _In_ PFILE_OBJECT FileObject
,
700 _In_ ULONG EventCode
);
702 _IRQL_requires_max_(APC_LEVEL
)
706 FsRtlNotifyInitializeSync(
707 _In_ PNOTIFY_SYNC
*NotifySync
);
709 _IRQL_requires_max_(APC_LEVEL
)
713 FsRtlNotifyUninitializeSync(
714 _In_ PNOTIFY_SYNC
*NotifySync
);
716 _IRQL_requires_max_(PASSIVE_LEVEL
)
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
);
732 _IRQL_requires_max_(PASSIVE_LEVEL
)
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
,
745 _In_opt_ PVOID TargetContext
,
746 _In_opt_ PVOID FilterContext
);
748 _IRQL_requires_max_(PASSIVE_LEVEL
)
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
,
761 _In_opt_ PVOID TargetContext
);
763 _IRQL_requires_max_(APC_LEVEL
)
768 _In_ PNOTIFY_SYNC NotifySync
,
769 _In_ PLIST_ENTRY NotifyList
,
770 _In_ PVOID FsContext
);
772 _IRQL_requires_max_(PASSIVE_LEVEL
)
777 _In_ UNICODE_STRING Name
,
778 _Out_ PUNICODE_STRING FirstPart
,
779 _Out_ PUNICODE_STRING RemainingPart
);
781 _Must_inspect_result_
782 _IRQL_requires_max_(PASSIVE_LEVEL
)
786 FsRtlDoesNameContainWildCards(
787 _In_ PUNICODE_STRING Name
);
789 _Must_inspect_result_
790 _IRQL_requires_max_(PASSIVE_LEVEL
)
795 _In_ PCUNICODE_STRING Name1
,
796 _In_ PCUNICODE_STRING Name2
,
797 _In_ BOOLEAN IgnoreCase
,
798 _In_reads_opt_(0x10000) PCWCH UpcaseTable
);
800 _Must_inspect_result_
801 _IRQL_requires_max_(PASSIVE_LEVEL
)
805 FsRtlIsNameInExpression(
806 _In_ PUNICODE_STRING Expression
,
807 _In_ PUNICODE_STRING Name
,
808 _In_ BOOLEAN IgnoreCase
,
809 _In_opt_ PWCHAR UpcaseTable
);
811 _IRQL_requires_max_(DISPATCH_LEVEL
)
815 FsRtlPostPagingFileStackOverflow(
818 _In_ PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine
);
820 _IRQL_requires_max_(DISPATCH_LEVEL
)
824 FsRtlPostStackOverflow (
827 _In_ PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine
);
829 _Must_inspect_result_
830 _IRQL_requires_max_(PASSIVE_LEVEL
)
834 FsRtlRegisterUncProvider(
835 _Out_ PHANDLE MupHandle
,
836 _In_ PCUNICODE_STRING RedirectorDeviceName
,
837 _In_ BOOLEAN MailslotsSupported
);
839 _IRQL_requires_max_(PASSIVE_LEVEL
)
843 FsRtlDeregisterUncProvider(
846 _IRQL_requires_max_(APC_LEVEL
)
850 FsRtlTeardownPerStreamContexts(
851 _In_ PFSRTL_ADVANCED_FCB_HEADER AdvancedHeader
);
853 _Must_inspect_result_
854 _IRQL_requires_max_(APC_LEVEL
)
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
,
870 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
872 #if (NTDDI_VERSION >= NTDDI_WINXP)
874 _IRQL_requires_max_(PASSIVE_LEVEL
)
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
);
891 _Must_inspect_result_
892 _IRQL_requires_max_(APC_LEVEL
)
896 FsRtlInsertPerStreamContext(
897 _In_ PFSRTL_ADVANCED_FCB_HEADER PerStreamContext
,
898 _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
);
900 _Must_inspect_result_
901 _IRQL_requires_max_(APC_LEVEL
)
903 PFSRTL_PER_STREAM_CONTEXT
905 FsRtlLookupPerStreamContextInternal(
906 _In_ PFSRTL_ADVANCED_FCB_HEADER StreamContext
,
907 _In_opt_ PVOID OwnerId
,
908 _In_opt_ PVOID InstanceId
);
910 _Must_inspect_result_
911 _IRQL_requires_max_(APC_LEVEL
)
913 PFSRTL_PER_STREAM_CONTEXT
915 FsRtlRemovePerStreamContext(
916 _In_ PFSRTL_ADVANCED_FCB_HEADER StreamContext
,
917 _In_opt_ PVOID OwnerId
,
918 _In_opt_ PVOID InstanceId
);
923 FsRtlIncrementCcFastReadNotPossible(
929 FsRtlIncrementCcFastReadWait(VOID
);
934 FsRtlIncrementCcFastReadNoWait(VOID
);
939 FsRtlIncrementCcFastReadResourceMiss(VOID
);
941 _IRQL_requires_max_(APC_LEVEL
)
946 _In_ PFILE_OBJECT FileObject
);
948 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
950 #if (NTDDI_VERSION >= NTDDI_WS03)
952 _IRQL_requires_max_(APC_LEVEL
)
956 FsRtlInitializeBaseMcb(
958 _In_ POOL_TYPE PoolType
);
960 _IRQL_requires_max_(APC_LEVEL
)
964 FsRtlUninitializeBaseMcb(
967 _IRQL_requires_max_(APC_LEVEL
)
972 _Out_ PBASE_MCB Mcb
);
974 _IRQL_requires_max_(APC_LEVEL
)
978 FsRtlTruncateBaseMcb(
979 _Inout_ PBASE_MCB Mcb
,
982 _IRQL_requires_max_(APC_LEVEL
)
986 FsRtlAddBaseMcbEntry(
987 _Inout_ PBASE_MCB Mcb
,
990 _In_ LONGLONG SectorCount
);
992 _IRQL_requires_max_(APC_LEVEL
)
996 FsRtlRemoveBaseMcbEntry(
997 _Inout_ PBASE_MCB Mcb
,
999 _In_ LONGLONG SectorCount
);
1001 _IRQL_requires_max_(APC_LEVEL
)
1005 FsRtlLookupBaseMcbEntry(
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
);
1014 _IRQL_requires_max_(APC_LEVEL
)
1018 FsRtlLookupLastBaseMcbEntry(
1020 _Out_ PLONGLONG Vbn
,
1021 _Out_ PLONGLONG Lbn
);
1023 _IRQL_requires_max_(APC_LEVEL
)
1027 FsRtlLookupLastBaseMcbEntryAndIndex(
1028 _In_ PBASE_MCB OpaqueMcb
,
1029 _Inout_ PLONGLONG LargeVbn
,
1030 _Inout_ PLONGLONG LargeLbn
,
1031 _Inout_ PULONG Index
);
1033 _IRQL_requires_max_(APC_LEVEL
)
1037 FsRtlNumberOfRunsInBaseMcb(
1038 _In_ PBASE_MCB Mcb
);
1040 _IRQL_requires_max_(APC_LEVEL
)
1044 FsRtlGetNextBaseMcbEntry(
1046 _In_ ULONG RunIndex
,
1047 _Out_ PLONGLONG Vbn
,
1048 _Out_ PLONGLONG Lbn
,
1049 _Out_ PLONGLONG SectorCount
);
1051 _IRQL_requires_max_(APC_LEVEL
)
1056 _Inout_ PBASE_MCB Mcb
,
1058 _In_ LONGLONG Amount
);
1060 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */
1062 #if (NTDDI_VERSION >= NTDDI_VISTA)
1064 _When_(!Flags
& MCB_FLAG_RAISE_ON_ALLOCATION_FAILURE
, _Must_inspect_result_
)
1065 _IRQL_requires_max_(APC_LEVEL
)
1068 FsRtlInitializeBaseMcbEx(
1069 _Out_ PBASE_MCB Mcb
,
1070 _In_ POOL_TYPE PoolType
,
1073 _Must_inspect_result_
1074 _IRQL_requires_max_(APC_LEVEL
)
1077 FsRtlAddBaseMcbEntryEx(
1078 _Inout_ PBASE_MCB Mcb
,
1081 _In_ LONGLONG SectorCount
);
1083 _Must_inspect_result_
1084 _IRQL_requires_max_(APC_LEVEL
)
1089 _In_ POPLOCK Oplock
);
1091 _Must_inspect_result_
1092 _IRQL_requires_max_(APC_LEVEL
)
1096 FsRtlOplockBreakToNone(
1097 _Inout_ POPLOCK Oplock
,
1098 _In_opt_ PIO_STACK_LOCATION IrpSp
,
1100 _In_opt_ PVOID Context
,
1101 _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine
,
1102 _In_opt_ POPLOCK_FS_PREPOST_IRP PostIrpRoutine
);
1104 _IRQL_requires_max_(DISPATCH_LEVEL
)
1108 FsRtlNotifyVolumeEventEx(
1109 _In_ PFILE_OBJECT FileObject
,
1110 _In_ ULONG EventCode
,
1111 _In_ PTARGET_DEVICE_CUSTOM_NOTIFICATION Event
);
1113 _IRQL_requires_max_(APC_LEVEL
)
1117 FsRtlNotifyCleanupAll(
1118 _In_ PNOTIFY_SYNC NotifySync
,
1119 _In_ PLIST_ENTRY NotifyList
);
1121 _Must_inspect_result_
1122 _IRQL_requires_max_(PASSIVE_LEVEL
)
1125 FsRtlRegisterUncProviderEx(
1126 _Out_ PHANDLE MupHandle
,
1127 _In_ PUNICODE_STRING RedirDevName
,
1128 _In_ PDEVICE_OBJECT DeviceObject
,
1131 _Must_inspect_result_
1132 _When_(Irp
!=NULL
, _IRQL_requires_max_(PASSIVE_LEVEL
))
1133 _When_(Irp
==NULL
, _IRQL_requires_max_(APC_LEVEL
))
1137 FsRtlCancellableWaitForSingleObject(
1139 _In_opt_ PLARGE_INTEGER Timeout
,
1142 _Must_inspect_result_
1143 _When_(Irp
!= NULL
, _IRQL_requires_max_(PASSIVE_LEVEL
))
1144 _When_(Irp
== NULL
, _IRQL_requires_max_(APC_LEVEL
))
1148 FsRtlCancellableWaitForMultipleObjects(
1150 _In_reads_(Count
) PVOID ObjectArray
[],
1151 _In_ WAIT_TYPE WaitType
,
1152 _In_opt_ PLARGE_INTEGER Timeout
,
1153 _In_opt_ PKWAIT_BLOCK WaitBlockArray
,
1156 _Must_inspect_result_
1157 _IRQL_requires_max_(APC_LEVEL
)
1161 FsRtlMupGetProviderInfoFromFileObject(
1162 _In_ PFILE_OBJECT pFileObject
,
1164 _Out_writes_bytes_(*pBufferSize
) PVOID pBuffer
,
1165 _Inout_ PULONG pBufferSize
);
1167 _Must_inspect_result_
1168 _IRQL_requires_max_(APC_LEVEL
)
1172 FsRtlMupGetProviderIdFromName(
1173 _In_ PUNICODE_STRING pProviderName
,
1174 _Out_ PULONG32 pProviderId
);
1179 FsRtlIncrementCcFastMdlReadWait(VOID
);
1181 _Must_inspect_result_
1182 _IRQL_requires_max_(PASSIVE_LEVEL
)
1186 FsRtlValidateReparsePointBuffer(
1187 _In_ ULONG BufferLength
,
1188 _In_reads_bytes_(BufferLength
) PREPARSE_DATA_BUFFER ReparseBuffer
);
1190 _Must_inspect_result_
1191 _IRQL_requires_max_(PASSIVE_LEVEL
)
1195 FsRtlRemoveDotsFromPath(
1196 _Inout_updates_bytes_(PathLength
) PWSTR OriginalString
,
1197 _In_ USHORT PathLength
,
1198 _Out_ USHORT
*NewLength
);
1200 _Must_inspect_result_
1201 _IRQL_requires_max_(APC_LEVEL
)
1205 FsRtlAllocateExtraCreateParameterList(
1206 _In_ FSRTL_ALLOCATE_ECPLIST_FLAGS Flags
,
1207 _Outptr_ PECP_LIST
*EcpList
);
1209 _IRQL_requires_max_(APC_LEVEL
)
1213 FsRtlFreeExtraCreateParameterList(
1214 _In_ PECP_LIST EcpList
);
1216 _Must_inspect_result_
1217 _IRQL_requires_max_(APC_LEVEL
)
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
,
1227 _Outptr_result_bytebuffer_(SizeOfContext
) PVOID
*EcpContext
);
1229 _IRQL_requires_max_(APC_LEVEL
)
1233 FsRtlFreeExtraCreateParameter(
1234 _In_ PVOID EcpContext
);
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
))
1241 FsRtlInitExtraCreateParameterLookasideList(
1242 _Inout_ PVOID Lookaside
,
1243 _In_ FSRTL_ECP_LOOKASIDE_FLAGS Flags
,
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
))
1251 FsRtlDeleteExtraCreateParameterLookasideList(
1252 _Inout_ PVOID Lookaside
,
1253 _In_ FSRTL_ECP_LOOKASIDE_FLAGS Flags
);
1255 _Must_inspect_result_
1256 _IRQL_requires_max_(APC_LEVEL
)
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
);
1268 _Must_inspect_result_
1269 _IRQL_requires_max_(APC_LEVEL
)
1273 FsRtlInsertExtraCreateParameter(
1274 _Inout_ PECP_LIST EcpList
,
1275 _Inout_ PVOID EcpContext
);
1277 _Must_inspect_result_
1278 _IRQL_requires_max_(APC_LEVEL
)
1282 FsRtlFindExtraCreateParameter(
1283 _In_ PECP_LIST EcpList
,
1284 _In_ LPCGUID EcpType
,
1285 _Outptr_opt_ PVOID
*EcpContext
,
1286 _Out_opt_ ULONG
*EcpContextSize
);
1288 _Must_inspect_result_
1289 _IRQL_requires_max_(APC_LEVEL
)
1293 FsRtlRemoveExtraCreateParameter(
1294 _Inout_ PECP_LIST EcpList
,
1295 _In_ LPCGUID EcpType
,
1296 _Outptr_ PVOID
*EcpContext
,
1297 _Out_opt_ ULONG
*EcpContextSize
);
1299 _Must_inspect_result_
1300 _IRQL_requires_max_(APC_LEVEL
)
1304 FsRtlGetEcpListFromIrp(
1306 _Outptr_result_maybenull_ PECP_LIST
*EcpList
);
1308 _Must_inspect_result_
1309 _IRQL_requires_max_(APC_LEVEL
)
1313 FsRtlSetEcpListIntoIrp(
1315 _In_ PECP_LIST EcpList
);
1317 _Must_inspect_result_
1318 _IRQL_requires_max_(APC_LEVEL
)
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
);
1329 _IRQL_requires_max_(APC_LEVEL
)
1333 FsRtlAcknowledgeEcp(
1334 _In_ PVOID EcpContext
);
1336 _IRQL_requires_max_(APC_LEVEL
)
1340 FsRtlIsEcpAcknowledged(
1341 _In_ PVOID EcpContext
);
1343 _IRQL_requires_max_(APC_LEVEL
)
1347 FsRtlIsEcpFromUserMode(
1348 _In_ PVOID EcpContext
);
1350 _Must_inspect_result_
1351 _IRQL_requires_max_(PASSIVE_LEVEL
)
1355 FsRtlChangeBackingFileObject(
1356 _In_opt_ PFILE_OBJECT CurrentFileObject
,
1357 _In_ PFILE_OBJECT NewFileObject
,
1358 _In_ FSRTL_CHANGE_BACKING_TYPE ChangeBackingType
,
1361 _Must_inspect_result_
1362 _IRQL_requires_max_(APC_LEVEL
)
1366 FsRtlLogCcFlushError(
1367 _In_ PUNICODE_STRING FileName
,
1368 _In_ PDEVICE_OBJECT DeviceObject
,
1369 _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer
,
1370 _In_ NTSTATUS FlushError
,
1373 _IRQL_requires_max_(APC_LEVEL
)
1377 FsRtlAreVolumeStartupApplicationsComplete(VOID
);
1382 FsRtlQueryMaximumVirtualDiskNestingLevel(VOID
);
1387 FsRtlGetVirtualDiskNestingLevel(
1388 _In_ PDEVICE_OBJECT DeviceObject
,
1389 _Out_ PULONG NestingLevel
,
1390 _Out_opt_ PULONG NestingFlags
);
1392 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
1394 #if (NTDDI_VERSION >= NTDDI_VISTASP1)
1395 _When_(Flags
| OPLOCK_FLAG_BACK_OUT_ATOMIC_OPLOCK
, _Must_inspect_result_
)
1396 _IRQL_requires_max_(APC_LEVEL
)
1401 _In_ POPLOCK Oplock
,
1404 _In_opt_ PVOID Context
,
1405 _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine
,
1406 _In_opt_ POPLOCK_FS_PREPOST_IRP PostIrpRoutine
);
1410 #if (NTDDI_VERSION >= NTDDI_WIN7)
1412 _IRQL_requires_max_(APC_LEVEL
)
1416 FsRtlAreThereCurrentOrInProgressFileLocks(
1417 _In_ PFILE_LOCK FileLock
);
1419 _Must_inspect_result_
1420 _IRQL_requires_max_(APC_LEVEL
)
1424 FsRtlOplockIsSharedRequest(
1427 _Must_inspect_result_
1428 _IRQL_requires_max_(APC_LEVEL
)
1433 _In_ POPLOCK Oplock
,
1436 _In_opt_ PVOID Context
,
1437 _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine
,
1438 _In_opt_ POPLOCK_FS_PREPOST_IRP PostIrpRoutine
);
1440 _IRQL_requires_max_(APC_LEVEL
)
1444 FsRtlCurrentOplockH(
1445 _In_ POPLOCK Oplock
);
1447 _Must_inspect_result_
1448 _IRQL_requires_max_(APC_LEVEL
)
1452 FsRtlOplockBreakToNoneEx(
1453 _Inout_ POPLOCK Oplock
,
1456 _In_opt_ PVOID Context
,
1457 _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine
,
1458 _In_opt_ POPLOCK_FS_PREPOST_IRP PostIrpRoutine
);
1460 _Must_inspect_result_
1461 _IRQL_requires_max_(APC_LEVEL
)
1465 FsRtlOplockFsctrlEx(
1466 _In_ POPLOCK Oplock
,
1468 _In_ ULONG OpenCount
,
1471 _IRQL_requires_max_(APC_LEVEL
)
1475 FsRtlOplockKeysEqual(
1476 _In_opt_ PFILE_OBJECT Fo1
,
1477 _In_opt_ PFILE_OBJECT Fo2
);
1482 FsRtlInitializeExtraCreateParameterList(
1483 _Inout_ PECP_LIST EcpList
);
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
);
1496 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
1498 _Must_inspect_result_
1499 _IRQL_requires_max_(APC_LEVEL
)
1503 FsRtlInsertPerFileContext(
1504 _In_ PVOID
* PerFileContextPointer
,
1505 _In_ PFSRTL_PER_FILE_CONTEXT Ptr
);
1507 _Must_inspect_result_
1508 _IRQL_requires_max_(APC_LEVEL
)
1510 PFSRTL_PER_FILE_CONTEXT
1512 FsRtlLookupPerFileContext(
1513 _In_ PVOID
* PerFileContextPointer
,
1514 _In_opt_ PVOID OwnerId
,
1515 _In_opt_ PVOID InstanceId
);
1517 _Must_inspect_result_
1518 _IRQL_requires_max_(APC_LEVEL
)
1520 PFSRTL_PER_FILE_CONTEXT
1522 FsRtlRemovePerFileContext(
1523 _In_ PVOID
* PerFileContextPointer
,
1524 _In_opt_ PVOID OwnerId
,
1525 _In_opt_ PVOID InstanceId
);
1527 _IRQL_requires_max_(APC_LEVEL
)
1531 FsRtlTeardownPerFileContexts(
1532 _In_ PVOID
* PerFileContextPointer
);
1534 _Must_inspect_result_
1535 _IRQL_requires_max_(APC_LEVEL
)
1539 FsRtlInsertPerFileObjectContext(
1540 _In_ PFILE_OBJECT FileObject
,
1541 _In_ PFSRTL_PER_FILEOBJECT_CONTEXT Ptr
);
1543 _Must_inspect_result_
1544 _IRQL_requires_max_(APC_LEVEL
)
1546 PFSRTL_PER_FILEOBJECT_CONTEXT
1548 FsRtlLookupPerFileObjectContext(
1549 _In_ PFILE_OBJECT FileObject
,
1550 _In_opt_ PVOID OwnerId
,
1551 _In_opt_ PVOID InstanceId
);
1553 _Must_inspect_result_
1554 _IRQL_requires_max_(APC_LEVEL
)
1556 PFSRTL_PER_FILEOBJECT_CONTEXT
1558 FsRtlRemovePerFileObjectContext(
1559 _In_ PFILE_OBJECT FileObject
,
1560 _In_opt_ PVOID OwnerId
,
1561 _In_opt_ PVOID InstanceId
);
1566 FsRtlRegisterFileSystemFilterCallbacks(
1567 _In_
struct _DRIVER_OBJECT
*FilterDriverObject
,
1568 _In_ PFS_FILTER_CALLBACKS Callbacks
);
1570 #if (NTDDI_VERSION >= NTDDI_VISTA)
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) */
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)
1584 #define FsRtlAreThereCurrentFileLocks(FL) \
1585 ((FL)->FastIoIsQuestionable)
1587 #define FsRtlIncrementLockRequestsInProgress(FL) { \
1588 ASSERT((FL)->LockRequestsInProgress >= 0); \
1590 (InterlockedIncrement((LONG volatile *)&((FL)->LockRequestsInProgress))); \
1593 #define FsRtlDecrementLockRequestsInProgress(FL) { \
1594 ASSERT((FL)->LockRequestsInProgress > 0); \
1596 (InterlockedDecrement((LONG volatile *)&((FL)->LockRequestsInProgress))); \
1600 extern const UCHAR
* const FsRtlLegalAnsiCharacterArray
;
1601 #define LEGAL_ANSI_CHARACTER_ARRAY FsRtlLegalAnsiCharacterArray
1603 __CREATE_NTOS_DATA_IMPORT_ALIAS(FsRtlLegalAnsiCharacterArray
)
1604 extern const UCHAR
* const *FsRtlLegalAnsiCharacterArray
;
1605 #define LEGAL_ANSI_CHARACTER_ARRAY (*FsRtlLegalAnsiCharacterArray)
1608 #define FsRtlIsAnsiCharacterWild(C) \
1609 FsRtlTestAnsiCharacter((C), FALSE, FALSE, FSRTL_WILD_CHARACTER)
1611 #define FsRtlIsAnsiCharacterLegalFat(C, WILD) \
1612 FsRtlTestAnsiCharacter((C), TRUE, (WILD), FSRTL_FAT_LEGAL)
1614 #define FsRtlIsAnsiCharacterLegalHpfs(C, WILD) \
1615 FsRtlTestAnsiCharacter((C), TRUE, (WILD), FSRTL_HPFS_LEGAL)
1617 #define FsRtlIsAnsiCharacterLegalNtfs(C, WILD) \
1618 FsRtlTestAnsiCharacter((C), TRUE, (WILD), FSRTL_NTFS_LEGAL)
1620 #define FsRtlIsAnsiCharacterLegalNtfsStream(C,WILD_OK) \
1621 FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_NTFS_STREAM_LEGAL)
1623 #define FsRtlIsAnsiCharacterLegal(C,FLAGS) \
1624 FsRtlTestAnsiCharacter((C), TRUE, FALSE, (FLAGS))
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)))
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))))
1636 #define FsRtlIsUnicodeCharacterWild(C) \
1637 ((((C) >= 0x40) ? FALSE : \
1638 FlagOn(LEGAL_ANSI_CHARACTER_ARRAY[(C)], FSRTL_WILD_CHARACTER )))
1640 #define FsRtlInitPerFileContext(_fc, _owner, _inst, _cb) \
1641 ((_fc)->OwnerId = (_owner), \
1642 (_fc)->InstanceId = (_inst), \
1643 (_fc)->FreeCallback = (_cb))
1645 #define FsRtlGetPerFileContextPointer(_fo) \
1646 (FsRtlSupportsPerFileContexts(_fo) ? \
1647 FsRtlGetPerStreamContextPointer(_fo)->FileContextSupportPointer : NULL)
1649 #define FsRtlSupportsPerFileContexts(_fo) \
1650 ((FsRtlGetPerStreamContextPointer(_fo) != NULL) && \
1651 (FsRtlGetPerStreamContextPointer(_fo)->Version >= FSRTL_FCB_HEADER_V1) && \
1652 (FsRtlGetPerStreamContextPointer(_fo)->FileContextSupportPointer != NULL))
1654 #define FsRtlSetupAdvancedHeaderEx(_advhdr, _fmutx, _fctxptr) \
1656 FsRtlSetupAdvancedHeader( _advhdr, _fmutx ); \
1657 if ((_fctxptr) != NULL) { \
1658 (_advhdr)->FileContextSupportPointer = (_fctxptr); \
1662 #define FsRtlGetPerStreamContextPointer(FO) \
1663 ((PFSRTL_ADVANCED_FCB_HEADER)(FO)->FsContext)
1665 #define FsRtlInitPerStreamContext(PSC, O, I, FC) \
1666 ((PSC)->OwnerId = (O), \
1667 (PSC)->InstanceId = (I), \
1668 (PSC)->FreeCallback = (FC))
1670 #define FsRtlSupportsPerStreamContexts(FO) \
1671 ((BOOLEAN)((NULL != FsRtlGetPerStreamContextPointer(FO) && \
1672 FlagOn(FsRtlGetPerStreamContextPointer(FO)->Flags2, \
1673 FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS)))
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)
1681 _IRQL_requires_max_(APC_LEVEL
)
1685 FsRtlSetupAdvancedHeader(
1687 _In_ PFAST_MUTEX FMutex
)
1689 PFSRTL_ADVANCED_FCB_HEADER localAdvHdr
= (PFSRTL_ADVANCED_FCB_HEADER
)AdvHdr
;
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
;
1696 localAdvHdr
->Version
= FSRTL_FCB_HEADER_V0
;
1698 InitializeListHead( &localAdvHdr
->FilterContexts
);
1699 if (FMutex
!= NULL
) {
1700 localAdvHdr
->FastMutex
= FMutex
;
1702 #if (NTDDI_VERSION >= NTDDI_VISTA)
1703 *((PULONG_PTR
)(&localAdvHdr
->PushLock
)) = 0;
1704 localAdvHdr
->FileContextSupportPointer
= NULL
;
1708 #define FsRtlInitPerFileObjectContext(_fc, _owner, _inst) \
1709 ((_fc)->OwnerId = (_owner), (_fc)->InstanceId = (_inst))
1711 #define FsRtlCompleteRequest(IRP, STATUS) { \
1712 (IRP)->IoStatus.Status = (STATUS); \
1713 IoCompleteRequest( (IRP), IO_DISK_INCREMENT ); \