OpenCore  1.0.6
OpenCore Bootloader
Loading...
Searching...
No Matches
Driver.h
Go to the documentation of this file.
1
9#ifndef DRIVER_H
10#define DRIVER_H
11
12#define NTFS_MAX_MFT 4096
13#define NTFS_MAX_IDX 16384
14#define COMPRESSION_BLOCK 4096
15#define NTFS_DRIVER_VERSION 0x00020000
16#define MAX_PATH 1024
17#define MINIMUM_INFO_LENGTH (sizeof (EFI_FILE_INFO) + MAX_PATH * sizeof(CHAR16))
18#define MINIMUM_FS_INFO_LENGTH (sizeof (EFI_FILE_SYSTEM_INFO) + MAX_PATH * sizeof(CHAR16))
19#define ATTRIBUTES_END_MARKER 0xFFFFFFFF
20#define MAX_FILE_SIZE (MAX_UINT32 & ~7ULL)
21#define S_FILENAME 0x3
22#define S_SYMLINK 0xC
23
113enum {
121 AT_DATA = 0x80,
124 AT_BITMAP = 0xB0,
127 AT_EA = 0xE0,
129};
130
134enum {
142 ATTR_SPARSE = 0x200,
145 ATTR_OFFLINE = 0x1000,
148 ATTR_DIRECTORY = 0x10000000,
149 ATTR_INDEX_VIEW = 0x20000000
151
155enum {
167};
168
169enum {
173};
174
178enum {
181 FLAG_SPARSE = 0x8000
183
187enum {
188 IS_IN_USE = 0x01,
192
197};
198
202enum {
203 SUB_NODE = 0x01,
205};
206
210enum {
211 POSIX = 0,
213 DOS = 2,
215};
216
220enum {
221 IS_ALIAS = 0x20000000,
222 IS_HIGH_LATENCY = 0x40000000,
223 IS_MICROSOFT = 0x80000000,
224 NSS = 0x68000005,
225 NSS_RECOVER = 0x68000006,
226 SIS = 0x68000007,
227 DFS = 0x68000008,
228 MOUNT_POINT = 0x88000003,
229 HSM = 0xA8000004,
230 SYMBOLIC_LINK = 0xE8000000,
231};
232
233#pragma pack(1)
234
270
291typedef struct {
292 UINT32 Type;
293 UINT32 Length;
297 UINT16 Flags;
302 UINT8 Padding;
304
346
363typedef struct {
364 UINT32 Type;
372
401typedef struct {
402 UINT8 FileRecordNumber[6];
406 UINT8 Flags;
407 UINT8 Padding[3];
409
433typedef struct {
434 UINT32 Magic;
436 UINT16 S_Size;
437 UINT64 LSN;
440
449
474typedef struct {
475 UINT32 Type;
479 UINT8 Padding[3];
480} INDEX_ROOT;
481
482typedef struct {
487 UINT8 Flags;
488 UINT8 Padding[3];
490
511typedef struct {
512 UINT64 ParentDir;
516 UINT64 ReadTime;
518 UINT64 RealSize;
519 UINT32 Flags;
520 UINT32 Reparse;
524
551typedef struct {
552 UINT8 BootLoaderJump[3];
553 UINT32 SystemId[2];
556 UINT8 Unused1[7];
558 UINT16 Unused2;
561 UINT64 Unused3;
562 UINT32 Usually;
564 UINT64 MftLcn;
567 UINT8 Unused4[3];
569 UINT8 Unused5[3];
572
596typedef struct {
597 UINT32 Type;
599 UINT16 Padding;
604} SYMLINK;
605#pragma pack()
606
607typedef struct _NTFS_FILE NTFS_FILE;
609typedef struct _EFI_FS EFI_FS;
610
611typedef struct {
612 INT32 Flags;
615 UINT8 *Current;
616 UINT8 *Next;
617 UINT8 *Last;
619} NTFS_ATTR;
620
632
633typedef struct _EFI_NTFS_FILE {
634 EFI_FILE_PROTOCOL EfiFile;
635 BOOLEAN IsDir;
636 UINT64 DirIndex;
637 CHAR16 *Path;
638 CHAR16 *BaseName;
639 UINT64 Offset;
640 UINT32 RefCount;
645
646typedef struct _EFI_FS {
647 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL FileIoInterface;
648 EFI_FILE_PROTOCOL EfiFile;
649 EFI_BLOCK_IO_PROTOCOL *BlockIo;
650 EFI_DISK_IO_PROTOCOL *DiskIo;
651 EFI_DEVICE_PATH *DevicePath;
659
660 //
661 // CFI = Cache for FileInfo
662 //
664 VOID *CFIData;
665 UINT64 CFIHash;
667} EFI_FS;
668
669typedef struct {
670 UINT64 Vcn;
671 UINT64 Lcn;
673
674typedef struct {
676 UINT8 Head;
677 UINT8 Tail;
678 UNIT_ELEMENT Elements[16];
680 UINT8 *Cluster;
684} COMPRESSED;
685
686typedef struct {
687 BOOLEAN IsSparse;
688 UINT64 TargetVcn;
691 UINT64 NextVcn;
695} RUNLIST;
696
697#endif // DRIVER_H
@ IS_A_SPECIAL
Definition Driver.h:191
@ IS_IN_USE
Definition Driver.h:188
@ IS_A_DIRECTORY
Definition Driver.h:189
@ IS_AN_EXTENSION
Definition Driver.h:190
@ IS_SUPPORTED_FLAGS
Definition Driver.h:193
@ POSIX
Definition Driver.h:211
@ WINDOWS32
Definition Driver.h:212
@ DOS
Definition Driver.h:213
@ WIN32_DOS
Definition Driver.h:214
@ ATTR_SYSTEM
Definition Driver.h:137
@ ATTR_TEMPORARY
Definition Driver.h:141
@ ATTR_COMPRESSED
Definition Driver.h:144
@ ATTR_INDEX_VIEW
Definition Driver.h:149
@ ATTR_NORMAL
Definition Driver.h:140
@ ATTR_REPARSE
Definition Driver.h:143
@ ATTR_DEVICE
Definition Driver.h:139
@ ATTR_OFFLINE
Definition Driver.h:145
@ ATTR_ENCRYPTED
Definition Driver.h:147
@ ATTR_READ_ONLY
Definition Driver.h:135
@ ATTR_SPARSE
Definition Driver.h:142
@ ATTR_DIRECTORY
Definition Driver.h:148
@ ATTR_HIDDEN
Definition Driver.h:136
@ ATTR_ARCHIVE
Definition Driver.h:138
@ ATTR_NOT_INDEXED
Definition Driver.h:146
@ NTFS_AF_MFT_FILE
Definition Driver.h:171
@ NTFS_AF_ALST
Definition Driver.h:170
@ NTFS_AF_GPOS
Definition Driver.h:172
@ LAST_INDEX_ENTRY
Definition Driver.h:204
@ SUB_NODE
Definition Driver.h:203
@ AT_VOLUME_VERSION
Definition Driver.h:117
@ AT_INDEX_ROOT
Definition Driver.h:122
@ AT_EA
Definition Driver.h:127
@ AT_PROPERTY_SET
Definition Driver.h:128
@ AT_INDEX_ALLOCATION
Definition Driver.h:123
@ AT_VOLUME_INFORMATION
Definition Driver.h:120
@ AT_STANDARD_INFORMATION
Definition Driver.h:114
@ AT_BITMAP
Definition Driver.h:124
@ AT_SYMLINK
Definition Driver.h:125
@ AT_FILENAME
Definition Driver.h:116
@ AT_ATTRIBUTE_LIST
Definition Driver.h:115
@ AT_VOLUME_NAME
Definition Driver.h:119
@ AT_SECURITY_DESCRIPTOR
Definition Driver.h:118
@ AT_EA_INFORMATION
Definition Driver.h:126
@ AT_DATA
Definition Driver.h:121
struct _NTFS_FILE NTFS_FILE
Definition Driver.h:607
struct _EFI_FS EFI_FS
Definition Driver.h:609
@ ROOT_FILE
Definition Driver.h:161
@ BADCLUS_FILE
Definition Driver.h:164
@ ATTRDEF_FILE
Definition Driver.h:160
@ QUOTA_FILE
Definition Driver.h:165
@ BOOT_FILE
Definition Driver.h:163
@ LOGFILE_FILE
Definition Driver.h:158
@ BITMAP_FILE
Definition Driver.h:162
@ MFTMIRR_FILE
Definition Driver.h:157
@ VOLUME_FILE
Definition Driver.h:159
@ UPCASE_FILE
Definition Driver.h:166
@ MFT_FILE
Definition Driver.h:156
struct _EFI_NTFS_FILE EFI_NTFS_FILE
Definition Driver.h:608
@ MOUNT_POINT
Definition Driver.h:228
@ IS_MICROSOFT
Definition Driver.h:223
@ IS_ALIAS
Definition Driver.h:221
@ DFS
Definition Driver.h:227
@ NSS_RECOVER
Definition Driver.h:225
@ SYMBOLIC_LINK
Definition Driver.h:230
@ IS_HIGH_LATENCY
Definition Driver.h:222
@ HSM
Definition Driver.h:229
@ SIS
Definition Driver.h:226
@ NSS
Definition Driver.h:224
@ FLAG_SPARSE
Definition Driver.h:181
@ FLAG_COMPRESSED
Definition Driver.h:179
@ FLAG_ENCRYPTED
Definition Driver.h:180
EFI_FILE_PROTOCOL EfiFile
Definition Driver.h:648
EFI_DISK_IO_PROTOCOL * DiskIo
Definition Driver.h:650
UINT64 CFIHash
Definition Driver.h:665
EFI_BLOCK_IO_PROTOCOL * BlockIo
Definition Driver.h:649
INT64 CFIDirIndex
Definition Driver.h:666
NTFS_FILE * RootIndex
Definition Driver.h:653
UINTN SectorSize
Definition Driver.h:657
UINTN CFIDataSize
Definition Driver.h:663
UINTN ClusterSize
Definition Driver.h:658
UINTN IndexRecordSize
Definition Driver.h:656
VOID * CFIData
Definition Driver.h:664
EFI_DEVICE_PATH * DevicePath
Definition Driver.h:651
NTFS_FILE * MftStart
Definition Driver.h:654
UINTN FileRecordSize
Definition Driver.h:655
UINT64 FirstMftRecord
Definition Driver.h:652
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL FileIoInterface
Definition Driver.h:647
NTFS_FILE RootFile
Definition Driver.h:641
UINT32 RefCount
Definition Driver.h:640
BOOLEAN IsDir
Definition Driver.h:635
CHAR16 * Path
Definition Driver.h:637
CHAR16 * BaseName
Definition Driver.h:638
EFI_FS * FileSystem
Definition Driver.h:643
UINT64 DirIndex
Definition Driver.h:636
UINT64 Offset
Definition Driver.h:639
EFI_FILE_PROTOCOL EfiFile
Definition Driver.h:634
NTFS_FILE MftFile
Definition Driver.h:642
NTFS_ATTR Attr
Definition Driver.h:629
UINT8 * FileRecord
Definition Driver.h:622
UINT64 ReadTime
Definition Driver.h:626
UINT64 CreationTime
Definition Driver.h:624
UINT64 AlteredTime
Definition Driver.h:625
UINT64 Inode
Definition Driver.h:627
EFI_NTFS_FILE * File
Definition Driver.h:630
BOOLEAN InodeRead
Definition Driver.h:628
UINT64 DataAttributeSize
Definition Driver.h:623
UINT64 AllocatedSize
Definition Driver.h:517
UINT64 CreationTime
Definition Driver.h:513
UINT64 RealSize
Definition Driver.h:518
UINT8 Namespace
Definition Driver.h:522
UINT32 Flags
Definition Driver.h:519
UINT64 AlteredTime
Definition Driver.h:514
UINT32 Reparse
Definition Driver.h:520
UINT64 ParentDir
Definition Driver.h:512
UINT8 FilenameLen
Definition Driver.h:521
UINT64 ReadTime
Definition Driver.h:516
UINT64 ChangedMftTime
Definition Driver.h:515
UINT16 NameOffset
Definition Driver.h:334
UINT16 DataRunsOffset
Definition Driver.h:339
UINT64 InitializedDataSize
Definition Driver.h:344
UINT64 AllocatedSize
Definition Driver.h:342
UINT16 AttributeId
Definition Driver.h:336
UINT16 CompressionUnitSize
Definition Driver.h:340
UINT64 StartingVCN
Definition Driver.h:337
UINT16 InfoOffset
Definition Driver.h:300
UINT32 InfoLength
Definition Driver.h:299
UINT8 Padding
Definition Driver.h:302
UINT8 NameLength
Definition Driver.h:295
UINT16 AttributeId
Definition Driver.h:298
UINT8 IndexedFlag
Definition Driver.h:301
UINT32 Type
Definition Driver.h:292
UINT32 Length
Definition Driver.h:293
UINT8 NonResFlag
Definition Driver.h:294
UINT16 Flags
Definition Driver.h:297
UINT16 NameOffset
Definition Driver.h:296
INDEX_ROOT Root
Definition Driver.h:483
UINT32 FirstEntryOffset
Definition Driver.h:484
UINT32 EntriesAllocatedSize
Definition Driver.h:486
UINT32 EntriesTotalSize
Definition Driver.h:485
UINT8 NameOffset
Definition Driver.h:367
UINT64 BaseFileReference
Definition Driver.h:369
UINT16 AttributeId
Definition Driver.h:370
UINT8 NameLength
Definition Driver.h:366
UINT16 RecordLength
Definition Driver.h:365
UINT64 StartingVCN
Definition Driver.h:368
UINT64 VolumeSectorsNumber
Definition Driver.h:563
INT8 MftRecordClusters
Definition Driver.h:566
UINT64 MftLcn
Definition Driver.h:564
UINT16 HeadsNumber
Definition Driver.h:560
UINT16 Unused2
Definition Driver.h:558
UINT16 SectorsPerTrack
Definition Driver.h:559
UINT16 BytesPerSector
Definition Driver.h:554
INT8 IndexRecordClusters
Definition Driver.h:568
UINT8 SectorsPerCluster
Definition Driver.h:555
UINT32 Usually
Definition Driver.h:562
UINT64 VolumeSerialNumber
Definition Driver.h:570
UINT64 Unused3
Definition Driver.h:561
UINT8 MediaDescriptor
Definition Driver.h:557
UINT64 MftMirrLcn
Definition Driver.h:565
UINTN ClusterOffset
Definition Driver.h:681
UINT8 * Cluster
Definition Driver.h:680
UINT64 SavedPosition
Definition Driver.h:682
UINT64 CurrentVcn
Definition Driver.h:679
UINT8 Head
Definition Driver.h:676
EFI_FS * FileSystem
Definition Driver.h:675
UINT8 Tail
Definition Driver.h:677
UINT8 * ClearTextBlock
Definition Driver.h:683
UINT16 SequenceNumber
Definition Driver.h:261
UINT32 AllocatedSize
Definition Driver.h:266
UINT16 HardLinkCount
Definition Driver.h:262
UINT16 UpdateSequenceOffset
Definition Driver.h:258
UINT16 NextAttributeId
Definition Driver.h:268
UINT64 BaseFileRecord
Definition Driver.h:267
UINT16 AttributeOffset
Definition Driver.h:263
UINT8 Flags
Definition Driver.h:406
UINT16 StreamLength
Definition Driver.h:405
UINT16 IndexEntryLength
Definition Driver.h:404
UINT16 SequenceNumber
Definition Driver.h:403
UINT32 Magic
Definition Driver.h:434
UINT16 S_Size
Definition Driver.h:436
UINT64 IndexRecordVCN
Definition Driver.h:438
UINT16 UpdateSequenceOffset
Definition Driver.h:435
UINT64 LSN
Definition Driver.h:437
INDEX_HEADER Header
Definition Driver.h:442
UINT32 IndexEntriesSize
Definition Driver.h:444
UINT32 IndexEntriesOffset
Definition Driver.h:443
UINT32 IndexEntriesAllocated
Definition Driver.h:445
UINT8 IndexRecordClusters
Definition Driver.h:478
UINT32 CollationRule
Definition Driver.h:476
UINT32 IndexAllocationSize
Definition Driver.h:477
UINT32 Type
Definition Driver.h:475
NTFS_FILE * BaseMftRecord
Definition Driver.h:618
UINT8 * Current
Definition Driver.h:615
UINT8 * Last
Definition Driver.h:617
UINT8 * NonResAttrList
Definition Driver.h:614
UINT8 * Next
Definition Driver.h:616
UINT8 * ExtensionMftRecord
Definition Driver.h:613
INT32 Flags
Definition Driver.h:612
UINT64 CurrentVcn
Definition Driver.h:689
UINT64 CurrentLcn
Definition Driver.h:690
COMPRESSED Unit
Definition Driver.h:694
BOOLEAN IsSparse
Definition Driver.h:687
NTFS_ATTR * Attr
Definition Driver.h:693
UINT64 TargetVcn
Definition Driver.h:688
UINT64 NextVcn
Definition Driver.h:691
UINT8 * NextDataRun
Definition Driver.h:692
UINT16 SubstituteOffset
Definition Driver.h:600
UINT16 DataLength
Definition Driver.h:598
UINT16 SubstituteLength
Definition Driver.h:601
UINT32 Type
Definition Driver.h:597
UINT16 PrintLength
Definition Driver.h:603
UINT16 PrintOffset
Definition Driver.h:602
UINT16 Padding
Definition Driver.h:599
UINT64 Lcn
Definition Driver.h:671
UINT64 Vcn
Definition Driver.h:670