FAT Clusters
Posted: Sun Sep 04, 2011 6:02 pm
While writing a driver for FAT32 file system I have stumbled upon a problem,
It goes as the following, lets assume I have a file called "text.txt" and it contains some data, now,
It is the the root directory so we just need to read the cluster that is defined in the EBPB( it is 2), which maps to 2063'rd sector, so far so good,
Now we found the the file's entry,
54 45 58 54 20 20 20 20 54 58 54 20 00 00 62 7E 24 3F 24 3F 00 00 62 7E 24 3F 26 00 AB 0B 00 00
TEXT TXT ..b~$?$?..b~$?&.«...
As we can see, the cluster of the file is 0x26(Highlighted), now cluster 0x26 should map to 2063+(38-2)=2099 which is, in fact, wrong,
because I can clearly see that the file doesn't even start until sector 2351.
What am I doing wrong?
Best regards,
Ness
P.S. Linux reads the file fine.
It goes as the following, lets assume I have a file called "text.txt" and it contains some data, now,
It is the the root directory so we just need to read the cluster that is defined in the EBPB( it is 2), which maps to 2063'rd sector, so far so good,
Now we found the the file's entry,
54 45 58 54 20 20 20 20 54 58 54 20 00 00 62 7E 24 3F 24 3F 00 00 62 7E 24 3F 26 00 AB 0B 00 00
TEXT TXT ..b~$?$?..b~$?&.«...
As we can see, the cluster of the file is 0x26(Highlighted), now cluster 0x26 should map to 2063+(38-2)=2099 which is, in fact, wrong,
because I can clearly see that the file doesn't even start until sector 2351.
What am I doing wrong?
Best regards,
Ness
P.S. Linux reads the file fine.