Microsoft KB Archive/114816

= Faster 8.3 Converted Long Filenames in NTFS =

Article ID: 114816

Article Last Modified on 11/1/2006

-

APPLIES TO


 * Microsoft Windows NT Workstation 3.5
 * Microsoft Windows NT Workstation 3.51
 * Microsoft Windows NT Workstation 4.0 Developer Edition
 * Microsoft Windows NT Server 3.5
 * Microsoft Windows NT Server 3.51
 * Microsoft Windows NT Server 4.0 Standard Edition

-



This article was previously published under Q114816



SUMMARY
Several Long Filename to 8.3 (MS-DOS compatible) name conversion performance enhancements have been introduced in Windows NT Workstation and Windows NT Server version 3.5(and later). These enhancements include a faster worst case scenario algorithm, as well as improved context retention across enumeration calls. Although these changes yield substantial improvements, you should continue to avoid using numerous long, similar names.



MORE INFORMATION
In Windows NT version 3.1, worst-case file manipulation of extremely large directories (500 to several thousand files) with similar long names was time consuming. This was evident when receiving screen output from a DIR command or reading a directory in File Manager.

In Windows NT 3.5(and later), NTFS has been enhanced to address these worst- case scenarios as well as other general improvements in 8.3 enumeration.

Under Windows NT 3.1 NTFS, longfile names are converted to 8.3 names to support DOS based clients. This conversion simply takes the first 6 characters of the long name, and uses a "~n" suffix (where "n" is number) to keep the name unique if needed. When the tenth filename is converted and the suffix exceeds 2 characters, only 5 characters of the name are used to accommodate the three characters in the suffix and so on as needed. For example:

  MyTermPaper.doc   becomes  MYTERM~1.DOC MyTermPaper2.doc becomes  MYTERM~2.DOC MyTermPaper3.doc becomes  MYTERM~3.DOC MyTermPaper4.doc becomes  MYTERM~4.DOC MyTermPaper5.doc becomes  MYTERM~5.DOC MyTermPaper6.doc becomes  MYTERM~6.DOC MyTermPaper7.doc becomes  MYTERM~7.DOC MyTermPaper8.doc becomes  MYTERM~8.DOC MyTermPaper9.doc becomes  MYTERM~9.DOC MyTermPaper10.doc becomes MYTER~10.DOC MyTermPaper11.doc becomes MYTER~11.DOC

That algorithm had been changed in Windows NT 3.5(and later) for enhanced performance. Since the occurrence of similar 8.3 names is generally minimal, only the first four attempts at generating the 8.3 name work like they did in Windows NT 3.1. The fifth attempt takes the first two characters of the long name, then the next four characters are generated by a hashing function of the entire name, and the last two characters are "~5". Only when the hashing of the middle four characters no longer produces a unique name will the "~5" be incremented to "~6" and so on. For example:

  MyTermPaper.doc   becomes  MYTERM~1.DOC MyTermPaper2.doc becomes  MYTERM~2.DOC MyTermPaper3.doc becomes  MYTERM~3.DOC MyTermPaper4.doc becomes  MYTERM~4.DOC MyTermPaper5.doc becomes  MY1E2E~5.DOC MyTermPaper6.doc becomes  MY1EEE~5.DOC MyTermPaper7.doc becomes  MY1EAE~5.DOC

Subsequent iterations are performed faster than under Windows NT 3.1.

NOTE: By avoiding using long names that are similar in the first 6 characters, enumeration are even more efficient.

Additional query words: prodnt lfn long name

Keywords: kbother KB114816

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.