FAT: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Line 551: Line 551:


After the correct cluster has been loaded into memory, the next step is to read and parse all of the entries in it. Each entry is 32 bytes long. For each 32 byte entry this is the flow of execution:
After the correct cluster has been loaded into memory, the next step is to read and parse all of the entries in it. Each entry is 32 bytes long. For each 32 byte entry this is the flow of execution:
# Does the entry even exist? If the first byte of the entry is equal to (==) 0 or 0xE5 then the entry does _not_ exist. Otherwise it does exist. Yes, goto number 2. No, goto number 7
# Does the entry even exist? If the first byte of the entry is equal to 0 or 0xE5 then the entry does _not_ exist. Otherwise it does exist. Yes, goto number 2. No, goto number 7
# Is this entry a long file name entry? If the 11'th byte of the entry equals (==) 0x0F, then it is a long file name entry. Otherwise, it is not. Yes, goto number 3. No, goto number 4
# Is this entry a long file name entry? If the 11'th byte of the entry equals 0x0F, then it is a long file name entry. Otherwise, it is not. Yes, goto number 3. No, goto number 4
# Read the portion of the long filename into a temporary buffer. goto 7
# Read the portion of the long filename into a temporary buffer. goto 7
# Parse the data for this entry using the table from further up on this page. It would be a good idea to save the data for later. Possibly in a virtual file system structure. goto number 5
# Parse the data for this entry using the table from further up on this page. It would be a good idea to save the data for later. Possibly in a virtual file system structure. goto number 5
Line 559: Line 559:
# Increment pointers and/or counters and check the next entry. (goto number 1)
# Increment pointers and/or counters and check the next entry. (goto number 1)


This process should be repeated until all of the entries have been read from the cluster. You should then check to see if there is another cluster following this one in the cluster chain or if this is the last cluster in the chain. See the section called following cluster chains for more information. You should do the above process for each cluster in the chain, following it until there are no more clusters left in the chain. Then you can check if any of the entries that you just read are directories. If the are they should each be read in the same way starting with their first cluster number which is stored in the entry.
This process should be repeated until all of the entries have been read from the cluster. You should then check to see if there is another cluster following this one in the cluster chain or if this is the last cluster in the chain. See [[#Following_Cluster_Chains|section below]] and [[#File_Allocation_Table|FAT]] section for more information. You should do the above process for each cluster in the chain, following it until there are no more clusters left in the chain. Then you can check if any of the entries that you just read are directories. If the are they should each be read in the same way starting with their first cluster number which is stored in the entry.


=== Following Cluster Chains ===
=== Following Cluster Chains ===