📄 fat.h
字号:
typedef struct _MBR_BLOCK { //////////512bytes
INT8 Res[454];
unsigned long StartSector;//分区起始扇区数
unsigned long TotalSector;//分区总扇区数
INT8 Res1[50];
} MBR_BLOCK,* PMBR_BLOCK;
typedef struct _BPB_BLOCK { /////////////512bytes
INT8 BS_jmpBoo[3]; //Ofs:0,典型的如0xEB,0x3E,0x90
INT8 BS_OEMName[8];//Ofs:3,如MSWIN41
INT16 BPB_BytesPerSec;//Ofs:11 每扇区字节数
INT8 BPB_SecPerClus;//Ofs:13没簇扇区数
INT8 BPB_RsvdSecCn[2];
//INT16 BPB_RsvdSecCn;//Ofs:14 保留扇区数,从DBR到FAT的扇区数
INT8 BPB_NumFATs;
INT16 BPB_RootEntCnt;
INT16 BPB_TotSec16;
INT8 BPB_Media;
INT16 BPB_FATSz16;
INT16 BPB_SecPerTrk;
INT16 BPB_NumHeads;
unsigned long BPB_HiddSec;
unsigned long BPB_TotSec32;
INT8 BS_DrvNum;
INT8 BS_Reserved1;
INT8 BS_BootSig;
INT8 BS_VolID[4];
INT8 BS_VolLab[11];
INT8 BS_FilSysType[8];
INT8 ExecutableCode[448];
INT8 Marker[2];
} BPB_BLOCK,* PBPB_BLOCK;
typedef struct _BPB32_BLOCK { /////////////512bytes
INT8 BS32_jmpBoo[3];
INT8 BS32_OEMName[8];
INT16 BPB32_BytesPerSec;
INT8 BPB32_SecPerClus;
INT8 BPB32_RsvdSecCn[2];
INT8 BPB32_NumFATs;
INT16 BPB32_RootEntCnt;
INT16 BPB32_TotSec16;
INT8 BPB32_Media;
INT16 BPB32_EMPTY;
INT16 BPB32_SecPerTrk;
INT16 BPB32_NumHeads;
unsigned long BPB32_HiddSec;
unsigned long BPB32_TotSec32;
unsigned long BPB32_FATSz32;
INT16 BPB32_ExternFlag;
INT16 BPB32_FileSYSVer;
unsigned long RootClsNum;
INT8 ExecutableCode[464];
} BPB32_BLOCK,* PBPB32_BLOCK;
typedef struct _SYS_INFO_BLOCK{ ////////68bytes
unsigned long StartSector;
unsigned long TotalSector;
//INT8 BS_jmpBoo[3];
//INT8 BS_OEMName[8];
INT16 BPB_BytesPerSec;
INT8 BPB_SecPerClus;
//INT8 BPB_RsvdSecCn[2];
INT8 BPB_NumFATs;
INT16 BPB_RootEntCnt;
INT16 BPB_TotSec16;
INT8 BPB_Media;
INT16 BPB_FATSz16;
INT16 BPB_SecPerTrk;
INT16 BPB_NumHeads;
unsigned long BPB_HiddSec;
unsigned long BPB_TotSec32;
unsigned long BPB_FATSz32;///////////////////////fat32 add
INT8 BS_DrvNum;
//INT8 BS_Reserved1;
INT8 BS_BootSig;
INT8 BS_VolID[4];
INT8 BS_VolLab[11];
INT8 BS_FilSysType[8];
//INT8 ExecutableCode[448];
//INT8 Marker[2];
///////////////////////////////
unsigned long FatStartSector;
unsigned long RootStartSector;
//unsigned long DataStartSector;
unsigned long FirstDataSector;
//unsigned long FirstSectorofCluster;
} SYS_INFO_BLOCK,* PSYS_INFO_BLOCK;
typedef struct _FILE_INFO{ ////////22bytes
unsigned char bFileOpen;
unsigned int StartCluster;
unsigned long LengthInByte;
unsigned int ClusterPointer;
unsigned long SectorPointer;
unsigned int OffsetofSector;
unsigned char SectorofCluster;
unsigned long pointer;
unsigned int FatSectorPointer;
} FILE_INFO, * PFILE_INFO;
typedef struct _FILE32_INFO{ ////////22bytes
unsigned char bFileOpen;
unsigned long StartCluster;
unsigned long LengthInByte;
unsigned long ClusterPointer;
unsigned long SectorPointer;
unsigned long OffsetofSector;
unsigned char SectorofCluster;
unsigned long pointer;
unsigned int FatSectorPointer;
} FILE32_INFO, * PFILE32_INFO;
typedef struct _FREE_FAT_INFO{ ////////10bytes
unsigned long SectorNum;
unsigned int OffsetofSector;
unsigned long OldSectorNum;
} FREE_FAT_INFO, * PFREE_FAT_INFO;
typedef struct _DIR_INFO{ ///////////32bytes
unsigned char name[8];
unsigned char extension[3];
unsigned char attribute;
unsigned char Reserved[10];
unsigned int lastUpdateDate;
unsigned int lastUpdateTime;
unsigned int startCluster;
unsigned long length;
} DIR_INFO,* PDIR_INFO;
typedef struct _DIR32_INFO{ ///////////32bytes
unsigned char name[8];
unsigned char extension[3];
unsigned char attribute;
unsigned char Reserved;
unsigned char time10ms;
unsigned int filesettime;
unsigned int filesetday;
unsigned int fileaccessday;
unsigned int high16Cluster;
unsigned int lastUpdateTime;
unsigned int lastUpdateDate;
unsigned int low16Cluster;
unsigned long length;
} DIR32_INFO,* PDIR32_INFO;
unsigned long FirstSectorofCluster(unsigned int n);
unsigned int ThisFatSecNum(unsigned int clusterNum);
unsigned int ThisFatEntOffset(unsigned int clusterNum);
unsigned int GetNextClusterNum(unsigned int clusterNum);
//unsigned long FirstSectorofCluster32(unsigned int n);
//unsigned int ThisFatSecNum32(unsigned int clusterNum);
//unsigned int ThisFatEntOffset32(unsigned int clusterNum);
//unsigned int GetNextClusterNum32(unsigned int clusterNum);
//unsigned int GetClusterNumFromSectorNum(unsigned long sectorNum);
//unsigned long GetSecNumFromPointer(void);
//unsigned char GoToPointer(unsigned long pointer);
//unsigned int GetFreeCusterNum(void);
//unsigned int CreateClusterLink(unsigned int currentCluster);
//unsigned char DeleteClusterLink(unsigned int clusterNum);
//void UpdateFat(unsigned long sectorNum);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -