Working on a NTFS implementation (it's only going to be RO)
[tpg/acess2.git] / Modules / Filesystems / NTFS / common.h
1 /*
2  */
3 #ifndef _COMMON_H_
4 #define _COMMON_H_
5
6 // === STRUCTURES ===
7 typedef struct sNTFS_Disk
8 {
9         
10 }       tNTFS_Disk;
11
12 typedef struct sNTFS_FILE_Header
13 {
14         Uint32  Magic;  // 'FILE'
15         Uint16  UpdateSequenceOfs;
16         Uint16  UpdateSequenceSize;     // Size in words of the UpdateSequenceArray
17         
18         Uint64  LSN;    // $LogFile Sequence Number
19         
20         Uint16  SequenceNumber;
21         Uint16  HardLinkCount;  
22         Uint16  FirstAttribOfs; // Size of header?
23         Uint16  Flags;  // 0: In Use, 1: Directory
24         
25         Uint32  RecordSize;             // Real Size of FILE Record
26         Uint32  RecordSpace;    // Allocated Size for FILE Record
27         
28         /**
29          * Base address of the MFT containing this record
30          */
31         Uint64  Reference;      // "File reference to the base FILE record" ???
32         
33         Uint16  NextAttribID;
34         union
35         {
36                 // Only in XP
37                 struct {
38                         Uint16  AlignTo4Byte;
39                         Uint16  RecordNumber;   // Number of this MFT Record
40                         Uint16  UpdateSequenceNumber;
41                         Uint16  UpdateSequenceArray[];
42                 }       XP;
43                 struct {
44                         Uint16  UpdateSequenceNumber;
45                         Uint16  UpdateSequenceArray[];
46                 }       All;
47         } OSDep;        
48         
49 }       tNTFS_FILE_Header;
50
51 typedef struct sNTFS_FILE_Attrib
52 {
53         Uint32  Type;   // See eNTFS_FILE_Attribs
54         Uint32  Size;   // Includes header
55         
56         Uint8   ResidentFlag;   // (What does this mean?)
57         Uint8   NameLength;
58         Uint16  NameOffset;
59         Uint16  Flags;  // 0: Compressed, 14: Encrypted, 15: Sparse
60         Uint16  AttributeID;
61         
62         union
63         {
64                 struct {
65                         Uint32  AttribLen;      // In words
66                         Uint16  AttribOfs;
67                         Uint8   IndexedFlag;
68                         Uint8   Padding;
69                         
70                         Uint16  Name[]; // UTF-16
71                         // Attribute Data
72                 }       Resident;
73                 struct {
74                         Uint64  StartingVCN;
75                         Uint64  LastVCN;
76                         Uint16  DataRunOfs;
77                         Uint16  CompressionUnitSize;
78                         Uint32  Padding;
79                         Uint64  AllocatedSize;
80                         Uint64  RealSize;
81                         Uint64  InitiatedSize;  // One assumes, ammount of actual data stored
82                         Uint16  Name[]; // UTF-16
83                         // Data Runs
84                 }       NonResident;
85         };
86 }       tNTFS_FILE_Attrib;
87
88 #endif

UCC git Repository :: git.ucc.asn.au