ReactOS 0.4.15-dev-5672-gf73ac17
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#define NTFS_MFT_MASK 0x0000FFFFFFFFFFFFULL
69
70#include <pshpack1.h>
71typedef struct
72{
73 UCHAR JumpBoot[3]; // Jump to the boot loader routine
74 CHAR SystemId[8]; // System Id ("NTFS ")
75 USHORT BytesPerSector; // Bytes per sector
76 UCHAR SectorsPerCluster; // Number of sectors in a cluster
77 UCHAR Unused1[7];
78 UCHAR MediaDescriptor; // Media descriptor byte
79 UCHAR Unused2[2];
80 USHORT SectorsPerTrack; // Number of sectors in a track
81 USHORT NumberOfHeads; // Number of heads on the disk
82 UCHAR Unused3[8];
83 UCHAR DriveNumber; // Int 0x13 drive number (e.g. 0x80)
85 UCHAR BootSignature; // Extended boot signature (0x80)
87 ULONGLONG VolumeSectorCount; // Number of sectors in the volume
90 CHAR ClustersPerMftRecord; // Clusters per MFT Record
91 UCHAR Unused5[3];
92 CHAR ClustersPerIndexRecord; // Clusters per Index Record
93 UCHAR Unused6[3];
94 ULONGLONG VolumeSerialNumber; // Volume serial number
95 UCHAR BootCodeAndData[430]; // The remainder of the boot sector
98
99typedef struct
100{
102 USHORT USAOffset; // Offset to the Update Sequence Array from the start of the ntfs record
105
106typedef struct
107{
109 USHORT USAOffset; // Offset to the Update Sequence Array from the start of the ntfs record
116 ULONG BytesInUse; // Number of bytes used in this mft record.
120 USHORT Padding; // Align to 4 UCHAR boundary (NTFS 3.1+ (Windows XP and above))
121 ULONG MFTRecordNumber; // Number of this MFT Record (NTFS 3.1+ (Windows XP and above))
123
124typedef struct
125{
133 union
134 {
135 // Resident attributes
136 struct
137 {
142 } Resident;
143 // Non-resident attributes
144 struct
145 {
150 UCHAR Reserved[4];
155 } NonResident;
156 };
158
159typedef struct
160{
167
168typedef struct
169{
177
178typedef struct
179{
194
195typedef struct
196{
206
207typedef struct
208{
209 union
210 {
211 struct
212 {
215 struct
216 {
220 } ViewIndex;
228#include <poppack.h>
229
230typedef struct
231{
240
242
243#include <pshpack1.h>
244typedef struct
245{
250#include <poppack.h>
251
struct NTFS_ATTR_RECORD * PNTFS_ATTR_RECORD
struct NTFS_INDEX_ENTRY * PNTFS_INDEX_ENTRY
struct NTFS_INDEX_HEADER * PNTFS_INDEX_HEADER
struct NTFS_ATTR_CONTEXT * PNTFS_ATTR_CONTEXT
struct NTFS_RECORD * PNTFS_RECORD
struct NTFS_FILE_NAME_ATTR * PNTFS_FILE_NAME_ATTR
struct NTFS_BOOTSECTOR * PNTFS_BOOTSECTOR
struct NTFS_FILE_HANDLE * PNTFS_FILE_HANDLE
struct NTFS_MFT_RECORD * PNTFS_MFT_RECORD
struct NTFS_ATTR_LIST_ATTR * PNTFS_ATTR_LIST_ATTR
struct _NTFS_VOLUME_INFO * PNTFS_VOLUME_INFO
Definition: ntfs.h:241
struct NTFS_INDEX_ROOT * PNTFS_INDEX_ROOT
const DEVVTBL * NtfsMount(ULONG DeviceId)
Definition: ntfs.c:881
unsigned short USHORT
Definition: pedump.c:61
base for all directory entries
Definition: entries.h:138
ULONGLONG CacheRunLength
Definition: ntfs.h:235
LONGLONG CacheRunStartLCN
Definition: ntfs.h:234
ULONGLONG CacheRunCurrentOffset
Definition: ntfs.h:237
PUCHAR CacheRun
Definition: ntfs.h:232
ULONGLONG CacheRunOffset
Definition: ntfs.h:233
LONGLONG CacheRunLastLCN
Definition: ntfs.h:236
NTFS_ATTR_RECORD Record
Definition: ntfs.h:238
UCHAR NameOffset
Definition: ntfs.h:200
ULONGLONG BaseFileRef
Definition: ntfs.h:202
USHORT AttrId
Definition: ntfs.h:203
USHORT RecLength
Definition: ntfs.h:198
UCHAR NameLength
Definition: ntfs.h:199
ULONGLONG StartingVCN
Definition: ntfs.h:201
USHORT Flags
Definition: ntfs.h:131
USHORT CompressionUnit
Definition: ntfs.h:149
LONGLONG AllocatedSize
Definition: ntfs.h:151
ULONG ValueLength
Definition: ntfs.h:138
USHORT ValueOffset
Definition: ntfs.h:139
UCHAR Reserved
Definition: ntfs.h:141
ULONG Length
Definition: ntfs.h:127
LONGLONG CompressedSize
Definition: ntfs.h:154
USHORT MappingPairsOffset
Definition: ntfs.h:148
USHORT NameOffset
Definition: ntfs.h:130
USHORT Instance
Definition: ntfs.h:132
LONGLONG InitializedSize
Definition: ntfs.h:153
ULONGLONG LowestVCN
Definition: ntfs.h:146
UCHAR NameLength
Definition: ntfs.h:129
UCHAR IsNonResident
Definition: ntfs.h:128
ULONGLONG HighestVCN
Definition: ntfs.h:147
UCHAR Flags
Definition: ntfs.h:140
ULONG Type
Definition: ntfs.h:126
LONGLONG DataSize
Definition: ntfs.h:152
UCHAR DriveNumber
Definition: ntfs.h:83
UCHAR CurrentHead
Definition: ntfs.h:84
UCHAR BootSignature
Definition: ntfs.h:85
ULONGLONG VolumeSectorCount
Definition: ntfs.h:87
ULONGLONG VolumeSerialNumber
Definition: ntfs.h:94
USHORT BytesPerSector
Definition: ntfs.h:75
ULONGLONG MftLocation
Definition: ntfs.h:88
ULONGLONG MftMirrorLocation
Definition: ntfs.h:89
CHAR ClustersPerIndexRecord
Definition: ntfs.h:92
UCHAR SectorsPerCluster
Definition: ntfs.h:76
USHORT NumberOfHeads
Definition: ntfs.h:81
CHAR ClustersPerMftRecord
Definition: ntfs.h:90
USHORT BootSectorMagic
Definition: ntfs.h:96
USHORT SectorsPerTrack
Definition: ntfs.h:80
UCHAR MediaDescriptor
Definition: ntfs.h:78
UCHAR Unused4
Definition: ntfs.h:86
PNTFS_VOLUME_INFO Volume
Definition: ntfs.h:248
ULONGLONG Offset
Definition: ntfs.h:247
PNTFS_ATTR_CONTEXT DataContext
Definition: ntfs.h:246
LONGLONG DataSize
Definition: ntfs.h:186
LONGLONG LastAccessTime
Definition: ntfs.h:184
UCHAR FileNameLength
Definition: ntfs.h:190
LONGLONG CreationTime
Definition: ntfs.h:181
ULONGLONG ParentDirectory
Definition: ntfs.h:180
ULONG FileAttributes
Definition: ntfs.h:187
USHORT Reserved
Definition: ntfs.h:189
USHORT PackedExtendedAttributeSize
Definition: ntfs.h:188
LONGLONG LastDataChangeTime
Definition: ntfs.h:182
UCHAR FileNameType
Definition: ntfs.h:191
LONGLONG LastMftChangeTime
Definition: ntfs.h:183
LONGLONG AllocatedSize
Definition: ntfs.h:185
Definition: ntfs.h:208
USHORT DataOffset
Definition: ntfs.h:217
NTFS_FILE_NAME_ATTR FileName
Definition: ntfs.h:226
USHORT Reserved
Definition: ntfs.h:225
USHORT Flags
Definition: ntfs.h:224
USHORT KeyLength
Definition: ntfs.h:223
USHORT DataLength
Definition: ntfs.h:218
ULONGLONG IndexedFile
Definition: ntfs.h:213
USHORT Length
Definition: ntfs.h:222
ULONG Reserved
Definition: ntfs.h:219
ULONG IndexLength
Definition: ntfs.h:162
UCHAR Flags
Definition: ntfs.h:164
ULONG AllocatedSize
Definition: ntfs.h:163
ULONG EntriesOffset
Definition: ntfs.h:161
NTFS_INDEX_HEADER IndexHeader
Definition: ntfs.h:175
ULONG IndexBlockSize
Definition: ntfs.h:172
ULONG Type
Definition: ntfs.h:170
UCHAR ClustersPerIndexBlock
Definition: ntfs.h:173
ULONG CollationRule
Definition: ntfs.h:171
USHORT USAOffset
Definition: ntfs.h:109
ULONG Magic
Definition: ntfs.h:108
USHORT NextAttributeInstance
Definition: ntfs.h:119
ULONGLONG LogSequenceNumber
Definition: ntfs.h:111
ULONG BytesAllocated
Definition: ntfs.h:117
USHORT Flags
Definition: ntfs.h:115
USHORT LinkCount
Definition: ntfs.h:113
USHORT Padding
Definition: ntfs.h:120
USHORT AttributesOffset
Definition: ntfs.h:114
USHORT SequenceNumber
Definition: ntfs.h:112
USHORT USACount
Definition: ntfs.h:110
ULONG MFTRecordNumber
Definition: ntfs.h:121
ULONGLONG BaseMFTRecord
Definition: ntfs.h:118
ULONG BytesInUse
Definition: ntfs.h:116
ULONG Magic
Definition: ntfs.h:101
USHORT USACount
Definition: ntfs.h:103
USHORT USAOffset
Definition: ntfs.h:102
ULONG DeviceId
Definition: ntfs.c:51
Definition: fs.h:25
int64_t LONGLONG
Definition: typedefs.h:68
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175