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