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