3 * By John Hodge (thePowersGang)
4 * This file is published under the terms of the Acess licence. See the
5 * file COPYING for details.
7 * common.h - Common Types and Definitions
17 * In-memory representation of an NTFS Disk
19 typedef struct sNTFS_Disk
30 typedef struct sNTFS_BootSector
34 Uint8 SystemID[8]; // = "NTFS "
35 Uint16 BytesPerSector;
36 Uint8 SectorsPerCluster;
40 Uint8 MediaDescriptor;
42 Uint16 SectorsPerTrack;
48 Uint64 TotalSectorCount; // Size of volume in sectors
49 Uint64 MFTStart; // Logical Cluster Number of Cluster 0 of MFT
50 Uint64 MFTMirrorStart; // Logical Cluster Number of Cluster 0 of MFT Backup
53 // If either of these are -ve, the size can be obtained via
54 // SizeInBytes = 2^(-1 * Value)
55 Uint32 ClustersPerMFTRecord;
56 Uint32 ClustersPerIndexRecord;
60 Uint8 Padding[512-72];
62 } PACKED tNTFS_BootSector;
65 * FILE header, an entry in the MFT
67 typedef struct sNTFS_FILE_Header
69 Uint32 Magic; // 'FILE'
70 Uint16 UpdateSequenceOfs;
71 Uint16 UpdateSequenceSize; // Size in words of the UpdateSequenceArray
73 Uint64 LSN; // $LogFile Sequence Number
75 Uint16 SequenceNumber;
77 Uint16 FirstAttribOfs; // Size of header?
78 Uint16 Flags; // 0: In Use, 1: Directory
80 Uint32 RecordSize; // Real Size of FILE Record
81 Uint32 RecordSpace; // Allocated Size for FILE Record
84 * Base address of the MFT containing this record
86 Uint64 Reference; // "File reference to the base FILE record" ???
94 Uint16 RecordNumber; // Number of this MFT Record
95 Uint16 UpdateSequenceNumber;
96 Uint16 UpdateSequenceArray[];
99 Uint16 UpdateSequenceNumber;
100 Uint16 UpdateSequenceArray[];
104 } PACKED tNTFS_FILE_Header;
107 * File Attribute, follows the FILE header
109 typedef struct sNTFS_FILE_Attrib
111 Uint32 Type; // See eNTFS_FILE_Attribs
112 Uint32 Size; // Includes header
114 Uint8 ResidentFlag; // (What does this mean?)
117 Uint16 Flags; // 0: Compressed, 14: Encrypted, 15: Sparse
123 Uint32 AttribLen; // In words
128 Uint16 Name[]; // UTF-16
135 Uint16 CompressionUnitSize;
137 Uint64 AllocatedSize;
139 Uint64 InitiatedSize; // One assumes, ammount of actual data stored
140 Uint16 Name[]; // UTF-16
144 } PACKED tNTFS_FILE_Attrib;