Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Retrieving files with invalid names (Users)

posted by ecm Homepage E-mail, Düsseldorf, Germany, 13.08.2009, 12:10

I now added some kind of "support" for files with invalid file names to my current RxDOS source code. When it's determined that the file name is invalid but the attributes show that this entry should be a file or directory (not a label/LFN/whatever), the file name is internally replaced by a representation of the directory entry's cluster and an index into the cluster. This is coded in digits 0..9 and letters A..V allowing to store 5 bits per character. Since a file name created that way is unique on the drive (as long as the directory entry doesn't move), it's unique within any given directory too. To insure that the name doesn't collide with actually existing (long or short) names in the same directory, the last character of the name is set to colon (:), which is an otherwise invalid character for both long and short names. Since the name is always zero-padded, that colon comes as the 8th character only, so the DOS name expansion code can tell it apart from an actual drive letter.

Besides the ability to see (using Find First/Find Next, aka DIR) and access (as long as the application doesn't do explicit file name checks itself) files with valid long file name only (whether DOSLFN installed/RxDOSLFN embedded or not), this method also works for any other file with corrupted file name and for files that aren't accessible because a character device with the same name is installed. (In MS-DOS, file searching with wildcards such as "DIR *.*" [or simply "DIR"] shows files and directories named as character devices but they aren't accessible.)

Since a name provided this way is actually invalid, renaming or moving the file to another place but with the same name won't work. Packing a file with such a name into an archive might be a bad idea too.

---
l

 

Complete thread:

Back to the forum
Board view  Mix view
22762 Postings in 2122 Threads, 402 registered users (0 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum