Page 1 of 1
tired of long file names in FAT
Posted: Mon Oct 23, 2006 2:48 am
by ces_mohab
just didn't find suitable documentation on long file names in fat.
I have a question.
a long file name has more than one entry must they follow each other
and a question in FAT
when deleting a file entry shall I shift up remaining entries
thanks ;
Posted: Mon Oct 23, 2006 3:50 am
by AJ
Hi,
Although I don't have a specific answer to your question, I was recently looking at
http://www.nondot.org/sabre/os/articles/FileSystems/, which may be helpful as there is a Microsoft document on the long filename specification.
Hope this helps,
Adam
Posted: Mon Oct 23, 2006 5:53 am
by Mikae
a long file name has more than one entry must they follow each other
Yes, they must. A set of a long name entries immediately precede a short name. Every long name entry has a number, in its 1st byte, which designates an ordinal number of a long entry. The last entry's ordinal number is ORed with 0x40.
when deleting a file entry shall I shift up remaining entries
You
may do it, but it is not necessary. It will significantly slow your driver. Usually, a driver just sets 1st byte of a short name and all of its long name entries to 0xE5 (0x5 is used for japanese(?) languages, and 0x0 means that the entry is deleted, there are no valid (non-deleted) entries after it) signature, which means, that the entry is deleted and can be used for a new file.
You can read FAT* specification at
http://download.microsoft.com/download/ ... gen103.doc
Posted: Mon Oct 23, 2006 8:11 am
by ces_mohab
Thanks AJ and Mikae;
I was reverse engineering FAT. and adding and deleting files and with a hex editor noticing changes.
Usually, a driver just sets 1st byte of a short name and all of its long name entries to 0xE5
I found winimage already doing that. and also I noticed that it ignores all entries after the first entry name begin with '\0'
so using the value 0xE5 is reasonable than 0x00
The last entry's ordinal number is ORed with 0x40.
which means the bit 6 while the first 5 bits are index of the long file name entry.
Posted: Mon Oct 23, 2006 8:15 am
by ces_mohab
when deleting a file entry shall I shift up remaining entries
You may do it, but it is not necessary. It will significantly slow your driver.
may i just bring the last entry up and taking care about long file names.
Posted: Mon Oct 23, 2006 10:33 am
by JAAman
I found winimage already doing that. and also I noticed that it ignores all entries after the first entry name begin with '\0'
so using the value 0xE5 is reasonable than 0x00
that is because when a disk is formated, all entries become /0 -- and the MS driver (and all other drivers -- its a required part of the spec) write entries in the first availible slot, therefore, if you find a file which begins with /0, that means that entry has never been used, and because the entries are used in order, it also means no further enteries have ever been used -- its a performance shortcut
0x00 means never used
0xE5 means deleted
0x05 means first character is a 0xE5 (lower case sigma, iirc)