2,643
社区成员
发帖
与我相关
我的任务
分享
#pragma pack(1)
typedef struct _Fat32BootData
{
BYTE jump[3]; // 0x00 Boot strap short or near jump
char bsOemName[8]; // 0x03 Name - can be used to special case partition manager volumes
WORD BytesPerSector; // 0x0B bytes per logical sector
BYTE SectorsPerCluster; // 0x0D sectors/cluster
WORD ReservedSectors; // 0x0E reserved sectors
BYTE NumberOfFATs; // 0x10 number of FATs
WORD RootEntries; // 0x11 root directory entries
WORD TotalSectors; // 0x13 number of sectors
BYTE MediaDescriptor; // 0x15 media code (unused)
WORD SectorsPerFAT; // 0x16 sectors/FAT FAT16
WORD SectorsPerTrack; // 0x18 sectors per track
WORD Heads; // 0x1A number of heads
DWORD HiddenSectors; // 0x1C hidden sectors (unused)
DWORD BigTotalSectors; // 0x20 number of sectors (if sectors == 0)
// The following fields are only used by FAT32
DWORD BigSectorsPerFat; // 0x24 sectors/FAT FAT32
WORD ExtFlags; // 0x28 bit 8: fat mirroring, low 4: active fat
WORD FS_Version; // 0x2A major, minor filesystem version
DWORD RootDirStrtClus; // 0x2C first cluster in root directory
WORD FSInfoSec; // 0x30 filesystem info sector
WORD BkUpBootSec; // 0x32 backup boot sector
WORD Reserved[6]; // 0x34 Unused
BYTE bsDriveNumber; // 0x40
BYTE bsReserved; // 0x41
BYTE bsBootSignature; // 0x42
DWORD bsVolumeID; // 0x43
char bsVolumeLabel[11]; // 0x47
char bsFileSysType[8]; // 0x52
BYTE unused [422]; // 0x5A
}Fat32BootData;
#pragma pack()
DWORD dwReservedSectors;
DWORD dwFatSectors;
DWORD dwDirtoryTableSectors;
dwReservedSectors = Boot.ReservedSectors;
dwFatSectors = Boot.BigSectorsPerFat * Boot.NumberOfFATs; //FAT32
dwDirtoryTableSectors = ((Boot.RootEntries * 32 - 1) / m_dwBytesPerSector + 1) * m_dwBytesPerSector;
m_dwFat32FirstDataSector = dwReservedSectors + dwFatSectors + dwDirtoryTableSectors;