ReactOS  0.4.14-dev-384-g5b37caa
ntfs.h
Go to the documentation of this file.
1 /*
2  * FreeLoader NTFS support
3  * Copyright (C) 2004 Filip Navara <xnavara@volny.cz>
4  * Copyright (C) 2011 Pierre Schweitzer <pierre.schweitzer@reactos.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
23 #define NTFS_FILE_MFT 0
24 #define NTFS_FILE_MFTMIRR 1
25 #define NTFS_FILE_LOGFILE 2
26 #define NTFS_FILE_VOLUME 3
27 #define NTFS_FILE_ATTRDEF 4
28 #define NTFS_FILE_ROOT 5
29 #define NTFS_FILE_BITMAP 6
30 #define NTFS_FILE_BOOT 7
31 #define NTFS_FILE_BADCLUS 8
32 #define NTFS_FILE_QUOTA 9
33 #define NTFS_FILE_UPCASE 10
34 #define NTFS_FILE_EXTEND 11
35 
36 #define NTFS_ATTR_TYPE_STANDARD_INFORMATION 0x10
37 #define NTFS_ATTR_TYPE_ATTRIBUTE_LIST 0x20
38 #define NTFS_ATTR_TYPE_FILENAME 0x30
39 #define NTFS_ATTR_TYPE_OBJECT_ID 0x40
40 #define NTFS_ATTR_TYPE_SECURITY_DESCRIPTOR 0x50
41 #define NTFS_ATTR_TYPE_VOLUME_NAME 0x60
42 #define NTFS_ATTR_TYPE_VOLUME_INFORMATION 0x70
43 #define NTFS_ATTR_TYPE_DATA 0x80
44 #define NTFS_ATTR_TYPE_INDEX_ROOT 0x90
45 #define NTFS_ATTR_TYPE_INDEX_ALLOCATION 0xa0
46 #define NTFS_ATTR_TYPE_BITMAP 0xb0
47 #define NTFS_ATTR_TYPE_REPARSE_POINT 0xc0
48 #define NTFS_ATTR_TYPE_EA_INFORMATION 0xd0
49 #define NTFS_ATTR_TYPE_EA 0xe0
50 #define NTFS_ATTR_TYPE_END 0xffffffff
51 
52 #define NTFS_ATTR_NORMAL 0
53 #define NTFS_ATTR_COMPRESSED 1
54 #define NTFS_ATTR_RESIDENT 2
55 #define NTFS_ATTR_ENCRYPTED 0x4000
56 
57 #define NTFS_SMALL_INDEX 0
58 #define NTFS_LARGE_INDEX 1
59 
60 #define NTFS_INDEX_ENTRY_NODE 1
61 #define NTFS_INDEX_ENTRY_END 2
62 
63 #define NTFS_FILE_NAME_POSIX 0
64 #define NTFS_FILE_NAME_WIN32 1
65 #define NTFS_FILE_NAME_DOS 2
66 #define NTFS_FILE_NAME_WIN32_AND_DOS 3
67 
68 #include <pshpack1.h>
69 typedef struct
70 {
71  UCHAR JumpBoot[3]; // Jump to the boot loader routine
72  CHAR SystemId[8]; // System Id ("NTFS ")
73  USHORT BytesPerSector; // Bytes per sector
74  UCHAR SectorsPerCluster; // Number of sectors in a cluster
75  UCHAR Unused1[7];
76  UCHAR MediaDescriptor; // Media descriptor byte
77  UCHAR Unused2[2];
78  USHORT SectorsPerTrack; // Number of sectors in a track
79  USHORT NumberOfHeads; // Number of heads on the disk
80  UCHAR Unused3[8];
81  UCHAR DriveNumber; // Int 0x13 drive number (e.g. 0x80)
83  UCHAR BootSignature; // Extended boot signature (0x80)
85  ULONGLONG VolumeSectorCount; // Number of sectors in the volume
88  CHAR ClustersPerMftRecord; // Clusters per MFT Record
89  UCHAR Unused5[3];
90  CHAR ClustersPerIndexRecord; // Clusters per Index Record
91  UCHAR Unused6[3];
92  ULONGLONG VolumeSerialNumber; // Volume serial number
93  UCHAR BootCodeAndData[430]; // The remainder of the boot sector
96 
97 typedef struct
98 {
100  USHORT USAOffset; // Offset to the Update Sequence Array from the start of the ntfs record
103 
104 typedef struct
105 {
107  USHORT USAOffset; // Offset to the Update Sequence Array from the start of the ntfs record
114  ULONG BytesInUse; // Number of bytes used in this mft record.
119 
120 typedef struct
121 {
129  union
130  {
131  // Resident attributes
132  struct
133  {
138  } Resident;
139  // Non-resident attributes
140  struct
141  {
146  UCHAR Reserved[4];
151  } NonResident;
152  };
154 
155 typedef struct
156 {
163 
164 typedef struct
165 {
173 
174 typedef struct
175 {
190 
191 typedef struct
192 {
202 
203 typedef struct
204 {
205  union
206  {
207  struct
208  {
210  } Directory;
211  struct
212  {
216  } ViewIndex;
217  } Data;
224 #include <poppack.h>
225 
226 typedef struct
227 {
236 
238 
239 #include <pshpack1.h>
240 typedef struct
241 {
246 #include <poppack.h>
247 
USHORT Flags
Definition: ntfs.h:113
UCHAR NameOffset
Definition: ntfs.h:196
LONGLONG AllocatedSize
Definition: ntfs.h:147
UCHAR Flags
Definition: ntfs.h:160
USHORT USAOffset
Definition: ntfs.h:100
UCHAR SectorsPerCluster
Definition: ntfs.h:74
UCHAR FileNameType
Definition: ntfs.h:187
ULONG AllocatedSize
Definition: ntfs.h:159
ULONGLONG LogSequenceNumber
Definition: ntfs.h:109
struct NTFS_MFT_RECORD * PNTFS_MFT_RECORD
LONGLONG LastDataChangeTime
Definition: ntfs.h:178
USHORT NameOffset
Definition: ntfs.h:126
ULONGLONG LowestVCN
Definition: ntfs.h:142
USHORT NextAttributeInstance
Definition: ntfs.h:117
struct NTFS_ATTR_RECORD * PNTFS_ATTR_RECORD
NTFS_INDEX_HEADER IndexHeader
Definition: ntfs.h:171
USHORT KeyLength
Definition: ntfs.h:219
PNTFS_VOLUME_INFO Volume
Definition: ntfs.h:244
USHORT MappingPairsOffset
Definition: ntfs.h:144
UCHAR Flags
Definition: ntfs.h:136
unsigned char * PUCHAR
Definition: retypes.h:3
char CHAR
Definition: xmlstorage.h:175
struct NTFS_ATTR_CONTEXT * PNTFS_ATTR_CONTEXT
ULONGLONG MftLocation
Definition: ntfs.h:86
NTFS_ATTR_RECORD Record
Definition: ntfs.h:234
LONGLONG CreationTime
Definition: ntfs.h:177
Definition: fs.h:24
USHORT AttributesOffset
Definition: ntfs.h:112
ULONGLONG CacheRunOffset
Definition: ntfs.h:229
ULONG Type
Definition: ntfs.h:122
ULONG EntriesOffset
Definition: ntfs.h:157
uint16_t * PWCHAR
Definition: typedefs.h:54
ULONGLONG HighestVCN
Definition: ntfs.h:143
LONGLONG CacheRunStartLCN
Definition: ntfs.h:230
ULONGLONG BaseMFTRecord
Definition: ntfs.h:116
PNTFS_ATTR_CONTEXT DataContext
Definition: ntfs.h:242
USHORT CompressionUnit
Definition: ntfs.h:145
NTFS_FILE_NAME_ATTR FileName
Definition: ntfs.h:222
LONGLONG InitializedSize
Definition: ntfs.h:149
struct NTFS_INDEX_HEADER * PNTFS_INDEX_HEADER
const DEVVTBL * NtfsMount(ULONG DeviceId)
Definition: ntfs.c:881
ULONGLONG IndexedFile
Definition: ntfs.h:209
struct NTFS_FILE_NAME_ATTR * PNTFS_FILE_NAME_ATTR
USHORT AttrId
Definition: ntfs.h:199
struct NTFS_ATTR_LIST_ATTR * PNTFS_ATTR_LIST_ATTR
USHORT Reserved
Definition: ntfs.h:221
USHORT USACount
Definition: ntfs.h:101
struct NTFS_RECORD * PNTFS_RECORD
ULONG Length
Definition: ntfs.h:123
ULONGLONG MftMirrorLocation
Definition: ntfs.h:87
LONGLONG AllocatedSize
Definition: ntfs.h:181
USHORT Instance
Definition: ntfs.h:128
ULONG CollationRule
Definition: ntfs.h:167
USHORT SequenceNumber
Definition: ntfs.h:110
ULONG BytesInUse
Definition: ntfs.h:114
USHORT LinkCount
Definition: ntfs.h:111
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
USHORT USAOffset
Definition: ntfs.h:107
USHORT DataOffset
Definition: ntfs.h:213
ULONG FileAttributes
Definition: ntfs.h:183
UCHAR MediaDescriptor
Definition: ntfs.h:76
ULONGLONG CacheRunCurrentOffset
Definition: ntfs.h:233
struct NTFS_FILE_HANDLE * PNTFS_FILE_HANDLE
ULONG IndexLength
Definition: ntfs.h:158
int64_t LONGLONG
Definition: typedefs.h:66
ULONGLONG BaseFileRef
Definition: ntfs.h:198
USHORT Flags
Definition: ntfs.h:220
USHORT PackedExtendedAttributeSize
Definition: ntfs.h:184
ULONGLONG VolumeSerialNumber
Definition: ntfs.h:92
struct NTFS_INDEX_ROOT * PNTFS_INDEX_ROOT
LONGLONG CompressedSize
Definition: ntfs.h:150
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONGLONG DataSize
Definition: ntfs.h:182
uint64_t ULONGLONG
Definition: typedefs.h:65
LONGLONG CacheRunLastLCN
Definition: ntfs.h:232
USHORT DataLength
Definition: ntfs.h:214
ULONGLONG Offset
Definition: ntfs.h:243
struct _NTFS_ATTR_CONTEXT NTFS_ATTR_CONTEXT
ULONG Type
Definition: ntfs.h:166
UCHAR NameLength
Definition: ntfs.h:195
USHORT RecLength
Definition: ntfs.h:194
LONGLONG LastAccessTime
Definition: ntfs.h:180
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR DriveNumber
Definition: ntfs.h:81
LONGLONG LastMftChangeTime
Definition: ntfs.h:179
Definition: ntfs.h:203
UCHAR BootSignature
Definition: ntfs.h:83
UCHAR IsNonResident
Definition: ntfs.h:124
USHORT ValueOffset
Definition: ntfs.h:135
ULONGLONG ParentDirectory
Definition: ntfs.h:176
CHAR ClustersPerIndexRecord
Definition: ntfs.h:90
USHORT BootSectorMagic
Definition: ntfs.h:94
ULONG ValueLength
Definition: ntfs.h:134
LONGLONG DataSize
Definition: ntfs.h:148
UCHAR NameLength
Definition: ntfs.h:125
unsigned short USHORT
Definition: pedump.c:61
UCHAR ClustersPerIndexBlock
Definition: ntfs.h:169
USHORT BytesPerSector
Definition: ntfs.h:73
USHORT Flags
Definition: ntfs.h:127
ULONG Reserved
Definition: ntfs.h:215
PUCHAR CacheRun
Definition: ntfs.h:228
ULONG BytesAllocated
Definition: ntfs.h:115
USHORT USACount
Definition: ntfs.h:108
USHORT SectorsPerTrack
Definition: ntfs.h:78
struct _NTFS_VOLUME_INFO * PNTFS_VOLUME_INFO
Definition: ntfs.h:237
struct NTFS_BOOTSECTOR * PNTFS_BOOTSECTOR
UCHAR CurrentHead
Definition: ntfs.h:82
UCHAR Unused4
Definition: ntfs.h:84
ULONGLONG VolumeSectorCount
Definition: ntfs.h:85
ULONG DeviceId
Definition: ntfs.c:51
CHAR ClustersPerMftRecord
Definition: ntfs.h:88
unsigned int ULONG
Definition: retypes.h:1
ULONG Magic
Definition: ntfs.h:99
ULONGLONG StartingVCN
Definition: ntfs.h:197
ULONG Magic
Definition: ntfs.h:106
UCHAR Reserved
Definition: ntfs.h:137
struct NTFS_INDEX_ENTRY * PNTFS_INDEX_ENTRY
UCHAR FileNameLength
Definition: ntfs.h:186
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3734
ULONGLONG CacheRunLength
Definition: ntfs.h:231
USHORT Length
Definition: ntfs.h:218
USHORT NumberOfHeads
Definition: ntfs.h:79
USHORT Reserved
Definition: ntfs.h:185
ULONG IndexBlockSize
Definition: ntfs.h:168
CHAR SystemId[32]
Definition: iso.h:65