Open FrankHB opened 9 years ago
From Microsoft FAT Specification Section 3.5:
First, determine the count of sectors occupied by the root directory: RootDirSectors = ((BPB_RootEntCnt * 32) + (BPB_BytsPerSec – 1)) / BPB_BytsPerSec Note that on a FAT32 volume, the BPB_RootEntCnt value is always 0. Therefore, on a FAT32 volume, RootDirSectors is always 0.
RootDirSectors = ((BPB_RootEntCnt * 32) + (BPB_BytsPerSec – 1)) / BPB_BytsPerSec
Note that on a FAT32 volume, the BPB_RootEntCnt value is always 0. Therefore, on a FAT32 volume, RootDirSectors is always 0.
In source/partition.c, line 250:
partition->dataStart = partition->rootDirStart + (( u8array_to_u16(sectorBuffer, BPB_rootEntries) * DIR_ENTRY_DATA_SIZE) / partition->bytesPerSector);
It seems that the correct code would be:
partition->dataStart = partition->rootDirStart + (( u8array_to_u16(sectorBuffer, BPB_rootEntries) * DIR_ENTRY_DATA_SIZE + (partition->bytesPerSector - 1)) / partition->bytesPerSector);
Not tested yet, not sure.
From Microsoft FAT Specification Section 3.5:
In source/partition.c, line 250:
It seems that the correct code would be:
Not tested yet, not sure.