Offset (bytes) | Size (bytes) | Name |
---|---|---|
0 | 11 | DIR_Name |
11 | 1 | DIR_Attr |
12 | 1 | DIR_NTRes |
13 | 1 | DIR_CrtTimeTenth |
14 | 2 | DIR_CrtTime |
16 | 2 | DIR_CrtDate |
18 | 2 | DIR_LstAccDate |
20 | 2 | DIR_FstClusHI |
22 | 2 | DIR_WrtTime |
24 | 2 | DIR_WrtDate |
26 | 2 | DIR_FstClusLO |
28 | 4 | DIR_FileSize |
Information:
The dot.
entry is a directory that points to itself.
The dotdot..
entry points to the starting cluster of the parent of this directory (which is 0 if this directories parent is the root directory).
DIR Δ offset
FirstRootDirSecNum
BPB_ResvdSecCnt + (BPB_NumFATs * BPB_FATSz16)
DIR_Name
Short name
Special notes about the first byte (DIR_Name[0]) of a FAT directory entry:
• If DIR_Name[0] == 0xE5
, then the directory entry is free (there is no file or directory name in this entry).
• If DIR_Name[0] == 0x00
, then the directory entry is free (same as for 0xE5), and there are no allocated directory entries after this one (all of the DIR_Name[0] bytes in all of the entries after this one are also set to 0). The special 0 value, rather than the 0xE5 value, indicates to FAT file system driver code that the rest of the entries in this directory do not need to be examined because they are all free.
• If DIR_Name[0] == 0x05
, then the actual file name character for this byte is 0xE5. 0xE5 is actually a valid KANJI lead byte value for the character set used in Japan. The special 0x05 value is used so that this special file name case for Japan can be handled properly and not cause FAT file system code to think that the entry is free.
The DIR_Name field is actually broken into two parts+ the 8-character main part of the name, and the 3-character extension. These two parts are “trailing space padded” with bytes of 0x20. DIR_Name[0] may not equal 0x20.
There is an implied ‘.’ character between the main part of the name and the extension part of the name that is not present in DIR_Name. Lower case characters are not allowed in DIR_Name (what these characters are is country specific).
The following characters are not legal in any bytes of DIR_Name:
• Values less than 0x20 except for the special case of 0x05 in DIR_Name[0] described above.
• 0x22, 0x2A, 0x2B, 0x2C, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x5B, 0x5C, 0x5D, and 0x7C.
Here are some examples of how a user-entered name maps into DIR_Name:
In FAT directories all names are unique. Look at the first three examples earlier. Those different names all refer to the same file, and there can only be one file with DIR_Name set to “FOO BAR” in any directory.