Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ecm-pushbx opened this issue Jan 10, 2025 · 0 comments
Open

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

ecm-pushbx opened this issue Jan 10, 2025 · 0 comments

Comments

@ecm-pushbx
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant