Author: fireball
Date: Mon Aug 9 20:38:12 2010
New Revision: 48494
URL:
http://svn.reactos.org/svn/reactos?rev=48494&view=rev
Log:
Pierre Schweitzer
- A better fix for CdfsIsNameLegalDOS8Dot3.
See issue #2404 for more details.
Modified:
trunk/reactos/drivers/filesystems/cdfs/misc.c
Modified: trunk/reactos/drivers/filesystems/cdfs/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/m…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/misc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/misc.c [iso-8859-1] Mon Aug 9 20:38:12 2010
@@ -96,31 +96,37 @@
}
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] == '.')
- {
- FileName->Length -= sizeof(WCHAR);
- }
-#endif
+ if (FileName.Buffer[FileName.Length / sizeof(WCHAR) - 1] == '.')
+ {
+ FileName.Length -= sizeof(WCHAR);
+ }
+
/* 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 @@
}
/* Cache miss */
- if (!CdfsIsNameLegalDOS8Dot3(LongName))
+ if (!CdfsIsNameLegalDOS8Dot3(*LongName))
{
RtlGenerate8dot3Name(LongName, FALSE, &Context, ShortName);
}