📄 fat.h
字号:
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) 1995-2000 Microsoft Corporation
Module Name: fat.h
Abstract: Boot loader FAT support code.
Functions: None.
Notes:
--*/
#ifndef _FAT_H_
#define _FAT_H_
// Preprocessor definitions.
//
#define PARTSIG_SIZE 2 // partition signature size (in bytes)
#define PARTTBL_SIZE 64 // whole partition table size (in bytes)
#define PARTACTV_FLAG 0x80 // active partition flag
#define MAX_PARTITIONS 4 // total number of partition table entries
#define SECTOR_SIZE 512 // sector size (in bytes)
#define FAT_EOF 0xfffe // EOF tag
// FAT boot sector header.
//
#pragma pack(1)
typedef struct
{
UCHAR rsvd1[3]; // jmp instruction
UCHAR oemname[8];
USHORT bytespsect;
UCHAR sectspclust;
USHORT numrsvdsects;
UCHAR numfats;
USHORT numrootentry;
USHORT numsects;
UCHAR mediadesc;
USHORT sectspfat;
USHORT sectsptrk;
USHORT numheads;
ULONG numhdnsects;
ULONG numsectshuge;
UCHAR drivenum;
UCHAR rsvd2;
UCHAR sig;
ULONG volid;
UCHAR vollabel[11];
UCHAR fstype[8];
} BSECTHDR, *PBSECTHDR;
// FAT partition table.
//
#pragma pack(1)
typedef struct
{
UCHAR actvflg;
UCHAR ssect;
UCHAR shd;
UCHAR scyl;
UCHAR type;
UCHAR esect;
UCHAR ehd;
UCHAR ecyl;
ULONG slba;
ULONG size;
} PARTTE, *PPARTTE;
// FAT directory entry.
//
#pragma pack(1)
typedef struct
{
UCHAR fname[8];
UCHAR fext[3];
UCHAR fattr;
UCHAR foo[10];
USHORT lmodtime;
USHORT lmoddate;
USHORT fclust;
ULONG fsize;
} DIRENTRY, *PDIRENTRY;
// BIN image and record headers
//
#pragma pack(1)
typedef struct // Image header (one per BIN image)
{
CHAR syncbytes[7];
ULONG imgaddr;
ULONG imglen;
} IMGHDR, *PIMGHDR;
#pragma pack(1)
typedef struct // Record header (one per section in image)
{
ULONG recaddr;
ULONG reclen;
ULONG recchksum;
} RECHDR, *PRECHDR;
// File information structure.
//
typedef struct
{
USHORT curclust;
ULONG fsize;
ULONG cursect;
UCHAR sectreminclust;
USHORT byteofst;
USHORT bytesreminsect;
USHORT clusttlbofst;
} FILEINFO, *PFILEINFO;
// Function prototypes
//
int init_fat(void);
int file_open(PUCHAR pfname);
int file_close(void);
int file_read(PUCHAR pbuf, ULONG len);
int build_clust_list(void);
#endif // _FAT_H_.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -