mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 21:56:40 +00:00
Pierre Schweitzer
- A better fix for CdfsIsNameLegalDOS8Dot3. See issue #2404 for more details. svn path=/trunk/; revision=48494
This commit is contained in:
parent
6cb85c8ae3
commit
9d1462a2b7
|
@ -96,31 +96,37 @@ CdfsFileFlagsToAttributes(PFCB Fcb,
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdfsIsNameLegalDOS8Dot3(IN PUNICODE_STRING FileName
|
CdfsIsNameLegalDOS8Dot3(IN UNICODE_STRING FileName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
STRING DbcsName;
|
STRING DbcsName;
|
||||||
CHAR DbcsNameBuffer[12];
|
CHAR DbcsNameBuffer[12];
|
||||||
|
|
||||||
for (i = 0; i < FileName->Length / sizeof(WCHAR) ; i++)
|
/* 8dot3 filename is max 12 length */
|
||||||
|
if (FileName.Length / sizeof(WCHAR) > 12)
|
||||||
{
|
{
|
||||||
/* Don't allow spaces in FileName */
|
|
||||||
if (FileName->Buffer[i] == L' ')
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
/* If FileName is finishing with a dot, remove it */
|
for (i = 0; i < FileName.Length / sizeof(WCHAR) ; i++)
|
||||||
if (FileName->Buffer[FileName->Length / sizeof(WCHAR) - 1] == '.')
|
|
||||||
{
|
{
|
||||||
FileName->Length -= sizeof(WCHAR);
|
/* Don't allow spaces in FileName */
|
||||||
|
if (FileName.Buffer[i] == L' ')
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
/* If FileName is finishing with a dot, remove it */
|
||||||
|
if (FileName.Buffer[FileName.Length / sizeof(WCHAR) - 1] == '.')
|
||||||
|
{
|
||||||
|
FileName.Length -= sizeof(WCHAR);
|
||||||
|
}
|
||||||
|
|
||||||
/* Finally, convert the string to call the FsRtl function */
|
/* Finally, convert the string to call the FsRtl function */
|
||||||
DbcsName.MaximumLength = 12;
|
DbcsName.MaximumLength = 12;
|
||||||
DbcsName.Buffer = DbcsNameBuffer;
|
DbcsName.Buffer = DbcsNameBuffer;
|
||||||
if (!NT_SUCCESS(RtlUnicodeStringToCountedOemString(&DbcsName,
|
if (!NT_SUCCESS(RtlUnicodeStringToCountedOemString(&DbcsName,
|
||||||
FileName,
|
&FileName,
|
||||||
FALSE )))
|
FALSE )))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -165,7 +171,7 @@ CdfsShortNameCacheGet
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cache miss */
|
/* Cache miss */
|
||||||
if (!CdfsIsNameLegalDOS8Dot3(LongName))
|
if (!CdfsIsNameLegalDOS8Dot3(*LongName))
|
||||||
{
|
{
|
||||||
RtlGenerate8dot3Name(LongName, FALSE, &Context, ShortName);
|
RtlGenerate8dot3Name(LongName, FALSE, &Context, ShortName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue