Skip to content

Int 21.7303 returns one too many in count of total clusters #194

@ecm-pushbx

Description

@ecm-pushbx

This is where function 7303h uses dpb_size or dpb_xsize:

(ISFAT32(dpbp) ? dpbp->dpb_xsize : dpbp->dpb_size);

But function 36h uses dpb_xsize minus one:

ntotal = dpbp->dpb_xsize - 1;

Or dpb_size minus 1 on FAT12/FAT16:

*nc = dpbp->dpb_size - 1;

The field is marked as "number of clusters plus 1":

UWORD dpb_size; /* # of clusters+1 on media */

In other words the DPB field gives the maximum valid cluster number (0 and 1 are reserved), plus one gives amount of FAT entries, plus one minus two = minus one gives amount of data clusters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompatibilityissue may effect compatibility

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions