ReactOS  0.4.13-dev-247-g0f29b3f
ntfs.h
Go to the documentation of this file.
1 #ifndef NTFS_H
2 #define NTFS_H
3 
4 #include <ntifs.h>
5 #include <pseh/pseh2.h>
6 #include <section_attribs.h>
7 
8 #define CACHEPAGESIZE(pDeviceExt) \
9  ((pDeviceExt)->NtfsInfo.UCHARsPerCluster > PAGE_SIZE ? \
10  (pDeviceExt)->NtfsInfo.UCHARsPerCluster : PAGE_SIZE)
11 
12 #define TAG_NTFS '0ftN'
13 #define TAG_CCB 'CftN'
14 #define TAG_FCB 'FftN'
15 #define TAG_IRP_CTXT 'iftN'
16 #define TAG_ATT_CTXT 'aftN'
17 #define TAG_FILE_REC 'rftN'
18 
19 #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
20 #define ROUND_DOWN(N, S) ((N) - ((N) % (S)))
21 
22 #define DEVICE_NAME L"\\Ntfs"
23 
24 #include <pshpack1.h>
25 typedef struct _BIOS_PARAMETERS_BLOCK
26 {
29  UCHAR Unused0[7]; // 0x0E, checked when volume is mounted
30  UCHAR MediaId; // 0x15
31  UCHAR Unused1[2]; // 0x16
33  USHORT Heads; // 0x1A
34  UCHAR Unused2[4]; // 0x1C
35  UCHAR Unused3[4]; // 0x20, checked when volume is mounted
37 
39 {
40  USHORT Unknown[2]; // 0x24, always 80 00 80 00
45  UCHAR Unused4[3]; // 0x41
47  UCHAR Unused5[3]; // 0x45
49  UCHAR Checksum[4]; // 0x50
51 
52 typedef struct _BOOT_SECTOR
53 {
54  UCHAR Jump[3]; // 0x00
55  UCHAR OEMID[8]; // 0x03
58  UCHAR BootStrap[426]; // 0x54
59  USHORT EndSector; // 0x1FE
61 #include <poppack.h>
62 
63 //typedef struct _BootSector BootSector;
64 
65 typedef struct _NTFS_INFO
66 {
76 
83 
86 
87 #define NTFS_TYPE_CCB '20SF'
88 #define NTFS_TYPE_FCB '30SF'
89 #define NTFS_TYPE_VCB '50SF'
90 #define NTFS_TYPE_IRP_CONTEXT '60SF'
91 #define NTFS_TYPE_GLOBAL_DATA '70SF'
92 
93 typedef struct
94 {
98 
99 typedef struct
100 {
102 
103  ERESOURCE DirResource;
104 // ERESOURCE FatResource;
105 
106  KSPIN_LOCK FcbListLock;
107  LIST_ENTRY FcbListHead;
108 
110  PDEVICE_OBJECT StorageDevice;
112 
115  struct _FCB *VolumeFcb;
116 
118 
120 
122  ULONG Flags;
124 
126 
127 #define VCB_VOLUME_LOCKED 0x0001
128 
129 typedef struct
130 {
135  /* for DirectoryControl */
137  /* for DirectoryControl */
141 } NTFS_CCB, *PNTFS_CCB;
142 
143 typedef struct
144 {
157 
158 
159 typedef enum
160 {
174  AttributeEA = 0xE0,
177  AttributeEnd = 0xFFFFFFFF
179 
180 // FILE_RECORD_END seems to follow AttributeEnd in every file record starting with $Quota.
181 // No clue what data is being represented here.
182 #define FILE_RECORD_END 0x11477982
183 
184 #define NTFS_FILE_MFT 0
185 #define NTFS_FILE_MFTMIRR 1
186 #define NTFS_FILE_LOGFILE 2
187 #define NTFS_FILE_VOLUME 3
188 #define NTFS_FILE_ATTRDEF 4
189 #define NTFS_FILE_ROOT 5
190 #define NTFS_FILE_BITMAP 6
191 #define NTFS_FILE_BOOT 7
192 #define NTFS_FILE_BADCLUS 8
193 #define NTFS_FILE_QUOTA 9
194 #define NTFS_FILE_UPCASE 10
195 #define NTFS_FILE_EXTEND 11
196 #define NTFS_FILE_FIRST_USER_FILE 16
197 
198 #define NTFS_MFT_MASK 0x0000FFFFFFFFFFFFULL
199 
200 #define COLLATION_BINARY 0x00
201 #define COLLATION_FILE_NAME 0x01
202 #define COLLATION_UNICODE_STRING 0x02
203 #define COLLATION_NTOFS_ULONG 0x10
204 #define COLLATION_NTOFS_SID 0x11
205 #define COLLATION_NTOFS_SECURITY_HASH 0x12
206 #define COLLATION_NTOFS_ULONGS 0x13
207 
208 #define INDEX_ROOT_SMALL 0x0
209 #define INDEX_ROOT_LARGE 0x1
210 
211 #define INDEX_NODE_SMALL 0x0
212 #define INDEX_NODE_LARGE 0x1
213 
214 #define NTFS_INDEX_ENTRY_NODE 1
215 #define NTFS_INDEX_ENTRY_END 2
216 
217 #define NTFS_FILE_NAME_POSIX 0
218 #define NTFS_FILE_NAME_WIN32 1
219 #define NTFS_FILE_NAME_DOS 2
220 #define NTFS_FILE_NAME_WIN32_AND_DOS 3
221 
222 #define NTFS_FILE_TYPE_READ_ONLY 0x1
223 #define NTFS_FILE_TYPE_HIDDEN 0x2
224 #define NTFS_FILE_TYPE_SYSTEM 0x4
225 #define NTFS_FILE_TYPE_ARCHIVE 0x20
226 #define NTFS_FILE_TYPE_REPARSE 0x400
227 #define NTFS_FILE_TYPE_COMPRESSED 0x800
228 #define NTFS_FILE_TYPE_DIRECTORY 0x10000000
229 
230 /* Indexed Flag in Resident attributes - still somewhat speculative */
231 #define RA_INDEXED 0x01
232 
233 typedef struct
234 {
235  ULONG Type; /* Magic number 'FILE' */
236  USHORT UsaOffset; /* Offset to the update sequence */
237  USHORT UsaCount; /* Size in words of Update Sequence Number & Array (S) */
238  ULONGLONG Lsn; /* $LogFile Sequence Number (LSN) */
240 
241 /* NTFS_RECORD_HEADER.Type */
242 #define NRH_FILE_TYPE 0x454C4946 /* 'FILE' */
243 #define NRH_INDX_TYPE 0x58444E49 /* 'INDX' */
244 
245 
246 typedef struct _FILE_RECORD_HEADER
247 {
249  USHORT SequenceNumber; /* Sequence number */
250  USHORT LinkCount; /* Hard link count */
251  USHORT AttributeOffset; /* Offset to the first Attribute */
252  USHORT Flags; /* Flags */
253  ULONG BytesInUse; /* Real size of the FILE record */
254  ULONG BytesAllocated; /* Allocated size of the FILE record */
255  ULONGLONG BaseFileRecord; /* File reference to the base FILE record */
256  USHORT NextAttributeNumber; /* Next Attribute Id */
257  USHORT Padding; /* Align to 4 UCHAR boundary (XP) */
258  ULONG MFTRecordNumber; /* Number of this MFT Record (XP) */
260 
261 /* Flags in FILE_RECORD_HEADER */
262 
263 #define FRH_IN_USE 0x0001 /* Record is in use */
264 #define FRH_DIRECTORY 0x0002 /* Record is a directory */
265 #define FRH_UNKNOWN1 0x0004 /* Don't know */
266 #define FRH_UNKNOWN2 0x0008 /* Don't know */
267 
268 typedef struct
269 {
270  ULONG Type;
271  ULONG Length;
272  UCHAR IsNonResident;
273  UCHAR NameLength;
274  USHORT NameOffset;
275  USHORT Flags;
277  union
278  {
279  // Resident attributes
280  struct
281  {
283  USHORT ValueOffset;
284  UCHAR Flags;
285  UCHAR Reserved;
286  } Resident;
287  // Non-resident attributes
288  struct
289  {
290  ULONGLONG LowestVCN;
291  ULONGLONG HighestVCN;
292  USHORT MappingPairsOffset;
293  USHORT CompressionUnit;
294  UCHAR Reserved[4];
295  LONGLONG AllocatedSize;
297  LONGLONG InitializedSize;
298  LONGLONG CompressedSize;
299  } NonResident;
300  };
302 
303 // The beginning and length of an attribute record are always aligned to an 8-byte boundary,
304 // relative to the beginning of the file record.
305 #define ATTR_RECORD_ALIGNMENT 8
306 
307 // Data runs are aligned to a 4-byte boundary, relative to the start of the attribute record
308 #define DATA_RUN_ALIGNMENT 4
309 
310 // Value offset is aligned to a 4-byte boundary, relative to the start of the attribute record
311 #define VALUE_OFFSET_ALIGNMENT 4
312 
313 typedef struct
314 {
320  ULONG AlignmentOrReserved[3];
321 #if 0
322  ULONG QuotaId;
323  ULONG SecurityId;
324  ULONGLONG QuotaCharge;
325  USN Usn;
326 #endif
328 
329 
330 typedef struct
331 {
336  ULONGLONG StartVcn; // LowVcn
339  USHORT AlignmentOrReserved[3];
341 
342 
343 typedef struct
344 {
353  union
354  {
355  struct
356  {
359  } EaInfo;
361  } Extended;
366 
367 typedef struct
368 {
373  UCHAR Padding[3];
375 
376 typedef struct
377 {
382  UCHAR Padding[3];
385 
386 typedef struct
387 {
392 
393 typedef struct
394 {
395  union
396  {
397  struct
398  {
400  } Directory;
401  struct
402  {
406  } ViewIndex;
407  } Data;
414 
415 struct _B_TREE_FILENAME_NODE;
417 
418 // Keys are arranged in nodes as an ordered, linked list
419 typedef struct _B_TREE_KEY
420 {
422  B_TREE_FILENAME_NODE *LesserChild; // Child-Node. All the keys in this node will be sorted before IndexEntry
423  PINDEX_ENTRY_ATTRIBUTE IndexEntry; // must be last member for FIELD_OFFSET
425 
426 // Every Node is just an ordered list of keys.
427 // Sub-nodes can be found attached to a key (if they exist).
428 // A key's sub-node precedes that key in the ordered list.
429 typedef struct _B_TREE_FILENAME_NODE
430 {
437 
438 typedef struct
439 {
441 } B_TREE, *PB_TREE;
442 
443 typedef struct
444 {
451 
452 typedef struct {
458 
459 #define IRPCONTEXT_CANWAIT 0x1
460 #define IRPCONTEXT_COMPLETE 0x2
461 #define IRPCONTEXT_QUEUE 0x4
462 
463 typedef struct
464 {
478 
479 typedef struct _NTFS_ATTR_CONTEXT
480 {
491 
492 #define FCB_CACHE_INITIALIZED 0x0001
493 #define FCB_IS_VOLUME_STREAM 0x0002
494 #define FCB_IS_VOLUME 0x0004
495 #define MAX_PATH 260
496 
497 typedef struct _FCB
498 {
500 
503 
506 
508  WCHAR *ObjectName; /* point on filename (250 chars max) in PathName */
509  WCHAR PathName[MAX_PATH]; /* path+filename 260 max */
510 
513 
515  struct _FCB* ParentFcb;
516 
518 
522 
525 
527 
528 } NTFS_FCB, *PNTFS_FCB;
529 
530 typedef struct _FIND_ATTR_CONTXT
531 {
541 
542 typedef struct
543 {
545  USHORT Array[];
547 
549 
551 NTSTATUS
553 {
554  PULONG Flags = &IrpContext->Flags;
555 
558 
559  return STATUS_PENDING;
560 }
561 
562 /* attrib.c */
563 
564 //VOID
565 //NtfsDumpAttribute(PATTRIBUTE Attribute);
566 
567 NTSTATUS
569  PFILE_RECORD_HEADER FileRecord,
570  PNTFS_ATTR_RECORD AttributeAddress,
571  PCWSTR Name,
572  USHORT NameLength);
573 
574 NTSTATUS
575 AddData(PFILE_RECORD_HEADER FileRecord,
576  PNTFS_ATTR_RECORD AttributeAddress);
577 
578 NTSTATUS
580  PNTFS_ATTR_CONTEXT AttrContext,
581  ULONG AttrOffset,
582  PFILE_RECORD_HEADER FileRecord,
583  ULONGLONG NextAssignedCluster,
584  ULONG RunLength);
585 
586 NTSTATUS
588  PFILE_RECORD_HEADER FileRecord,
589  PNTFS_ATTR_RECORD AttributeAddress,
590  PCWSTR Name,
591  USHORT NameLength);
592 
593 NTSTATUS
595  PFILE_RECORD_HEADER FileRecord,
596  PNTFS_ATTR_RECORD AttributeAddress,
597  PINDEX_ROOT_ATTRIBUTE NewIndexRoot,
598  ULONG RootLength,
599  PCWSTR Name,
600  USHORT NameLength);
601 
602 NTSTATUS
604  PNTFS_ATTR_RECORD AttributeAddress,
605  PDEVICE_EXTENSION DeviceExt,
607  BOOLEAN CaseSensitive,
608  PULONGLONG ParentMftIndex);
609 
610 NTSTATUS
612  PNTFS_ATTR_RECORD AttributeAddress);
613 
614 NTSTATUS
616  PLARGE_MCB DataRunsMCB,
617  PULONGLONG pNextVBN);
618 
619 NTSTATUS
621  PUCHAR RunBuffer,
622  ULONG MaxBufferSize,
623  PULONG UsedBufferSize);
624 
625 PUCHAR
626 DecodeRun(PUCHAR DataRun,
627  LONGLONG *DataRunOffset,
628  ULONGLONG *DataRunLength);
629 
631 
632 VOID
633 NtfsDumpDataRuns(PVOID StartOfRun,
634  ULONGLONG CurrentLCN);
635 
636 VOID
638  PFILE_RECORD_HEADER FileRecord);
639 
642  PFILE_RECORD_HEADER FileRecord);
643 
646  PFILE_RECORD_HEADER FileRecord,
647  UCHAR NameType);
648 
649 UCHAR
650 GetPackedByteCount(LONGLONG NumberToPack,
651  BOOLEAN IsSigned);
652 
653 NTSTATUS
655  PNTFS_ATTR_RECORD Attribute,
656  PULONGLONG LastCluster);
657 
660  PFILE_RECORD_HEADER FileRecord);
661 
662 NTSTATUS
665  PFILE_RECORD_HEADER FileRecord,
666  BOOLEAN OnlyResident,
667  PNTFS_ATTR_RECORD * Attribute);
668 
669 NTSTATUS
671  PNTFS_ATTR_RECORD * Attribute);
672 
673 VOID
675 
676 NTSTATUS
678  PNTFS_ATTR_CONTEXT AttrContext,
679  ULONG AttrOffset,
680  PFILE_RECORD_HEADER FileRecord,
681  ULONG ClustersToFree);
682 
683 /* blockdev.c */
684 
685 NTSTATUS
688  IN ULONG Length,
691  IN BOOLEAN Override);
692 
693 NTSTATUS
696  IN ULONG Length,
698  IN const PUCHAR Buffer);
699 
700 NTSTATUS
702  IN ULONG DiskSector,
706  IN BOOLEAN Override);
707 
708 NTSTATUS
712  IN ULONG InputBufferSize,
714  IN OUT PULONG OutputBufferSize,
715  IN BOOLEAN Override);
716 
717 
718 /* btree.c */
719 
720 LONG
722  PB_TREE_KEY Key2,
723  BOOLEAN CaseSensitive);
724 
725 NTSTATUS
727  PFILE_RECORD_HEADER FileRecordWithIndex,
728  /*PCWSTR IndexName,*/
729  PNTFS_ATTR_CONTEXT IndexRootContext,
730  PINDEX_ROOT_ATTRIBUTE IndexRoot,
731  PB_TREE *NewTree);
732 
733 NTSTATUS
735  PB_TREE Tree,
736  ULONG MaxIndexSize,
737  PINDEX_ROOT_ATTRIBUTE *IndexRoot,
738  ULONG *Length);
739 
740 NTSTATUS
742 
743 VOID
745 
746 VOID
748 
749 VOID
751 
752 VOID
755  ULONG Number,
756  ULONG Depth);
757 
758 VOID
761  ULONG Number,
762  ULONG Depth);
763 
764 NTSTATUS
765 CreateEmptyBTree(PB_TREE *NewTree);
766 
767 ULONGLONG
769  ULONG IndexBufferSize,
770  ULONGLONG Vcn);
771 
772 ULONGLONG
774 
775 ULONG
777 
778 NTSTATUS
780  ULONGLONG FileReference,
781  PFILENAME_ATTRIBUTE FileNameAttribute,
783  BOOLEAN CaseSensitive,
784  ULONG MaxIndexRootSize,
785  ULONG IndexRecordSize,
786  PB_TREE_KEY *MedianKey,
787  PB_TREE_FILENAME_NODE *NewRightHandSibling);
788 
789 NTSTATUS
792  PB_TREE_KEY *MedianKey,
793  PB_TREE_FILENAME_NODE *NewRightHandSibling,
794  BOOLEAN CaseSensitive);
795 
796 NTSTATUS
798  PB_TREE Tree,
799  ULONG IndexBufferSize,
800  PFILE_RECORD_HEADER FileRecord);
801 
802 NTSTATUS
804  PFILE_RECORD_HEADER FileRecord,
806  ULONG IndexBufferSize,
807  PNTFS_ATTR_CONTEXT IndexAllocationContext,
808  ULONG IndexAllocationOffset);
809 
810 /* close.c */
811 
812 NTSTATUS
813 NtfsCleanup(PNTFS_IRP_CONTEXT IrpContext);
814 
815 
816 /* close.c */
817 
818 NTSTATUS
821 
822 NTSTATUS
823 NtfsClose(PNTFS_IRP_CONTEXT IrpContext);
824 
825 
826 /* create.c */
827 
828 NTSTATUS
829 NtfsCreate(PNTFS_IRP_CONTEXT IrpContext);
830 
831 NTSTATUS
834  BOOLEAN CaseSensitive,
835  BOOLEAN CanWait);
836 
839 
840 NTSTATUS
843  BOOLEAN CaseSensitive,
844  BOOLEAN CanWait);
845 
846 /* devctl.c */
847 
848 NTSTATUS
850 
851 
852 /* dirctl.c */
853 
854 ULONGLONG
856  PFILE_RECORD_HEADER FileRecord,
857  PCWSTR Stream,
858  ULONG StreamLength,
859  PULONGLONG AllocatedSize);
860 
861 NTSTATUS
863 
864 
865 /* dispatch.c */
866 
870  PIRP Irp);
871 
872 
873 /* fastio.c */
874 
877  BOOLEAN Wait);
878 
879 VOID NTAPI
881 
884  BOOLEAN Wait);
885 
886 VOID NTAPI
888 
889 FAST_IO_CHECK_IF_POSSIBLE NtfsFastIoCheckIfPossible;
890 FAST_IO_READ NtfsFastIoRead;
891 FAST_IO_WRITE NtfsFastIoWrite;
892 
893 
894 /* fcb.c */
895 
896 PNTFS_FCB
898  PCWSTR Stream,
899  PNTFS_VCB Vcb);
900 
901 VOID
903 
904 BOOLEAN
906 
907 BOOLEAN
909 
910 BOOLEAN
912 
913 BOOLEAN
915 
916 VOID
918  PNTFS_FCB Fcb);
919 
920 VOID
922  PNTFS_FCB Fcb);
923 
924 VOID
926  PNTFS_FCB Fcb);
927 
928 PNTFS_FCB
930  PCWSTR FileName);
931 
932 NTSTATUS
934  PNTFS_FCB Fcb);
935 
936 PNTFS_FCB
938 
939 PNTFS_FCB
941 
942 NTSTATUS
944  PNTFS_FCB Fcb,
946 
947 NTSTATUS
949  PNTFS_FCB *pParentFCB,
950  PNTFS_FCB *pFCB,
951  PCWSTR pFileName,
952  BOOLEAN CaseSensitive);
953 
954 NTSTATUS
956  PNTFS_FCB pFCB,
957  ULONG Type,
958  PCWSTR Name,
959  ULONG NameLength,
960  PVOID * Data);
961 
962 NTSTATUS
964  PNTFS_FCB DirectoryFCB,
966  PCWSTR Stream,
968  ULONGLONG MFTIndex,
969  PNTFS_FCB * fileFCB);
970 
971 
972 /* finfo.c */
973 
974 NTSTATUS
976 
977 NTSTATUS
980  PDEVICE_EXTENSION DeviceExt,
981  ULONG IrpFlags,
982  BOOLEAN CaseSensitive,
984 
985 NTSTATUS
987 
988 /* fsctl.c */
989 
990 NTSTATUS
992 
993 
994 /* mft.c */
995 NTSTATUS
997  ULONGLONG DirectoryMftIndex,
998  ULONGLONG FileReferenceNumber,
999  PFILENAME_ATTRIBUTE FilenameAttribute,
1000  BOOLEAN CaseSensitive);
1001 
1002 NTSTATUS
1004  PDEVICE_EXTENSION DeviceExt,
1005  PULONGLONG DestinationIndex,
1006  BOOLEAN CanWait);
1007 
1008 VOID
1010 
1013 
1014 VOID
1016 
1017 ULONG
1020  ULONGLONG Offset,
1021  PCHAR Buffer,
1022  ULONG Length);
1023 
1024 NTSTATUS
1027  ULONGLONG Offset,
1028  const PUCHAR Buffer,
1029  ULONG Length,
1030  PULONG LengthWritten,
1031  PFILE_RECORD_HEADER FileRecord);
1032 
1033 ULONGLONG
1035 
1036 NTSTATUS
1038  PNTFS_ATTR_CONTEXT AttrContext,
1039  PFILE_RECORD_HEADER FileRecord,
1040  ULONG AttrOffset,
1041  ULONG DataSize);
1042 
1045  PNTFS_ATTR_RECORD FirstAttributeToMove,
1046  ULONG FirstAttributeOffset,
1047  ULONG_PTR MoveTo);
1048 
1049 NTSTATUS
1051  PNTFS_FCB Fcb,
1052  PNTFS_ATTR_CONTEXT AttrContext,
1053  ULONG AttrOffset,
1054  PFILE_RECORD_HEADER FileRecord,
1056 
1057 VOID
1059  PNTFS_ATTR_RECORD AttrEnd,
1060  ULONG EndMarker);
1061 
1062 NTSTATUS
1064  PNTFS_ATTR_CONTEXT AttrContext,
1065  ULONG AttrOffset,
1066  PFILE_RECORD_HEADER FileRecord,
1068 
1069 NTSTATUS
1071  PNTFS_ATTR_CONTEXT AttrContext,
1072  ULONG AttrOffset,
1073  PFILE_RECORD_HEADER FileRecord,
1075 
1076 ULONGLONG
1078 
1079 BOOLEAN
1081  PINDEX_ENTRY_ATTRIBUTE IndexEntry,
1082  BOOLEAN DirSearch,
1083  BOOLEAN CaseSensitive);
1084 
1085 NTSTATUS
1087 
1088 NTSTATUS
1090  ULONGLONG index,
1092 
1093 NTSTATUS
1095  PFILE_RECORD_HEADER MftRecord,
1096  PCHAR IndexRecord,
1097  ULONG IndexBlockSize,
1098  PINDEX_ENTRY_ATTRIBUTE FirstEntry,
1099  PINDEX_ENTRY_ATTRIBUTE LastEntry,
1101  PULONG StartEntry,
1102  PULONG CurrentEntry,
1103  BOOLEAN DirSearch,
1104  ULONGLONG NewDataSize,
1105  ULONGLONG NewAllocatedSize,
1106  BOOLEAN CaseSensitive);
1107 
1108 NTSTATUS
1110  ULONGLONG ParentMFTIndex,
1112  BOOLEAN DirSearch,
1113  ULONGLONG NewDataSize,
1114  ULONGLONG NewAllocationSize,
1115  BOOLEAN CaseSensitive);
1116 
1117 NTSTATUS
1119  ULONGLONG MftIndex,
1120  PFILE_RECORD_HEADER FileRecord);
1121 
1122 NTSTATUS
1124  PFILE_RECORD_HEADER MftRecord,
1125  ULONG Type,
1126  PCWSTR Name,
1127  ULONG NameLength,
1128  PNTFS_ATTR_CONTEXT * AttrCtx,
1129  PULONG Offset);
1130 
1131 VOID
1135  ULONGLONG vcn,
1136  ULONG count,
1137  PVOID buffer);
1138 
1139 NTSTATUS
1142 
1143 NTSTATUS
1146 
1147 NTSTATUS
1149  ULONGLONG lcn,
1150  ULONG count,
1151  PVOID buffer);
1152 
1153 VOID
1157 
1158 NTSTATUS
1160  PUNICODE_STRING PathName,
1161  BOOLEAN CaseSensitive,
1162  PFILE_RECORD_HEADER *FileRecord,
1163  PULONGLONG MFTIndex);
1164 
1165 NTSTATUS
1167  PUNICODE_STRING PathName,
1168  BOOLEAN CaseSensitive,
1169  PFILE_RECORD_HEADER *FileRecord,
1170  PULONGLONG MFTIndex,
1171  ULONGLONG CurrentMFTIndex);
1172 
1173 VOID
1175  PFILE_RECORD_HEADER FileRecord);
1176 
1177 NTSTATUS
1179  PUNICODE_STRING SearchPattern,
1180  PULONG FirstEntry,
1181  PFILE_RECORD_HEADER *FileRecord,
1182  PULONGLONG MFTIndex,
1183  ULONGLONG CurrentMFTIndex,
1184  BOOLEAN CaseSensitive);
1185 
1186 NTSTATUS
1188  ULONGLONG MFTIndex,
1190  PULONG FirstEntry,
1191  BOOLEAN DirSearch,
1192  BOOLEAN CaseSensitive,
1193  ULONGLONG *OutMFTIndex);
1194 
1195 /* misc.c */
1196 
1197 BOOLEAN
1199 
1202  PIRP Irp);
1203 
1204 PVOID
1206  BOOLEAN Paging);
1207 
1208 NTSTATUS
1210  IN ULONG Length,
1212 
1213 #if 0
1214 BOOLEAN
1216 
1217 VOID
1218 CdfsSwapString(PWCHAR Out,
1219  PUCHAR In,
1220  ULONG Count);
1221 #endif
1222 
1223 VOID
1224 NtfsFileFlagsToAttributes(ULONG NtfsAttributes,
1226 
1227 
1228 /* rw.c */
1229 
1230 NTSTATUS
1231 NtfsRead(PNTFS_IRP_CONTEXT IrpContext);
1232 
1233 NTSTATUS
1234 NtfsWrite(PNTFS_IRP_CONTEXT IrpContext);
1235 
1236 
1237 /* volinfo.c */
1238 
1239 NTSTATUS
1241  ULONG FirstDesiredCluster,
1242  ULONG DesiredClusters,
1243  PULONG FirstAssignedCluster,
1244  PULONG AssignedClusters);
1245 
1246 ULONGLONG
1248 
1249 NTSTATUS
1251 
1252 NTSTATUS
1254 
1255 
1256 /* ntfs.c */
1257 
1258 INIT_FUNCTION
1259 DRIVER_INITIALIZE DriverEntry;
1260 
1261 INIT_FUNCTION
1262 VOID
1263 NTAPI
1265 
1266 #endif /* NTFS_H */
NTSTATUS SplitBTreeNode(PB_TREE Tree, PB_TREE_FILENAME_NODE Node, PB_TREE_KEY *MedianKey, PB_TREE_FILENAME_NODE *NewRightHandSibling, BOOLEAN CaseSensitive)
Definition: btree.c:1883
FAST_IO_WRITE NtfsFastIoWrite
Definition: ntfs.h:891
PNTFS_ATTR_RECORD MoveAttributes(PDEVICE_EXTENSION DeviceExt, PNTFS_ATTR_RECORD FirstAttributeToMove, ULONG FirstAttributeOffset, ULONG_PTR MoveTo)
Definition: mft.c:456
UCHAR OEMID[8]
Definition: ntfs.h:55
ULONG Reserved
Definition: ntfs.h:405
signed char * PCHAR
Definition: retypes.h:7
PNTFS_ATTR_RECORD LastAttr
Definition: ntfs.h:536
NTSTATUS AddRun(PNTFS_VCB Vcb, PNTFS_ATTR_CONTEXT AttrContext, ULONG AttrOffset, PFILE_RECORD_HEADER FileRecord, ULONGLONG NextAssignedCluster, ULONG RunLength)
Definition: attrib.c:599
NTSTATUS NtfsSetEndOfFile(PNTFS_FCB Fcb, PFILE_OBJECT FileObject, PDEVICE_EXTENSION DeviceExt, ULONG IrpFlags, BOOLEAN CaseSensitive, PLARGE_INTEGER NewFileSize)
Definition: finfo.c:561
ULONG Flags
Definition: ntfs.h:150
struct NTFS_RECORD_HEADER * PNTFS_RECORD_HEADER
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define IN
Definition: typedefs.h:38
VOID NtfsDumpFileRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: mft.c:3278
ULONG GetSizeOfIndexEntries(PB_TREE_FILENAME_NODE Node)
Definition: btree.c:855
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:656
USHORT Padding
Definition: ntfs.h:257
ULONG CollationRule
Definition: ntfs.h:379
PDRIVER_OBJECT DriverObject
Definition: ntfs.h:147
LIST_ENTRY FcbListEntry
Definition: ntfs.h:514
PDEVICE_OBJECT DeviceObject
Definition: ntfs.h:473
ULONGLONG AllocatedSize
Definition: ntfs.h:350
struct S2 s2
struct NTFS_IRP_CONTEXT * PNTFS_IRP_CONTEXT
UCHAR Unused2[4]
Definition: ntfs.h:34
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST NPAGED_LOOKASIDE_LIST
NTFSIDENTIFIER Identifier
Definition: ntfs.h:465
struct _FCB NTFS_FCB
Type
Definition: Type.h:6
NTSTATUS NtfsMakeFCBFromDirEntry(PNTFS_VCB Vcb, PNTFS_FCB DirectoryFCB, PUNICODE_STRING Name, PCWSTR Stream, PFILE_RECORD_HEADER Record, ULONGLONG MFTIndex, PNTFS_FCB *fileFCB)
Definition: fcb.c:378
NPAGED_LOOKASIDE_LIST AttrCtxtLookasideList
Definition: ntfs.h:154
_In_ PFCB _In_ LONGLONG StartingOffset
Definition: cdprocs.h:282
ULONGLONG LastAccessTime
Definition: ntfs.h:318
UCHAR MinorFunction
Definition: ntfs.h:469
NPAGED_LOOKASIDE_LIST FcbLookasideList
Definition: ntfs.h:153
FILENAME_ATTRIBUTE FileName
Definition: ntfs.h:412
ULONGLONG LastWriteTime
Definition: ntfs.h:317
ULONGLONG ChangeTime
Definition: ntfs.h:347
ULONGLONG SerialNumber
Definition: ntfs.h:77
ULONG BytesPerSector
Definition: ntfs.h:67
PFILE_OBJECT FileObject
Definition: ntfs.h:504
PFILENAME_ATTRIBUTE GetFileNameFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord, UCHAR NameType)
Definition: attrib.c:1766
PIO_STACK_LOCATION Stack
Definition: ntfs.h:467
NTSTATUS UpdateIndexNode(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, PB_TREE_FILENAME_NODE Node, ULONG IndexBufferSize, PNTFS_ATTR_CONTEXT IndexAllocationContext, ULONG IndexAllocationOffset)
Definition: btree.c:1319
struct NTFSIDENTIFIER * PNTFSIDENTIFIER
struct NTFS_ATTR_RECORD * PNTFS_ATTR_RECORD
PFILE_OBJECT StreamFileObject
Definition: ntfs.h:111
_In_ PIRP Irp
Definition: csq.h:116
PNTFS_ATTR_RECORD NonResidentEnd
Definition: ntfs.h:538
struct FIXUP_ARRAY * PFIXUP_ARRAY
ULONG ReadAttribute(PDEVICE_EXTENSION Vcb, PNTFS_ATTR_CONTEXT Context, ULONGLONG Offset, PCHAR Buffer, ULONG Length)
Definition: mft.c:1009
#define IRPCONTEXT_COMPLETE
Definition: ntfs.h:460
Definition: cdstruc.h:908
struct _NTFS_INFO NTFS_INFO
NTSTATUS UpdateFileRecord(PDEVICE_EXTENSION Vcb, ULONGLONG MftIndex, PFILE_RECORD_HEADER FileRecord)
Definition: mft.c:1875
BOOLEAN NtfsFCBIsRoot(PNTFS_FCB Fcb)
Definition: fcb.c:147
#define MAX_PATH
Definition: ntfs.h:495
uint16_t * PWSTR
Definition: typedefs.h:54
FORCEINLINE NTSTATUS NtfsMarkIrpContextForQueue(PNTFS_IRP_CONTEXT IrpContext)
Definition: ntfs.h:552
ULONG MFTRecordNumber
Definition: ntfs.h:258
ULONGLONG CacheRunOffset
Definition: ntfs.h:482
NTSTATUS FindNextAttribute(PFIND_ATTR_CONTXT Context, PNTFS_ATTR_RECORD *Attribute)
Definition: attrib.c:1388
PNTFS_FCB NtfsMakeRootFCB(PNTFS_VCB Vcb)
Definition: fcb.c:308
GLuint GLuint GLsizei count
Definition: gl.h:1545
unsigned char * PUCHAR
Definition: retypes.h:3
char CHAR
Definition: xmlstorage.h:175
NTSTATUS NtfsSetInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: finfo.c:717
struct NTFS_ATTR_CONTEXT * PNTFS_ATTR_CONTEXT
PNTFS_ATTR_RECORD NonResidentStart
Definition: ntfs.h:537
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NtfsFCBIsDirectory(PNTFS_FCB Fcb)
Definition: fcb.c:127
NTSTATUS NtfsLookupFile(PDEVICE_EXTENSION Vcb, PUNICODE_STRING PathName, BOOLEAN CaseSensitive, PFILE_RECORD_HEADER *FileRecord, PULONGLONG MFTIndex)
Definition: mft.c:3231
ULONG MftDataOffset
Definition: ntfs.h:121
UCHAR BootStrap[426]
Definition: ntfs.h:58
UCHAR Unused0[7]
Definition: ntfs.h:29
NPAGED_LOOKASIDE_LIST FileRecLookasideList
Definition: ntfs.h:119
ULONG FileAttribute
Definition: ntfs.h:319
ULONGLONG CacheRunLength
Definition: ntfs.h:484
PB_TREE_KEY FirstKey
Definition: ntfs.h:435
NTSTATUS NtfsFileSystemControl(PNTFS_IRP_CONTEXT IrpContext)
Definition: fsctl.c:963
USHORT Reserved
Definition: ntfs.h:411
ULONGLONG GetIndexEntryVCN(PINDEX_ENTRY_ATTRIBUTE IndexEntry)
Definition: btree.c:1641
ULONG DirIndex
Definition: ntfs.h:517
NTSTATUS SetNonResidentAttributeDataLength(PDEVICE_EXTENSION Vcb, PNTFS_ATTR_CONTEXT AttrContext, ULONG AttrOffset, PFILE_RECORD_HEADER FileRecord, PLARGE_INTEGER DataSize)
Definition: mft.c:700
ULONGLONG CacheRunCurrentOffset
Definition: ntfs.h:486
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
USHORT Length
Definition: ntfs.h:408
PNTFS_FCB NtfsGrabFCBFromTable(PNTFS_VCB Vcb, PCWSTR FileName)
Definition: fcb.c:211
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
ULONG BytesInUse
Definition: ntfs.h:253
ULONGLONG NtfsGetFileSize(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, PCWSTR Stream, ULONG StreamLength, PULONGLONG AllocatedSize)
Definition: dirctl.c:38
PFILE_RECORD_HEADER NtfsCreateEmptyFileRecord(PDEVICE_EXTENSION DeviceExt)
Definition: create.c:818
NTSTATUS NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject, IN ULONG DiskSector, IN ULONG SectorCount, IN ULONG SectorSize, IN OUT PUCHAR Buffer, IN BOOLEAN Override)
Definition: blockdev.c:308
UCHAR MajorVersion
Definition: ntfs.h:446
GLuint buffer
Definition: glext.h:5915
ULONG LastCluster
Definition: ntfs.h:139
NTSTATUS NtfsLockUserBuffer(IN PIRP Irp, IN ULONG Length, IN LOCK_OPERATION Operation)
Definition: misc.c:158
struct _FIND_ATTR_CONTXT FIND_ATTR_CONTXT
ULONGLONG VCN
Definition: ntfs.h:434
USHORT LinkCount
Definition: ntfs.h:524
UCHAR NameLength
Definition: ntfs.h:362
UCHAR SectorsPerCluster
Definition: ntfs.h:28
Definition: ntfs.h:393
DRIVER_DISPATCH NtfsFsdDispatch
Definition: ntfs.h:867
WORK_QUEUE_ITEM WorkQueueItem
Definition: ntfs.h:470
struct _BIOS_PARAMETERS_BLOCK * PBIOS_PARAMETERS_BLOCK
uint16_t * PWCHAR
Definition: typedefs.h:54
PB_TREE_FILENAME_NODE RootNode
Definition: ntfs.h:440
USHORT SequenceNumber
Definition: ntfs.h:249
WCHAR PathName[MAX_PATH]
Definition: ntfs.h:509
NTSTATUS NtfsDeviceControl(PNTFS_IRP_CONTEXT IrpContext)
Definition: devctl.c:36
VOID DumpBTreeKey(PB_TREE Tree, PB_TREE_KEY Key, ULONG Number, ULONG Depth)
Definition: btree.c:1549
ULONGLONG MFTIndex
Definition: ntfs.h:523
ULONGLONG ClusterCount
Definition: ntfs.h:71
PNTFS_ATTR_CONTEXT PrepareAttributeContext(PNTFS_ATTR_RECORD AttrRecord)
Definition: mft.c:41
NTSTATUS ConvertDataRunsToLargeMCB(PUCHAR DataRun, PLARGE_MCB DataRunsMCB, PULONGLONG pNextVBN)
Definition: attrib.c:825
ULONGLONG LastAccessTime
Definition: ntfs.h:349
ULONG Entry
Definition: ntfs.h:136
struct _B_TREE_KEY * PB_TREE_KEY
ULONGLONG VCN
Definition: ntfs.h:389
ULONGLONG NtfsGetFreeClusters(PDEVICE_EXTENSION DeviceExt)
Definition: volinfo.c:37
CHAR InputBuffer[80]
Definition: conmgr.c:33
struct VOLINFO_ATTRIBUTE * PVOLINFO_ATTRIBUTE
UCHAR MajorVersion
Definition: ntfs.h:80
NTSTATUS DemoteBTreeRoot(PB_TREE Tree)
Definition: btree.c:1089
USHORT DataOffset
Definition: ntfs.h:403
LIST_ENTRY NextCCB
Definition: ntfs.h:132
BOOLEAN wstrcmpjoki(PWSTR s1, PWSTR s2)
ULONG FileAttributes
Definition: ntfs.h:352
USHORT KeyLength
Definition: ntfs.h:409
USHORT DataLength
Definition: ntfs.h:404
uint32_t ULONG_PTR
Definition: typedefs.h:63
VOID NTAPI NtfsRelLazyWrite(PVOID Context)
Definition: fastio.c:51
NTSTATUS NtfsDirectoryControl(PNTFS_IRP_CONTEXT IrpContext)
Definition: dirctl.c:590
LONGLONG USN
Definition: ntbasedef.h:395
NTSTATUS UpdateIndexEntryFileNameSize(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER MftRecord, PCHAR IndexRecord, ULONG IndexBlockSize, PINDEX_ENTRY_ATTRIBUTE FirstEntry, PINDEX_ENTRY_ATTRIBUTE LastEntry, PUNICODE_STRING FileName, PULONG StartEntry, PULONG CurrentEntry, BOOLEAN DirSearch, ULONGLONG NewDataSize, ULONGLONG NewAllocatedSize, BOOLEAN CaseSensitive)
Definition: mft.c:1714
VOID NtfsDumpDataRuns(PVOID StartOfRun, ULONGLONG CurrentLCN)
Definition: attrib.c:1712
NTSTATUS NtfsCleanup(PNTFS_IRP_CONTEXT IrpContext)
Definition: cleanup.c:89
struct _B_TREE_FILENAME_NODE * PB_TREE_FILENAME_NODE
Definition: ntfs.h:129
struct B_TREE * PB_TREE
ULONG FirstEntryOffset
Definition: ntfs.h:369
_In_ struct _KBUGCHECK_REASON_CALLBACK_RECORD * Record
Definition: ketypes.h:256
NTFSIDENTIFIER Identifier
Definition: ntfs.h:499
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID SetFileRecordEnd(PFILE_RECORD_HEADER FileRecord, PNTFS_ATTR_RECORD AttrEnd, ULONG EndMarker)
Definition: mft.c:650
struct _EXTENDED_BIOS_PARAMETERS_BLOCK EXTENDED_BIOS_PARAMETERS_BLOCK
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
struct FILENAME_ATTRIBUTE * PFILENAME_ATTRIBUTE
ERESOURCE Resource
Definition: ntfs.h:146
long LONG
Definition: pedump.c:60
USHORT AttributeOffset
Definition: ntfs.h:251
INDEX_HEADER_ATTRIBUTE Header
Definition: ntfs.h:390
NTSTATUS NtfsCreateDirectory(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, BOOLEAN CaseSensitive, BOOLEAN CanWait)
Definition: create.c:681
PNTFS_FCB NtfsCreateFCB(PCWSTR FileName, PCWSTR Stream, PNTFS_VCB Vcb)
Definition: fcb.c:67
USHORT USN
Definition: ntfs.h:544
ULARGE_INTEGER MftMirrStart
Definition: ntfs.h:73
struct _B_TREE_KEY B_TREE_KEY
ULONG LastOffset
Definition: ntfs.h:140
USHORT VolumeLabelLength
Definition: ntfs.h:78
unsigned char BOOLEAN
ULONGLONG SectorCount
Definition: ntfs.h:70
NTSTATUS NtfsAddFilenameToDirectory(PDEVICE_EXTENSION DeviceExt, ULONGLONG DirectoryMftIndex, ULONGLONG FileReferenceNumber, PFILENAME_ATTRIBUTE FilenameAttribute, BOOLEAN CaseSensitive)
Definition: mft.c:2136
NTFS_INFO NtfsInfo
Definition: ntfs.h:117
LONG RefCount
Definition: ntfs.h:519
NTSTATUS ReadLCN(PDEVICE_EXTENSION Vcb, ULONGLONG lcn, ULONG count, PVOID buffer)
Definition: mft.c:2575
NTSTATUS NtfsCloseFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject)
Definition: close.c:40
BOOLEAN NtfsFCBIsReparsePoint(PNTFS_FCB Fcb)
Definition: fcb.c:134
PNTFS_IRP_CONTEXT NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: misc.c:66
WCHAR Stream[MAX_PATH]
Definition: ntfs.h:507
VOID NTAPI NtfsRelReadAhead(PVOID Context)
Definition: fastio.c:72
NTSTATUS UpdateIndexAllocation(PDEVICE_EXTENSION DeviceExt, PB_TREE Tree, ULONG IndexBufferSize, PFILE_RECORD_HEADER FileRecord)
Definition: btree.c:1182
#define IRPCONTEXT_QUEUE
Definition: ntfs.h:461
#define FORCEINLINE
Definition: ntbasedef.h:221
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
USHORT NextAttributeNumber
Definition: ntfs.h:256
USHORT LinkCount
Definition: ntfs.h:250
WCHAR * ObjectName
Definition: ntfs.h:508
#define MAXIMUM_VOLUME_LABEL_LENGTH
Definition: iotypes.h:154
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
Definition: wmitypes.h:55
struct _B_TREE_KEY * NextKey
Definition: ntfs.h:421
struct _FILE_RECORD_HEADER * PFILE_RECORD_HEADER
Definition: bufpool.h:45
ULONG BytesPerIndexRecord
Definition: ntfs.h:75
B_TREE_FILENAME_NODE * LesserChild
Definition: ntfs.h:422
NTSTATUS NtfsQueryInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: finfo.c:418
GLuint index
Definition: glext.h:6031
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
struct STANDARD_INFORMATION * PSTANDARD_INFORMATION
NTSTATUS CreateEmptyBTree(PB_TREE *NewTree)
Definition: btree.c:348
NTSTATUS NtfsRead(PNTFS_IRP_CONTEXT IrpContext)
Definition: rw.c:209
PDEVICE_EXTENSION Vcb
Definition: ntfs.h:532
BOOLEAN NTAPI NtfsAcqReadAhead(PVOID Context, BOOLEAN Wait)
Definition: fastio.c:60
ULONG SizeOfEntry
Definition: ntfs.h:380
VOID NtfsDestroyFCB(PNTFS_FCB Fcb)
Definition: fcb.c:115
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE _In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG FileAttributes
Definition: fltkernel.h:1230
struct DEVICE_EXTENSION * PDEVICE_EXTENSION
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
USHORT Length
Definition: ntfs.h:333
NTSTATUS NtfsInsertKey(PB_TREE Tree, ULONGLONG FileReference, PFILENAME_ATTRIBUTE FileNameAttribute, PB_TREE_FILENAME_NODE Node, BOOLEAN CaseSensitive, ULONG MaxIndexRootSize, ULONG IndexRecordSize, PB_TREE_KEY *MedianKey, PB_TREE_FILENAME_NODE *NewRightHandSibling)
Definition: btree.c:1691
FSRTL_COMMON_FCB_HEADER RFCB
Definition: ntfs.h:501
ATTRIBUTE_TYPE
Definition: ntfs.h:159
USHORT AttributeNumber
Definition: ntfs.h:338
ULONG OpenHandleCount
Definition: ntfs.h:521
int64_t LONGLONG
Definition: typedefs.h:66
NTSTATUS NtfsReadFCBAttribute(PNTFS_VCB Vcb, PNTFS_FCB pFCB, ULONG Type, PCWSTR Name, ULONG NameLength, PVOID *Data)
Definition: fcb.c:724
NTSTATUS ConvertLargeMCBToDataRuns(PLARGE_MCB DataRunsMCB, PUCHAR RunBuffer, ULONG MaxBufferSize, PULONG UsedBufferSize)
Definition: attrib.c:896
BOOLEAN NtfsIsIrpTopLevel(PIRP Irp)
Definition: misc.c:43
ULONGLONG GetAllocationOffsetFromVCN(PDEVICE_EXTENSION DeviceExt, ULONG IndexBufferSize, ULONGLONG Vcn)
Definition: btree.c:1630
USHORT AlignmentOrReserved
Definition: ntfs.h:358
NTSTATUS FindFirstAttribute(PFIND_ATTR_CONTXT Context, PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord, BOOLEAN OnlyResident, PNTFS_ATTR_RECORD *Attribute)
Definition: attrib.c:1340
ULONGLONG DataSize
Definition: ntfs.h:351
UCHAR Unused1[2]
Definition: ntfs.h:31
FAST_IO_CHECK_IF_POSSIBLE NtfsFastIoCheckIfPossible
Definition: ntfs.h:889
NTSTATUS AddFileName(PFILE_RECORD_HEADER FileRecord, PNTFS_ATTR_RECORD AttributeAddress, PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, BOOLEAN CaseSensitive, PULONGLONG ParentMftIndex)
Definition: attrib.c:230
BOOLEAN DiskNeedsUpdating
Definition: ntfs.h:433
VOID EnumerAttribute(PFILE_RECORD_HEADER file, PDEVICE_EXTENSION Vcb, PDEVICE_OBJECT DeviceObject)
struct _BOOT_SECTOR * PBOOT_SECTOR
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _FILE_RECORD_HEADER FILE_RECORD_HEADER
NTSTATUS NtfsCreateFileRecord(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, BOOLEAN CaseSensitive, BOOLEAN CanWait)
Definition: create.c:886
NTSTATUS AddNewMftEntry(PFILE_RECORD_HEADER FileRecord, PDEVICE_EXTENSION DeviceExt, PULONGLONG DestinationIndex, BOOLEAN CanWait)
Definition: mft.c:1966
ULONG BytesAllocated
Definition: ntfs.h:254
#define STATUS_PENDING
Definition: ntstatus.h:82
struct _FILE_RECORD_HEADER * MasterFileTable
Definition: ntfs.h:114
PFILE_OBJECT PtrFileObject
Definition: ntfs.h:133
char CCHAR
Definition: typedefs.h:50
struct S1 s1
uint64_t ULONGLONG
Definition: typedefs.h:65
ULONG BytesPerFileRecord
Definition: ntfs.h:74
VOID NtfsFileFlagsToAttributes(ULONG NtfsAttributes, PULONG FileAttributes)
Definition: misc.c:105
#define Vcb
Definition: cdprocs.h:1425
UCHAR MajorFunction
Definition: ntfs.h:468
struct _NTFS_ATTR_CONTEXT NTFS_ATTR_CONTEXT
PNTFS_ATTR_RECORD FirstAttr
Definition: ntfs.h:534
NTSTATUS SetResidentAttributeDataLength(PDEVICE_EXTENSION Vcb, PNTFS_ATTR_CONTEXT AttrContext, ULONG AttrOffset, PFILE_RECORD_HEADER FileRecord, PLARGE_INTEGER DataSize)
Definition: mft.c:835
BIOS_PARAMETERS_BLOCK BPB
Definition: ntfs.h:56
BOOLEAN NtfsFCBIsCompressed(PNTFS_FCB Fcb)
Definition: fcb.c:141
ULONG AttributeType
Definition: ntfs.h:378
ULONGLONG CreationTime
Definition: ntfs.h:346
ULONG GetFileNameAttributeLength(PFILENAME_ATTRIBUTE FileNameAttribute)
Definition: attrib.c:1935
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
INDEX_HEADER_ATTRIBUTE Header
Definition: ntfs.h:383
enum ATTRIBUTE_TYPE * PATTRIBUTE_TYPE
* PFILE_OBJECT
Definition: iotypes.h:1954
CRegistryTree Tree
NTSTATUS FixupUpdateSequenceArray(PDEVICE_EXTENSION Vcb, PNTFS_RECORD_HEADER Record)
Definition: mft.c:1909
struct DEVICE_EXTENSION NTFS_VCB
struct INDEX_HEADER_ATTRIBUTE * PINDEX_HEADER_ATTRIBUTE
_In_opt_ PLARGE_INTEGER NewFileSize
Definition: mmfuncs.h:609
NTSTATUS AddFixupArray(PDEVICE_EXTENSION Vcb, PNTFS_RECORD_HEADER Record)
Definition: mft.c:2547
VOID DestroyBTree(PB_TREE Tree)
Definition: btree.c:1542
ULONGLONG AttributeDataLength(PNTFS_ATTR_RECORD AttrRecord)
Definition: mft.c:203
ULONG Flags
Definition: ntfs.h:520
PNTFS_VCB Vcb
Definition: ntfs.h:505
PWCHAR DirectorySearchPattern
Definition: ntfs.h:138
BOOLEAN CompareFileName(PUNICODE_STRING FileName, PINDEX_ENTRY_ATTRIBUTE IndexEntry, BOOLEAN DirSearch, BOOLEAN CaseSensitive)
Definition: mft.c:2594
unsigned char UCHAR
Definition: xmlstorage.h:181
USHORT Flags
Definition: ntfs.h:410
UCHAR NameOffset
Definition: ntfs.h:335
INIT_FUNCTION DRIVER_INITIALIZE DriverEntry
Definition: ntfs.h:1259
struct NTFS_CCB * PNTFS_CCB
NTSTATUS NtfsLookupFileAt(PDEVICE_EXTENSION Vcb, PUNICODE_STRING PathName, BOOLEAN CaseSensitive, PFILE_RECORD_HEADER *FileRecord, PULONGLONG MFTIndex, ULONGLONG CurrentMFTIndex)
Definition: mft.c:3173
NTSTATUS AddData(PFILE_RECORD_HEADER FileRecord, PNTFS_ATTR_RECORD AttributeAddress)
Definition: attrib.c:160
NTSTATUS NtfsAttachFCBToFileObject(PNTFS_VCB Vcb, PNTFS_FCB Fcb, PFILE_OBJECT FileObject)
Definition: fcb.c:453
ULONG Type
Definition: ntfs.h:95
_In_ GUID _In_ PVOID _In_ ULONG ValueLength
Definition: hubbusif.h:311
PNTFS_ATTR_RECORD CurrAttr
Definition: ntfs.h:535
struct _FCB * PNTFS_FCB
ULONG TotalSizeOfEntries
Definition: ntfs.h:370
USHORT UsaCount
Definition: ntfs.h:237
VOID ReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context)
Definition: mft.c:104
ULONG Offset
Definition: ntfs.h:539
ULONG Flags
Definition: ntfs.h:466
BOOLEAN NTAPI NtfsAcqLazyWrite(PVOID Context, BOOLEAN Wait)
Definition: fastio.c:39
FAST_IO_READ NtfsFastIoRead
Definition: ntfs.h:890
Definition: typedefs.h:117
NTFSIDENTIFIER Identifier
Definition: ntfs.h:131
ULONGLONG DirectoryFileReferenceNumber
Definition: ntfs.h:345
VOID ReadVCN(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER file, ATTRIBUTE_TYPE type, ULONGLONG vcn, ULONG count, PVOID buffer)
ULONG SectorCount
Definition: part_xbox.c:32
DRIVER_DISPATCH(nfs41_FsdDispatch)
UCHAR ClustersPerIndexRecord
Definition: ntfs.h:381
USHORT Flags
Definition: ntfs.h:82
NTSTATUS AddIndexRoot(PNTFS_VCB Vcb, PFILE_RECORD_HEADER FileRecord, PNTFS_ATTR_RECORD AttributeAddress, PINDEX_ROOT_ATTRIBUTE NewIndexRoot, ULONG RootLength, PCWSTR Name, USHORT NameLength)
Definition: attrib.c:495
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
ERESOURCE MainResource
Definition: ntfs.h:512
VOID FindCloseAttribute(PFIND_ATTR_CONTXT Context)
Definition: attrib.c:1422
struct REPARSE_POINT_ATTRIBUTE * PREPARSE_POINT_ATTRIBUTE
PSTANDARD_INFORMATION GetStandardInformationFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: attrib.c:1897
PDEVICE_OBJECT DeviceObject
Definition: ntfs.h:148
USHORT Flags
Definition: ntfs.h:448
ULONGLONG Unknown1
Definition: ntfs.h:445
NTSTATUS SetAttributeDataLength(PFILE_OBJECT FileObject, PNTFS_FCB Fcb, PNTFS_ATTR_CONTEXT AttrContext, ULONG AttrOffset, PFILE_RECORD_HEADER FileRecord, PLARGE_INTEGER DataSize)
Definition: mft.c:559
ULONG ReparseTag
Definition: ntfs.h:360
NTSTATUS NtfsDeviceIoControl(IN PDEVICE_OBJECT DeviceObject, IN ULONG ControlCode, IN PVOID InputBuffer, IN ULONG InputBufferSize, IN OUT PVOID OutputBuffer, IN OUT PULONG OutputBufferSize, IN BOOLEAN Override)
Definition: blockdev.c:326
LONG CompareTreeKeys(PB_TREE_KEY Key1, PB_TREE_KEY Key2, BOOLEAN CaseSensitive)
Definition: btree.c:417
VOID NtfsGrabFCB(PNTFS_VCB Vcb, PNTFS_FCB Fcb)
Definition: fcb.c:154
UCHAR MinorVersion
Definition: ntfs.h:447
NTSTATUS SavedExceptionCode
Definition: ntfs.h:475
NTSTATUS NtfsCreate(PNTFS_IRP_CONTEXT IrpContext)
Definition: create.c:622
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
ULONG Unknown2
Definition: ntfs.h:449
NTSTATUS UpdateFileNameRecord(PDEVICE_EXTENSION Vcb, ULONGLONG ParentMFTIndex, PUNICODE_STRING FileName, BOOLEAN DirSearch, ULONGLONG NewDataSize, ULONGLONG NewAllocationSize, BOOLEAN CaseSensitive)
Definition: mft.c:1604
ULONGLONG LastWriteTime
Definition: ntfs.h:348
NTSTATUS ReadFileRecord(PDEVICE_EXTENSION Vcb, ULONGLONG index, PFILE_RECORD_HEADER file)
Definition: mft.c:1575
LONGLONG CacheRunLastLCN
Definition: ntfs.h:485
ULONG MftZoneReservation
Definition: ntfs.h:84
VOID NtfsAddFCBToTable(PNTFS_VCB Vcb, PNTFS_FCB Fcb)
Definition: fcb.c:198
ULONGLONG FileMFTIndex
Definition: ntfs.h:488
enum _LOCK_OPERATION LOCK_OPERATION
NPAGED_LOOKASIDE_LIST IrpContextLookasideList
Definition: ntfs.h:152
UCHAR GetPackedByteCount(LONGLONG NumberToPack, BOOLEAN IsSigned)
Definition: attrib.c:1803
unsigned short USHORT
Definition: pedump.c:61
ULONGLONG IndexedFile
Definition: ntfs.h:399
CACHE_MANAGER_CALLBACKS CacheMgrCallbacks
Definition: ntfs.h:149
UCHAR Unused3[4]
Definition: ntfs.h:35
NTSTATUS NtfsWriteDisk(IN PDEVICE_OBJECT DeviceObject, IN LONGLONG StartingOffset, IN ULONG Length, IN ULONG SectorSize, IN const PUCHAR Buffer)
Definition: blockdev.c:163
EXTENDED_BIOS_PARAMETERS_BLOCK EBPB
Definition: ntfs.h:57
NTSTATUS GetLastClusterInDataRun(PDEVICE_EXTENSION Vcb, PNTFS_ATTR_RECORD Attribute, PULONGLONG LastCluster)
Definition: attrib.c:1865
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH]
Definition: ntfs.h:79
struct DEVICE_EXTENSION * PNTFS_VCB
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
NTSTATUS CreateIndexRootFromBTree(PDEVICE_EXTENSION DeviceExt, PB_TREE Tree, ULONG MaxIndexSize, PINDEX_ROOT_ATTRIBUTE *IndexRoot, ULONG *Length)
Definition: btree.c:910
BOOLEAN OnlyResident
Definition: ntfs.h:533
struct _BIOS_PARAMETERS_BLOCK BIOS_PARAMETERS_BLOCK
LARGE_INTEGER CurrentByteOffset
Definition: ntfs.h:134
NTSTATUS CreateBTreeFromIndex(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecordWithIndex, PNTFS_ATTR_CONTEXT IndexRootContext, PINDEX_ROOT_ATTRIBUTE IndexRoot, PB_TREE *NewTree)
Definition: btree.c:682
ULONGLONG StartVcn
Definition: ntfs.h:336
ATTRIBUTE_TYPE AttributeType
Definition: ntfs.h:332
unsigned int * PULONG
Definition: retypes.h:1
struct _FIND_ATTR_CONTXT * PFIND_ATTR_CONTXT
struct _NTFS_ATTR_CONTEXT * MFTContext
Definition: ntfs.h:113
struct ATTRIBUTE_LIST * PATTRIBUTE_LIST
USHORT Flags
Definition: ntfs.h:252
struct _EXTENDED_BIOS_PARAMETERS_BLOCK * PEXTENDED_BIOS_PARAMETERS_BLOCK
struct INDEX_BUFFER * PINDEX_BUFFER
IN PVOID Instance
Definition: pci.h:359
UCHAR NameLength
Definition: ntfs.h:334
Definition: ntfs.h:438
NTSTATUS NtfsFindFileAt(PDEVICE_EXTENSION Vcb, PUNICODE_STRING SearchPattern, PULONG FirstEntry, PFILE_RECORD_HEADER *FileRecord, PULONGLONG MFTIndex, ULONGLONG CurrentMFTIndex, BOOLEAN CaseSensitive)
Definition: mft.c:3299
NTSTATUS AddBitmap(PNTFS_VCB Vcb, PFILE_RECORD_HEADER FileRecord, PNTFS_ATTR_RECORD AttributeAddress, PCWSTR Name, USHORT NameLength)
Definition: attrib.c:72
NTSTATUS InternalSetResidentAttributeLength(PDEVICE_EXTENSION DeviceExt, PNTFS_ATTR_CONTEXT AttrContext, PFILE_RECORD_HEADER FileRecord, ULONG AttrOffset, ULONG DataSize)
Definition: mft.c:486
NTSTATUS NtfsFCBInitializeCache(PNTFS_VCB Vcb, PNTFS_FCB Fcb)
Definition: fcb.c:254
ULONGLONG Lsn
Definition: ntfs.h:238
VOID DumpBTree(PB_TREE Tree)
Definition: btree.c:1622
struct _BEEP_DEVICE_EXTENSION DEVICE_EXTENSION
NTFSIDENTIFIER Identifier
Definition: ntfs.h:145
PNTFS_ATTR_RECORD pRecord
Definition: ntfs.h:489
INIT_FUNCTION VOID NTAPI NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject)
Definition: ntfs.c:175
BOOLEAN IsTopLevel
Definition: ntfs.h:472
VOID DestroyBTreeNode(PB_TREE_FILENAME_NODE Node)
Definition: btree.c:1511
NTFS_RECORD_HEADER Ntfs
Definition: ntfs.h:248
VOID DumpBTreeNode(PB_TREE Tree, PB_TREE_FILENAME_NODE Node, ULONG Number, ULONG Depth)
Definition: btree.c:1583
Definition: iotypes.h:166
#define OUT
Definition: typedefs.h:39
VOID NtfsDumpData(ULONG_PTR Buffer, ULONG Length)
Definition: mft.c:3241
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:390
NTSTATUS NtfsGetFCBForFile(PNTFS_VCB Vcb, PNTFS_FCB *pParentFCB, PNTFS_FCB *pFCB, PCWSTR pFileName, BOOLEAN CaseSensitive)
Definition: fcb.c:592
FAST_IO_DISPATCH FastIoDispatch
Definition: ntfs.h:151
NTSTATUS WriteAttribute(PDEVICE_EXTENSION Vcb, PNTFS_ATTR_CONTEXT Context, ULONGLONG Offset, const PUCHAR Buffer, ULONG Length, PULONG LengthWritten, PFILE_RECORD_HEADER FileRecord)
Definition: mft.c:1259
PUCHAR DecodeRun(PUCHAR DataRun, LONGLONG *DataRunOffset, ULONGLONG *DataRunLength)
Definition: attrib.c:966
ULONG ERESOURCE
Definition: env_spec_w32.h:594
PUCHAR CacheRun
Definition: ntfs.h:481
unsigned int ULONG
Definition: retypes.h:1
ULONGLONG BaseFileRecord
Definition: ntfs.h:255
PVOID NtfsGetUserBuffer(PIRP Irp, BOOLEAN Paging)
Definition: misc.c:120
ERESOURCE PagingIoResource
Definition: ntfs.h:511
NTSTATUS AddIndexAllocation(PNTFS_VCB Vcb, PFILE_RECORD_HEADER FileRecord, PNTFS_ATTR_RECORD AttributeAddress, PCWSTR Name, USHORT NameLength)
Definition: attrib.c:388
PNTFS_GLOBAL_DATA NtfsGlobalData
Definition: ntfs.c:41
struct _FCB * VolumeFcb
Definition: ntfs.h:115
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468
ULONGLONG CreationTime
Definition: ntfs.h:315
LONGLONG CacheRunStartLCN
Definition: ntfs.h:483
struct _FCB * ParentFcb
Definition: cdstruc.h:946
ULONG SectorsPerCluster
Definition: ntfs.h:68
struct INDEX_ROOT_ATTRIBUTE * PINDEX_ROOT_ATTRIBUTE
CCHAR PriorityBoost
Definition: ntfs.h:476
PFILENAME_ATTRIBUTE GetBestFileNameFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: attrib.c:1942
ULARGE_INTEGER MftStart
Definition: ntfs.h:72
NTFS_RECORD_HEADER Ntfs
Definition: ntfs.h:388
struct NTFS_GLOBAL_DATA * PNTFS_GLOBAL_DATA
NTSTATUS FindAttribute(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER MftRecord, ULONG Type, PCWSTR Name, ULONG NameLength, PNTFS_ATTR_CONTEXT *AttrCtx, PULONG Offset)
Definition: mft.c:131
NTSTATUS AddStandardInformation(PFILE_RECORD_HEADER FileRecord, PNTFS_ATTR_RECORD AttributeAddress)
Definition: attrib.c:766
NTSTATUS NtfsClose(PNTFS_IRP_CONTEXT IrpContext)
Definition: close.c:84
PINDEX_ENTRY_ATTRIBUTE IndexEntry
Definition: ntfs.h:423
USHORT UsaOffset
Definition: ntfs.h:236
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 NameType
Definition: acpixf.h:642
NTSTATUS FreeClusters(PNTFS_VCB Vcb, PNTFS_ATTR_CONTEXT AttrContext, ULONG AttrOffset, PFILE_RECORD_HEADER FileRecord, ULONG ClustersToFree)
Definition: attrib.c:1057
struct _B_TREE_FILENAME_NODE B_TREE_FILENAME_NODE
Definition: ntfs.h:416
_In_ ULONG SectorSize
Definition: halfuncs.h:291
ULONGLONG AttributeAllocatedLength(PNTFS_ATTR_RECORD AttrRecord)
Definition: mft.c:193
USHORT BytesPerSector
Definition: ntfs.h:27
NTSTATUS NtfsReadDisk(IN PDEVICE_OBJECT DeviceObject, IN LONGLONG StartingOffset, IN ULONG Length, IN ULONG SectorSize, IN OUT PUCHAR Buffer, IN BOOLEAN Override)
Definition: blockdev.c:37
_In_ PFCB Fcb
Definition: cdprocs.h:151
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3718
FILENAME_ATTRIBUTE Entry
Definition: ntfs.h:526
BOOLEAN EnableWriteSupport
Definition: ntfs.h:155
SECTION_OBJECT_POINTERS SectionObjectPointers
Definition: ntfs.h:502
UCHAR MinorVersion
Definition: ntfs.h:81
USHORT EndSector
Definition: ntfs.h:59
ULONG Size
Definition: ntfs.h:96
PFILE_OBJECT FileObject
Definition: ntfs.h:474
NTSTATUS NtfsFindMftRecord(PDEVICE_EXTENSION Vcb, ULONGLONG MFTIndex, PUNICODE_STRING FileName, PULONG FirstEntry, BOOLEAN DirSearch, BOOLEAN CaseSensitive, ULONGLONG *OutMFTIndex)
Definition: mft.c:3090
ULONG BytesPerCluster
Definition: ntfs.h:69
UCHAR Jump[3]
Definition: ntfs.h:54
ULONGLONG FileReferenceNumber
Definition: ntfs.h:337
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
PNTFS_FCB NtfsOpenRootFCB(PNTFS_VCB Vcb)
Definition: fcb.c:363
_Inout_opt_ PUNICODE_STRING _Inout_opt_ PUNICODE_STRING Stream
Definition: fltkernel.h:1092
struct _NTFS_INFO * PNTFS_INFO
NTSTATUS NtfsAllocateClusters(PDEVICE_EXTENSION DeviceExt, ULONG FirstDesiredCluster, ULONG DesiredClusters, PULONG FirstAssignedCluster, PULONG AssignedClusters)
Definition: volinfo.c:105
struct INDEX_ENTRY_ATTRIBUTE * PINDEX_ENTRY_ATTRIBUTE
NTSTATUS NtfsQueryVolumeInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: volinfo.c:343
NTSTATUS UpdateMftMirror(PNTFS_VCB Vcb)
Definition: mft.c:2658
LARGE_MCB DataRunsMCB
Definition: ntfs.h:487
ULONGLONG ChangeTime
Definition: ntfs.h:316
NTFSIDENTIFIER Identifier
Definition: ntfs.h:101
NTSTATUS NtfsSetVolumeInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: volinfo.c:420
NTSTATUS NtfsWrite(PNTFS_IRP_CONTEXT IrpContext)
Definition: rw.c:530
VOID NtfsDumpFileAttributes(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: attrib.c:1747
VOID NtfsReleaseFCB(PNTFS_VCB Vcb, PNTFS_FCB Fcb)
Definition: fcb.c:171
UCHAR NameType
Definition: ntfs.h:363
Definition: dlist.c:348
BOOLEAN HasValidVCN
Definition: ntfs.h:432
IN BOOLEAN Wait
Definition: fatprocs.h:1529
Definition: fci.c:126
struct _BOOT_SECTOR BOOT_SECTOR
USHORT SectorsPerTrack
Definition: ntfs.h:32
USHORT PackedEaSize
Definition: ntfs.h:357