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;
49 Uint64 TotalSectorCount; // Size of volume in sectors
50 Uint64 MFTStart; // Logical Cluster Number of Cluster 0 of MFT
51 Uint64 MFTMirrorStart; // Logical Cluster Number of Cluster 0 of MFT Backup
54 // If either of these are -ve, the size can be obtained via
55 // SizeInBytes = 2^(-1 * Value)
56 Uint32 ClustersPerMFTRecord;
57 Uint32 ClustersPerIndexRecord;
61 Uint8 Padding[512-0x50];
63 } PACKED tNTFS_BootSector;
66 * FILE header, an entry in the MFT
68 typedef struct sNTFS_FILE_Header
70 Uint32 Magic; // 'FILE'
71 Uint16 UpdateSequenceOfs;
72 Uint16 UpdateSequenceSize; // Size in words of the UpdateSequenceArray
74 Uint64 LSN; // $LogFile Sequence Number
76 Uint16 SequenceNumber;
78 Uint16 FirstAttribOfs; // Size of header?
79 Uint16 Flags; // 0: In Use, 1: Directory
81 Uint32 RecordSize; // Real Size of FILE Record
82 Uint32 RecordSpace; // Allocated Size for FILE Record
85 * Base address of the MFT containing this record
87 Uint64 Reference; // "File reference to the base FILE record" ???
95 Uint16 RecordNumber; // Number of this MFT Record
96 Uint16 UpdateSequenceNumber;
97 Uint16 UpdateSequenceArray[];
100 Uint16 UpdateSequenceNumber;
101 Uint16 UpdateSequenceArray[];
105 } PACKED tNTFS_FILE_Header;
108 * File Attribute, follows the FILE header
110 typedef struct sNTFS_FILE_Attrib
112 Uint32 Type; // See eNTFS_FILE_Attribs
113 Uint32 Size; // Includes header
115 Uint8 ResidentFlag; // (What does this mean?)
118 Uint16 Flags; // 0: Compressed, 14: Encrypted, 15: Sparse
124 Uint32 AttribLen; // In words
129 Uint16 Name[]; // UTF-16
136 Uint16 CompressionUnitSize;
138 Uint64 AllocatedSize;
140 Uint64 InitiatedSize; // One assumes, ammount of actual data stored
141 Uint16 Name[]; // UTF-16
145 } PACKED tNTFS_FILE_Attrib;