tired of long file names in FAT

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
ces_mohab
Member
Member
Posts: 77
Joined: Wed Oct 18, 2006 3:08 am

tired of long file names in FAT

Post 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 ;
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post 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
Mikae
Member
Member
Posts: 94
Joined: Sun Jul 30, 2006 1:08 pm

Post 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
User avatar
ces_mohab
Member
Member
Posts: 77
Joined: Wed Oct 18, 2006 3:08 am

Post 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.

:wink:
User avatar
ces_mohab
Member
Member
Posts: 77
Joined: Wed Oct 18, 2006 3:08 am

Post 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.
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post 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)
Post Reply