Pierre Schweitzer

- A better fix for CdfsIsNameLegalDOS8Dot3.

See issue #2404 for more details.

svn path=/trunk/; revision=48494
This commit is contained in:
Aleksey Bragin 2010-08-09 20:38:12 +00:00
parent 6cb85c8ae3
commit 9d1462a2b7

View file

@ -96,31 +96,37 @@ CdfsFileFlagsToAttributes(PFCB Fcb,
}
BOOLEAN
CdfsIsNameLegalDOS8Dot3(IN PUNICODE_STRING FileName
CdfsIsNameLegalDOS8Dot3(IN UNICODE_STRING FileName
)
{
ULONG i;
STRING DbcsName;
CHAR DbcsNameBuffer[12];
for (i = 0; i < FileName->Length / sizeof(WCHAR) ; i++)
/* 8dot3 filename is max 12 length */
if (FileName.Length / sizeof(WCHAR) > 12)
{
return FALSE;
}
for (i = 0; i < FileName.Length / sizeof(WCHAR) ; i++)
{
/* Don't allow spaces in FileName */
if (FileName->Buffer[i] == L' ')
if (FileName.Buffer[i] == L' ')
return FALSE;
}
#if 0
/* If FileName is finishing with a dot, remove it */
if (FileName->Buffer[FileName->Length / sizeof(WCHAR) - 1] == '.')
if (FileName.Buffer[FileName.Length / sizeof(WCHAR) - 1] == '.')
{
FileName->Length -= sizeof(WCHAR);
FileName.Length -= sizeof(WCHAR);
}
#endif
/* Finally, convert the string to call the FsRtl function */
DbcsName.MaximumLength = 12;
DbcsName.Buffer = DbcsNameBuffer;
if (!NT_SUCCESS(RtlUnicodeStringToCountedOemString(&DbcsName,
FileName,
&FileName,
FALSE )))
{
@ -165,7 +171,7 @@ CdfsShortNameCacheGet
}
/* Cache miss */
if (!CdfsIsNameLegalDOS8Dot3(LongName))
if (!CdfsIsNameLegalDOS8Dot3(*LongName))
{
RtlGenerate8dot3Name(LongName, FALSE, &Context, ShortName);
}