Like the FAT file system, the VFAT file system used in Windows 95 organizes data on both hard disks and floppy disks. Because it is compatible with the FAT file system, using file allocation tables and directory entries to store information about the contents of a disk, you do not need to reformat your disk structure when you install Windows 95. VFAT supports long filenames by storing the names and other information, such as the date and time each file was last accessed, in extended FAT structures.
In the VFAT system, a filename can contain as many as 255 characters, including a terminating null character. VFAT allows pathnames of as many as 260 characters, including the terminating null. Remember that the pathname contains the full filename; if your filename is 255 characters, only 4 characters are left for the path. (The last character is the terminating null.)
The VFAT file system supports dual name spacesthat is, it keeps track of both short (8.3) and long filenamesso that it can work with older applications that allow only short names as well as newer applications that permit long names. When you run an older application with a VFAT file system, you will see the 8.3 filename.
When an application creates a file, the API that is used (Win32 or Win16) determines whether long filenames are supported. Using the Win32 CreateFile function sets up a file with both a long filename and an associated 8.3 alias. An 8.3 alias is generated for every long filename, and the file can be accessed by either name. Your application can use the GetShortName function to get the alias. The alias is based on the long filename and on the directory in which the file resides. If you change a long filename or copy the file to a different directory, the alias might change. The alias is created using the following basic algorithm:
An interesting side effect of filename aliasing occurs when you use the FindFirstFile and FindNextFile functions. Windows 95 checks for both the long filename and the alias, for compatibility reasons. If, for instance, you search for a file using the pattern *1, you might find a file named Whatchamacallit, whose alias is WHATCH~1. To determine the name that actually caused the match, you can check both the cFileName and cAlternateFileName members of the WIN32_FIND_DATA structure.