Storing Filenames
When an application stores filenames, it should follow these guidelines:
-
Using an alias instead of a long filename can break the association with the file because certain operations, such as editing the file, can potentially change the alias. For example, if the server side of a network uses the alias instead of the long filename of a client file to store information related to the file (such as access permissions), it will be more susceptible to lose the association of permissions with the file. If the user edits the file on the client side, the alias may potentially change, and if it changes, the server side will lose the associated information.
-
When an application caches the absolute path to a filename, the path itself can be a mixture of filenames and aliases. Because of this, applications that need to store a path should store a canonical form of the absolute path. Applications may use either Get Short Path Name (Interrupt 21h Function 7160h Minor Code 1h) or te GetShortPathName function to retrieve the canonical form of a path. Applications that need to determine if two files are the same can use the nFileIndexHigh and nFileIndexLow members of the BY_HANDLE_FILE_INFORMATION structure. Note, however, that nFileIndexHigh and nFileIndexLow might not be supported on real-mode file systems, such as Microsoft CD-ROM Extensions (MSCDEX), or real-mode networks.
-
An installation program that needs to enter information into configuration files, such as CONFIG.SYS, should make sure it uses paths that only consist of 8.3 filename components, because the long filenames will not be visible at boot up time when startup files, such as CONFIG.SYS and AUTOEXEC.BAT, are processed. Again, the GetShortPathName function should be used for this purpose.