⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dosbpb.h

📁 从大量的wince源代码中剥离出的fat文件系统源代码.移植性非常高. 里面带有source i.rar
💻 H
📖 第 1 页 / 共 2 页
字号:
typedef struct EXT_BIGIBMBOOT_HEADER { /* */
        BYTE    EXT_BGBOOT_JUMP[3];
        BYTE    EXT_BGBOOT_OEM[8];
        EXT_BIGBPB_INFO EXT_BGBOOT_BPB;
        BYTE    EXT_BGPHYDRV;
        BYTE    EXT_BGCURHD;
        BYTE    EXT_BGBOOT_SIG;
        DWORD   EXT_BGBOOT_SERIAL;
        BYTE    EXT_BGBOOT_VOL_LABEL[11];
        BYTE    EXT_BGSYSTEM_ID[8];
} EXT_BIGIBMBOOT_HEADER;

/* ASM
.errnz  EXT_BIGIBMBOOT_HEADER.EXT_BGBOOT_JUMP   NE  EXT_IBMBOOT_HEADER.EXT_BOOT_JUMP
.errnz  EXT_BIGIBMBOOT_HEADER.EXT_BGBOOT_OEM    NE  EXT_IBMBOOT_HEADER.EXT_BOOT_OEM
.errnz  EXT_BIGIBMBOOT_HEADER.EXT_BGBOOT_BPB    NE  EXT_IBMBOOT_HEADER.EXT_BOOT_BPB
 */

#pragma pack()



typedef struct DPB {
    HVOLB   dpb_drive;                  /* Logical drive identifier */
    BYTE    dpb_unit;                   /* Driver unit number of DPB */
    UINT    dpb_sector_size;            /* Size of physical sector in bytes */
    BYTE    dpb_cluster_mask;           /* Sectors/cluster - 1 */
    BYTE    dpb_cluster_shift;          /* Log2 of sectors/cluster */
    UINT    dpb_first_fat;              /* Starting record of FATs */
    BYTE    dpb_fat_count;              /* Number of FATs for this drive */
    UINT    dpb_root_entries;           /* Number of directory entries */
    UINT    dpb_first_sector;           /* First sector of first cluster */
    UINT    dpb_max_cluster;            /* Number of clusters on drive + 1 */
    /*
     * If the following field is 0, this is a BigFAT drive and the
     * extdpb fields MUST be used. For non BigFAT drives (this field is non-0),
     * the extdpb_ fields MUST NOT be used internally by MS-DOS (there are non
     * MS-DOS folks like compression drivers that create DPBs at the old size).
     * For a non-BigFAT DPB gotten through the INT 21h API (AX=7302h) the
     * extdpb_ fields are extended versions of the matching dpb_ fields and
     * either the dpb_ or extdpb_ field can be used.
     */
    UINT    dpb_fat_size;               /* Number of records occupied by FAT */
    UINT    dpb_dir_sector;             /* Starting record of directory */
    DWORD   dpb_driver_addr;            /* Pointer to driver */
    BYTE    dpb_media;                  /* Media byte */
#ifdef NOTFAT32
    BYTE    dpb_first_access;           /* This is initialized to -1 to force a
                     * media check the first time this DPB
                     * is used.
                     */
#else
    BYTE   dpb_flags;                   /* This is initialized to 80h to force a
                     * media check the first time this DPB
                     * is used.
                     */
#endif
    DWORD   dpb_next_dpb;               /* Pointer to next DPB */
    UINT    dpb_next_free;              /* # of last allocated cluster */
    UINT    dpb_free_cnt;               /* Count of free clusters, -1 if unknown */
#ifndef NOTFAT32
    UINT    extdpb_free_cnt_hi;         /* high word of free_cnt if BigFAT */
    UINT    extdpb_flags;               /* FAT32 flags from BPB */
    UINT    extdpb_FSInfoSec;           /* Sec # of file system info sector (-1 if none) */
    UINT    extdpb_BkUpBootSec;         /* Sec # of backup boot sector (-1 if none) */
    DWORD   extdpb_first_sector;        /* First sector of first cluster */
    DWORD   extdpb_max_cluster;         /* Number of clusters on drive + 1 */
    DWORD   extdpb_fat_size;            /* Number of records occupied by FAT */
    DWORD   extdpb_root_clus;           /* cluster # of first cluster of root dir */
    DWORD   extdpb_next_free;           /* # of last allocated cluster */
#endif
} DPB;
typedef DPB *PDPB;
typedef DPB FAR *LPDPB;

#define DPBSIZ      (sizeof(DPB))   /* Size of the structure in bytes */


#define DSKSIZ      dpb_max_cluster /* Size of disk (used during init only) */

#define DPB_NEXTFREEOFF 29              // offset of next_free


// dpb_flags bits
// PLEASE NOTE CAREFULLY!!!! This used to be a value field in the old pre-FAT32
//               DPB. Value 0xFF was equivalent to DPB_F_FIRSTACCESS.
//               For this reason it must be OK if all the bits in
//               here get SET by some random app. This may cause
//               unwanted side effects, but it must not cause
//               DAMAGE.
//
//               There is clean up for this special case and
//               for this reason AT LEAST ONE OF THE 8 BITS
//               IN THIS BYTE MUST NEVER BE DEFINED TO MEAN
//               ANYTHING!!!!!! So that the special case "some
//               piece of software other than MS-DOS shoved
//               0FFh in here" can be detected.
//
#define DPB_F_FREECNTCHANGED     0x01   /* Free cnt has changed  (FAT32 ONLY) */
#define DPB_F_FREECNTCHANGEDBIT  0
#define DPB_F_ROOTCLUSCHANGED    0x02   /* Root Clus has changed  (FAT32 ONLY) */
#define DPB_F_ROOTCLUSCHANGEDBIT 1

#define DPB_F_EXTFLGSCHANGED     0x08   /* Mirror setting changed (FAT32 ONLY) */
#define DPB_F_EXTFLGSCHANGEDBIT  3

#define DPB_F_FIRSTACCESS    0x80   /* This MUST be 80h (the sign bit, see FAT.ASM) */
#define DPB_F_FIRSTACCESSBIT     7

// extdpb_flags bits
//  NOTE: It is a design point of this field that the proper "default"
//        initialization is 0.
//
#define DPB_EF_ActiveFATMsk 0x000F  /* 0 based active FAT # */
#define DPB_EF_NoFATMirror  0x0080  /* Do not Mirror active FAT to inactive FATs */
#define DPB_EF_NoFATMirrorBit   7
#define DPB_EF_CompressedVol    0x0100  /* Volume is compressed */
#define DPB_EF_CompressedVolBit 8

// End of definitions and types migrated from DPB.H



/*--------------------------------------------------------------------------*/
/*  Format IOCTL Device Parameter Block Structure -                  */
/*--------------------------------------------------------------------------*/

#define MAX_SEC_PER_TRACK   64

typedef struct tagODEVPB {
    BYTE    SplFunctions;
    BYTE    devType;
    UINT    devAtt;
    UINT    NumCyls;
    BYTE    bMediaType;         /* 0=>1.2MB and 1=>360KB */
    BPB     BPB;
    BYTE    A_BPB_Reserved[6];           // Unused 6 BPB bytes
    BYTE    TrackLayout[MAX_SEC_PER_TRACK * 4 + 2];
} ODEVPB;

#define OLDTRACKLAYOUT_OFFSET   (7+sizeof(BPB)+6)  // Offset of tracklayout

typedef struct tagEDEVPB {
    BYTE    SplFunctions;
    BYTE    devType;
    UINT    devAtt;
    UINT    NumCyls;
    BYTE    bMediaType;         /* 0=>1.2MB and 1=>360KB */
    BIGFATBPB BPB;
    BYTE    reserved1[32];
    BYTE    TrackLayout[MAX_SEC_PER_TRACK * 4 + 2];
} EDEVPB;

#define EXTTRACKLAYOUT_OFFSET   (7+sizeof(BIGFATBPB)+32)// Offset of tracklayout
                                                        // in a Device Parameter Block */
//
// NOTE that it is pretty irrelevant whether you use NonExtDevPB or ExtDevPB
//  until you get up to the new FAT32 fields in the BPB and/or the
//  TrackLayout area as the structures are identical andinterchangeable
//  up to that point.
//
typedef struct tagDEVPB {
    union   {
    ODEVPB  OldDevPB;
    EDEVPB  ExtDevPB;
    } DevPrm;
    BYTE    CallForm;
} DEVPB;
typedef DEVPB *PDEVPB;
typedef DEVPB FAR *LPDEVPB;

//
// Defines for devType field
//
#define DEVPB_DEVTYP_525_0360   0
#define DEVPB_DEVTYP_525_1200   1
#define DEVPB_DEVTYP_350_0720   2
#define DEVPB_DEVTYP_800_SD 3
#define DEVPB_DEVTYP_800_DD 4
#define DEVPB_DEVTYP_FIXED  5
#define DEVPB_DEVTYP_TAPE   6
#define DEVPB_DEVTYP_350_1440   7
#define DEVPB_DEVTYP_350_2880   9

//
// Bit masks for devAtt
//
#define DEVPB_DEVATT_NONREM 0x0001  // set if non removable
#define DEVPB_DEVATT_CHNGLN 0x0002  // set if changeline supported on drive
#define DEVPB_DEVATT_FAKE_BPB   0x0004  // when set, don't do a build bpb
#define DEVPB_DEVATT_GD_TRKL    0x0008  // set if track layout has no funny sectors
#define DEVPB_DEVATT_MLT_LOG    0x0010  // set if more than one drive letter mapped
#define DEVPB_DEVATT_OWN_PHY    0x0020  // set if this drive currently is mapped to the phys unit
#define DEVPB_DEVATT_CHNGD  0x0040  // set if media changed
#define DEVPB_DEVATT_SET_DASD   0x0080  // do a set DASD before next format
#define DEVPB_DEVATT_FMT_CHNG   0x0100  // media changed by format
#define DEVPB_DEVATT_UNF    0x0200  // unformatted media (non-rem only)
#define DEVPB_DEVATT_X13    0x0400  // extended INT 13 used for drive
#define DEVPB_DEVATT_DMF    0x0800  // Last access was a DMF floppy

//
// DEFINES for the AX=4302h GetVolumeInformation BX FileSysFlags return
//
#undef  FS_CASE_IS_PRESERVED            // undefine in case WINBASE.H was included
#define FS_CASE_IS_PRESERVED            0x0002

#undef  FS_VOL_IS_COMPRESSED            // undefine in case WINBASE.H was included
#define FS_VOL_IS_COMPRESSED            0x8000

#undef  FS_VOL_SUPPORTS_LONG_NAMES      // undefine in case WINBASE.H was included
#define FS_VOL_SUPPORTS_LONG_NAMES  0x4000

// End of definitions and types migrated from DMAINT.H


#endif // INCLUDE_DOSBPB

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -