ZwQueryDirectoryFile behavior

Hi,

I have encountered with the behavior of ZwQueryDirectoryFile,
which seems me quite strange. Please correct me if I wrong.

It happens at least on Windows 2000 FAT partitions. But a brief looking
at FASTFAT sources says that it could happen also on other platforms.

When performing a directory query against the pattern string containing
an unmappable caracter (for example “1/2” in “3 1/2 Floppy (A).lnk”)
ZwQueryDirectoryFile returns the requested information about the file,
but indicates a failure with STATUS_UNMAPPABLE_CHARACTER.

The FASTFAT dirctrl.c has the following code:

//
// Upcase the name and convert it to the Oem code page.
//
Status = RtlUpcaseUnicodeStringToCountedOemString( &LocalBestFit,
UniArgFileName,
TRUE );

//
// If this conversion failed for any reason other than
// an unmappable character fail the request.
//
if (!NT_SUCCESS(Status)) {

if (Status == STATUS_UNMAPPABLE_CHARACTER) {

SetFlag( Ccb->Flags, CCB_FLAG_SKIP_SHORT_NAME_COMPARE );

} else {

try_return( Status );
}
} …

After this it never touches the Status and returns it as is.

Is it the way it should be?

Thanks in advance for your comments.

Regards,
Leonid.

Apparently it is a bug in FAT. By the way, if FileInformationClass is
FileBothDirectoryInformation this function works properly, so Win32 API
FindFirstFile / FindNextFile functions are not affected by this bug.

Alexei.