Shared_Includes/structures/FileSystem.inc
Anatoliy Belyanskiy 378f3fdd49 ...
2024-06-09 06:32:49 +10:00

481 lines
20 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

////////////////////////////////////////////////////////////////////////////////////////////
BOOT_SECTOR EQU #00
.JMP EQU #00 ; BLOCK 3,0 BS_jmpBoot Jump to bootstrap (E.g. eb 3c 90; on i86: JMP 003E NOP. One finds either eb xx 90, or e9 xx xx.
.ID_NAME EQU #03 ; TEXT 8 BS_OEMName DOS NAME - DB "DSS_1.70"
; Block Parameters BIOS
.BytesPerSector EQU #0B ; WORD #200 BPB_BytsPerSec <09> §¬¥à ᥪâ®à  ¢ ¡ ©â å
.SectorsPerCluster EQU #0D ; BYTE 2 BPB_SecPerClus <09> §¬¥à ª« áâ¥à  ¢ ᥪâ®à å
.RESERVED_SECTORS EQU #0E ; WORD 1 BPB_ResvdSecCnt <09> §¬¥à á¨á⥬­®© ®¡« á⨠(¢ª«îç ï íâ®â ᥪâ®à) RESERVE SECTORS
.Number_of_FATs EQU #10 ; BYTE 2 BPB_NumFATs Š®«¨ç¥á⢮ â ¡«¨æ FAT
.FilesInRootDIR EQU #11 ; WORD 112 BPB_RootEntCnt —¨á«® ®¯¨á â¥«¥© ä ©«®¢ ¢ ª®à­¥¢®¬ ª â «®£¥ (¢ FAT32 - 0)
.SectorsPerDrive EQU #13 ; WORD 1440 BPB_TotSec16 ޡ饥 ç¨á«® ᥪâ®à®¢ ­  ¤¨áª¥ (¥á«¨ 0, â® à §¬¥à - ¢ .BPB_BIG_TOTAL_SECTORS)
.DRIVE_TYPE EQU #15 ; BYTE #F0 BPB_Media ’¨¯ ãáâனá⢠
.SectorsPerFAT16 EQU #16 ; WORD 2 BPB_FATSz16 <09> §¬¥à ®¤­®© FAT ¢ ᥪâ®à å (0 ¢ FAT32)
.SectorsPerTrack EQU #18 ; WORD 9 BPB_SecPerTrk <09> §¬¥à ¤®à®¦ª¨ ¢ ᥪâ®à å
.HEADS EQU #1A ; WORD 2 BPB_NumHeads ª®«¨ç¥á⢮ £®«®¢®ª
.HIDDEN EQU #1C ; DWORD 0 BPB_HiddSec ª®«¨ç¥á⢮ ªàëâëå ᥪâ®à®¢
.BPB_BIG_TOTAL_SECTORS_L EQU #20 ; WORD 0 BPB_TotSec32 BIG TOTAL SECTOR Low word
.BPB_BIG_TOTAL_SECTORS_H EQU #22 ; WORD 0 BPB_TotSec32 BIG TOTAL SECTOR High word
; FAT 12, FAT 16
.BPB_PHISICAL_DRIVE_NUMBER EQU #24 ; BYTE #80 BS_DrvNum ”¨§¨ç¥áª¨© ­®¬¥à ¤à ©¢ 
.reserved_1 EQU #25 ; BYTE 0 BS_Reserved1 ‡ à¥§¥à¢¨à®¢ ­®
.FAT.EXT_BOOT_REC_SIGNATURE EQU #26 ; BYTE #29 BS_BootSig ‘¨£­ âãà  - #29
.FAT.SERIAL_NUMBER EQU #27 ; DWORD 0 BS_VolID VOLUME SERIAL NUMBER
.FAT.LABEL EQU #2B ; TEXT 11 BS_VolLab Œ¥âª  ¤¨áª 
.ID_FAT EQU #36 ; TEXT 8 BS_FilSysType FILE SYSTEM ID (BPB_FS_ID) ;!TODO detect fat type by clusters!
; #3E
; FAT 32
.SectorsPerFAT32 EQU #24 ; DWORD 4 BPB_FATSz32 <09> §¬¥à ®¤­®© FAT ¢ ᥪâ®à å
.MainFATnumber EQU #28 ; WORD 0 BPB_ExtFlags <09>®¬¥à £« ¢­®© â ¡«¨æë FAT
.Version EQU #2A ; WORD 0 BPB_FSVer ‚¥àá¨ï FAT32 (®¡ëç­® 0)
.RootDirStartCluster EQU #2C ; DWORD 2 BPB_RootClus <09>¥à¢ë© ª« áâ¥à ª®à­¥¢®£® ª â «®£  (®¡ëç­® 2)
.FSINFO_Sector EQU #30 ; WORD 1 BPB_FSInfo <09>®¬¥à ᥪâ®à  áâàãªâãàë FSINFO (®¡ëç­® 1)
.CopyBootSector EQU #32 ; WORD 6 BPB_BkBootSec <09>®¬¥à ᥪâ®à  - ª®¯¨¨ § £à㧮筮£® (®¡ëç­® 6)
.reserved_block: EQU #34 ; BLOCK 12 BPB_Reserved ‡ à¥§¥à¢¨à®¢ ­®
.FDD_Number EQU #40 ; BYTE 0 BS_DrvNum <09>®¬¥à ¤¨áª®¢®¤  ¤«ï ä㭪権 BIOS
.reserved_2: EQU #41 ; BYTE 0 BS_Reserved1 ‡ à¥§¥à¢¨à®¢ ­®
.FAT32.EXT_BOOT_REC_SIGNATURE EQU #42 ; BYTE #29 BS_BootSig ‘¨£­ âãà  - #29
.FAT32.SERIAL_NUMBER EQU #43 ; DWORD 0 BS_VolID VOLUME SERIAL NUMBER
.FAT32.LABEL EQU #47 ; TEXT 11 BS_VolLab Œ¥âª  ¤¨áª 
.ID_FAT32 EQU #52 ; TEXT 8 BS_FilSysType €¡¡à¥¢¨ âãà  ä ©«®¢®© á¨á⥬ë
; #5A
; PC Loader
.BOOT_CODE_FAT16 EQU #3E
.BOOT_CODE_FAT32 EQU #5A
; Partition table
.PARTITION_TABLE EQU #1BE
.PARTITION_TABLE.Size EQU #40
.RECORD_SIZE EQU #10
; Record
.Partition.isActive EQU #00 ; BYTE 0
.Partition.Start_head EQU #01 ; BYTE 0
.Partition.Start_sector EQU #02 ; BYTE 0
.Partition.Start_cylinder EQU #03 ; BYTE 0
.Partition.FS_ID EQU #04 ; BYTE 0
.Partition.End_head EQU #05 ; BYTE 0
.Partition.End_sector EQU #06 ; BYTE 0
.Partition.End_cylinder EQU #07 ; BYTE 0
.Partition.Start_LBA EQU #08 ; DWORD 0
.Partition.Size_LBA EQU #0C ; DWORD 0
; Signature
.MBR_SIGNATURE EQU #1FE; WORD #AA55
////////////////////////////////////////////////////////////////////////////////////////////
STRUCT _sFSinfo
.LEAD_SIGNATURE DWORD #41615252 ; #52 #52 #61 #41
.RESERVED_1 BLOCK #1E0,0
.DATA_SIGNATURE DWORD #61417272 ; #72 #72 #41 #61
.FREE_CLUSTERS_COUNT DWORD #FFFF'FFFF
.FIRST_FREE_CLUSTER DWORD #FFFF'FFFF
.RESERVED_2 BLOCK #0C,0
.SECTOR_SIGNATURE DWORD #AA550000 ; #00 #00 #55 #AA
ENDS
;
//---------------------------------------------------------------------------
STRUCT _sBOOT_SECTOR_PARAMS
.JMP: BLOCK 3,0 ; BS_jmpBoot +#00 "JMP"
.ID_NAME: TEXT 8,{"DSS_1.7","0"} ; BS_OEMName +#03 DOS NAME - DB "DSS_1.70"
; Block Parameters BIOS
.BytesPerSector: WORD #200 ; BPB_BytsPerSec +#0B <20> §¬¥à ᥪâ®à  ¢ ¡ ©â å
.SectorsPerCluster: BYTE 2 ; BPB_SecPerClus +#0D <20> §¬¥à ª« áâ¥à  ¢ ᥪâ®à å
.RESERVED_SECTORS: WORD 1 ; BPB_RsvdSecCnt +#0E <20> §¬¥à á¨á⥬­®© ®¡« á⨠(¢ª«îç ï íâ®â ᥪâ®à) RESERVE SECTORS
.Number_of_FATs: BYTE 2 ; BPB_NumFATs +#10 Š®«¨ç¥á⢮ â ¡«¨æ FAT
.FilesInRootDIR: WORD 112 ; BPB_RootEntCnt +#11 —¨á«® ®¯¨á â¥«¥© ä ©«®¢ ¢ ª®à­¥¢®¬ ª â «®£¥ (¢ FAT32 - 0)
.SectorsPerDrive: WORD 1440 ; BPB_TotSec16 +#13 ޡ饥 ç¨á«® ᥪâ®à®¢ ­  ¤¨áª¥ (¥á«¨ 0, â® à §¬¥à - ¢ .BPB_BIG_TOTAL_SECTORS)
.DRIVE_TYPE: BYTE #F0 ; BPB_Media +#15 ’¨¯ ãáâனá⢠
.SectorsPerFAT16: WORD 2 ; BPB_FATSz16 +#16 <20> §¬¥à ®¤­®© FAT ¢ ᥪâ®à å (0 ¢ FAT32)
.SectorsPerTrack: WORD 9 ; BPB_SecPerTrk +#18 <20> §¬¥à ¤®à®¦ª¨ ¢ ᥪâ®à å
.HEADS: WORD 2 ; BPB_NumHeads +#1A ª®«¨ç¥á⢮ £®«®¢®ª
.HIDDEN: DWORD 0 ; BPB_HiddSec +#1C ª®«¨ç¥á⢮ ªàëâëå ᥪâ®à®¢
.BPB_BIG_TOTAL_SECTORS_L: WORD 0 ; BPB_TotSec32 +#20 BIG TOTAL SECTOR Low word
.BPB_BIG_TOTAL_SECTORS_H: WORD 0 ; BPB_TotSec32 +#22 BIG TOTAL SECTOR High word
; FAT 12-16
.BPB_PHISICAL_DRIVE_NUMBER: BYTE #80 ; BS_DrvNum +#24 ”¨§¨ç¥áª¨© ­®¬¥à ¤à ©¢ 
.reserved: BYTE 0 ; BS_Reserved1 +#25 ‡ à¥§¥à¢¨à®¢ ­®
.BPB_EXT_BOOT_RECORD_SIGNATURE: BYTE #29 ; BS_BootSig +#26 ‘¨£­ âãà  - #29
.BPB_SERIAL_NUMBER: DWORD 0 ; BS_VolID +#27 VOLUME SERIAL NUMBER
.BPB_LABEL: TEXT 11,{"NO NAME"," "}; BS_VolLab +#2B Œ¥âª  ¤¨áª 
.ID_FAT: TEXT 8,{"FAT16"," "} ; BS_FilSysType +#36 FILE SYSTEM ID (BPB_FS_ID) ;!TODO detect fat type by clusters!
ENDS ;
;
; FAT 32
STRUCT _sBOOT_SECTOR_PARAMS_FAT32
.skip BLOCK #24,0
.SectorsPerFAT32: DWORD 4 ; +#24 <20> §¬¥à ®¤­®© FAT ¢ ᥪâ®à å
.MainFATnumber WORD 0 ; +#28 <20>®¬¥à £« ¢­®© â ¡«¨æë FAT
.Version WORD 0 ; +#2A ‚¥àá¨ï FAT32 (®¡ëç­® 0)
.RootDirStartCluster: DWORD 2 ; +#2C <20>¥à¢ë© ª« áâ¥à ª®à­¥¢®£® ª â «®£  (®¡ëç­® 2)
.FSINFO_Sector WORD 1 ; +#30 <20>®¬¥à ᥪâ®à  áâàãªâãàë FSINFO (®¡ëç­® 1)
.CopyBootSector WORD 6 ; +#32 <20>®¬¥à ᥪâ®à  - ª®¯¨¨ § £à㧮筮£® (®¡ëç­® 6)
.reserved_block: BLOCK 12 ; +#34 ‡ à¥§¥à¢¨à®¢ ­®
.FDD_Number BYTE 0 ; +#40 <20>®¬¥à ¤¨áª®¢®¤  ¤«ï ä㭪権 BIOS
.reserved: BYTE 0 ; +#41 ‡ à¥§¥à¢¨à®¢ ­®
.BPB_EXT_BOOT_RECORD_SIGNATURE: BYTE #29 ; +#42 ‘¨£­ âãà  - #29
.BPB_SERIAL_NUMBER: DWORD 0 ; +#43 VOLUME SERIAL NUMBER
.BPB_LABEL: TEXT 11,{"NO NAME"," "} ; +#47 Œ¥âª  ¤¨áª 
.ID_FAT: TEXT 8,{"FAT16"," "} ; +#52 €¡¡à¥¢¨ âãà  ä ©«®¢®© á¨á⥬ë
ENDS ; +#5A
;
;
STRUCT _sMBR_PARTITION_RECORD
.isActive: BYTE 0 ; +#00
.Start_head: BYTE 0 ; +#01
.Start_sector: BYTE 0 ; +#02
.Start_cylinder: BYTE 0 ; +#03
.FS_ID: BYTE 0 ; +#04
.End_head: BYTE 0 ; +#05
.End_sector: BYTE 0 ; +#06
.End_cylinder: BYTE 0 ; +#07
.Start_LBA: DWORD 0 ; +#08
.Size_LBA: DWORD 0 ; +#0C
ENDS
;
;
STRUCT _sMBR_PARTITION_TABLE ;, #01BE ; MBR: Offset of partition table in the MBR
.Record_1: _sMBR_PARTITION_RECORD ; +#1BE
.Record_2: _sMBR_PARTITION_RECORD ; +#1CE
.Record_3: _sMBR_PARTITION_RECORD ; +#1DE
.Record_4: _sMBR_PARTITION_RECORD ; +#1EE
ENDS
;
;
STRUCT _sBOOT_SECTOR
.PARAMS: _sBOOT_SECTOR_PARAMS_FAT32
.BOOT_CODE: BLOCK #1BE-_sBOOT_SECTOR_PARAMS_FAT32,0 ; +#3E boot loader's code
.PARTITION_TABLE: _sMBR_PARTITION_TABLE ; +#1BE table = 4x16 bytes
.MBR_SIGNATURE: WORD #AA55 ; +#1FE Signature
ENDS
;
;
STRUCT FAT_DIRECTORY_RECORD
.NAME: TEXT 8,{". "," "} ; DIR_Name #00 +00 NAME
.EXT: TEXT 3,{" "," "} ; --//--//; #08 +08 EXT
.ATTRIBUT: BYTE #10 ; DIR_Attr; #0B +11 ATTRIBUT
.RESERVED_NT: BYTE #00 ; DIR_NTRes; #0C +12 RESERVED
.RESERVED_FAT32: BYTE #00 ; DIR_CrtTimeHundth #0D +13 „¥áïâë¥ ¤®«¨ ᥪ㭤ë á®§¤ ­¨ï ä ©«  (0-1.99)
.CREATE_TIME_FAT32: WORD #0000 ; DIR_CrtTime #0E +14 ‚६ï á®§¤ ­¨ï ä ©« 
.CREATE_DATE_FAT32: WORD #0000 ; DIR_CrtDate #10 +16 „ â  á®§¤ ­¨ï ä ©« 
.LAST_ACCESS_DATE_FAT32: WORD #0000 ; DIR_LstAccDate #12 +18 „ â  ¯®á«¥¤­¥£® ¤®áâ㯠 (r/w)
.FIRST_CLUSTER_H: WORD #0000 ; DIR_FstClusHI #14 +20 START CLUSTER high ;!TODO fat32
.TIME: WORD #0000 ; DIR_WrtTime #16 +22 Time of last write.
.DATE: WORD #0000 ; DIR_WrtDate #18 +24 Date of last write.
.FIRST_CLUSTER_L: WORD #0000 ; DIR_FstClusLO #1A +26 START CLUSTER low
.F_SIZE: DWORD #00000000 ; DIR_FileSize #1C +28 SIZE FILE
ENDS
//---------------------------------------------------------------------------
;
//---------------------------------------------------------------------------
PartitionSysTypes:
.Empty EQU #00
.FAT12 EQU #01
.FAT16_32Mb EQU #04
.Extended EQU #05
.FAT16 EQU #06
.HPFS_NTFS EQU #07
.FAT32 EQU #0B
.FAT32_LBA EQU #0C
.FAT16_LBA EQU #0E
.Win_Ext_LBA EQU #0F
.Linux_swap EQU #82
.Linux EQU #83
.Linux_extended EQU #85
//---------------------------------------------------------------------------
;
//---------------------------------------------------------------------------
; * DOS partition types
; *
; * Taken from fdisk/i386_sys_types.c and fdisk/common.h of
; * util-linux 2.11n (as packaged by Debian), Feb 08, 2003.
; *
; * Part of the info is also taken from PartInfo tool from PartitionMagic 8
; const system_identifier_t system_identifiers[] =
; {
; {0x00, "Empty"},
; {0x01, "FAT12"},
; {0x02, "XENIX root"},
; {0x03, "XENIX usr"},
; {0x04, "FAT16 <32MB"},
; {0x05, "Extended"},
; {0x06, "FAT16B (>= 32 MB)"},
; {0x07, "Installable File System (NTFS, HPFS)"},
; {0x08, "AIX"},
; {0x09, "AIX bootable"},
; {0x0A, "OS/2 Boot Manager"},
; {0x0B, "Win95 FAT32"},
; {0x0C, "Win95 FAT32 (LBA)"},
; {0x0E, "Win95 FAT16 (LBA)"},
; {0x0F, "Win95 Extended (LBA)"},
; {0x10, "OPUS"},
; {0x11, "Hidden FAT12"},
; {0x12, "Compaq diagnostics"},
; {0x14, "Hidden FAT16 <32MB"},
; {0x16, "Hidden FAT16"},
; {0x17, "Hidden IFS (HPFS/NTFS)"},
; {0x18, "AST SmartSleep"},
; {0x1B, "Hidden Win95 FAT32"},
; {0x1C, "Hidden Win95 FAT32 (LBA)"},
; {0x1E, "Hidden Win95 FAT16 (LBA)"},
; {0x24, "NEC DOS"},
; {0x2C, "WildFile/Adaptec GOBack"},
; {0x39, "Plan 9"},
; {0x3C, "PowerQuest Recoverable Partition"},
; {0x40, "Venix 80286"},
; {0x41, "PPC PReP Boot"},
; {0x42, "Veritas Logical Disk Manager"},
; {0x4d, "QNX4.x"},
; {0x4e, "QNX4.x 2nd part"},
; {0x4f, "QNX4.x 3rd part"},
; {0x50, "OnTrack DM"},
; {0x51, "OnTrack DM6 Aux1"},
; {0x52, "CP/M"},
; {0x53, "OnTrack DM6 Aux3"},
; {0x54, "OnTrackDM6"},
; {0x55, "EZ-Drive"},
; {0x56, "Golden Bow"},
; {0x5c, "Priam Edisk"},
; {0x61, "SpeedStor"},
; {0x63, "GNU HURD or SysV"},
; {0x64, "Novell Netware 286"},
; {0x65, "Novell Netware (3.11 and 4.1)"},
; {0x66, "Novell Netware 386"},
; {0x70, "DiskSecure Multi-Boot"},
; {0x75, "PC/IX"},
; {0x78, "XOSL"},
; {0x80, "Old Minix"},
; {0x81, "Linux/Minix v1.4b+"},
; {0x82, "Linux swap / Solaris"},
; {0x83, "Linux native file system (Ext2/3)"},
; {0x84, "OS/2 hiding type 04h partition"},
; {0x85, "Linux extended"},
; {0x86, "NT FAT volume set"},
; {0x87, "NT IFS volume set"},
; {0x8e, "Linux LVM"},
; {0x93, "Amoeba/Hidden Linux native file system (Ext2/3)"},
; {0x94, "Amoeba BBT"},
; {0x9f, "BSD/OS"},
; {0xA0, "IBM Thinkpad hibernation"},
; {0xA5, "FreeBSD"},
; {0xA6, "OpenBSD"},
; {0xA7, "NeXTSTEP"},
; {0xA9, "NetBSD"},
; {0xB7, "BSDI fs"},
; {0xb8, "BSDI swap"},
; {0xbb, "Boot Wizard hidden"},
; {0xc1, "DRDOS / sec (FAT-12)"},
; {0xc4, "DRDOS / sec (FAT-16 < 32M)"},
; {0xc6, "Disabled NT FAT (FAT-16) volume set/DRDOS"},
; {0xc7, "Syrinx / Disabled NT IFS volume set"},
; {0xda, "Non-FS data"},
; {0xdb, "CP/M / CTOS / ..."},
; {0xde, "Dell Corporation diagnostic partition"},
; {0xdf, "BootIt"},
; {0xe1, "DOS access"},
; {0xe3, "DOS R/O"},
; {0xe4, "SpeedStor"},
; {0xeb, "BeOS fs"},
; {0xee, "EFI GPT"},
; {0xef, "EFI (FAT-12/16/32)"},
; {0xf0, "Linux/PA-RISC boot"},
; {0xf1, "SpeedStor"},
; {0xf4, "SpeedStor"},
; {0xf2, "DOS secondary"},
; {0xfd, "Linux raid autodetect"},
; {0xfe, "LANstep"},
; {0xff, "Bad Track Table"},
; {0, 0} // End-Of-Table
; };
; Limits and boundaries
; MAX_DIR 0x200000 ; Max size of FAT directory
; MAX_DIR_EX 0x10000000 ; Max size of exFAT directory
; MAX_FAT12 0xFF5 ; Max FAT12 clusters (differs from specs, but right for real DOS/Windows behavior)
; MAX_FAT16 0xFFF5 ; Max FAT16 clusters (differs from specs, but right for real DOS/Windows behavior)
; MAX_FAT32 0x0FFFFFF5 ; Max FAT32 clusters (not specified, practical limit)
; MAX_EXFAT 0x7FFFFFFD ; Max exFAT clusters (differs from specs, implementation limit)
; Character code support macros
; IsUpper(c) ((c) >= 'A' && (c) <= 'Z')
; IsLower(c) ((c) >= 'a' && (c) <= 'z')
; IsDigit(c) ((c) >= '0' && (c) <= '9')
; IsSeparator(c) ((c) == '/' || (c) == '\\')
; IsTerminator(c) ((UINT)(c) < (FF_USE_LFN ? ' ' : '!'))
; IsSurrogate(c) ((c) >= 0xD800 && (c) <= 0xDFFF)
; IsSurrogateH(c) ((c) >= 0xD800 && (c) <= 0xDBFF)
; IsSurrogateL(c) ((c) >= 0xDC00 && (c) <= 0xDFFF)
; Additional file access control and file status flags for internal use
; FA_SEEKEND 0x20 ; Seek to end of the file on file open
; FA_MODIFIED 0x40 ; File has been modified
; FA_DIRTY 0x80 ; FIL.buf[] needs to be written-back
; Additional file attribute bits for internal use
; AM_VOL 0x08 ; Volume label
; AM_LFN 0x0F ; LFN entry
; AM_MASK 0x3F ; Mask of defined bits in FAT
; AM_MASKX 0x37 ; Mask of defined bits in exFAT
; Name status flags in fn[11]
; NSFLAG 11 ; Index of the name status byte
; NS_LOSS 0x01 ; Out of 8.3 format
; NS_LFN 0x02 ; Force to create LFN entry
; NS_LAST 0x04 ; Last segment
; NS_BODY 0x08 ; Lower case flag (body)
; NS_EXT 0x10 ; Lower case flag (ext)
; NS_DOT 0x20 ; Dot entry
; NS_NOLFN 0x40 ; Do not find LFN
; NS_NONAME 0x80 ; Not followed
; exFAT directory entry types
; ET_BITMAP 0x81 ; Allocation bitmap
; ET_UPCASE 0x82 ; Up-case table
; ET_VLABEL 0x83 ; Volume label
; ET_FILEDIR 0x85 ; File and directory
; ET_STREAM 0xC0 ; Stream extension
; ET_FILENAME 0xC1 ; Name extension
; FatFs refers the FAT structure as simple byte array instead of structure member
; because the C structure is not binary compatible between different platforms
; BS_JmpBoot 0 ; x86 jump instruction (3-byte)
; BS_OEMName 3 ; OEM name (8-byte)
; BPB_BytsPerSec 11 ; Sector size [byte] (WORD)
; BPB_SecPerClus 13 ; Cluster size [sector] (BYTE)
; BPB_RsvdSecCnt 14 ; Size of reserved area [sector] (WORD)
; BPB_NumFATs 16 ; Number of FATs (BYTE)
; BPB_RootEntCnt 17 ; Size of root directory area for FAT [entry] (WORD)
; BPB_TotSec16 19 ; Volume size (16-bit) [sector] (WORD)
; BPB_Media 21 ; Media descriptor byte (BYTE)
; BPB_FATSz16 22 ; FAT size (16-bit) [sector] (WORD)
; BPB_SecPerTrk 24 ; Number of sectors per track for int13h [sector] (WORD)
; BPB_NumHeads 26 ; Number of heads for int13h (WORD)
; BPB_HiddSec 28 ; Volume offset from top of the drive (DWORD)
; BPB_TotSec32 32 ; Volume size (32-bit) [sector] (DWORD)
; BS_DrvNum 36 ; Physical drive number for int13h (BYTE)
; BS_NTres 37 ; WindowsNT error flag (BYTE)
; BS_BootSig 38 ; Extended boot signature (BYTE)
; BS_VolID 39 ; Volume serial number (DWORD)
; BS_VolLab 43 ; Volume label string (8-byte)
; BS_FilSysType 54 ; Filesystem type string (8-byte)
; BS_BootCode 62 ; Boot code (448-byte)
; BS_55AA 510 ; Signature word (WORD)
; BPB_FATSz32 36 ; FAT32: FAT size [sector] (DWORD)
; BPB_ExtFlags32 40 ; FAT32: Extended flags (WORD)
; BPB_FSVer32 42 ; FAT32: Filesystem version (WORD)
; BPB_RootClus32 44 ; FAT32: Root directory cluster (DWORD)
; BPB_FSInfo32 48 ; FAT32: Offset of FSINFO sector (WORD)
; BPB_BkBootSec32 50 ; FAT32: Offset of backup boot sector (WORD)
; BS_DrvNum32 64 ; FAT32: Physical drive number for int13h (BYTE)
; BS_NTres32 65 ; FAT32: Error flag (BYTE)
; BS_BootSig32 66 ; FAT32: Extended boot signature (BYTE)
; BS_VolID32 67 ; FAT32: Volume serial number (DWORD)
; BS_VolLab32 71 ; FAT32: Volume label string (8-byte)
; BS_FilSysType32 82 ; FAT32: Filesystem type string (8-byte)
; BS_BootCode32 90 ; FAT32: Boot code (420-byte)
; BPB_ZeroedEx 11 ; exFAT: MBZ field (53-byte)
; BPB_VolOfsEx 64 ; exFAT: Volume offset from top of the drive [sector] (QWORD)
; BPB_TotSecEx 72 ; exFAT: Volume size [sector] (QWORD)
; BPB_FatOfsEx 80 ; exFAT: FAT offset from top of the volume [sector] (DWORD)
; BPB_FatSzEx 84 ; exFAT: FAT size [sector] (DWORD)
; BPB_DataOfsEx 88 ; exFAT: Data offset from top of the volume [sector] (DWORD)
; BPB_NumClusEx 92 ; exFAT: Number of clusters (DWORD)
; BPB_RootClusEx 96 ; exFAT: Root directory start cluster (DWORD)
; BPB_VolIDEx 100 ; exFAT: Volume serial number (DWORD)
; BPB_FSVerEx 104 ; exFAT: Filesystem version (WORD)
; BPB_VolFlagEx 106 ; exFAT: Volume flags (WORD)
; BPB_BytsPerSecEx 108 ; exFAT: Log2 of sector size in unit of byte (BYTE)
; BPB_SecPerClusEx 109 ; exFAT: Log2 of cluster size in unit of sector (BYTE)
; BPB_NumFATsEx 110 ; exFAT: Number of FATs (BYTE)
; BPB_DrvNumEx 111 ; exFAT: Physical drive number for int13h (BYTE)
; BPB_PercInUseEx 112 ; exFAT: Percent in use (BYTE)
; BPB_RsvdEx 113 ; exFAT: Reserved (7-byte)
; BS_BootCodeEx 120 ; exFAT: Boot code (390-byte)
; DIR_Name 0 ; Short file name (11-byte)
; DIR_Attr 11 ; Attribute (BYTE)
; DIR_NTres 12 ; Lower case flag (BYTE)
; DIR_CrtTime10 13 ; Created time sub-second (BYTE)
; DIR_CrtTime 14 ; Created time (DWORD)
; DIR_LstAccDate 18 ; Last accessed date (WORD)
; DIR_FstClusHI 20 ; Higher 16-bit of first cluster (WORD)
; DIR_ModTime 22 ; Modified time (DWORD)
; DIR_FstClusLO 26 ; Lower 16-bit of first cluster (WORD)
; DIR_FileSize 28 ; File size (DWORD)
; LDIR_Ord 0 ; LFN: LFN order and LLE flag (BYTE)
; LDIR_Attr 11 ; LFN: LFN attribute (BYTE)
; LDIR_Type 12 ; LFN: Entry type (BYTE)
; LDIR_Chksum 13 ; LFN: Checksum of the SFN (BYTE)
; LDIR_FstClusLO 26 ; LFN: MBZ field (WORD)
; XDIR_Type 0 ; exFAT: Type of exFAT directory entry (BYTE)
; XDIR_NumLabel 1 ; exFAT: Number of volume label characters (BYTE)
; XDIR_Label 2 ; exFAT: Volume label (11-WORD)
; XDIR_CaseSum 4 ; exFAT: Sum of case conversion table (DWORD)
; XDIR_NumSec 1 ; exFAT: Number of secondary entries (BYTE)
; XDIR_SetSum 2 ; exFAT: Sum of the set of directory entries (WORD)
; XDIR_Attr 4 ; exFAT: File attribute (WORD)
; XDIR_CrtTime 8 ; exFAT: Created time (DWORD)
; XDIR_ModTime 12 ; exFAT: Modified time (DWORD)
; XDIR_AccTime 16 ; exFAT: Last accessed time (DWORD)
; XDIR_CrtTime10 20 ; exFAT: Created time subsecond (BYTE)
; XDIR_ModTime10 21 ; exFAT: Modified time subsecond (BYTE)
; XDIR_CrtTZ 22 ; exFAT: Created timezone (BYTE)
; XDIR_ModTZ 23 ; exFAT: Modified timezone (BYTE)
; XDIR_AccTZ 24 ; exFAT: Last accessed timezone (BYTE)
; XDIR_GenFlags 33 ; exFAT: General secondary flags (BYTE)
; XDIR_NumName 35 ; exFAT: Number of file name characters (BYTE)
; XDIR_NameHash 36 ; exFAT: Hash of file name (WORD)
; XDIR_ValidFileSize 40 ; exFAT: Valid file size (QWORD)
; XDIR_FstClus 52 ; exFAT: First cluster of the file data (DWORD)
; XDIR_FileSize 56 ; exFAT: File/Directory size (QWORD)
; SZDIRE 32 ; Size of a directory entry
; DDEM 0xE5 ; Deleted directory entry mark set to DIR_Name[0]
; RDDEM 0x05 ; Replacement of the character collides with DDEM
; LLEF 0x40 ; Last long entry flag in LDIR_Ord
; FSI_LeadSig 0 ; FAT32 FSI: Leading signature (DWORD)
; FSI_StrucSig 484 ; FAT32 FSI: Structure signature (DWORD)
; FSI_Free_Count 488 ; FAT32 FSI: Number of free clusters (DWORD)
; FSI_Nxt_Free 492 ; FAT32 FSI: Last allocated cluster (DWORD)
; GPTH_Sign 0 ; GPT: Header signature (8-byte)
; GPTH_Rev 8 ; GPT: Revision (DWORD)
; GPTH_Size 12 ; GPT: Header size (DWORD)
; GPTH_Bcc 16 ; GPT: Header BCC (DWORD)
; GPTH_CurLba 24 ; GPT: Main header LBA (QWORD)
; GPTH_BakLba 32 ; GPT: Backup header LBA (QWORD)
; GPTH_FstLba 40 ; GPT: First LBA for partitions (QWORD)
; GPTH_LstLba 48 ; GPT: Last LBA for partitions (QWORD)
; GPTH_DskGuid 56 ; GPT: Disk GUID (16-byte)
; GPTH_PtOfs 72 ; GPT: Partation table LBA (QWORD)
; GPTH_PtNum 80 ; GPT: Number of table entries (DWORD)
; GPTH_PteSize 84 ; GPT: Size of table entry (DWORD)
; GPTH_PtBcc 88 ; GPT: Partation table BCC (DWORD)
; SZ_GPTE 128 ; GPT: Size of partition table entry
; GPTE_PtGuid 0 ; GPT PTE: Partition type GUID (16-byte)
; GPTE_UpGuid 16 ; GPT PTE: Partition unique GUID (16-byte)
; GPTE_FstLba 32 ; GPT PTE: First LBA (QWORD)
; GPTE_LstLba 40 ; GPT PTE: Last LBA inclusive (QWORD)
; GPTE_Flags 48 ; GPT PTE: Flags (QWORD)
; GPTE_Name 56 ; GPT PTE: Name