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
31 typedef struct sNTFS_BootSector
35 Uint8 SystemID[8]; // = "NTFS "
36 Uint16 BytesPerSector;
37 Uint8 SectorsPerCluster;
41 Uint8 MediaDescriptor;
43 Uint16 SectorsPerTrack;
48 Uint32 Unkown; // Usually 0x00800080 (according to Linux docs)
51 Uint64 TotalSectorCount; // Size of volume in sectors
52 Uint64 MFTStart; // Logical Cluster Number of Cluster 0 of MFT
53 Uint64 MFTMirrorStart; // Logical Cluster Number of Cluster 0 of MFT Backup
56 // If either of these are -ve, the size can be obtained via
57 // SizeInBytes = 2^(-1 * Value)
58 Sint8 ClustersPerMFTRecord;
60 Sint8 ClustersPerIndexRecord;
65 Uint8 Padding[512-0x50];
67 } PACKED tNTFS_BootSector;
70 * FILE header, an entry in the MFT
72 typedef struct sNTFS_FILE_Header
74 Uint32 Magic; // 'FILE'
75 Uint16 UpdateSequenceOfs;
76 Uint16 UpdateSequenceSize; // Size in words of the UpdateSequenceArray
78 Uint64 LSN; // $LogFile Sequence Number
80 Uint16 SequenceNumber;
82 Uint16 FirstAttribOfs; // Size of header?
83 Uint16 Flags; // 0: In Use, 1: Directory
85 Uint32 RecordSize; // Real Size of FILE Record
86 Uint32 RecordSpace; // Allocated Size for FILE Record
89 * Base address of the MFT containing this record
91 Uint64 Reference; // "File reference to the base FILE record" ???
99 Uint16 RecordNumber; // Number of this MFT Record
100 Uint16 UpdateSequenceNumber;
101 Uint16 UpdateSequenceArray[];
104 Uint16 UpdateSequenceNumber;
105 Uint16 UpdateSequenceArray[];
109 } PACKED tNTFS_FILE_Header;
112 * File Attribute, follows the FILE header
114 typedef struct sNTFS_FILE_Attrib
116 Uint32 Type; // See eNTFS_FILE_Attribs
117 Uint32 Size; // Includes header
119 Uint8 ResidentFlag; // (What does this mean?)
122 Uint16 Flags; // 0: Compressed, 14: Encrypted, 15: Sparse
128 Uint32 AttribLen; // In words
133 Uint16 Name[]; // UTF-16
140 Uint16 CompressionUnitSize;
142 Uint64 AllocatedSize;
144 Uint64 InitiatedSize; // One assumes, ammount of actual data stored
145 Uint16 Name[]; // UTF-16
149 } PACKED tNTFS_FILE_Attrib;