Reputation: 21
I am trying to parse the root directory of FAT32 in order to get a dir list in the root folder.
So I need to go over all the directory entries in the root directory and parse them. My problem is that I don't know when to stop the iteration - How to get the size of the root directory?
I noticed that there is a byte in the boot sector - the number of the entries in the root - but in FAT32 the value is always 0, So how can i get the size of the directory?
Upvotes: 2
Views: 2939
Reputation: 14880
The short integer at address 17 of the boot sector is 0 for FAT32 by definition, it's non-zero only for older FATs. The integer at address 44 should instead point you to the first cluster where the root directory resides. (That cluster is usually cluster #2.)
For FAT32 your code should treat the root directory as any other (non-root) directory.
Upvotes: 1