ReactOS  0.4.13-dev-100-gc8611ae
fatprocs.h
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) 1989-2000 Microsoft Corporation
4 
5 Module Name:
6 
7  FatProcs.h
8 
9 Abstract:
10 
11  This module defines all of the globally used procedures in the FAT
12  file system.
13 
14 
15 --*/
16 
17 #ifndef _FATPROCS_
18 #define _FATPROCS_
19 
20 #ifdef _MSC_VER
21 #pragma warning( disable: 4127 ) // conditional expression is constant
22 
23 #pragma warning( push )
24 #pragma warning( disable: 4201 ) // nonstandard extension used : nameless struct/union
25 #pragma warning( disable: 4214 ) // nonstandard extension used : bit field types
26 #endif
27 
28 #include <ntifs.h>
29 
30 
31 #include <ntddscsi.h>
32 #include <scsi.h>
33 #include <ntddcdrm.h>
34 #include <ntdddisk.h>
35 #include <ntddstor.h>
36 #include <ntintsafe.h>
37 #ifdef __REACTOS__
38 #include <pseh/pseh2.h>
39 #endif
40 
41 
42 #ifdef __REACTOS__
43 typedef enum _TYPE_OF_OPEN {
44 
51  EaFile,
52 } TYPE_OF_OPEN;
53 #endif
54 
55 #include "nodetype.h"
56 #include "fat.h"
57 #include "lfn.h"
58 #include "fatstruc.h"
59 #include "fatdata.h"
60 
61 
62 
63 #ifdef _MSC_VER
64 #pragma warning( pop )
65 #endif
66 
67 #ifndef INLINE
68 #define INLINE __inline
69 #endif
70 
71 #define Add2Ptr(P,I) ((PVOID)((PUCHAR)(P) + (I)))
72 
73 #ifndef MAX_ULONG
74 #define MAX_ULONG ((ULONG)-1)
75 #endif
76 
77 #ifndef MAX_USHORT
78 #define MAX_USHORT ((USHORT)-1)
79 #endif
80 
81 //
82 // We must explicitly tag our allocations.
83 //
84 
85 #undef FsRtlAllocatePool
86 #undef FsRtlAllocatePoolWithQuota
87 
88 //
89 // A function that returns finished denotes if it was able to complete the
90 // operation (TRUE) or could not complete the operation (FALSE) because the
91 // wait value stored in the irp context was false and we would have had
92 // to block for a resource or I/O
93 //
94 
95 typedef BOOLEAN FINISHED;
96 
97 //
98 // Size (characters) of stack allocated name component buffers in
99 // the create/rename paths.
100 //
101 
102 #define FAT_CREATE_INITIAL_NAME_BUF_SIZE 32
103 
104 
105 //
106 // Some string buffer handling functions, implemented in strucsup.c
107 //
108 
109 VOID
112  );
113 
114 VOID
117  _In_ USHORT DesiredBufferSize,
118  _In_ BOOLEAN FreeOldBuffer,
119  __out_opt PBOOLEAN NeedsFree
120  );
121 
122 VOID
125  _In_ USHORT DesiredBufferSize
126  );
127 
128 BOOLEAN
130  IN PVCB Vcb,
131  IN PLARGE_MCB Mcb,
132  IN VBO Vbo,
133  IN LBO Lbo,
135  );
136 
137 BOOLEAN
139  IN PVCB Vcb,
140  IN PLARGE_MCB Mcb,
141  IN VBO Vbo,
142  OUT PLBO Lbo,
145  );
146 
147 BOOLEAN
149  IN PVCB Vcb,
150  IN PLARGE_MCB Mcb,
151  OUT PVBO Vbo,
152  OUT PLBO Lbo,
154  );
155 
156 BOOLEAN
158  IN PVCB Vcb,
159  IN PLARGE_MCB Mcb,
160  IN ULONG RunIndex,
161  OUT PVBO Vbo,
162  OUT PLBO Lbo,
164  );
165 
166 VOID
168  IN PVCB Vcb,
169  IN PLARGE_MCB Mcb,
170  IN VBO Vbo,
172  );
173 
174 
175 //
176 // File access check routine, implemented in AcChkSup.c
177 //
178 
179 BOOLEAN
181  PIRP_CONTEXT IrpContext,
182  IN UCHAR DirentAttributes,
184  );
185 
186 BOOLEAN
188  _In_ PIRP_CONTEXT IrpContext,
190  _In_ KPROCESSOR_MODE ProcessorMode
191  );
192 
193 NTSTATUS
195  IN PIRP_CONTEXT IrpContext,
198  IN KPROCESSOR_MODE ProcessorMode
199  );
200 
201 
202 //
203 // Allocation support routines, implemented in AllocSup.c
204 //
205 
206 static
207 INLINE
208 BOOLEAN
210  IN PVCB Vcb,
212  IN ULONG Length
213  )
214 
215 /*++
216 
217 Routine Description:
218 
219  This routine enforces the restriction that object space must be
220  representable in 32 bits.
221 
222 Arguments:
223 
224  Vcb - the volume the range is on
225 
226  Start - starting byte (zero based) of the range
227 
228  Length - size of the range
229 
230  HeaderSize - if the file has a header
231 
232 Return Value:
233 
234  BOOLEAN - if, considering the cluster size, the neccesary size of
235  the object to contain the range can be represented in 32 bits.
236 
237 --*/
238 
239 {
240 
242 
243  //
244  // The only restriction on a FAT object is that the filesize must
245  // fit in 32bits, i.e. <= 0xffffffff. This then implies that the
246  // range of valid byte offsets is [0, fffffffe].
247  //
248  // Two phases which check for illegality
249  //
250  // - if the high 32bits are nonzero
251  // - if the length would cause a 32bit overflow
252  //
253 
254  return !(Start.HighPart ||
255  Start.LowPart + Length < Start.LowPart);
256 }
257 
258 
259 //
260 // This strucure is used by FatLookupFatEntry to remember a pinned page
261 // of fat.
262 //
263 
264 typedef struct _FAT_ENUMERATION_CONTEXT {
265 
269 
271 
272 VOID
274  IN PIRP_CONTEXT IrpContext,
275  IN PVCB Vcb,
276  IN ULONG FatIndex,
279  );
280 
281 VOID
283  IN PIRP_CONTEXT IrpContext,
284  IN PVCB Vcb
285  );
286 
287 VOID
289  IN PIRP_CONTEXT IrpContext,
290  IN PVCB Vcb
291  );
292 
293 _Requires_lock_held_(_Global_critical_region_)
294 VOID
295 FatLookupFileAllocation (
296  IN PIRP_CONTEXT IrpContext,
298  IN VBO Vbo,
299  OUT PLBO Lbo,
304  );
305 
306 _Requires_lock_held_(_Global_critical_region_)
307 VOID
308 FatAddFileAllocation (
309  IN PIRP_CONTEXT IrpContext,
313  );
314 
315 _Requires_lock_held_(_Global_critical_region_)
316 VOID
317 FatTruncateFileAllocation (
318  IN PIRP_CONTEXT IrpContext,
319  IN PFCB FcbOrDcb,
321  );
322 
323 _Requires_lock_held_(_Global_critical_region_)
324 VOID
325 FatLookupFileAllocationSize (
326  IN PIRP_CONTEXT IrpContext,
328  );
329 
330 _Requires_lock_held_(_Global_critical_region_)
331 VOID
332 FatAllocateDiskSpace (
333  IN PIRP_CONTEXT IrpContext,
339  );
340 
341 _Requires_lock_held_(_Global_critical_region_)
342 VOID
343 FatDeallocateDiskSpace (
344  IN PIRP_CONTEXT IrpContext,
346  IN PLARGE_MCB Mcb,
348  );
349 
350 _Requires_lock_held_(_Global_critical_region_)
351 VOID
352 FatSplitAllocation (
353  IN PIRP_CONTEXT IrpContext,
356  IN VBO SplitAtVbo,
358  );
359 
360 _Requires_lock_held_(_Global_critical_region_)
361 VOID
362 FatMergeAllocation (
363  IN PIRP_CONTEXT IrpContext,
367  );
368 
369 _Requires_lock_held_(_Global_critical_region_)
370 VOID
371 FatSetFatEntry (
372  IN PIRP_CONTEXT IrpContext,
374  IN ULONG FatIndex,
376  );
377 
378 UCHAR
379 FatLogOf(
380  IN ULONG Value
381  );
382 
383 
384 //
385 // Buffer control routines for data caching, implemented in CacheSup.c
386 //
387 
388 VOID
390  IN PIRP_CONTEXT IrpContext,
391  IN PVCB Vcb,
394  OUT PBCB *Bcb,
395  OUT PVOID *Buffer
396  );
397 
398 _Requires_lock_held_(_Global_critical_region_)
399 VOID
400 FatPrepareWriteVolumeFile (
401  IN PIRP_CONTEXT IrpContext,
405  OUT PBCB *Bcb,
406  OUT PVOID *Buffer,
408  IN BOOLEAN Zero
409  );
410 
411 _Requires_lock_held_(_Global_critical_region_)
412 VOID
413 FatReadDirectoryFile (
414  IN PIRP_CONTEXT IrpContext,
418  IN BOOLEAN Pin,
419  OUT PBCB *Bcb,
420  OUT PVOID *Buffer,
422  );
423 
424 _Requires_lock_held_(_Global_critical_region_)
425 VOID
426 FatPrepareWriteDirectoryFile (
427  IN PIRP_CONTEXT IrpContext,
428  IN PDCB Dcb,
431  OUT PBCB *Bcb,
432  OUT PVOID *Buffer,
433  IN BOOLEAN Zero,
436  );
437 
438 _Requires_lock_held_(_Global_critical_region_)
439 VOID
440 FatOpenDirectoryFile (
441  IN PIRP_CONTEXT IrpContext,
442  IN PDCB Dcb
443  );
444 
447  IN PIRP_CONTEXT IrpContext,
448  IN PFCB EaFcb
449  );
450 
451 VOID
453  IN PIRP_CONTEXT IrpContext,
454  IN PVCB Vcb,
455  IN BOOLEAN FlushFirst
456  );
457 
458 
459 _Requires_lock_held_(_Global_critical_region_)
460 VOID
461 FatSetDirtyBcb (
462  IN PIRP_CONTEXT IrpContext,
463  IN PBCB Bcb,
466  );
467 
468 VOID
469 FatRepinBcb (
470  IN PIRP_CONTEXT IrpContext,
471  IN PBCB Bcb
472  );
473 
474 VOID
476  IN PIRP_CONTEXT IrpContext
477  );
478 
479 FINISHED
480 FatZeroData (
481  IN PIRP_CONTEXT IrpContext,
482  IN PVCB Vcb,
484  IN ULONG StartingZero,
486  );
487 
488 NTSTATUS
490  IN PIRP_CONTEXT IrpContext,
491  IN PIRP Irp
492  );
493 
494 VOID
496  IN PIRP_CONTEXT IrpContext,
497  IN PDCB Dcb,
500  OUT PBCB *Bcb
501  );
502 
503 NTSTATUS
505  IN PIRP_CONTEXT IrpContext,
507  IN ULONG StartingPage,
508  IN ULONG PageCount
509  );
510 
511 //
512 // VOID
513 // FatUnpinBcb (
514 // IN PIRP_CONTEXT IrpContext,
515 // IN OUT PBCB Bcb,
516 // );
517 //
518 
519 //
520 // This macro unpins a Bcb, in the checked build make sure all
521 // requests unpin all Bcbs before leaving.
522 //
523 
524 #if DBG
525 
526 #define FatUnpinBcb(IRPCONTEXT,BCB) { \
527  if ((BCB) != NULL) { \
528  CcUnpinData((BCB)); \
529  NT_ASSERT( (IRPCONTEXT)->PinCount );\
530  (IRPCONTEXT)->PinCount -= 1; \
531  (BCB) = NULL; \
532  } \
533 }
534 
535 #else
536 
537 #define FatUnpinBcb(IRPCONTEXT,BCB) { \
538  if ((BCB) != NULL) { \
539  CcUnpinData((BCB)); \
540  (BCB) = NULL; \
541  } \
542 }
543 
544 #endif // DBG
545 
546 VOID
550  _In_ BOOLEAN PinAccess,
552  _In_ PVOID LazyWriteContext
553  );
554 
555 VOID
557  IN PIRP_CONTEXT IrpContext,
559  );
560 
561 
562 //
563 // Device I/O routines, implemented in DevIoSup.c
564 //
565 // These routines perform the actual device read and writes. They only affect
566 // the on disk structure and do not alter any other data structures.
567 //
568 
569 VOID
571  IN PIRP Irp,
572  IN PFCB Fcb
573  );
574 
575 
576 _Requires_lock_held_(_Global_critical_region_)
577 NTSTATUS
578 FatNonCachedIo (
579  IN PIRP_CONTEXT IrpContext,
581  IN PFCB FcbOrDcb,
586  );
587 
588 _Requires_lock_held_(_Global_critical_region_)
589 VOID
590 FatNonCachedNonAlignedRead (
591  IN PIRP_CONTEXT IrpContext,
592  IN PIRP Irp,
593  IN PFCB FcbOrDcb,
596  );
597 
598 VOID
600  IN PIRP_CONTEXT IrpContext,
601  IN PVCB Vcb,
602  IN PIRP Irp,
603  IN ULONG MultipleIrpCount,
604  IN PIO_RUN IoRuns
605  );
606 
607 VOID
609  IN PIRP_CONTEXT IrpContext,
610  IN PVCB Vcb,
611  IN LBO Lbo,
613  IN PIRP Irp
614  );
615 
616 VOID
617 FatWaitSync (
618  IN PIRP_CONTEXT IrpContext
619  );
620 
621 VOID
623  IN PIRP_CONTEXT IrpContext,
624  IN OUT PIRP Irp,
627  );
628 
629 PVOID
631  IN PIRP_CONTEXT IrpContext,
632  IN OUT PIRP Irp,
634  );
635 
636 PVOID
638  IN PIRP_CONTEXT IrpContext,
639  IN OUT PIRP Irp
640  );
641 
642 NTSTATUS
644  IN PIRP_CONTEXT IrpContext,
645  IN PVCB Vcb,
646  IN BOOLEAN PreventRemoval
647  );
648 
649 NTSTATUS
651  IN PIRP_CONTEXT IrpContext,
659  IN BOOLEAN OverrideVerify,
661  );
662 
663 PMDL
665  __in PIRP_CONTEXT IrpContext,
667  );
668 
669 
670 //
671 // Dirent support routines, implemented in DirSup.c
672 //
673 
674 //
675 // Tunneling is a deletion precursor (all tunneling cases do
676 // not involve deleting dirents, however)
677 //
678 
679 VOID
681  IN PFCB FcbOrDcb,
683  );
684 
685 _Requires_lock_held_(_Global_critical_region_)
686 ULONG
687 FatCreateNewDirent (
688  IN PIRP_CONTEXT IrpContext,
692  );
693 
694 _Requires_lock_held_(_Global_critical_region_)
695 VOID
696 FatInitializeDirectoryDirent (
697  IN PIRP_CONTEXT IrpContext,
700  );
701 
702 _Requires_lock_held_(_Global_critical_region_)
703 VOID
704 FatDeleteDirent (
705  IN PIRP_CONTEXT IrpContext,
707  IN PDELETE_CONTEXT DeleteContext OPTIONAL,
709  );
710 
711 
712 _Requires_lock_held_(_Global_critical_region_)
713 VOID
714 FatLocateDirent (
715  IN PIRP_CONTEXT IrpContext,
717  IN PCCB Ccb,
719  IN OUT PULONG Flags,
720  OUT PDIRENT *Dirent,
721  OUT PBCB *Bcb,
723  OUT PBOOLEAN FileNameDos OPTIONAL,
725  IN OUT PUNICODE_STRING OrigLfn OPTIONAL
726  );
727 
728 _Requires_lock_held_(_Global_critical_region_)
729 VOID
730 FatLocateSimpleOemDirent (
731  IN PIRP_CONTEXT IrpContext,
734  OUT PDIRENT *Dirent,
735  OUT PBCB *Bcb,
737  );
738 
739 _Requires_lock_held_(_Global_critical_region_)
740 BOOLEAN
741 FatLfnDirentExists (
742  IN PIRP_CONTEXT IrpContext,
746  );
747 
748 _Requires_lock_held_(_Global_critical_region_)
749 VOID
750 FatLocateVolumeLabel (
751  IN PIRP_CONTEXT IrpContext,
752  IN PVCB Vcb,
753  OUT PDIRENT *Dirent,
754  OUT PBCB *Bcb,
756  );
757 
758 _Requires_lock_held_(_Global_critical_region_)
759 VOID
760 FatGetDirentFromFcbOrDcb (
761  IN PIRP_CONTEXT IrpContext,
764  OUT PDIRENT *Dirent,
765  OUT PBCB *Bcb
766  );
767 
768 _Requires_lock_held_(_Global_critical_region_)
769 BOOLEAN
770 FatIsDirectoryEmpty (
771  IN PIRP_CONTEXT IrpContext,
772  IN PDCB Dcb
773  );
774 
775 _Requires_lock_held_(_Global_critical_region_)
776 VOID
777 FatDeleteFile (
778  IN PIRP_CONTEXT IrpContext,
782  IN PDIRENT Dirent,
784  );
785 
786 
787 VOID
789  IN PIRP_CONTEXT IrpContext,
792  IN BOOLEAN ComponentReallyLowercase,
793  IN BOOLEAN ExtensionReallyLowercase,
796  IN BOOLEAN ZeroAndSetTimeFields,
797  IN PLARGE_INTEGER SetCreationTime OPTIONAL
798  );
799 
800 VOID
802  IN PIRP_CONTEXT IrpContext,
805  );
806 
807 _Requires_lock_held_(_Global_critical_region_)
808 VOID
809 FatSetFileSizeInDirent (
810  IN PIRP_CONTEXT IrpContext,
812  IN PULONG AlternativeFileSize OPTIONAL
813  );
814 
815 _Requires_lock_held_(_Global_critical_region_)
816 VOID
817 FatSetFileSizeInDirentNoRaise (
818  IN PIRP_CONTEXT IrpContext,
819  IN PFCB Fcb,
820  IN PULONG AlternativeFileSize OPTIONAL
821  );
822 
823 
824 _Requires_lock_held_(_Global_critical_region_)
825 VOID
826 FatUpdateDirentFromFcb (
827  IN PIRP_CONTEXT IrpContext,
829  IN PFCB FcbOrDcb,
830  IN PCCB Ccb
831  );
832 
833 
834 //
835 // Generate a relatively unique static 64bit ID from a FAT Fcb/Dcb
836 //
837 // ULONGLONG
838 // FatDirectoryKey (FcbOrDcb);
839 //
840 
841 #define FatDirectoryKey(FcbOrDcb) ((ULONGLONG)((FcbOrDcb)->CreationTime.QuadPart ^ (FcbOrDcb)->FirstClusterOfFile))
842 
843 
844 //
845 // The following routines are used to access and manipulate the
846 // clusters containing EA data in the ea data file. They are
847 // implemented in EaSup.c
848 //
849 
850 //
851 // VOID
852 // FatUpcaseEaName (
853 // IN PIRP_CONTEXT IrpContext,
854 // IN POEM_STRING EaName,
855 // OUT POEM_STRING UpcasedEaName
856 // );
857 //
858 
859 #define FatUpcaseEaName( IRPCONTEXT, NAME, UPCASEDNAME ) \
860  RtlUpperString( UPCASEDNAME, NAME )
861 
862 _Requires_lock_held_(_Global_critical_region_)
863 VOID
864 FatGetEaLength (
865  IN PIRP_CONTEXT IrpContext,
867  IN PDIRENT Dirent,
869  );
870 
871 _Requires_lock_held_(_Global_critical_region_)
872 VOID
873 FatGetNeedEaCount (
874  IN PIRP_CONTEXT IrpContext,
876  IN PDIRENT Dirent,
878  );
879 
880 _Requires_lock_held_(_Global_critical_region_)
881 VOID
882 FatCreateEa (
883  IN PIRP_CONTEXT IrpContext,
885  IN PUCHAR Buffer,
886  IN ULONG Length,
889  );
890 
891 _Requires_lock_held_(_Global_critical_region_)
892 VOID
893 FatDeleteEa (
894  IN PIRP_CONTEXT IrpContext,
895  IN PVCB Vcb,
898  );
899 
900 _Requires_lock_held_(_Global_critical_region_)
901 VOID
902 FatGetEaFile (
903  IN PIRP_CONTEXT IrpContext,
906  OUT PBCB *EaBcb,
909  );
910 
911 VOID
912 FatReadEaSet (
913  IN PIRP_CONTEXT IrpContext,
914  IN PVCB Vcb,
917  IN BOOLEAN ReturnEntireSet,
919  );
920 
921 _Requires_lock_held_(_Global_critical_region_)
922 VOID
923 FatDeleteEaSet (
924  IN PIRP_CONTEXT IrpContext,
926  IN PBCB EaBcb,
930  );
931 
932 _Requires_lock_held_(_Global_critical_region_)
933 VOID
934 FatAddEaSet (
935  IN PIRP_CONTEXT IrpContext,
938  IN PBCB EaBcb,
942  );
943 
944 VOID
946  IN PIRP_CONTEXT IrpContext,
947  IN OUT PEA_SET_HEADER EaSetHeader,
948  IN OUT PULONG PackedEasLength,
949  IN ULONG Offset
950  );
951 
952 VOID
954  IN PIRP_CONTEXT IrpContext,
955  IN OUT PEA_SET_HEADER *EaSetHeader,
956  IN OUT PULONG PackedEasLength,
957  IN OUT PULONG AllocationLength,
959  IN ULONG BytesPerCluster
960  );
961 
962 ULONG
964  IN PIRP_CONTEXT IrpContext,
965  IN PPACKED_EA FirstPackedEa,
966  IN ULONG PackedEasLength,
967  IN ULONG PreviousOffset
968  );
969 
970 BOOLEAN
972  IN PIRP_CONTEXT IrpContext,
973  IN PPACKED_EA FirstPackedEa,
974  IN ULONG PackedEasLength,
975  IN POEM_STRING EaName,
977  );
978 
979 BOOLEAN
981  IN PIRP_CONTEXT IrpContext,
983  );
984 
985 VOID
987  IN PIRP_CONTEXT IrpContext,
988  IN PFILE_OBJECT VirtualEaFile,
989  IN PFCB EaFcb,
990  IN OUT PEA_RANGE EaRange,
992  IN ULONG Length,
993  IN NTSTATUS ErrorStatus
994  );
995 
996 VOID
998  IN PIRP_CONTEXT IrpContext,
999  IN PFILE_OBJECT EaFileObject,
1000  IN OUT PEA_RANGE EaRange
1001  );
1002 
1003 VOID
1005  IN PIRP_CONTEXT IrpContext,
1006  IN OUT PEA_RANGE EaRange
1007  );
1008 
1009 //
1010 // The following macro computes the size of a full ea (not including
1011 // padding to bring it to a longword. A full ea has a 4 byte offset,
1012 // folowed by 1 byte flag, 1 byte name length, 2 bytes value length,
1013 // the name, 1 null byte, and the value.
1014 //
1015 // ULONG
1016 // SizeOfFullEa (
1017 // IN PFILE_FULL_EA_INFORMATION FullEa
1018 // );
1019 //
1020 
1021 #define SizeOfFullEa(EA) (4+1+1+2+(EA)->EaNameLength+1+(EA)->EaValueLength)
1022 
1023 
1024 //
1025 // The following routines are used to manipulate the fscontext fields
1026 // of the file object, implemented in FilObSup.c
1027 //
1028 
1029 #ifndef __REACTOS__
1030 typedef enum _TYPE_OF_OPEN {
1031 
1039 } TYPE_OF_OPEN;
1040 #endif
1041 
1042 typedef enum _FAT_FLUSH_TYPE {
1043 
1044  NoFlush = 0,
1048 
1049 } FAT_FLUSH_TYPE;
1050 
1051 VOID
1055  IN PVOID VcbOrFcbOrDcb,
1057  );
1058 
1062  _Outptr_ PVCB *Vcb,
1064  _Outptr_ PCCB *Ccb
1065  );
1066 
1067 _Requires_lock_held_(_Global_critical_region_)
1068 VOID
1069 FatPurgeReferencedFileObjects (
1070  IN PIRP_CONTEXT IrpContext,
1073  );
1074 
1075 _Requires_lock_held_(_Global_critical_region_)
1076 VOID
1077 FatForceCacheMiss (
1078  IN PIRP_CONTEXT IrpContext,
1079  IN PFCB Fcb,
1081  );
1082 
1083 
1084 //
1085 // File system control routines, implemented in FsCtrl.c
1086 //
1087 
1088 _Requires_lock_held_(_Global_critical_region_)
1089 VOID
1090 FatFlushAndCleanVolume(
1091  IN PIRP_CONTEXT IrpContext,
1092  IN PIRP Irp,
1093  IN PVCB Vcb,
1095  );
1096 
1097 BOOLEAN
1100  );
1101 
1102 _Requires_lock_held_(_Global_critical_region_)
1103 NTSTATUS
1104 FatLockVolumeInternal (
1105  IN PIRP_CONTEXT IrpContext,
1106  IN PVCB Vcb,
1108  );
1109 
1110 NTSTATUS
1112  IN PIRP_CONTEXT IrpContext,
1113  IN PVCB Vcb,
1115  );
1116 
1117 
1118 //
1119 // Name support routines, implemented in NameSup.c
1120 //
1121 
1122 //
1123 // BOOLEAN
1124 // FatAreNamesEqual (
1125 // IN PIRP_CONTEXT IrpContext,
1126 // IN OEM_STRING ConstantNameA,
1127 // IN OEM_STRING ConstantNameB
1128 // )
1129 //
1130 // /*++
1131 //
1132 // Routine Description:
1133 //
1134 // This routine simple returns whether the two names are exactly equal.
1135 // If the two names are known to be constant, this routine is much
1136 // faster than FatIsDbcsInExpression.
1137 //
1138 // Arguments:
1139 //
1140 // ConstantNameA - Constant name.
1141 //
1142 // ConstantNameB - Constant name.
1143 //
1144 // Return Value:
1145 //
1146 // BOOLEAN - TRUE if the two names are lexically equal.
1147 //
1148 
1149 #define FatAreNamesEqual(IRPCONTEXT,NAMEA,NAMEB) ( \
1150  ((ULONG)(NAMEA).Length == (ULONG)(NAMEB).Length) && \
1151  (RtlEqualMemory( &(NAMEA).Buffer[0], \
1152  &(NAMEB).Buffer[0], \
1153  (NAMEA).Length )) \
1154 )
1155 
1156 //
1157 // BOOLEAN
1158 // FatIsNameShortOemValid (
1159 // IN PIRP_CONTEXT IrpContext,
1160 // IN OEM_STRING Name,
1161 // IN BOOLEAN CanContainWildCards,
1162 // IN BOOLEAN PathNamePermissible,
1163 // IN BOOLEAN LeadingBackslashPermissible
1164 // )
1165 //
1166 // /*++
1167 //
1168 // Routine Description:
1169 //
1170 // This routine scans the input name and verifies that if only
1171 // contains valid characters
1172 //
1173 // Arguments:
1174 //
1175 // Name - Supplies the input name to check.
1176 //
1177 // CanContainWildCards - Indicates if the name can contain wild cards
1178 // (i.e., * and ?).
1179 //
1180 // Return Value:
1181 //
1182 // BOOLEAN - Returns TRUE if the name is valid and FALSE otherwise.
1183 //
1184 // --*/
1185 //
1186 // The FatIsNameLongOemValid and FatIsNameLongUnicodeValid are similar.
1187 //
1188 
1189 #define FatIsNameShortOemValid(IRPCONTEXT,NAME,CAN_CONTAIN_WILD_CARDS,PATH_NAME_OK,LEADING_BACKSLASH_OK) ( \
1190  FsRtlIsFatDbcsLegal((NAME), \
1191  (CAN_CONTAIN_WILD_CARDS), \
1192  (PATH_NAME_OK), \
1193  (LEADING_BACKSLASH_OK)) \
1194 )
1195 
1196 #define FatIsNameLongOemValid(IRPCONTEXT,NAME,CAN_CONTAIN_WILD_CARDS,PATH_NAME_OK,LEADING_BACKSLASH_OK) ( \
1197  FsRtlIsHpfsDbcsLegal((NAME), \
1198  (CAN_CONTAIN_WILD_CARDS), \
1199  (PATH_NAME_OK), \
1200  (LEADING_BACKSLASH_OK)) \
1201 )
1202 
1203 static
1204 INLINE
1205 BOOLEAN
1207  PIRP_CONTEXT IrpContext,
1209  BOOLEAN CanContainWildcards,
1210  BOOLEAN PathNameOk,
1211  BOOLEAN LeadingBackslashOk
1212  )
1213 {
1214  ULONG i;
1215 
1216  UNREFERENCED_PARAMETER( IrpContext );
1217  UNREFERENCED_PARAMETER( LeadingBackslashOk );
1218  UNREFERENCED_PARAMETER( PathNameOk );
1219 
1220  //
1221  // I'm not bothering to do the whole thing, just enough to make this call look
1222  // the same as the others.
1223  //
1224 
1225  NT_ASSERT( !PathNameOk && !LeadingBackslashOk );
1226 
1227  for (i=0; i < Name->Length/sizeof(WCHAR); i++) {
1228 
1229  if ((Name->Buffer[i] < 0x80) &&
1230  !(FsRtlIsAnsiCharacterLegalHpfs(Name->Buffer[i], CanContainWildcards))) {
1231 
1232  return FALSE;
1233  }
1234  }
1235 
1236  return TRUE;
1237 }
1238 
1239 BOOLEAN
1241  IN PIRP_CONTEXT IrpContext,
1244  );
1245 
1246 VOID
1248  _In_ PIRP_CONTEXT IrpContext,
1249  _In_ OEM_STRING InputString,
1250  _Out_writes_bytes_(11) PFAT8DOT3 Output8dot3
1251  );
1252 
1253 VOID
1255  _In_ PIRP_CONTEXT IrpContext,
1257  _In_ BOOLEAN RestoreCase,
1258  _Out_ POEM_STRING OutputString
1259  );
1260 
1261 _Requires_lock_held_(_Global_critical_region_)
1262 VOID
1263 FatGetUnicodeNameFromFcb (
1264  IN PIRP_CONTEXT IrpContext,
1265  IN PFCB Fcb,
1267  );
1268 
1269 _Requires_lock_held_(_Global_critical_region_)
1270 VOID
1271 FatSetFullFileNameInFcb (
1272  IN PIRP_CONTEXT IrpContext,
1273  IN PFCB Fcb
1274  );
1275 
1276 VOID
1278  _In_ PIRP_CONTEXT IrpContext,
1279  _Inout_ PFCB Fcb,
1280  _In_ PUNICODE_STRING FinalName
1281  );
1282 
1283 VOID
1285  IN PIRP_CONTEXT IrpContext,
1288  );
1289 
1290 _Requires_lock_held_(_Global_critical_region_)
1291 VOID
1292 FatSelectNames (
1293  IN PIRP_CONTEXT IrpContext,
1298  IN PUNICODE_STRING SuggestedShortName OPTIONAL,
1302  );
1303 
1304 VOID
1306  IN PIRP_CONTEXT IrpContext,
1311  );
1312 
1313 BOOLEAN
1315  IN PIRP_CONTEXT IrpContext,
1317  );
1318 
1319 VOID
1321  IN PUNICODE_STRING ShortNameWithCase,
1322  IN BOOLEAN LowerCase8,
1323  IN BOOLEAN LowerCase3
1324  );
1325 
1326 
1327 //
1328 // Resources support routines/macros, implemented in ResrcSup.c
1329 //
1330 // The following routines/macros are used for gaining shared and exclusive
1331 // access to the global/vcb data structures. The routines are implemented
1332 // in ResrcSup.c. There is a global resources that everyone tries to take
1333 // out shared to do their work, with the exception of mount/dismount which
1334 // take out the global resource exclusive. All other resources only work
1335 // on their individual item. For example, an Fcb resource does not take out
1336 // a Vcb resource. But the way the file system is structured we know
1337 // that when we are processing an Fcb other threads cannot be trying to remove
1338 // or alter the Fcb, so we do not need to acquire the Vcb.
1339 //
1340 // The procedures/macros are:
1341 //
1342 // Macro FatData Vcb Fcb Subsequent macros
1343 //
1344 // AcquireExclusiveGlobal Read/Write None None ReleaseGlobal
1345 //
1346 // AcquireSharedGlobal Read None None ReleaseGlobal
1347 //
1348 // AcquireExclusiveVcb Read Read/Write None ReleaseVcb
1349 //
1350 // AcquireSharedVcb Read Read None ReleaseVcb
1351 //
1352 // AcquireExclusiveFcb Read None Read/Write ConvertToSharFcb
1353 // ReleaseFcb
1354 //
1355 // AcquireSharedFcb Read None Read ReleaseFcb
1356 //
1357 // ConvertToSharedFcb Read None Read ReleaseFcb
1358 //
1359 // ReleaseGlobal
1360 //
1361 // ReleaseVcb
1362 //
1363 // ReleaseFcb
1364 //
1365 
1366 //
1367 // FINISHED
1368 // FatAcquireExclusiveGlobal (
1369 // IN PIRP_CONTEXT IrpContext
1370 // );
1371 //
1372 // FINISHED
1373 // FatAcquireSharedGlobal (
1374 // IN PIRP_CONTEXT IrpContext
1375 // );
1376 //
1377 
1378 #define FatAcquireExclusiveGlobal(IRPCONTEXT) ( \
1379  ExAcquireResourceExclusiveLite( &FatData.Resource, BooleanFlagOn((IRPCONTEXT)->Flags, IRP_CONTEXT_FLAG_WAIT) ) \
1380 )
1381 
1382 #define FatAcquireSharedGlobal(IRPCONTEXT) ( \
1383  ExAcquireResourceSharedLite( &FatData.Resource, BooleanFlagOn((IRPCONTEXT)->Flags, IRP_CONTEXT_FLAG_WAIT) ) \
1384 )
1385 
1386 //
1387 // The following macro must only be called when Wait is TRUE!
1388 //
1389 // FatAcquireExclusiveVolume (
1390 // IN PIRP_CONTEXT IrpContext,
1391 // IN PVCB Vcb
1392 // );
1393 //
1394 // FatReleaseVolume (
1395 // IN PIRP_CONTEXT IrpContext,
1396 // IN PVCB Vcb
1397 // );
1398 //
1399 
1400 #define FatAcquireExclusiveVolume(IRPCONTEXT,VCB) { \
1401  PFCB __FFFFFcb = NULL; \
1402  NT_ASSERT(FlagOn((IRPCONTEXT)->Flags, IRP_CONTEXT_FLAG_WAIT)); \
1403  (VOID)FatAcquireExclusiveVcb( (IRPCONTEXT), (VCB) ); \
1404  while ( (__FFFFFcb = FatGetNextFcbBottomUp((IRPCONTEXT), __FFFFFcb, (VCB)->RootDcb)) != NULL) { \
1405  (VOID)FatAcquireExclusiveFcb((IRPCONTEXT), __FFFFFcb ); \
1406  } \
1407 }
1408 
1409 #define FatReleaseVolume(IRPCONTEXT,VCB) { \
1410  PFCB __FFFFFcb = NULL; \
1411  NT_ASSERT(FlagOn((IRPCONTEXT)->Flags, IRP_CONTEXT_FLAG_WAIT)); \
1412  while ( (__FFFFFcb = FatGetNextFcbBottomUp((IRPCONTEXT), __FFFFFcb, (VCB)->RootDcb)) != NULL) { \
1413  (VOID)ExReleaseResourceLite( __FFFFFcb->Header.Resource ); \
1414  } \
1415  FatReleaseVcb((IRPCONTEXT), (VCB)); \
1416 }
1417 
1418 //
1419 // Macro to enable easy tracking of Vcb state transitions.
1420 //
1421 
1422 #ifdef FASTFATDBG
1423 #define FatSetVcbCondition( V, X) { \
1424  DebugTrace(0,DEBUG_TRACE_VERFYSUP,"%d -> ",(V)->VcbCondition); \
1425  DebugTrace(0,DEBUG_TRACE_VERFYSUP,"%x\n",(X)); \
1426  (V)->VcbCondition = (X); \
1427  }
1428 #else
1429 #define FatSetVcbCondition( V, X) (V)->VcbCondition = (X)
1430 #endif
1431 
1432 //
1433 // These macros can be used to determine what kind of FAT we have for an
1434 // initialized Vcb. It is somewhat more elegant to use these (visually).
1435 //
1436 
1437 #define FatIsFat32(VCB) ((BOOLEAN)((VCB)->AllocationSupport.FatIndexBitSize == 32))
1438 #define FatIsFat16(VCB) ((BOOLEAN)((VCB)->AllocationSupport.FatIndexBitSize == 16))
1439 #define FatIsFat12(VCB) ((BOOLEAN)((VCB)->AllocationSupport.FatIndexBitSize == 12))
1440 
1441 
1442 _Requires_lock_held_(_Global_critical_region_)
1444 FINISHED
1445 FatAcquireExclusiveVcb_Real (
1446  IN PIRP_CONTEXT IrpContext,
1449  );
1450 
1451 #define FatAcquireExclusiveVcb( IC, V) FatAcquireExclusiveVcb_Real( IC, V, FALSE)
1452 #define FatAcquireExclusiveVcbNoOpCheck( IC, V) FatAcquireExclusiveVcb_Real( IC, V, TRUE)
1453 
1454 _Requires_lock_held_(_Global_critical_region_)
1455 _When_(return != 0, _Acquires_shared_lock_(Vcb->Resource))
1456 FINISHED
1457 FatAcquireSharedVcb (
1458  IN PIRP_CONTEXT IrpContext,
1459  IN PVCB Vcb
1460  );
1461 
1462 _Requires_lock_held_(_Global_critical_region_)
1464 FINISHED
1465 FatAcquireExclusiveFcb (
1466  IN PIRP_CONTEXT IrpContext,
1467  IN PFCB Fcb
1468  );
1469 
1470 _Requires_lock_held_(_Global_critical_region_)
1472 FINISHED
1473 FatAcquireSharedFcb (
1474  IN PIRP_CONTEXT IrpContext,
1475  IN PFCB Fcb
1476  );
1477 
1478 _Requires_lock_held_(_Global_critical_region_)
1480 FINISHED
1482  IN PIRP_CONTEXT IrpContext,
1483  IN PFCB Fcb
1484  );
1485 
1486 #define FatVcbAcquiredExclusive(IRPCONTEXT,VCB) ( \
1487  ExIsResourceAcquiredExclusiveLite(&(VCB)->Resource) || \
1488  ExIsResourceAcquiredExclusiveLite(&FatData.Resource) \
1489 )
1490 
1491 #define FatFcbAcquiredShared(IRPCONTEXT,FCB) ( \
1492  ExIsResourceAcquiredSharedLite((FCB)->Header.Resource) \
1493 )
1494 
1495 #define FatFcbAcquiredExclusive(IRPCONTEXT,FCB) ( \
1496  ExIsResourceAcquiredExclusiveLite((FCB)->Header.Resource) \
1497 )
1498 
1499 #define FatAcquireDirectoryFileMutex(VCB) { \
1500  NT_ASSERT(KeAreApcsDisabled()); \
1501  ExAcquireFastMutexUnsafe(&(VCB)->DirectoryFileCreationMutex); \
1502 }
1503 
1504 #define FatReleaseDirectoryFileMutex(VCB) { \
1505  NT_ASSERT(KeAreApcsDisabled()); \
1506  ExReleaseFastMutexUnsafe(&(VCB)->DirectoryFileCreationMutex); \
1507 }
1508 
1509 //
1510 // The following are cache manager call backs
1511 
1512 BOOLEAN
1514  IN PVOID Vcb,
1515  IN BOOLEAN Wait
1516  );
1517 
1518 VOID
1520  IN PVOID Vcb
1521  );
1522 
1523 _Requires_lock_held_(_Global_critical_region_)
1524 BOOLEAN
1525 NTAPI
1526 FatAcquireFcbForLazyWrite (
1527  IN PVOID Null,
1528  IN BOOLEAN Wait
1529  );
1530 
1531 _Requires_lock_held_(_Global_critical_region_)
1532 VOID
1533 NTAPI
1534 FatReleaseFcbFromLazyWrite (
1535  IN PVOID Null
1536  );
1537 
1538 _Requires_lock_held_(_Global_critical_region_)
1539 BOOLEAN
1540 NTAPI
1541 FatAcquireFcbForReadAhead (
1542  IN PVOID Null,
1543  IN BOOLEAN Wait
1544  );
1545 
1546 _Requires_lock_held_(_Global_critical_region_)
1547 VOID
1548 NTAPI
1549 FatReleaseFcbFromReadAhead (
1550  IN PVOID Null
1551  );
1552 
1553 _Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH)
1554 _Requires_lock_held_(_Global_critical_region_)
1555 NTSTATUS
1556 NTAPI
1557 FatAcquireForCcFlush (
1560  );
1561 
1562 _Function_class_(FAST_IO_RELEASE_FOR_CCFLUSH)
1563 _Requires_lock_held_(_Global_critical_region_)
1564 NTSTATUS
1565 NTAPI
1566 FatReleaseForCcFlush (
1569  );
1570 
1571 BOOLEAN
1572 NTAPI
1574  IN PVOID Fcb,
1575  IN BOOLEAN Wait
1576  );
1577 
1578 VOID
1579 NTAPI
1581  IN PVOID Fcb
1582  );
1583 
1584 _Requires_lock_held_(_Global_critical_region_)
1585 NTSTATUS
1586 NTAPI
1587 FatFilterCallbackAcquireForCreateSection (
1590  );
1591 
1592 //
1593 // VOID
1594 // FatConvertToSharedFcb (
1595 // IN PIRP_CONTEXT IrpContext,
1596 // IN PFCB Fcb
1597 // );
1598 //
1599 
1600 #define FatConvertToSharedFcb(IRPCONTEXT,Fcb) { \
1601  ExConvertExclusiveToSharedLite( (Fcb)->Header.Resource ); \
1602  }
1603 
1604 //
1605 // VOID
1606 // FatReleaseGlobal (
1607 // IN PIRP_CONTEXT IrpContext
1608 // );
1609 //
1610 // VOID
1611 // FatReleaseVcb (
1612 // IN PIRP_CONTEXT IrpContext,
1613 // IN PVCB Vcb
1614 // );
1615 //
1616 // VOID
1617 // FatReleaseFcb (
1618 // IN PIRP_CONTEXT IrpContext,
1619 // IN PVCB Vcb
1620 // );
1621 //
1622 
1623 #define FatDeleteResource(RESRC) { \
1624  ExDeleteResourceLite( (RESRC) ); \
1625 }
1626 
1627 #define FatReleaseGlobal(IRPCONTEXT) { \
1628  ExReleaseResourceLite( &(FatData.Resource) ); \
1629  }
1630 
1631 #define FatReleaseVcb(IRPCONTEXT,Vcb) { \
1632  ExReleaseResourceLite( &((Vcb)->Resource) ); \
1633  }
1634 
1635 #define FatReleaseFcb(IRPCONTEXT,Fcb) { \
1636  ExReleaseResourceLite( (Fcb)->Header.Resource ); \
1637  }
1638 
1639 //
1640 // The following macro is used to retrieve the oplock structure within
1641 // the Fcb. This structure was moved to the advanced Fcb header
1642 // in Win8.
1643 //
1644 
1645 #if (NTDDI_VERSION >= NTDDI_WIN8)
1646 
1647 #define FatGetFcbOplock(F) &(F)->Header.Oplock
1648 
1649 #else
1650 
1651 #define FatGetFcbOplock(F) &(F)->Specific.Fcb.Oplock
1652 
1653 #endif
1654 
1655 
1656 //
1657 // In-memory structure support routine, implemented in StrucSup.c
1658 //
1659 
1660 _Requires_lock_held_(_Global_critical_region_)
1661 VOID
1662 FatInitializeVcb (
1663  IN PIRP_CONTEXT IrpContext,
1666  IN PVPB Vpb,
1668  );
1669 
1670 VOID
1672  IN PIRP_CONTEXT IrpContext,
1673  IN PVCB Vcb
1674  );
1675 
1676 VOID
1677 FatDeleteVcb (
1678  IN PIRP_CONTEXT IrpContext,
1679  IN PVCB Vcb
1680  );
1681 
1682 _Requires_lock_held_(_Global_critical_region_)
1683 VOID
1684 FatCreateRootDcb (
1685  IN PIRP_CONTEXT IrpContext,
1686  IN PVCB Vcb
1687  );
1688 
1689 PFCB
1690 FatCreateFcb (
1691  IN PIRP_CONTEXT IrpContext,
1692  IN PVCB Vcb,
1693  IN PDCB ParentDcb,
1694  IN ULONG LfnOffsetWithinDirectory,
1695  IN ULONG DirentOffsetWithinDirectory,
1696  IN PDIRENT Dirent,
1698  IN PUNICODE_STRING OrigLfn OPTIONAL,
1699  IN BOOLEAN IsPagingFile,
1700  IN BOOLEAN SingleResource
1701  );
1702 
1703 PDCB
1704 FatCreateDcb (
1705  IN PIRP_CONTEXT IrpContext,
1706  IN PVCB Vcb,
1707  IN PDCB ParentDcb,
1708  IN ULONG LfnOffsetWithinDirectory,
1709  IN ULONG DirentOffsetWithinDirectory,
1710  IN PDIRENT Dirent,
1712  );
1713 
1714 VOID
1715 FatDeleteFcb (
1716  IN PIRP_CONTEXT IrpContext,
1717  IN PFCB *Fcb
1718  );
1719 
1720 PCCB
1721 FatCreateCcb (
1722  IN PIRP_CONTEXT IrpContext
1723  );
1724 
1725 VOID
1727  IN PCCB Ccb
1728  );
1729 
1730 VOID
1731 FatDeleteCcb (
1732  IN PIRP_CONTEXT IrpContext,
1733  IN PCCB *Ccb
1734  );
1735 
1738  IN PIRP Irp,
1739  IN BOOLEAN Wait
1740  );
1741 
1742 VOID
1744  IN PIRP_CONTEXT IrpContext
1745  );
1746 
1747 #ifdef FASTFATDBG
1748 #define FatDeleteIrpContext(IRPCONTEXT) { \
1749  FatDeleteIrpContext_Real((IRPCONTEXT)); \
1750  (IRPCONTEXT) = NULL; \
1751 }
1752 #else
1753 #define FatDeleteIrpContext(IRPCONTEXT) { \
1754  FatDeleteIrpContext_Real((IRPCONTEXT)); \
1755 }
1756 #endif // FASTFAT_DBG
1757 
1758 PFCB
1760  IN PIRP_CONTEXT IrpContext,
1761  IN PFCB Fcb,
1762  IN PFCB TerminationFcb
1763  );
1764 
1765 PFCB
1767  IN PIRP_CONTEXT IrpContext,
1768  IN PFCB Fcb,
1769  IN PFCB TerminationFcb
1770  );
1771 
1772 //
1773 // These two macros just make the code a bit cleaner.
1774 //
1775 
1776 #define FatGetFirstChild(DIR) ((PFCB)( \
1777  IsListEmpty(&(DIR)->Specific.Dcb.ParentDcbQueue) ? NULL : \
1778  CONTAINING_RECORD((DIR)->Specific.Dcb.ParentDcbQueue.Flink, \
1779  DCB, \
1780  ParentDcbLinks.Flink)))
1781 
1782 #define FatGetNextSibling(FILE) ((PFCB)( \
1783  &(FILE)->ParentDcb->Specific.Dcb.ParentDcbQueue.Flink == \
1784  (PVOID)(FILE)->ParentDcbLinks.Flink ? NULL : \
1785  CONTAINING_RECORD((FILE)->ParentDcbLinks.Flink, \
1786  FCB, \
1787  ParentDcbLinks.Flink)))
1788 
1789 _Requires_lock_held_(_Global_critical_region_)
1790 BOOLEAN
1791 FatCheckForDismount (
1792  IN PIRP_CONTEXT IrpContext,
1794  IN BOOLEAN Force
1795  );
1796 
1797 VOID
1799  IN PIRP_CONTEXT IrpContext,
1800  PFCB Fcb,
1801  PDIRENT Dirent,
1803  );
1804 
1805 _Requires_lock_held_(_Global_critical_region_)
1806 VOID
1807 FatCheckFreeDirentBitmap (
1808  IN PIRP_CONTEXT IrpContext,
1809  IN PDCB Dcb
1810  );
1811 
1812 ULONG
1814  IN PIRP_CONTEXT IrpContext,
1815  IN PVCB Vcb
1816  );
1817 
1818 VOID
1820  IN PVCB Vcb
1821  );
1822 
1825  IN PVCB Vcb
1826  );
1827 
1828 //
1829 // BOOLEAN
1830 // FatIsRawDevice (
1831 // IN PIRP_CONTEXT IrpContext,
1832 // IN NTSTATUS Status
1833 // );
1834 //
1835 
1836 #define FatIsRawDevice(IC,S) ( \
1837  ((S) == STATUS_DEVICE_NOT_READY) || \
1838  ((S) == STATUS_NO_MEDIA_IN_DEVICE) \
1839 )
1840 
1841 
1842 //
1843 // Routines to support managing file names Fcbs and Dcbs.
1844 // Implemented in SplaySup.c
1845 //
1846 
1847 VOID
1848 FatInsertName (
1849  IN PIRP_CONTEXT IrpContext,
1852  );
1853 
1854 VOID
1856  IN PIRP_CONTEXT IrpContext,
1857  IN PFCB Fcb
1858  );
1859 
1860 PFCB
1861 FatFindFcb (
1862  IN PIRP_CONTEXT IrpContext,
1864  IN PSTRING Name,
1865  OUT PBOOLEAN FileNameDos OPTIONAL
1866  );
1867 
1868 BOOLEAN
1870  IN PIRP_CONTEXT IrpContext,
1871  IN PVCB Vcb
1872  );
1873 
1874 typedef enum _COMPARISON {
1878 } COMPARISON;
1879 
1880 COMPARISON
1882  IN PSTRING NameA,
1883  IN PSTRING NameB
1884  );
1885 
1886 //
1887 // Do a macro here to check for a common case.
1888 //
1889 
1890 #define CompareNames(NAMEA,NAMEB) ( \
1891  *(PUCHAR)(NAMEA)->Buffer != *(PUCHAR)(NAMEB)->Buffer ? \
1892  *(PUCHAR)(NAMEA)->Buffer < *(PUCHAR)(NAMEB)->Buffer ? \
1893  IsLessThan : IsGreaterThan : \
1894  FatCompareNames((PSTRING)(NAMEA), (PSTRING)(NAMEB)) \
1895 )
1896 
1897 //
1898 // Time conversion support routines, implemented in TimeSup.c
1899 //
1900 
1901 _Success_(return != FALSE)
1902 BOOLEAN
1903 FatNtTimeToFatTime (
1904  _In_ PIRP_CONTEXT IrpContext,
1909  );
1910 
1913  _In_ PIRP_CONTEXT IrpContext,
1915  _In_ UCHAR TenMilliSeconds
1916  );
1917 
1920  _In_ PIRP_CONTEXT IrpContext,
1921  _In_ FAT_DATE FatDate
1922  );
1923 
1926  _In_ PIRP_CONTEXT IrpContext
1927  );
1928 
1929 
1930 //
1931 // Low level verification routines, implemented in VerfySup.c
1932 //
1933 // The first routine is called to help process a verify IRP. Its job is
1934 // to walk every Fcb/Dcb and mark them as need to be verified.
1935 //
1936 // The other routines are used by every dispatch routine to verify that
1937 // an Vcb/Fcb/Dcb is still good. The routine walks as much of the opened
1938 // file/directory tree as necessary to make sure that the path is still valid.
1939 // The function result indicates if the procedure needed to block for I/O.
1940 // If the structure is bad the procedure raise the error condition
1941 // STATUS_FILE_INVALID, otherwise they simply return to their caller
1942 //
1943 
1944 typedef enum _FAT_VOLUME_STATE {
1949 
1950 VOID
1952  IN PIRP_CONTEXT IrpContext,
1953  IN PFCB Fcb,
1954  IN FCB_CONDITION FcbCondition,
1955  IN BOOLEAN Recursive
1956  );
1957 
1958 VOID
1959 FatVerifyVcb (
1960  IN PIRP_CONTEXT IrpContext,
1961  IN PVCB Vcb
1962  );
1963 
1964 _Requires_lock_held_(_Global_critical_region_)
1965 VOID
1966 FatVerifyFcb (
1967  IN PIRP_CONTEXT IrpContext,
1968  IN PFCB Fcb
1969  );
1970 
1971 
1972 KDEFERRED_ROUTINE FatCleanVolumeDpc;
1973 
1974 VOID
1975 NTAPI
1977  _In_ PKDPC Dpc,
1981  );
1982 
1983 _Requires_lock_held_(_Global_critical_region_)
1984 VOID
1985 FatMarkVolume (
1986  IN PIRP_CONTEXT IrpContext,
1989  );
1990 
1991 WORKER_THREAD_ROUTINE FatFspMarkVolumeDirtyWithRecover;
1992 
1993 VOID
1994 NTAPI
1997  );
1998 
1999 VOID
2001  IN PIRP_CONTEXT IrpContext,
2002  IN PVCB Vcb
2003  );
2004 
2005 VOID
2007  IN PIRP_CONTEXT IrpContext,
2008  IN PVCB Vcb
2009  );
2010 
2011 VOID
2013  IN PIRP_CONTEXT IrpContext
2014  );
2015 
2016 _Requires_lock_held_(_Global_critical_region_)
2017 NTSTATUS
2018 FatPerformVerify (
2019  _In_ PIRP_CONTEXT IrpContext,
2022  );
2023 
2024 
2025 //
2026 // Work queue routines for posting and retrieving an Irp, implemented in
2027 // workque.c
2028 //
2029 
2030 VOID
2031 NTAPI
2033  IN PVOID Context,
2034  IN PIRP Irp
2035  );
2036 
2037 VOID
2038 NTAPI
2039 FatPrePostIrp (
2040  IN PVOID Context,
2041  IN PIRP Irp
2042  );
2043 
2044 VOID
2046  IN PIRP_CONTEXT IrpContext,
2047  IN PIRP Irp
2048  );
2049 
2050 NTSTATUS
2052  IN PIRP_CONTEXT IrpContext,
2053  IN PIRP Irp
2054  );
2055 
2056 //
2057 // Miscellaneous support routines
2058 //
2059 
2060 //
2061 // ULONG
2062 // PtrOffset (
2063 // IN PVOID BasePtr,
2064 // IN PVOID OffsetPtr
2065 // );
2066 //
2067 
2068 #define PtrOffset(BASE,OFFSET) ((ULONG)((ULONG_PTR)(OFFSET) - (ULONG_PTR)(BASE)))
2069 
2070 //
2071 // This macro takes a pointer (or ulong) and returns its rounded up word
2072 // value
2073 //
2074 
2075 #define WordAlign(Ptr) ( \
2076  ((((ULONG)(Ptr)) + 1) & 0xfffffffe) \
2077  )
2078 
2079 //
2080 // This macro takes a pointer (or ulong) and returns its rounded up longword
2081 // value
2082 //
2083 
2084 #define LongAlign(Ptr) ( \
2085  ((((ULONG)(Ptr)) + 3) & 0xfffffffc) \
2086  )
2087 
2088 //
2089 // This macro takes a pointer (or ulong) and returns its rounded up quadword
2090 // value
2091 //
2092 
2093 #define QuadAlign(Ptr) ( \
2094  ((((ULONG)(Ptr)) + 7) & 0xfffffff8) \
2095  )
2096 
2097 //
2098 // The following types and macros are used to help unpack the packed and
2099 // misaligned fields found in the Bios parameter block
2100 //
2101 
2102 typedef union _UCHAR1 {
2103  UCHAR Uchar[1];
2105 } UCHAR1, *PUCHAR1;
2106 
2107 typedef union _UCHAR2 {
2108  UCHAR Uchar[2];
2110 } UCHAR2, *PUCHAR2;
2111 
2112 typedef union _UCHAR4 {
2113  UCHAR Uchar[4];
2115 } UCHAR4, *PUCHAR4;
2116 
2117 //
2118 // This macro copies an unaligned src byte to an aligned dst byte
2119 //
2120 
2121 #define CopyUchar1(Dst,Src) { \
2122  *((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \
2123  }
2124 
2125 //
2126 // This macro copies an unaligned src word to an aligned dst word
2127 //
2128 
2129 #define CopyUchar2(Dst,Src) { \
2130  *((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \
2131  }
2132 
2133 //
2134 // This macro copies an unaligned src longword to an aligned dsr longword
2135 //
2136 
2137 #define CopyUchar4(Dst,Src) { \
2138  *((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \
2139  }
2140 
2141 #define CopyU4char(Dst,Src) { \
2142  *((UNALIGNED UCHAR4 *)(Dst)) = *((UCHAR4 *)(Src)); \
2143  }
2144 
2145 //
2146 // VOID
2147 // FatNotifyReportChange (
2148 // IN PIRP_CONTEXT IrpContext,
2149 // IN PVCB Vcb,
2150 // IN PFCB Fcb,
2151 // IN ULONG Filter,
2152 // IN ULONG Action
2153 // );
2154 //
2155 
2156 #define FatNotifyReportChange(I,V,F,FL,A) { \
2157  if ((F)->FullFileName.Buffer == NULL) { \
2158  FatSetFullFileNameInFcb((I),(F)); \
2159  } \
2160  NT_ASSERT( (F)->FullFileName.Length != 0 ); \
2161  NT_ASSERT( (F)->FinalNameLength != 0 ); \
2162  NT_ASSERT( (F)->FullFileName.Length > (F)->FinalNameLength ); \
2163  NT_ASSERT( (F)->FullFileName.Buffer[((F)->FullFileName.Length - (F)->FinalNameLength)/sizeof(WCHAR) - 1] == L'\\' ); \
2164  FsRtlNotifyFullReportChange( (V)->NotifySync, \
2165  &(V)->DirNotifyList, \
2166  (PSTRING)&(F)->FullFileName, \
2167  (USHORT) ((F)->FullFileName.Length - \
2168  (F)->FinalNameLength), \
2169  (PSTRING)NULL, \
2170  (PSTRING)NULL, \
2171  (ULONG)FL, \
2172  (ULONG)A, \
2173  (PVOID)NULL ); \
2174 }
2175 
2176 
2177 //
2178 // The FSD Level dispatch routines. These routines are called by the
2179 // I/O system via the dispatch table in the Driver Object.
2180 //
2181 // They each accept as input a pointer to a device object (actually most
2182 // expect a volume device object, with the exception of the file system
2183 // control function which can also take a file system device object), and
2184 // a pointer to the IRP. They either perform the function at the FSD level
2185 // or post the request to the FSP work queue for FSP level processing.
2186 //
2187 
2190 NTSTATUS
2191 NTAPI
2192 FatFsdCleanup ( // implemented in Cleanup.c
2193  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2194  _Inout_ PIRP Irp
2195  );
2196 
2199 NTSTATUS
2200 NTAPI
2201 FatFsdClose ( // implemented in Close.c
2202  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2203  _Inout_ PIRP Irp
2204  );
2205 
2208 NTSTATUS
2209 NTAPI
2210 FatFsdCreate ( // implemented in Create.c
2211  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2212  _Inout_ PIRP Irp
2213  );
2214 
2215 
2218 NTSTATUS
2219 NTAPI
2220 FatFsdDeviceControl ( // implemented in DevCtrl.c
2221  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2222  _Inout_ PIRP Irp
2223  );
2224 
2227 NTSTATUS
2228 NTAPI
2229 FatFsdDirectoryControl ( // implemented in DirCtrl.c
2230  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2231  _Inout_ PIRP Irp
2232  );
2233 
2236 NTSTATUS
2237 NTAPI
2238 FatFsdQueryEa ( // implemented in Ea.c
2239  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2240  _Inout_ PIRP Irp
2241  );
2242 
2245 NTSTATUS
2246 NTAPI
2247 FatFsdSetEa ( // implemented in Ea.c
2248  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2249  _Inout_ PIRP Irp
2250  );
2251 
2254 NTSTATUS
2255 NTAPI
2256 FatFsdQueryInformation ( // implemented in FileInfo.c
2257  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2258  _Inout_ PIRP Irp
2259  );
2260 
2263 NTSTATUS
2264 NTAPI
2265 FatFsdSetInformation ( // implemented in FileInfo.c
2266  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2267  _Inout_ PIRP Irp
2268  );
2269 
2272 NTSTATUS
2273 NTAPI
2274 FatFsdFlushBuffers ( // implemented in Flush.c
2275  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2276  _Inout_ PIRP Irp
2277  );
2278 
2281 NTSTATUS
2282 NTAPI
2283 FatFsdFileSystemControl ( // implemented in FsCtrl.c
2284  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2285  _Inout_ PIRP Irp
2286  );
2287 
2290 NTSTATUS
2291 NTAPI
2292 FatFsdLockControl ( // implemented in LockCtrl.c
2293  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2294  _Inout_ PIRP Irp
2295  );
2296 
2299 NTSTATUS
2300 NTAPI
2301 FatFsdPnp ( // implemented in Pnp.c
2302  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2303  _Inout_ PIRP Irp
2304  );
2305 
2308 NTSTATUS
2309 NTAPI
2310 FatFsdRead ( // implemented in Read.c
2311  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2312  _Inout_ PIRP Irp
2313  );
2314 
2317 NTSTATUS
2318 NTAPI
2319 FatFsdShutdown ( // implemented in Shutdown.c
2320  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2321  _Inout_ PIRP Irp
2322  );
2323 
2326 NTSTATUS
2327 NTAPI
2328 FatFsdQueryVolumeInformation ( // implemented in VolInfo.c
2329  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2330  _Inout_ PIRP Irp
2331  );
2332 
2335 NTSTATUS
2336 NTAPI
2337 FatFsdSetVolumeInformation ( // implemented in VolInfo.c
2338  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2339  _Inout_ PIRP Irp
2340  );
2341 
2344 NTSTATUS
2345 NTAPI
2346 FatFsdWrite ( // implemented in Write.c
2347  _In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
2348  _Inout_ PIRP Irp
2349  );
2350 
2351 //
2352 // The following macro is used to determine if an FSD thread can block
2353 // for I/O or wait for a resource. It returns TRUE if the thread can
2354 // block and FALSE otherwise. This attribute can then be used to call
2355 // the FSD & FSP common work routine with the proper wait value.
2356 //
2357 
2358 #define CanFsdWait(IRP) IoIsOperationSynchronous(Irp)
2359 
2360 
2361 //
2362 // The FSP level dispatch/main routine. This is the routine that takes
2363 // IRP's off of the work queue and calls the appropriate FSP level
2364 // work routine.
2365 //
2366 
2367 
2368 WORKER_THREAD_ROUTINE FatFspDispatch;
2369 
2370 VOID
2371 NTAPI
2372 FatFspDispatch ( // implemented in FspDisp.c
2374  );
2375 
2376 //
2377 // The following routines are the FSP work routines that are called
2378 // by the preceding FatFspDispath routine. Each takes as input a pointer
2379 // to the IRP, perform the function, and return a pointer to the volume
2380 // device object that they just finished servicing (if any). The return
2381 // pointer is then used by the main Fsp dispatch routine to check for
2382 // additional IRPs in the volume's overflow queue.
2383 //
2384 // Each of the following routines is also responsible for completing the IRP.
2385 // We moved this responsibility from the main loop to the individual routines
2386 // to allow them the ability to complete the IRP and continue post processing
2387 // actions.
2388 //
2389 
2390 _Requires_lock_held_(_Global_critical_region_)
2391 NTSTATUS
2392 FatCommonCleanup ( // implemented in Cleanup.c
2393  IN PIRP_CONTEXT IrpContext,
2394  IN PIRP Irp
2395  );
2396 
2397 _Requires_lock_held_(_Global_critical_region_)
2398 NTSTATUS
2399 FatCommonClose ( // implemented in Close.c
2400  IN PVCB Vcb,
2402  IN PCCB Ccb,
2404  IN BOOLEAN Wait,
2406  OUT PBOOLEAN VcbDeleted OPTIONAL
2407  );
2408 
2409 _Requires_lock_held_(_Global_critical_region_)
2410 VOID
2411 FatFspClose ( // implemented in Close.c
2413  );
2414 
2415 _Requires_lock_held_(_Global_critical_region_)
2416 NTSTATUS
2417 FatCommonCreate ( // implemented in Create.c
2418  _Inout_ PIRP_CONTEXT IrpContext,
2419  _Inout_ PIRP Irp
2420  );
2421 
2422 #if (NTDDI_VERSION >= NTDDI_WINTHRESHOLD)
2423 
2424 _Requires_lock_held_(_Global_critical_region_)
2425 NTSTATUS
2426 FatCommonCreateOnNewStack ( // implemented in Create.c
2427  _Inout_ PIRP_CONTEXT IrpContext,
2428  _Inout_ PIRP Irp
2429  );
2430 
2431 _Requires_lock_held_(_Global_critical_region_)
2432 VOID
2433 FatCommonCreateCallout ( // implemented in Create.c
2434  _In_ PFAT_CALLOUT_PARAMETERS CalloutParameters
2435  );
2436 
2437 #endif
2438 
2439 _Requires_lock_held_(_Global_critical_region_)
2440 NTSTATUS
2441 FatCommonDirectoryControl ( // implemented in DirCtrl.c
2442  IN PIRP_CONTEXT IrpContext,
2443  IN PIRP Irp
2444  );
2445 
2446 _Requires_lock_held_(_Global_critical_region_)
2447 NTSTATUS
2448 FatCommonDeviceControl ( // implemented in DevCtrl.c
2449  IN PIRP_CONTEXT IrpContext,
2450  IN PIRP Irp
2451  );
2452 
2453 NTSTATUS
2454 FatCommonQueryEa ( // implemented in Ea.c
2455  IN PIRP_CONTEXT IrpContext,
2456  IN PIRP Irp
2457  );
2458 
2459 NTSTATUS
2460 FatCommonSetEa ( // implemented in Ea.c
2461  IN PIRP_CONTEXT IrpContext,
2462  IN PIRP Irp
2463  );
2464 
2465 _Requires_lock_held_(_Global_critical_region_)
2466 NTSTATUS
2467 FatCommonQueryInformation ( // implemented in FileInfo.c
2468  IN PIRP_CONTEXT IrpContext,
2469  IN PIRP Irp
2470  );
2471 
2472 _Requires_lock_held_(_Global_critical_region_)
2473 NTSTATUS
2474 FatCommonSetInformation ( // implemented in FileInfo.c
2475  IN PIRP_CONTEXT IrpContext,
2476  IN PIRP Irp
2477  );
2478 
2479 _Requires_lock_held_(_Global_critical_region_)
2480 NTSTATUS
2481 FatCommonFlushBuffers ( // implemented in Flush.c
2482  IN PIRP_CONTEXT IrpContext,
2483  IN PIRP Irp
2484  );
2485 
2486 _Requires_lock_held_(_Global_critical_region_)
2487 NTSTATUS
2488 FatCommonFileSystemControl ( // implemented in FsCtrl.c
2489  IN PIRP_CONTEXT IrpContext,
2490  IN PIRP Irp
2491  );
2492 
2493 _Requires_lock_held_(_Global_critical_region_)
2494 NTSTATUS
2495 FatCommonLockControl ( // implemented in LockCtrl.c
2496  IN PIRP_CONTEXT IrpContext,
2497  IN PIRP Irp
2498  );
2499 
2500 _Requires_lock_held_(_Global_critical_region_)
2501 NTSTATUS
2502 FatCommonPnp ( // implemented in Pnp.c
2503  IN PIRP_CONTEXT IrpContext,
2504  IN PIRP Irp
2505  );
2506 
2507 _Requires_lock_held_(_Global_critical_region_)
2508 NTSTATUS
2509 FatCommonRead ( // implemented in Read.c
2510  IN PIRP_CONTEXT IrpContext,
2511  IN PIRP Irp
2512  );
2513 
2514 _Requires_lock_held_(_Global_critical_region_)
2515 NTSTATUS
2516 FatCommonShutdown ( // implemented in Shutdown.c
2517  IN PIRP_CONTEXT IrpContext,
2518  IN PIRP Irp
2519  );
2520 
2521 _Requires_lock_held_(_Global_critical_region_)
2522 NTSTATUS
2523 FatCommonQueryVolumeInfo ( // implemented in VolInfo.c
2524  IN PIRP_CONTEXT IrpContext,
2525  IN PIRP Irp
2526  );
2527 
2528 _Requires_lock_held_(_Global_critical_region_)
2529 NTSTATUS
2530 FatCommonSetVolumeInfo ( // implemented in VolInfo.c
2531  IN PIRP_CONTEXT IrpContext,
2532  IN PIRP Irp
2533  );
2534 
2535 _Requires_lock_held_(_Global_critical_region_)
2536 NTSTATUS
2537 FatCommonWrite ( // implemented in Write.c
2538  IN PIRP_CONTEXT IrpContext,
2539  IN PIRP Irp
2540  );
2541 
2542 //
2543 // The following is implemented in Flush.c, and does what is says.
2544 //
2545 
2546 _Requires_lock_held_(_Global_critical_region_)
2547 NTSTATUS
2548 FatFlushFile (
2549  IN PIRP_CONTEXT IrpContext,
2550  IN PFCB Fcb,
2552  );
2553 
2554 _Requires_lock_held_(_Global_critical_region_)
2555 NTSTATUS
2556 FatFlushDirectory (
2557  IN PIRP_CONTEXT IrpContext,
2558  IN PDCB Dcb,
2560  );
2561 
2562 NTSTATUS
2563 FatFlushFat (
2564  IN PIRP_CONTEXT IrpContext,
2565  IN PVCB Vcb
2566  );
2567 
2568 _Requires_lock_held_(_Global_critical_region_)
2569 NTSTATUS
2570 FatFlushVolume (
2571  IN PIRP_CONTEXT IrpContext,
2572  IN PVCB Vcb,
2574  );
2575 
2576 NTSTATUS
2578  IN PIRP_CONTEXT IrpContext,
2579  IN PIRP Irp,
2581  );
2582 
2583 VOID
2585  IN PIRP_CONTEXT IrpContext,
2586  IN PVCB Vcb,
2587  IN ULONG Cluster,
2588  IN ULONG Count
2589 );
2590 
2591 VOID
2593  IN PIRP_CONTEXT IrpContext,
2594  IN PFCB Fcb
2595 );
2596 
2597 
2598 
2599 //
2600 // The following procedure is used by the FSP and FSD routines to complete
2601 // an IRP.
2602 //
2603 // Note that this macro allows either the Irp or the IrpContext to be
2604 // null, however the only legal order to do this in is:
2605 //
2606 // FatCompleteRequest( NULL, Irp, Status ); // completes Irp & preserves context
2607 // ...
2608 // FatCompleteRequest( IrpContext, NULL, DontCare ); // deallocates context
2609 //
2610 // This would typically be done in order to pass a "naked" IrpContext off to
2611 // the Fsp for post processing, such as read ahead.
2612 //
2613 
2614 VOID
2616  IN PIRP_CONTEXT IrpContext,
2617  IN PIRP Irp,
2619  );
2620 
2621 #define FatCompleteRequest(IRPCONTEXT,IRP,STATUS) { \
2622  FatCompleteRequest_Real(IRPCONTEXT,IRP,STATUS); \
2623 }
2624 
2625 BOOLEAN
2627  IN PIRP Irp
2628  );
2629 
2630 //
2631 // The Following routine makes a popup
2632 //
2633 
2634 _Requires_lock_held_(_Global_critical_region_)
2635 VOID
2636 FatPopUpFileCorrupt (
2637  IN PIRP_CONTEXT IrpContext,
2638  IN PFCB Fcb
2639  );
2640 
2641 //
2642 // Here are the callbacks used by the I/O system for checking for fast I/O or
2643 // doing a fast query info call, or doing fast lock calls.
2644 //
2645 _Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
2646 BOOLEAN
2647 NTAPI
2648 FatFastIoCheckIfPossible (
2651  IN ULONG Length,
2652  IN BOOLEAN Wait,
2653  IN ULONG LockKey,
2657  );
2658 
2659 _Function_class_(FAST_IO_QUERY_BASIC_INFO)
2660 BOOLEAN
2661 NTAPI
2662 FatFastQueryBasicInfo (
2664  IN BOOLEAN Wait,
2668  );
2669 
2670 _Function_class_(FAST_IO_QUERY_STANDARD_INFO)
2671 BOOLEAN
2672 NTAPI
2673 FatFastQueryStdInfo (
2675  IN BOOLEAN Wait,
2679  );
2680 
2681 _Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
2682 BOOLEAN
2683 NTAPI
2684 FatFastQueryNetworkOpenInfo (
2686  IN BOOLEAN Wait,
2690  );
2691 
2692 _Function_class_(FAST_IO_LOCK)
2693 BOOLEAN
2694 NTAPI
2695 FatFastLock (
2700  ULONG Key,
2705  );
2706 
2707 _Function_class_(FAST_IO_UNLOCK_SINGLE)
2708 BOOLEAN
2709 NTAPI
2710 FatFastUnlockSingle (
2715  ULONG Key,
2718  );
2719 
2720 _Function_class_(FAST_IO_UNLOCK_ALL)
2721 BOOLEAN
2722 NTAPI
2723 FatFastUnlockAll (
2728  );
2729 
2730 _Function_class_(FAST_IO_UNLOCK_ALL_BY_KEY)
2731 BOOLEAN
2732 NTAPI
2733 FatFastUnlockAllByKey (
2735  PVOID ProcessId,
2736  ULONG Key,
2739  );
2740 
2741 
2742 VOID
2744  IN PIRP_CONTEXT IrpContext,
2745  IN PVCB Vcb,
2746  IN ULONG StartIndex OPTIONAL,
2747  IN ULONG EndIndex OPTIONAL,
2748  IN BOOLEAN SetupWindows,
2749  IN PFAT_WINDOW SwitchToWindow OPTIONAL,
2750  IN PULONG BitMapBuffer OPTIONAL
2751  );
2752 
2753 BOOLEAN
2755  IN PIRP_CONTEXT IrpContext,
2757  );
2758 
2759 //
2760 // The following macro is used to determine is a file has been deleted.
2761 //
2762 // BOOLEAN
2763 // IsFileDeleted (
2764 // IN PIRP_CONTEXT IrpContext,
2765 // IN PFCB Fcb
2766 // );
2767 //
2768 
2769 #define IsFileDeleted(IRPCONTEXT,FCB) \
2770  (FlagOn((FCB)->FcbState, FCB_STATE_DELETE_ON_CLOSE) && \
2771  ((FCB)->UncleanCount == 0))
2772 
2773 //
2774 // The following macro is used by the dispatch routines to determine if
2775 // an operation is to be done with or without Write Through.
2776 //
2777 // BOOLEAN
2778 // IsFileWriteThrough (
2779 // IN PFILE_OBJECT FileObject,
2780 // IN PVCB Vcb
2781 // );
2782 //
2783 
2784 #define IsFileWriteThrough(FO,VCB) ( \
2785  BooleanFlagOn((FO)->Flags, FO_WRITE_THROUGH) \
2786 )
2787 
2788 //
2789 // The following macro is used to set the is fast i/o possible field in
2790 // the common part of the nonpaged fcb. It checks that this is actually
2791 // an FCB (as opposed to a DCB) so that directory oplock code works properly.
2792 //
2793 //
2794 // BOOLEAN
2795 // FatIsFastIoPossible (
2796 // IN PFCB Fcb
2797 // );
2798 //
2799 
2800 
2801 #define FatIsFastIoPossible(FCB) ((BOOLEAN) \
2802  ((((FCB)->FcbCondition != FcbGood) || \
2803  (NodeType( (FCB) ) != FAT_NTC_FCB) || \
2804  !FsRtlOplockIsFastIoPossible( FatGetFcbOplock(FCB) )) ? \
2805  FastIoIsNotPossible \
2806  : \
2807  (!FsRtlAreThereCurrentFileLocks( &(FCB)->Specific.Fcb.FileLock ) && \
2808  ((FCB)->NonPaged->OutstandingAsyncWrites == 0) && \
2809  !FlagOn( (FCB)->Vcb->VcbState, VCB_STATE_FLAG_WRITE_PROTECTED ) ? \
2810  FastIoIsPossible \
2811  : \
2812  FastIoIsQuestionable \
2813  ) \
2814  ) \
2815 )
2816 
2817 
2818 #if (NTDDI_VERSION >= NTDDI_WIN8)
2819 
2820 //
2821 // Detect whether this file can have an oplock on it. As of Windows 8 file and
2822 // directories can have oplocks.
2823 //
2824 
2825 #define FatIsNodeTypeOplockable(N) ( \
2826  ((N) == FAT_NTC_FCB) || \
2827  ((N) == FAT_NTC_ROOT_DCB) || \
2828  ((N) == FAT_NTC_DCB) \
2829 )
2830 
2831 #else
2832 
2833 #define FatIsNodeTypeOplockable(N) ( \
2834  ((N) == FAT_NTC_FCB) \
2835 )
2836 
2837 #endif
2838 
2839 #define FatIsFileOplockable(F) ( \
2840  FatIsNodeTypeOplockable( NodeType( (F) )) \
2841 )
2842 
2843 //
2844 // The following macro is used to detemine if the file object is opened
2845 // for read only access (i.e., it is not also opened for write access or
2846 // delete access).
2847 //
2848 // BOOLEAN
2849 // IsFileObjectReadOnly (
2850 // IN PFILE_OBJECT FileObject
2851 // );
2852 //
2853 
2854 #define IsFileObjectReadOnly(FO) (!((FO)->WriteAccess | (FO)->DeleteAccess))
2855 
2856 
2857 //
2858 // The following two macro are used by the Fsd/Fsp exception handlers to
2859 // process an exception. The first macro is the exception filter used in the
2860 // Fsd/Fsp to decide if an exception should be handled at this level.
2861 // The second macro decides if the exception is to be finished off by
2862 // completing the IRP, and cleaning up the Irp Context, or if we should
2863 // bugcheck. Exception values such as STATUS_FILE_INVALID (raised by
2864 // VerfySup.c) cause us to complete the Irp and cleanup, while exceptions
2865 // such as accvio cause us to bugcheck.
2866 //
2867 // The basic structure for fsd/fsp exception handling is as follows:
2868 //
2869 // FatFsdXxx(...)
2870 // {
2871 // try {
2872 //
2873 // ...
2874 //
2875 // } except(FatExceptionFilter( IrpContext, GetExceptionCode() )) {
2876 //
2877 // Status = FatProcessException( IrpContext, Irp, GetExceptionCode() );
2878 // }
2879 //
2880 // Return Status;
2881 // }
2882 //
2883 // To explicitly raise an exception that we expect, such as
2884 // STATUS_FILE_INVALID, use the below macro FatRaiseStatus(). To raise a
2885 // status from an unknown origin (such as CcFlushCache()), use the macro
2886 // FatNormalizeAndRaiseStatus. This will raise the status if it is expected,
2887 // or raise STATUS_UNEXPECTED_IO_ERROR if it is not.
2888 //
2889 // If we are vicariously handling exceptions without using FatProcessException(),
2890 // if there is the possibility that we raised that exception, one *must*
2891 // reset the IrpContext so a subsequent raise in the course of handling this
2892 // request that is *not* explicit, i.e. like a pagein error, does not get
2893 // spoofed into believing that the first raise status is the reason the second
2894 // occured. This could have really serious consequences.
2895 //
2896 // It is an excellent idea to always FatResetExceptionState in these cases.
2897 //
2898 // Note that when using these two macros, the original status is placed in
2899 // IrpContext->ExceptionStatus, signaling FatExceptionFilter and
2900 // FatProcessException that the status we actually raise is by definition
2901 // expected.
2902 //
2903 
2904 ULONG
2906  IN PIRP_CONTEXT IrpContext,
2907  IN PEXCEPTION_POINTERS ExceptionPointer
2908  );
2909 
2910 #if DBG
2911 ULONG
2912 FatBugCheckExceptionFilter (
2913  IN PEXCEPTION_POINTERS ExceptionPointer
2914  );
2915 #endif
2916 
2917 _Requires_lock_held_(_Global_critical_region_)
2918 NTSTATUS
2919 FatProcessException (
2920  IN PIRP_CONTEXT IrpContext,
2923  );
2924 
2925 //
2926 // VOID
2927 // FatRaiseStatus (
2928 // IN PRIP_CONTEXT IrpContext,
2929 // IN NT_STATUS Status
2930 // );
2931 //
2932 //
2933 
2934 #if DBG
2935 #ifdef _MSC_VER
2936 #define DebugBreakOnStatus(S) { \
2937 __pragma(warning(push)) \
2938 __pragma(warning(disable:4127)) \
2939  if (FatTestRaisedStatus) { \
2940  if ((S) == STATUS_DISK_CORRUPT_ERROR || (S) == STATUS_FILE_CORRUPT_ERROR) { \
2941 __pragma(warning(pop)) \
2942  DbgPrint( "FAT: Breaking on interesting raised status (0x%08x)\n", (S) );\
2943  DbgPrint( "FAT: Set FatTestRaisedStatus @ 0x%p to 0 to disable\n", \
2944  &FatTestRaisedStatus ); \
2945  NT_ASSERT(FALSE); \
2946  } \
2947  } \
2948 }
2949 #else
2950 #define DebugBreakOnStatus(S) { \
2951  if (FatTestRaisedStatus) { \
2952  if ((S) == STATUS_DISK_CORRUPT_ERROR || (S) == STATUS_FILE_CORRUPT_ERROR) { \
2953  DbgPrint( "FAT: Breaking on interesting raised status (0x%08x)\n", (S) );\
2954  DbgPrint( "FAT: Set FatTestRaisedStatus @ 0x%p to 0 to disable\n", \
2955  &FatTestRaisedStatus ); \
2956  NT_ASSERT(FALSE); \
2957  } \
2958  } \
2959 }
2960 #endif
2961 #else
2962 #define DebugBreakOnStatus(S)
2963 #endif
2964 
2965 #define FatRaiseStatus(IRPCONTEXT,STATUS) { \
2966  (IRPCONTEXT)->ExceptionStatus = (STATUS); \
2967  DebugBreakOnStatus( (STATUS) ) \
2968  ExRaiseStatus( (STATUS) ); \
2969 }
2970 
2971 #define FatResetExceptionState( IRPCONTEXT ) { \
2972  (IRPCONTEXT)->ExceptionStatus = STATUS_SUCCESS; \
2973 }
2974 
2975 //
2976 // VOID
2977 // FatNormalAndRaiseStatus (
2978 // IN PRIP_CONTEXT IrpContext,
2979 // IN NT_STATUS Status
2980 // );
2981 //
2982 
2983 #define FatNormalizeAndRaiseStatus(IRPCONTEXT,STATUS) { \
2984  (IRPCONTEXT)->ExceptionStatus = (STATUS); \
2985  ExRaiseStatus(FsRtlNormalizeNtstatus((STATUS),STATUS_UNEXPECTED_IO_ERROR)); \
2986 }
2987 
2988 
2989 //
2990 // The following macros are used to establish the semantics needed
2991 // to do a return from within a try-finally clause. As a rule every
2992 // try clause must end with a label call try_exit. For example,
2993 //
2994 // try {
2995 // :
2996 // :
2997 //
2998 // try_exit: NOTHING;
2999 // } finally {
3000 //
3001 // :
3002 // :
3003 // }
3004 //
3005 // Every return statement executed inside of a try clause should use the
3006 // try_return macro. If the compiler fully supports the try-finally construct
3007 // then the macro should be
3008 //
3009 // #define try_return(S) { return(S); }
3010 //
3011 // If the compiler does not support the try-finally construct then the macro
3012 // should be
3013 //
3014 // #define try_return(S) { S; goto try_exit; }
3015 //
3016 
3017 #define try_return(S) { S; goto try_exit; }
3018 #define try_leave(S) { S; _SEH2_LEAVE; }
3019 
3020 
3023  IN PVCB Vcb,
3025  );
3026 
3027 
3028 //
3029 // These routines define the FileId for FAT. Lacking a fixed/uniquifiable
3030 // notion, we simply come up with one which is unique in a given snapshot
3031 // of the volume. As long as the parent directory is not moved or compacted,
3032 // it may even be permanent.
3033 //
3034 
3035 //
3036 // The internal information used to identify the fcb/dcb on the
3037 // volume is the byte offset of the dirent of the file on disc.
3038 // Our root always has fileid 0. FAT32 roots are chains and can
3039 // use the LBO of the cluster, 12/16 roots use the lbo in the Vcb.
3040 //
3041 
3042 #define FatGenerateFileIdFromDirentOffset(ParentDcb,DirentOffset) \
3043  ((ParentDcb) ? ((NodeType(ParentDcb) != FAT_NTC_ROOT_DCB || FatIsFat32((ParentDcb)->Vcb)) ? \
3044  FatGetLboFromIndex( (ParentDcb)->Vcb, \
3045  (ParentDcb)->FirstClusterOfFile ) : \
3046  (ParentDcb)->Vcb->AllocationSupport.RootDirectoryLbo) + \
3047  (DirentOffset) \
3048  : \
3049  0)
3050 
3051 //
3052 //
3053 
3054 #define FatGenerateFileIdFromFcb(Fcb) \
3055  FatGenerateFileIdFromDirentOffset( (Fcb)->ParentDcb, (Fcb)->DirentOffsetWithinDirectory )
3056 
3057 //
3058 // Wrap to handle the ./.. cases appropriately. Note that we commute NULL parent to 0. This would
3059 // only occur in an illegal root ".." entry.
3060 //
3061 
3062 #define FATDOT ((ULONG)0x2020202E)
3063 #define FATDOTDOT ((ULONG)0x20202E2E)
3064 
3065 #define FatGenerateFileIdFromDirentAndOffset(Dcb,Dirent,DirentOffset) \
3066  ((*((PULONG)(Dirent)->FileName)) == FATDOT ? FatGenerateFileIdFromFcb(Dcb) : \
3067  ((*((PULONG)(Dirent)->FileName)) == FATDOTDOT ? ((Dcb)->ParentDcb ? \
3068  FatGenerateFileIdFromFcb((Dcb)->ParentDcb) : \
3069  0) : \
3070  FatGenerateFileIdFromDirentOffset(Dcb,DirentOffset)))
3071 
3072 
3073 //
3074 // BOOLEAN
3075 // FatDeviceIsFatFsdo(
3076 // IN PDEVICE_OBJECT D
3077 // );
3078 //
3079 // Evaluates to TRUE if the supplied device object is one of the file system devices
3080 // we created at initialisation.
3081 //
3082 
3083 #define FatDeviceIsFatFsdo( D) (((D) == FatData.DiskFileSystemDeviceObject) || ((D) == FatData.CdromFileSystemDeviceObject))
3084 
3085 
3086 //
3087 // BlockAlign(): Aligns P on the next V boundary.
3088 // BlockAlignTruncate(): Aligns P on the prev V boundary.
3089 //
3090 
3091 #define BlockAlign(P,V) ((ASSERT( V != 0)), (((P)) + (V-1) & (0-(V))))
3092 #define BlockAlignTruncate(P,V) ((P) & (0-(V)))
3093 
3094 #define IsDirectory(FcbOrDcb) ((NodeType((FcbOrDcb)) == FAT_NTC_DCB) || (NodeType((FcbOrDcb)) == FAT_NTC_ROOT_DCB))
3095 
3096 #endif // _FATPROCS_
3097 
3098 
VOID FatRepinBcb(IN PIRP_CONTEXT IrpContext, IN PBCB Bcb)
Definition: cachesup.c:1317
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING IN PUNICODE_STRING SuggestedShortName IN OUT BOOLEAN IN OUT BOOLEAN * AllLowerExtension
Definition: fatprocs.h:1294
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING ShortName
Definition: fatprocs.h:1294
_COMPARISON
Definition: fatprocs.h:1874
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
ULONG ForceAlignment
Definition: cdprocs.h:1683
* PNTSTATUS
Definition: strlen.c:14
VOID FatConstructNamesInFcb(IN PIRP_CONTEXT IrpContext, PFCB Fcb, PDIRENT Dirent, PUNICODE_STRING Lfn OPTIONAL)
Definition: strucsup.c:3021
IN PVCB IN ULONG AbsoluteClusterHint
Definition: fatprocs.h:334
*BytesInOemString PCHAR OemString
Definition: rtlfuncs.h:1561
#define IN
Definition: typedefs.h:38
return
Definition: dirsup.c:529
VOID FatAppendPackedEa(IN PIRP_CONTEXT IrpContext, IN OUT PEA_SET_HEADER *EaSetHeader, IN OUT PULONG PackedEasLength, IN OUT PULONG AllocationLength, IN PFILE_FULL_EA_INFORMATION FullEa, IN ULONG BytesPerCluster)
Definition: easup.c:2967
VOID FatExtendString(_Inout_ PVOID String, _In_ USHORT DesiredBufferSize, _In_ BOOLEAN FreeOldBuffer, __out_opt PBOOLEAN NeedsFree)
PCWSTR Expression
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
IN PVCB IN FAT_VOLUME_STATE VolumeState
Definition: fatprocs.h:1987
VOID FatPreallocateCloseContext(IN PVCB Vcb)
OUT PVOID * CompletionContext
Definition: fatprocs.h:1590
#define TRUE
Definition: types.h:120
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
FAT_TIME_STAMP FatGetCurrentFatTime(_In_ PIRP_CONTEXT IrpContext)
Definition: timesup.c:317
ULONG FatLocateNextEa(IN PIRP_CONTEXT IrpContext, IN PPACKED_EA FirstPackedEa, IN ULONG PackedEasLength, IN ULONG PreviousOffset)
Definition: easup.c:3257
union _UCHAR2 UCHAR2
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:402
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
PCLOSE_CONTEXT FatAllocateCloseContext(IN PVCB Vcb)
#define INLINE
Definition: fatprocs.h:68
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
_Requires_lock_held_(_Global_critical_region_) VOID FatLookupFileAllocation(IN PIRP_CONTEXT IrpContext
VOID FatTearDownVcb(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
Definition: strucsup.c:662
#define IRP_MJ_FLUSH_BUFFERS
unsigned char Uchar
Definition: utypes.h:45
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING IN PUNICODE_STRING SuggestedShortName IN OUT BOOLEAN * AllLowerComponent
Definition: fatprocs.h:1294
LARGE_INTEGER FatFatDateToNtTime(_In_ PIRP_CONTEXT IrpContext, _In_ FAT_DATE FatDate)
Definition: timesup.c:171
VOID FatUnicodeToUpcaseOem(IN PIRP_CONTEXT IrpContext, IN POEM_STRING OemString, IN PUNICODE_STRING UnicodeString)
Definition: namesup.c:632
VOID FatMarkEaRangeDirty(IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT EaFileObject, IN OUT PEA_RANGE EaRange)
Definition: easup.c:3709
VOID FatReadEaSet(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN USHORT EaHandle, IN POEM_STRING FileName, IN BOOLEAN ReturnEntireSet, OUT PEA_RANGE EaSetRange)
Definition: easup.c:1306
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN IN BOOLEAN ExclusiveFcb
Definition: fatprocs.h:904
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
IN PIRP IN NTSTATUS ExceptionCode
Definition: fatprocs.h:2921
#define IRP_MJ_SHUTDOWN
_In_ PIRP Irp
Definition: csq.h:116
ERESOURCE Resource
Definition: fatstruc.h:400
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
Definition: cdstruc.h:908
VOID Fat8dot3ToString(_In_ PIRP_CONTEXT IrpContext, _In_ PDIRENT Dirent, _In_ BOOLEAN RestoreCase, _Out_ POEM_STRING OutputString)
Definition: namesup.c:179
IN PDCB IN PCCB Ccb
Definition: fatprocs.h:716
VOID FatAddToWorkque(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
Definition: workque.c:277
NTSTATUS FatToggleMediaEjectDisable(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN BOOLEAN PreventRemoval)
Definition: deviosup.c:3515
VOID FatMultipleAsync(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN PIRP Irp, IN ULONG MultipleIrpCount, IN PIO_RUN IoRuns)
Definition: deviosup.c:1630
Definition: cdstruc.h:1073
ULONG32 VBO
Definition: fat.h:38
unsigned char * PUCHAR
Definition: retypes.h:3
IN PVCB IN OUT PLARGE_MCB IN PLARGE_MCB SecondMcb
Definition: fatprocs.h:364
enum _FAT_VOLUME_STATE * PFAT_VOLUME_STATE
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID _In_ ULONG _In_ BOOLEAN InternalDeviceIoControl
Definition: iofuncs.h:713
PVOID FatMapUserBuffer(IN PIRP_CONTEXT IrpContext, IN OUT PIRP Irp)
Definition: deviosup.c:3369
NTSTATUS FatCompleteMdl(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
Definition: cachesup.c:1728
IN PDCB Dcb
Definition: fatprocs.h:415
VOID NTAPI FatOplockComplete(IN PVOID Context, IN PIRP Irp)
Definition: workque.c:35
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT * Dirent
Definition: fatprocs.h:716
LONG NTSTATUS
Definition: precomp.h:26
PFCB FatFindFcb(IN PIRP_CONTEXT IrpContext, IN OUT PRTL_SPLAY_LINKS *RootNode, IN PSTRING Name, OUT PBOOLEAN FileNameDos OPTIONAL)
Definition: splaysup.c:306
USHORT ForceAlignment
Definition: cdprocs.h:1678
IN PVCB IN ULONG EaSetLength
Definition: fatprocs.h:936
IN PDCB IN POEM_STRING IN PUNICODE_STRING UnicodeName
Definition: fatprocs.h:1294
VOID FatFlushFatEntries(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN ULONG Cluster, IN ULONG Count)
Definition: flush.c:1191
IN PFCB IN VBO OUT PLBO Lbo
Definition: fatprocs.h:297
#define _Outptr_
Definition: no_sal2.h:396
IN PFCB IN PCCB IN TYPE_OF_OPEN TypeOfOpen
Definition: fatprocs.h:2401
#define IRP_MJ_SET_VOLUME_INFORMATION
PFILE_OBJECT FatOpenEaFile(IN PIRP_CONTEXT IrpContext, IN PFCB EaFcb)
Definition: cachesup.c:979
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG _In_ ULONG OutputBufferLength
Definition: fltkernel.h:1374
VOID FatPinEaRange(IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT VirtualEaFile, IN PFCB EaFcb, IN OUT PEA_RANGE EaRange, IN ULONG StartingVbo, IN ULONG Length, IN NTSTATUS ErrorStatus)
Definition: easup.c:3512
_Acquires_shared_lock_(Vcb->Resource)) FINISHED FatAcquireSharedVcb(IN PIRP_CONTEXT IrpContext
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
Definition: cdstruc.h:504
VOID FatVerifyVcb(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
Definition: verfysup.c:270
LBO * PLBO
Definition: fat.h:36
IN PVCB IN PUCHAR IN ULONG IN POEM_STRING OUT PUSHORT EaHandle
Definition: fatprocs.h:884
IN PVCB IN BOOLEAN NoOpCheck
Definition: fatprocs.h:1447
static WCHAR String[]
Definition: stringtable.c:55
enum _TYPE_OF_OPEN TYPE_OF_OPEN
IN PDCB IN ULONG IN BOOLEAN RescanDir
Definition: fatprocs.h:689
static CC_FILE_SIZES FileSizes
_Acquires_exclusive_lock_(Vcb->Resource)) FINISHED FatAcquireExclusiveVcb_Real(IN PIRP_CONTEXT IrpContext
BOOLEAN FatLookupLastMcbEntry(IN PVCB Vcb, IN PLARGE_MCB Mcb, OUT PVBO Vbo, OUT PLBO Lbo, OUT PULONG Index OPTIONAL)
Definition: fsctrl.c:494
_In_ PVOID Parameter
Definition: ldrtypes.h:240
STRING OEM_STRING
Definition: umtypes.h:203
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB ParentDcb
Definition: create.c:4157
VOID FatSingleAsync(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN LBO Lbo, IN ULONG ByteCount, IN PIRP Irp)
Definition: deviosup.c:1998
VOID FatVerifyOperationIsLegal(IN PIRP_CONTEXT IrpContext)
Definition: verfysup.c:1308
KDEFERRED_ROUTINE FatCleanVolumeDpc
Definition: fatprocs.h:1972
VOID FatCompleteRequest_Real(IN PIRP_CONTEXT IrpContext, IN PIRP Irp, IN NTSTATUS Status)
Definition: fatdata.c:733
VOID FatLockUserBuffer(IN PIRP_CONTEXT IrpContext, IN OUT PIRP Irp, IN LOCK_OPERATION Operation, IN ULONG BufferLength)
Definition: deviosup.c:3288
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN CheckForReadOperation
Definition: fatprocs.h:2650
CHAR InputBuffer[80]
Definition: conmgr.c:33
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:925
#define _In_opt_
Definition: no_sal2.h:213
VOID FatConstructLabelDirent(IN PIRP_CONTEXT IrpContext, IN OUT PDIRENT Dirent, IN POEM_STRING Label)
Definition: dirsup.c:2440
IN PFCB IN BOOLEAN ReturnOnFailure
Definition: fatprocs.h:762
_Must_inspect_result_ _In_ ULONG RunIndex
Definition: fsrtlfuncs.h:538
IN PIRP IN PFCB IN ULONG IN ULONG IN ULONG UserByteCount
Definition: fatprocs.h:580
IN PFCB IN PCCB IN TYPE_OF_OPEN IN BOOLEAN IN BOOLEAN TopLevel
Definition: fatprocs.h:2401
PVCB IN BOOLEAN Force
Definition: fatprocs.h:1793
IN PDCB Parent
Definition: fatprocs.h:1294
VOID FatInitializeCacheMap(_In_ PFILE_OBJECT FileObject, _In_ PCC_FILE_SIZES FileSizes, _In_ BOOLEAN PinAccess, _In_ PCACHE_MANAGER_CALLBACKS Callbacks, _In_ PVOID LazyWriteContext)
Definition: cachesup.c:62
IN OUT PVCB OUT PDIRENT * EaDirent
Definition: fatprocs.h:904
IN PDCB IN ULONG LfnOffset
Definition: fatprocs.h:779
NTSTATUS FatCommonQueryEa(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
Definition: ea.c:250
IN PVCB Vcb
Definition: fatprocs.h:334
BOOLEAN FatScanForDataTrack(IN PIRP_CONTEXT IrpContext, IN PDEVICE_OBJECT TargetDeviceObject)
Definition: strucsup.c:3827
IN PFCB FcbOrDcb
Definition: fatprocs.h:297
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
LARGE_INTEGER FatFatTimeToNtTime(_In_ PIRP_CONTEXT IrpContext, _In_ FAT_TIME_STAMP FatTime, _In_ UCHAR TenMilliSeconds)
Definition: timesup.c:233
IN PFCB IN VBO OUT PLBO OUT PULONG OUT PBOOLEAN OUT PBOOLEAN EndOnMax
Definition: fatprocs.h:297
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID FatDeleteCcb(IN PIRP_CONTEXT IrpContext, IN PCCB *Ccb)
Definition: strucsup.c:2253
#define __out_opt
Definition: dbghelp.h:65
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
VOID FatPagingFileIo(IN PIRP Irp, IN PFCB Fcb)
Definition: deviosup.c:211
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848
BOOLEAN FatLookupMcbEntry(IN PVCB Vcb, IN PLARGE_MCB Mcb, IN VBO Vbo, OUT PLBO Lbo, OUT PULONG ByteCount OPTIONAL, OUT PULONG Index OPTIONAL)
Definition: fsctrl.c:418
Definition: Header.h:8
_In_ ULONG BufferLength
Definition: usbdlib.h:225
VOID FatTearDownAllocationSupport(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
Definition: allocsup.c:547
LONGLONG LBO
Definition: fat.h:34
BOOLEAN FatLocateEaByName(IN PIRP_CONTEXT IrpContext, IN PPACKED_EA FirstPackedEa, IN ULONG PackedEasLength, IN POEM_STRING EaName, OUT PULONG Offset)
Definition: easup.c:3344
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN FailImmediately
Definition: fatprocs.h:2697
ULONG FatVolumeUncleanCount(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
static INLINE BOOLEAN FatIsIoRangeValid(IN PVCB Vcb, IN LARGE_INTEGER Start, IN ULONG Length)
Definition: fatprocs.h:209
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN Reversible
Definition: fatprocs.h:402
VOID FatRemoveMcbEntry(IN PVCB Vcb, IN PLARGE_MCB Mcb, IN VBO Vbo, IN ULONG SectorCount)
Definition: fsctrl.c:599
VOID FatReleaseVolumeFromClose(IN PVOID Vcb)
#define IRP_MJ_SET_EA
BOOLEAN FatIsBootSectorFat(IN PPACKED_BOOT_SECTOR BootSector)
Definition: fsctrl.c:2526
VOID FatEnsureStringBufferEnough(_Inout_ PVOID String, _In_ USHORT DesiredBufferSize)
Definition: strucsup.c:3738
CLUSTER_TYPE FatInterpretClusterType(IN PVCB Vcb, IN FAT_ENTRY Entry)
Definition: allocsup.c:3475
VOID FatEvaluateNameCase(IN PIRP_CONTEXT IrpContext, IN PUNICODE_STRING Name, IN OUT BOOLEAN *AllLowerComponent, IN OUT BOOLEAN *AllLowerExtension, IN OUT BOOLEAN *CreateLfn)
Definition: namesup.c:891
unsigned char BOOLEAN
IN PFCB IN VBO OUT PLBO OUT PULONG OUT PBOOLEAN Allocated
Definition: fatprocs.h:297
VOID FatFlushDirentForFile(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb)
Definition: flush.c:1264
VOID FatTunnelFcbOrDcb(IN PFCB FcbOrDcb, IN PCCB Ccb OPTIONAL)
Definition: dirsup.c:652
#define _Out_writes_bytes_(size)
Definition: no_sal2.h:370
#define _Out_
Definition: no_sal2.h:323
enum _FCB_CONDITION FCB_CONDITION
FINISHED FatZeroData(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN PFILE_OBJECT FileObject, IN ULONG StartingZero, IN ULONG ByteCount)
Definition: cachesup.c:1659
_In_ PLARGE_INTEGER _In_ BOOLEAN Rounding
Definition: fatprocs.h:1905
Definition: bufpool.h:45
IN PFCB Fcb
Definition: fatprocs.h:811
IN PFCB IN PDELETE_CONTEXT DeleteContext IN BOOLEAN DeleteEa
Definition: fatprocs.h:706
VOID FatSetFullNameInFcb(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ PUNICODE_STRING FinalName)
Definition: create.c:6758
NTSTATUS FatPerformDevIoCtrl(IN PIRP_CONTEXT IrpContext, IN ULONG IoControlCode, IN PDEVICE_OBJECT Device, IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferLength, OUT PVOID OutputBuffer OPTIONAL, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
Definition: deviosup.c:3641
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
PDCB FatCreateDcb(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN PDCB ParentDcb, IN ULONG LfnOffsetWithinDirectory, IN ULONG DirentOffsetWithinDirectory, IN PDIRENT Dirent, IN PUNICODE_STRING Lfn OPTIONAL)
Definition: strucsup.c:1618
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
IN PDCB TargetDcb
Definition: fatprocs.h:779
BOOLEAN NTAPI FatNoOpAcquire(IN PVOID Fcb, IN BOOLEAN Wait)
Definition: resrcsup.c:795
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
BOOLEAN FatCheckManageVolumeAccess(_In_ PIRP_CONTEXT IrpContext, _In_ PACCESS_STATE AccessState, _In_ KPROCESSOR_MODE ProcessorMode)
Definition: acchksup.c:176
_Success_(return !=FALSE) BOOLEAN FatNtTimeToFatTime(_In_ PIRP_CONTEXT IrpContext
Definition: fsctrl.c:3139
COMPARISON FatCompareNames(IN PSTRING NameA, IN PSTRING NameB)
Definition: splaysup.c:421
PIRP_CONTEXT FatCreateIrpContext(IN PIRP Irp, IN BOOLEAN Wait)
Definition: strucsup.c:2300
IN PFCB IN FAT_FLUSH_TYPE FlushType
Definition: fatprocs.h:1071
BOOLEAN FatIsIrpTopLevel(IN PIRP Irp)
Definition: fatdata.c:817
PMDL FatBuildZeroMdl(__in PIRP_CONTEXT IrpContext, __in ULONG Length)
Definition: deviosup.c:3754
VOID FatWaitSync(IN PIRP_CONTEXT IrpContext)
Definition: deviosup.c:2375
VOID FatRemoveNames(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb)
Definition: splaysup.c:222
NTSTATUS FatFlushFat(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
Definition: flush.c:801
_TYPE_OF_OPEN
Definition: cdprocs.h:576
_Acquires_shared_lock_ Fcb FINISHED FatAcquireSharedFcbWaitForEx(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb)
#define IRP_MJ_QUERY_EA
NTSTATUS FatUnlockVolumeInternal(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN PFILE_OBJECT FileObject OPTIONAL)
Definition: fsctrl.c:3605
union _UCHAR4 UCHAR4
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2650
#define _Out_opt_
Definition: no_sal2.h:339
_In_ LARGE_INTEGER _In_opt_ PKDPC Dpc
Definition: kefuncs.h:524
VOID FatUnpinEaRange(IN PIRP_CONTEXT IrpContext, IN OUT PEA_RANGE EaRange)
Definition: easup.c:3782
VOID FatDeleteFcb(IN PIRP_CONTEXT IrpContext, IN PFCB *Fcb)
Definition: strucsup.c:1951
IN PFILE_OBJECT FileObject
Definition: fatprocs.h:828
VOID FatCheckDirtyBit(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
Definition: verfysup.c:1189
VOID FatSetFileObject(IN PFILE_OBJECT FileObject OPTIONAL, IN TYPE_OF_OPEN TypeOfOpen, IN PVOID VcbOrFcbOrDcb, IN PCCB Ccb OPTIONAL)
Definition: filobsup.c:39
BOOLEAN FatIsHandleCountZero(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
Definition: strucsup.c:3613
const struct winhelp_callbacks Callbacks
Definition: callback.c:161
IN PVCB IN PDIRENT OUT PULONG EaLength
Definition: fatprocs.h:866
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4426
enum _CLUSTER_TYPE CLUSTER_TYPE
struct _FAT_ENUMERATION_CONTEXT * PFAT_ENUMERATION_CONTEXT
enum _FAT_FLUSH_TYPE FAT_FLUSH_TYPE
VOID FatInsertName(IN PIRP_CONTEXT IrpContext, IN PRTL_SPLAY_LINKS *RootNode, IN PFILE_NAME_NODE Name)
Definition: splaysup.c:39
PFCB FatCreateFcb(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN PDCB ParentDcb, IN ULONG LfnOffsetWithinDirectory, IN ULONG DirentOffsetWithinDirectory, IN PDIRENT Dirent, IN PUNICODE_STRING Lfn OPTIONAL, IN PUNICODE_STRING OrigLfn OPTIONAL, IN BOOLEAN IsPagingFile, IN BOOLEAN SingleResource)
Definition: strucsup.c:1238
#define IRP_MJ_FILE_SYSTEM_CONTROL
IN PVCB IN ULONG IN PBCB OUT PDIRENT OUT PUSHORT OUT PEA_RANGE EaSetRange
Definition: fatprocs.h:936
BOOLEAN FatIsEaNameValid(IN PIRP_CONTEXT IrpContext, IN OEM_STRING Name)
Definition: easup.c:3429
static const UCHAR Index[8]
Definition: usbohci.c:18
IN PVCB IN OUT PLARGE_MCB IN VBO OUT PLARGE_MCB RemainingMcb
Definition: fatprocs.h:354
#define FsRtlIsAnsiCharacterLegalHpfs(C, WILD)
Definition: fsrtlfuncs.h:1614
NTSTATUS FatPrefetchPages(IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT FileObject, IN ULONG StartingPage, IN ULONG PageCount)
Definition: cachesup.c:1929
VOID FatDeleteVcb(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
Definition: strucsup.c:750
BOOLEAN FatGetNextMcbEntry(IN PVCB Vcb, IN PLARGE_MCB Mcb, IN ULONG RunIndex, OUT PVBO Vbo, OUT PLBO Lbo, OUT PULONG ByteCount)
Definition: fsctrl.c:541
FAT8DOT3 * PFAT8DOT3
Definition: fat.h:296
UCHAR ForceAlignment
Definition: cdprocs.h:1673
#define _Inout_
Definition: no_sal2.h:244
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
* PFILE_OBJECT
Definition: iotypes.h:1954
Definition: partlist.h:33
_In_opt_ PVOID _In_opt_ PUNICODE_STRING _In_ PSECURITY_DESCRIPTOR _In_ PACCESS_STATE AccessState
Definition: sefuncs.h:414
union _UCHAR4 * PUCHAR4
PFCB FatGetNextFcbBottomUp(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN PFCB TerminationFcb)
Definition: strucsup.c:2524
VOID FatMarkFcbCondition(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN FCB_CONDITION FcbCondition, IN BOOLEAN Recursive)
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR FatLogOf(IN ULONG Value)
Definition: allocsup.c:4657
IN PDCB IN PUNICODE_STRING IN PUNICODE_STRING LfnTmp
Definition: fatprocs.h:743
VOID FatReadVolumeFile(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN VBO StartingVbo, IN ULONG ByteCount, OUT PBCB *Bcb, OUT PVOID *Buffer)
Definition: cachesup.c:102
char * PBOOLEAN
Definition: retypes.h:11
_In_ PLARGE_INTEGER NtTime
Definition: fatprocs.h:1905
VOID NTAPI FatNoOpRelease(IN PVOID Fcb)
Definition: resrcsup.c:842
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN ExactMatchRequired
Definition: fatprocs.h:334
IN PDCB IN ULONG IN ULONG DirentOffset
Definition: fatprocs.h:779
VBO * PVBO
Definition: fat.h:39
struct _FAT_ENUMERATION_CONTEXT FAT_ENUMERATION_CONTEXT
Definition: fsck.fat.h:192
IN PFCB IN VBO OUT PLBO OUT PULONG ByteCount
Definition: fatprocs.h:297
Definition: ketypes.h:687
PCCB FatCreateCcb(IN PIRP_CONTEXT IrpContext)
Definition: strucsup.c:2154
IN PDCB IN PDIRENT ParentDirent
Definition: fatprocs.h:698
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB IN PDEVICE_OBJECT FsDeviceObject
Definition: fatprocs.h:1664
VOID FatSyncUninitializeCacheMap(IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT FileObject)
Definition: cachesup.c:1812
enum _TYPE_OF_OPEN TYPE_OF_OPEN
IN PVCB IN ULONG FatIndex
Definition: fatprocs.h:373
BOOLEAN FatAcquireVolumeForClose(IN PVOID Vcb, IN BOOLEAN Wait)
ULONG SectorCount
Definition: part_xbox.c:32
DRIVER_DISPATCH(nfs41_FsdDispatch)
IN PVCB IN VBO StartingVbo
Definition: fatprocs.h:402
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG InputBufferLength
Definition: fltkernel.h:1372
IN PVCB IN PLARGE_MCB IN BOOLEAN ZeroOnDeallocate
Definition: fatprocs.h:345
VOID FatDeleteIrpContext_Real(IN PIRP_CONTEXT IrpContext)
Definition: strucsup.c:2460
Status
Definition: gdiplustypes.h:24
BOOLEAN FatAddMcbEntry(IN PVCB Vcb, IN PLARGE_MCB Mcb, IN VBO Vbo, IN LBO Lbo, IN ULONG SectorCount)
Definition: fsctrl.c:364
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
IN PVCB IN OUT PLARGE_MCB IN VBO SplitAtVbo
Definition: fatprocs.h:354
#define _In_
Definition: no_sal2.h:204
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
Definition: fatprocs.h:310
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
union _UCHAR1 * PUCHAR1
BOOLEAN FatIsNameInExpression(IN PIRP_CONTEXT IrpContext, IN OEM_STRING Expression, IN OEM_STRING Name)
Definition: namesup.c:35
union _UCHAR2 * PUCHAR2
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
enum _COMPARISON COMPARISON
ULONG FatExceptionFilter(IN PIRP_CONTEXT IrpContext, IN PEXCEPTION_POINTERS ExceptionPointer)
Definition: fatdata.c:204
WORKER_THREAD_ROUTINE FatFspMarkVolumeDirtyWithRecover
Definition: fatprocs.h:1991
_In_ PLARGE_INTEGER _In_ BOOLEAN _Out_ PFAT_TIME_STAMP FatTime
Definition: fatprocs.h:1905
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN CreateFile
Definition: fatprocs.h:904
enum _LOCK_OPERATION LOCK_OPERATION
PVOID FatBufferUserBuffer(IN PIRP_CONTEXT IrpContext, IN OUT PIRP Irp, IN ULONG BufferLength)
Definition: deviosup.c:3427
unsigned short USHORT
Definition: pedump.c:61
VOID FatPinMappedData(IN PIRP_CONTEXT IrpContext, IN PDCB Dcb, IN VBO StartingVbo, IN ULONG ByteCount, OUT PBCB *Bcb)
Definition: cachesup.c:1866
static INLINE BOOLEAN FatIsNameLongUnicodeValid(PIRP_CONTEXT IrpContext, PUNICODE_STRING Name, BOOLEAN CanContainWildcards, BOOLEAN PathNameOk, BOOLEAN LeadingBackslashOk)
Definition: fatprocs.h:1206
VOID FatSetupAllocationSupport(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
Definition: allocsup.c:357
enum _FAT_VOLUME_STATE FAT_VOLUME_STATE
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
Definition: fatprocs.h:334
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
VOID FatExamineFatEntries(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN ULONG StartIndex OPTIONAL, IN ULONG EndIndex OPTIONAL, IN BOOLEAN SetupWindows, IN PFAT_WINDOW SwitchToWindow OPTIONAL, IN PULONG BitMapBuffer OPTIONAL)
Definition: allocsup.c:4722
NTSTATUS FatCommonSetEa(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
Definition: ea.c:659
_Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH) _Requires_lock_held_(_Global_critical_region_) NTSTATUS NTAPI FatAcquireForCcFlush(IN PFILE_OBJECT FileObject
IN PVCB IN PDIRENT OUT PULONG NeedEaCount
Definition: fatprocs.h:875
VOID FatUnpinRepinnedBcbs(IN PIRP_CONTEXT IrpContext)
Definition: cachesup.c:1407
WORKER_THREAD_ROUTINE FatFspDispatch
Definition: fatprocs.h:2368
unsigned int * PULONG
Definition: retypes.h:1
#define _When_(expr, annos)
Definition: no_sal2.h:639
IN PDCB ParentDirectory
Definition: fatprocs.h:689
VOID FatFreeStringBuffer(_Inout_ PVOID String)
Definition: strucsup.c:3783
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN BOOLEAN ExclusiveLock
Definition: fatprocs.h:2697
#define IRP_MJ_LOCK_CONTROL
Definition: rdpdr.c:53
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN IN BOOLEAN Zero
Definition: fatprocs.h:402
VOID FatCloseEaFile(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN BOOLEAN FlushFirst)
Definition: cachesup.c:1079
BOOLEAN FatCheckFileAccess(PIRP_CONTEXT IrpContext, IN UCHAR DirentAttributes, IN PACCESS_MASK DesiredAccess)
Definition: acchksup.c:39
_FAT_FLUSH_TYPE
Definition: fatprocs.h:1042
#define IRP_MJ_READ
Definition: rdpdr.c:46
VOID FatStringTo8dot3(_In_ PIRP_CONTEXT IrpContext, _In_ OEM_STRING InputString, _Out_writes_bytes_(11) PFAT8DOT3 Output8dot3)
Definition: namesup.c:79
VOID FatDeletePackedEa(IN PIRP_CONTEXT IrpContext, IN OUT PEA_SET_HEADER EaSetHeader, IN OUT PULONG PackedEasLength, IN ULONG Offset)
Definition: easup.c:3148
#define IRP_MJ_CLEANUP
union _UCHAR1 UCHAR1
Definition: iotypes.h:166
NTSTATUS FatFsdPostRequest(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
Definition: workque.c:229
#define OUT
Definition: typedefs.h:39
VOID FatLookupFatEntry(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN ULONG FatIndex, IN OUT PULONG FatEntry, IN OUT PFAT_ENUMERATION_CONTEXT Context)
Definition: allocsup.c:3567
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING IN PUNICODE_STRING SuggestedShortName IN OUT BOOLEAN IN OUT BOOLEAN IN OUT BOOLEAN * CreateLfn
Definition: fatprocs.h:1294
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
unsigned int ULONG
Definition: retypes.h:1
ACCESS_MASK * PACCESS_MASK
Definition: nt_native.h:41
NTSTATUS FatExplicitDeviceAccessGranted(IN PIRP_CONTEXT IrpContext, IN PDEVICE_OBJECT DeviceObject, IN PACCESS_STATE AccessState, IN KPROCESSOR_MODE ProcessorMode)
Definition: acchksup.c:225
PWCHAR Label
Definition: format.c:70
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468
NTSTATUS FatHijackIrpAndFlushDevice(IN PIRP_CONTEXT IrpContext, IN PIRP Irp, IN PDEVICE_OBJECT TargetDeviceObject)
Definition: flush.c:1101
_In_ PLARGE_INTEGER _In_ BOOLEAN _Out_ PFAT_TIME_STAMP _Out_opt_ PUCHAR TenMsecs
Definition: fatprocs.h:1905
BOOLEAN FINISHED
Definition: fatprocs.h:95
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
VOID FatConstructDirent(IN PIRP_CONTEXT IrpContext, IN OUT PDIRENT Dirent, IN POEM_STRING FileName, IN BOOLEAN ComponentReallyLowercase, IN BOOLEAN ExtensionReallyLowercase, IN PUNICODE_STRING Lfn OPTIONAL, IN USHORT Attributes, IN BOOLEAN ZeroAndSetTimeFields, IN PLARGE_INTEGER SetCreationTime OPTIONAL)
Definition: dirsup.c:2171
IN PIRP IN PFCB IN ULONG IN ULONG IN ULONG IN ULONG StreamFlags
Definition: fatprocs.h:580
IN PDCB IN POEM_STRING OemName
Definition: fatprocs.h:1294
IN OUT PVCB OUT PDIRENT OUT PBCB * EaBcb
Definition: fatprocs.h:904
VOID FatUnicodeRestoreShortNameCase(IN PUNICODE_STRING ShortNameWithCase, IN BOOLEAN LowerCase8, IN BOOLEAN LowerCase3)
Definition: namesup.c:1041
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
Definition: fatprocs.h:1664
IN PVCB IN ULONG IN FAT_ENTRY FatEntry
Definition: fatprocs.h:373
VOID NTAPI FatPrePostIrp(IN PVOID Context, IN PIRP Irp)
Definition: workque.c:91
#define __in
Definition: dbghelp.h:35
VOID FatQuickVerifyVcb(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
Definition: verfysup.c:1666
IN PLARGE_INTEGER FileOffset
Definition: fatprocs.h:2650
unsigned short * PUSHORT
Definition: retypes.h:2
IN PFCB IN VBO Vbo
Definition: fatprocs.h:297
BOOLEAN FatSpaceInName(IN PIRP_CONTEXT IrpContext, IN PUNICODE_STRING UnicodeName)
Definition: namesup.c:1003
TYPE_OF_OPEN FatDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Outptr_ PVCB *Vcb, _Outptr_ PFCB *FcbOrDcb, _Outptr_ PCCB *Ccb)
Definition: filobsup.c:176
base of all file and directory entries
Definition: entries.h:82
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1664
VOID FatDeallocateCcbStrings(IN PCCB Ccb)
Definition: strucsup.c:2208
Definition: fat.h:274
_FAT_VOLUME_STATE
Definition: fatprocs.h:1944
IN PDCB IN ULONG DirentsNeeded
Definition: fatprocs.h:689
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
Definition: fatprocs.h:716
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
IN PDCB IN PUNICODE_STRING Lfn
Definition: fatprocs.h:743
PCONFIGURATION_COMPONENT_DATA RootNode
Definition: macharm.c:19
IN BOOLEAN Wait
Definition: fatprocs.h:1529
#define NT_ASSERT
Definition: rtlfuncs.h:3312
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
PFCB FatGetNextFcbTopDown(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN PFCB TerminationFcb)
Definition: strucsup.c:2626
IN PDCB IN PCCB IN VBO OffsetToStartSearchFrom
Definition: fatprocs.h:716
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675