OpenCore  1.0.4
OpenCore Bootloader
1.0.4
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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,
190};
191
195enum {
196 SUB_NODE = 0x01,
198};
199
203enum {
204 POSIX = 0,
206 DOS = 2,
208};
209
213enum {
214 IS_ALIAS = 0x20000000,
215 IS_HIGH_LATENCY = 0x40000000,
216 IS_MICROSOFT = 0x80000000,
217 NSS = 0x68000005,
218 NSS_RECOVER = 0x68000006,
219 SIS = 0x68000007,
220 DFS = 0x68000008,
221 MOUNT_POINT = 0x88000003,
222 HSM = 0xA8000004,
223 SYMBOLIC_LINK = 0xE8000000,
224};
225
226#pragma pack(1)
227
263
284typedef struct {
285 UINT32 Type;
286 UINT32 Length;
290 UINT16 Flags;
295 UINT8 Padding;
297
339
356typedef struct {
357 UINT32 Type;
365
394typedef struct {
395 UINT8 FileRecordNumber[6];
399 UINT8 Flags;
400 UINT8 Padding[3];
402
426typedef struct {
427 UINT32 Magic;
429 UINT16 S_Size;
430 UINT64 LSN;
433
442
467typedef struct {
468 UINT32 Type;
472 UINT8 Padding[3];
473} INDEX_ROOT;
474
475typedef struct {
480 UINT8 Flags;
481 UINT8 Padding[3];
483
504typedef struct {
505 UINT64 ParentDir;
509 UINT64 ReadTime;
511 UINT64 RealSize;
512 UINT32 Flags;
513 UINT32 Reparse;
517
544typedef struct {
545 UINT8 BootLoaderJump[3];
546 UINT32 SystemId[2];
549 UINT8 Unused1[7];
551 UINT16 Unused2;
554 UINT64 Unused3;
555 UINT32 Usually;
557 UINT64 MftLcn;
560 UINT8 Unused4[3];
562 UINT8 Unused5[3];
565
589typedef struct {
590 UINT32 Type;
592 UINT16 Padding;
597} SYMLINK;
598#pragma pack()
599
600typedef struct _NTFS_FILE NTFS_FILE;
602typedef struct _EFI_FS EFI_FS;
603
604typedef struct {
605 INT32 Flags;
608 UINT8 *Current;
609 UINT8 *Next;
610 UINT8 *Last;
612} NTFS_ATTR;
613
625
626typedef struct _EFI_NTFS_FILE {
627 EFI_FILE_PROTOCOL EfiFile;
628 BOOLEAN IsDir;
629 UINT64 DirIndex;
630 CHAR16 *Path;
631 CHAR16 *BaseName;
632 UINT64 Offset;
633 UINT32 RefCount;
638
639typedef struct _EFI_FS {
640 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL FileIoInterface;
641 EFI_FILE_PROTOCOL EfiFile;
642 EFI_BLOCK_IO_PROTOCOL *BlockIo;
643 EFI_DISK_IO_PROTOCOL *DiskIo;
644 EFI_DEVICE_PATH *DevicePath;
652} EFI_FS;
653
654typedef struct {
655 UINT64 Vcn;
656 UINT64 Lcn;
658
659typedef struct {
661 UINT8 Head;
662 UINT8 Tail;
663 UNIT_ELEMENT Elements[16];
665 UINT8 *Cluster;
669} COMPRESSED;
670
671typedef struct {
672 BOOLEAN IsSparse;
673 UINT64 TargetVcn;
676 UINT64 NextVcn;
680} RUNLIST;
681
682#endif // DRIVER_H
@ IS_IN_USE
Definition Driver.h:188
@ IS_A_DIRECTORY
Definition Driver.h:189
@ POSIX
Definition Driver.h:204
@ WINDOWS32
Definition Driver.h:205
@ DOS
Definition Driver.h:206
@ WIN32_DOS
Definition Driver.h:207
@ 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:197
@ SUB_NODE
Definition Driver.h:196
@ 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:600
struct _EFI_FS EFI_FS
Definition Driver.h:602
@ 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:601
@ MOUNT_POINT
Definition Driver.h:221
@ IS_MICROSOFT
Definition Driver.h:216
@ IS_ALIAS
Definition Driver.h:214
@ DFS
Definition Driver.h:220
@ NSS_RECOVER
Definition Driver.h:218
@ SYMBOLIC_LINK
Definition Driver.h:223
@ IS_HIGH_LATENCY
Definition Driver.h:215
@ HSM
Definition Driver.h:222
@ SIS
Definition Driver.h:219
@ NSS
Definition Driver.h:217
@ 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:641
EFI_DISK_IO_PROTOCOL * DiskIo
Definition Driver.h:643
EFI_BLOCK_IO_PROTOCOL * BlockIo
Definition Driver.h:642
NTFS_FILE * RootIndex
Definition Driver.h:646
UINTN SectorSize
Definition Driver.h:650
UINTN ClusterSize
Definition Driver.h:651
UINTN IndexRecordSize
Definition Driver.h:649
EFI_DEVICE_PATH * DevicePath
Definition Driver.h:644
NTFS_FILE * MftStart
Definition Driver.h:647
UINTN FileRecordSize
Definition Driver.h:648
UINT64 FirstMftRecord
Definition Driver.h:645
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL FileIoInterface
Definition Driver.h:640
NTFS_FILE RootFile
Definition Driver.h:634
UINT32 RefCount
Definition Driver.h:633
BOOLEAN IsDir
Definition Driver.h:628
CHAR16 * Path
Definition Driver.h:630
CHAR16 * BaseName
Definition Driver.h:631
EFI_FS * FileSystem
Definition Driver.h:636
UINT64 DirIndex
Definition Driver.h:629
UINT64 Offset
Definition Driver.h:632
EFI_FILE_PROTOCOL EfiFile
Definition Driver.h:627
NTFS_FILE MftFile
Definition Driver.h:635
NTFS_ATTR Attr
Definition Driver.h:622
UINT8 * FileRecord
Definition Driver.h:615
UINT64 ReadTime
Definition Driver.h:619
UINT64 CreationTime
Definition Driver.h:617
UINT64 AlteredTime
Definition Driver.h:618
UINT64 Inode
Definition Driver.h:620
EFI_NTFS_FILE * File
Definition Driver.h:623
BOOLEAN InodeRead
Definition Driver.h:621
UINT64 DataAttributeSize
Definition Driver.h:616
UINT64 AllocatedSize
Definition Driver.h:510
UINT64 CreationTime
Definition Driver.h:506
UINT64 RealSize
Definition Driver.h:511
UINT8 Namespace
Definition Driver.h:515
UINT32 Flags
Definition Driver.h:512
UINT64 AlteredTime
Definition Driver.h:507
UINT32 Reparse
Definition Driver.h:513
UINT64 ParentDir
Definition Driver.h:505
UINT8 FilenameLen
Definition Driver.h:514
UINT64 ReadTime
Definition Driver.h:509
UINT64 ChangedMftTime
Definition Driver.h:508
UINT16 NameOffset
Definition Driver.h:327
UINT16 DataRunsOffset
Definition Driver.h:332
UINT64 InitializedDataSize
Definition Driver.h:337
UINT64 AllocatedSize
Definition Driver.h:335
UINT16 AttributeId
Definition Driver.h:329
UINT16 CompressionUnitSize
Definition Driver.h:333
UINT64 StartingVCN
Definition Driver.h:330
UINT16 InfoOffset
Definition Driver.h:293
UINT32 InfoLength
Definition Driver.h:292
UINT8 Padding
Definition Driver.h:295
UINT8 NameLength
Definition Driver.h:288
UINT16 AttributeId
Definition Driver.h:291
UINT8 IndexedFlag
Definition Driver.h:294
UINT32 Type
Definition Driver.h:285
UINT32 Length
Definition Driver.h:286
UINT8 NonResFlag
Definition Driver.h:287
UINT16 Flags
Definition Driver.h:290
UINT16 NameOffset
Definition Driver.h:289
INDEX_ROOT Root
Definition Driver.h:476
UINT32 FirstEntryOffset
Definition Driver.h:477
UINT32 EntriesAllocatedSize
Definition Driver.h:479
UINT32 EntriesTotalSize
Definition Driver.h:478
UINT8 NameOffset
Definition Driver.h:360
UINT64 BaseFileReference
Definition Driver.h:362
UINT16 AttributeId
Definition Driver.h:363
UINT8 NameLength
Definition Driver.h:359
UINT16 RecordLength
Definition Driver.h:358
UINT64 StartingVCN
Definition Driver.h:361
UINT64 VolumeSectorsNumber
Definition Driver.h:556
INT8 MftRecordClusters
Definition Driver.h:559
UINT64 MftLcn
Definition Driver.h:557
UINT16 HeadsNumber
Definition Driver.h:553
UINT16 Unused2
Definition Driver.h:551
UINT16 SectorsPerTrack
Definition Driver.h:552
UINT16 BytesPerSector
Definition Driver.h:547
INT8 IndexRecordClusters
Definition Driver.h:561
UINT8 SectorsPerCluster
Definition Driver.h:548
UINT32 Usually
Definition Driver.h:555
UINT64 VolumeSerialNumber
Definition Driver.h:563
UINT64 Unused3
Definition Driver.h:554
UINT8 MediaDescriptor
Definition Driver.h:550
UINT64 MftMirrLcn
Definition Driver.h:558
UINTN ClusterOffset
Definition Driver.h:666
UINT8 * Cluster
Definition Driver.h:665
UINT64 SavedPosition
Definition Driver.h:667
UINT64 CurrentVcn
Definition Driver.h:664
UINT8 Head
Definition Driver.h:661
EFI_FS * FileSystem
Definition Driver.h:660
UINT8 Tail
Definition Driver.h:662
UINT8 * ClearTextBlock
Definition Driver.h:668
UINT16 SequenceNumber
Definition Driver.h:254
UINT32 AllocatedSize
Definition Driver.h:259
UINT16 HardLinkCount
Definition Driver.h:255
UINT16 UpdateSequenceOffset
Definition Driver.h:251
UINT16 NextAttributeId
Definition Driver.h:261
UINT64 BaseFileRecord
Definition Driver.h:260
UINT16 AttributeOffset
Definition Driver.h:256
UINT8 Flags
Definition Driver.h:399
UINT16 StreamLength
Definition Driver.h:398
UINT16 IndexEntryLength
Definition Driver.h:397
UINT16 SequenceNumber
Definition Driver.h:396
UINT32 Magic
Definition Driver.h:427
UINT16 S_Size
Definition Driver.h:429
UINT64 IndexRecordVCN
Definition Driver.h:431
UINT16 UpdateSequenceOffset
Definition Driver.h:428
UINT64 LSN
Definition Driver.h:430
INDEX_HEADER Header
Definition Driver.h:435
UINT32 IndexEntriesSize
Definition Driver.h:437
UINT32 IndexEntriesOffset
Definition Driver.h:436
UINT32 IndexEntriesAllocated
Definition Driver.h:438
UINT8 IndexRecordClusters
Definition Driver.h:471
UINT32 CollationRule
Definition Driver.h:469
UINT32 IndexAllocationSize
Definition Driver.h:470
UINT32 Type
Definition Driver.h:468
NTFS_FILE * BaseMftRecord
Definition Driver.h:611
UINT8 * Current
Definition Driver.h:608
UINT8 * Last
Definition Driver.h:610
UINT8 * NonResAttrList
Definition Driver.h:607
UINT8 * Next
Definition Driver.h:609
UINT8 * ExtensionMftRecord
Definition Driver.h:606
INT32 Flags
Definition Driver.h:605
UINT64 CurrentVcn
Definition Driver.h:674
UINT64 CurrentLcn
Definition Driver.h:675
COMPRESSED Unit
Definition Driver.h:679
BOOLEAN IsSparse
Definition Driver.h:672
NTFS_ATTR * Attr
Definition Driver.h:678
UINT64 TargetVcn
Definition Driver.h:673
UINT64 NextVcn
Definition Driver.h:676
UINT8 * NextDataRun
Definition Driver.h:677
UINT16 SubstituteOffset
Definition Driver.h:593
UINT16 DataLength
Definition Driver.h:591
UINT16 SubstituteLength
Definition Driver.h:594
UINT32 Type
Definition Driver.h:590
UINT16 PrintLength
Definition Driver.h:596
UINT16 PrintOffset
Definition Driver.h:595
UINT16 Padding
Definition Driver.h:592
UINT64 Lcn
Definition Driver.h:656
UINT64 Vcn
Definition Driver.h:655