FAT Filesystem
FAT Filesystem
Alright, I am reading a disk to get the FS info, i have the dir entry, a file finding function, but when it finds the file and calculates the sector it's on (cluster is begins at multiplied by number of sectors in a cluster), but i always get an incorrect value (i.e. it says 74 when it should be 105 (i used a hex editor and some math to figure out the right value), how could i tune this so it's correct?
Re:FAT Filesystem
You need to add on the number of FAT sectors, root dir sectors and reserved sectors(eg bootsect) Quick arithmitic tells me that this will turn 74 to 105
Re:FAT Filesystem
Ok, i've come up with the solution, thanks for your help.
for anyone who may have the same problem:
where rdir is a structure containing the dir entry, rootloc is the location (sector-wise) of the root directory, clustersize is the # of sectors in a cluster, and bs is a structure containing the boot sector data
for anyone who may have the same problem:
Code: Select all
filestart = (((rdir.start - 2) * clustersize) + (bs.reserved) + ((FAT_CVT_U16(bs.dir_entries) * 32) / 512) + (rootloc)) - 1;