Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging

The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.

Check out The OSR Learning Library at:

short file names creation

OSR_Community_UserOSR_Community_User Member Posts: 110,217

Could anybody shed light on the short file names creation algorithm?
How can I reproduce it?

As far as I can understand, there are two routines which can be used for
RtlIsNameLegalDOS8Dot3 and RtlGenerate8dot3Name.

First, RtlIsNameLegalDOS8Dot3 can be used for name checking. If it returns
FALSE or indicates that the name contains spaces, a short name should be
generated using RtlGenerate8dot3Name (allowing extended characters on FAT
and disabling them on NTFS).

The question is about the case when RtlIsNameLegalDOS8Dot3 returns TRUE
and the name does not contain spaces. Even in this case the file system
generates a short name. I do not know exact circumstances, but seems it
when the name contains non-ASCII symbols (something else?). Results on FAT
NTFS are different in this case. On NTFS the short name appears as generated
RtlGenerate8dot3Name, while on FAT it looks the same as the OEM name
from RtlIsNameLegalDOS8Dot3.

So, can I use the following algorithm?

if (!RtlIsNameLegalDOS8Dot3(&Name, &OemName, &ContainsSpaces) ||
ContainsSpaces == TRUE) {
if (NTFS) {
RtlGenerate8dot3Name(&Name, FALSE, &Context, &Name8dot3);
else {
RtlGenerate8dot3Name(&Name, TRUE, &Context, &Name8dot3);
else if (At least one character in OemName is greater than 0x7F) {
if (NTFS) {
RtlGenerate8dot3Name(&Name, FALSE, &Context, &Name8dot3);
else {
RtlOemStringToCountedUnicodeString(&Name8dot3, &OemName, FALSE);

I will appreciate any comments on this subject.

Thanks in advance.


  • john_8998john_8998 Member Posts: 2

    Also, it seems NTFS algo for shortname creation is somewhat different from RtlGenerate8dot3Name. In the case of file extension longer than 3 chars, RtlGenerate8dot3Name tend to put a "~" (tilde) in the extension also, wheres the NTFS does not.

  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,473

    19 year old post...Start a new discussion if you have a question.


This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Internals & Software Drivers 7 February 2022 Live, Online
Kernel Debugging 21 March 2022 Live, Online
Developing Minifilters 23 May 2022 Live, Online
Writing WDF Drivers 12 September 2022 Live, Online