Long File Name LFN Root Directory entries data into its data space supporting read-only hidden system volume label attributes Bits 0FH enumeration functions entry Unicode format Byte of ASCII Bits

Files Recovery Software
Home Contact Details Customer Support Download Demo Products  

 
 

Long File Name (LFN)

As we have already discussed earlier in Root Directory Discussion, Previously the root directory used to be fixed in size and located at a fixed position on disk but now it is free to grow as necessary as it is now treated as a file.

This is very important to long filenames because each long filename uses multiple directory entries. Adding long filename support to an operating system that uses 8.3 filenames is not as simple as expanding directory entries to hold more than 11 characters.

If this new operating system returns 255-character filenames, many older applications, which expect to receive no more than 11 characters, would crash because a program has to set aside memory to store the filenames it reads, and if it sets aside 16 Bytes for a filename and the operating system copies (say) 32 characters into that space, then other data gets overwritten. A sure way to break an application is to copy random data into its data space.

To overcome this problem, a clever solution was found in Windows 95, to the problem of supporting long filenames while preserving compatibility with previous versions of DOS and Windows applications.

When most applications (except for low-level disk utilities such as the Norton Disk Doctor) query the system for file and subdirectory names, they do so not by reading directory entries directly off the disk, but by using enumeration functions built into the operating system.

As we know that a directory entry is marked with the combination of read-only, hidden, system, and volume label attributes Bits. Likely, if the attribute byte of Directory Entry holds the value 0FH the enumeration functions built into all existing versions of DOS and all Pre-Windows 95 versions of Windows will skip over that directory entry as if it were not there.

Then, the solution was to store two names for every file and subdirectory, a short name that is visible to all applications and a long name that is visible only to Windows 95 (and Later) applications and to applications that have been rewritten to add support for long filenames. Short filenames are stored in 8.3 formats in conventional 32-byte directory entries.

We have already discussed that Windows creates a short filename from a long one by truncating it to six uppercase characters and adding "~1" to the end of the base filename.

If there is already another filename with the same first six characters, the number is incremented. The extension is kept the same, and any character that was illegal in earlier versions of Windows and DOS is replaced with an underscore.

The Long filenames are stored in specially formatted 32-Byte Long File Name (LFN) Directory Entries marked with attribute bytes set to 0FH. For a given file or subdirectory, a group of one or more Long File Name directory entries immediately precedes the single 8.3 directory entry on the disk.

Each Long File Name directory entry contains up to 13 characters of the long filename, and the operating system strings together as many as needed to comprise an entire long filename.

For a Long File Name directory entry, filenames are stored in Unicode format, which requires 2 Bytes per character as opposed to 1 Byte of ASCII. Filename characters are spread among three separate fields:

  • The first 10 Bytes (five characters) in length,
  • The second 12 Bytes (six characters),
  • The third 4 Bytes (two characters).

The lowest five Bits of the first byte of directory entry hold a sequence number that identifies the position of directory entry relative to other Long File Name directory entries associated with the same file.

If a long filename requires three LFN directory entries, the sequence number of the first will be 1, that of the second will be 2, and the sequence number of the third will be 3 and Bit 6 of the first Byte of third entry is set to 1 to indicate that it is the last entry in the sequence.

The attribute field appears at the same location in LFN directory entries as in 8.3 directory entries because the file system does not know which type of directory entry it is dealing with until after it examines the attribute byte. The starting cluster number field also appears at the same location, but in LFN directory entries its value is always 0. The type indicator field also holds 0 in every long filename.

One of the problems with long filenames is that they consume more disk space than short ones.  That is not a big deal when long names are stored in subdirectories, because as long as disk space is available, subdirectories can grow to accommodate added directory entries but the maximum number of directory entries available in the root directory is fixed, and long filenames waste space in the root directory which is limited in size.

Now for Example, if the root directory of a hard disks contains at most 512 directory entries, because a 128-character name requires 11 entries, 10 for the long name and 1 for the short name, you could create only 46 files and subdirectories in the root directory if each were given a 128-character name.

The problem goes away for FAT32 also because the root directory under FAT32 can grow as well because in FAT32 system the root directory is treated as a File which can grow in size.

Previous page

page 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20


page 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35

Next page
 
 
Data Recovery Book
 
Chapter 1 An Overview of Data Recovery
Chapter 2 Introduction of Hard Disks
Chapter 3 Logical Approach to Disks and OS
Chapter 4 Number Systems
Chapter 5 Introduction of C Programming
Chapter 6 Introduction to Computer Basics
Chapter 7 Necessary DOS Commands
Chapter 8 Disk-BIOS Functions and Interrupts Handling With C
Chapter 9 Handling Large Hard Disks
Chapter 10 Data Recovery From Corrupted Floppy
Chapter 11 Making Backups
Chapter 12 Reading and Modifying MBR with Programming
Chapter 13 Reading and Modifying DBR with Programming
Chapter 14 Programming for “Raw File” Recovery
Chapter 15 Programming for Data Wipers
Chapter 16 Developing more Utilities for Disks
Appendix Glossary of Data Recovery Terms
 
 

Pro Data Doctor

Home

Products

Contact Details

Customer Support

Download Demo

Terms and Conditions

 
Pro Data Doctor