Author: pschweitzer
Date: Fri Aug 22 14:37:03 2008
New Revision: 35539
URL:
http://svn.reactos.org/svn/reactos?rev=35539&view=rev
Log:
Liberate RtlGenerate8dot3Name from NLS stuff as it is in Windows. This definitely fixes
bug #2404
However this function needs more and more fixes to work properly
See issue #2404 for more details.
Modified:
branches/pierre-fsd/lib/rtl/dos8dot3.c
Modified: branches/pierre-fsd/lib/rtl/dos8dot3.c
URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/lib/rtl/dos8dot3.c?r…
==============================================================================
--- branches/pierre-fsd/lib/rtl/dos8dot3.c [iso-8859-1] (original)
+++ branches/pierre-fsd/lib/rtl/dos8dot3.c [iso-8859-1] Fri Aug 22 14:37:03 2008
@@ -58,6 +58,20 @@
Length++;
}
return Length ? Length : 1;
+}
+
+static WCHAR
+RtlpUpcaseUnicodeCharIfLegal(IN WCHAR LowChar)
+{
+ if (RtlpIsShortIllegal(LowChar))
+ {
+ return L'_';
+ }
+ if (LowChar >= L'a' && LowChar <= L'z')
+ {
+ return LowChar - 32;
+ }
+ return LowChar;
}
@@ -70,7 +84,6 @@
IN OUT PGENERATE_NAME_CONTEXT Context,
OUT PUNICODE_STRING Name8dot3)
{
- ULONG Count;
WCHAR NameBuffer[8];
WCHAR ExtBuffer[4];
ULONG StrLength;
@@ -82,7 +95,6 @@
ULONG IndexLength;
ULONG CurrentIndex;
USHORT Checksum;
- CHAR c;
StrLength = Name->Length / sizeof(WCHAR);
DPRINT("StrLength: %lu\n", StrLength);
@@ -106,15 +118,9 @@
/* Copy name (6 valid characters max) */
for (i = 0, NameLength = 0; NameLength < 6 && i < DotPos; i++)
{
- c = 0;
- RtlUpcaseUnicodeToOemN(&c, sizeof(CHAR), &Count, &Name->Buffer[i],
sizeof(WCHAR));
- if (Count != 1 || c == 0 || RtlpIsShortIllegal(c))
- {
- NameBuffer[NameLength++] = L'_';
- }
- else if (c != '.')
- {
- NameBuffer[NameLength++] = (WCHAR)c;
+ if (Name->Buffer[i] != L'.' && Name->Buffer[i] != L'
')
+ {
+ NameBuffer[NameLength++] = RtlpUpcaseUnicodeCharIfLegal(Name->Buffer[i]);
}
}
@@ -126,16 +132,10 @@
{
for (i = DotPos, ExtLength = 0; ExtLength < 4 && i < StrLength; i++)
{
- c = 0;
- RtlUpcaseUnicodeToOemN(&c, sizeof(CHAR), &Count,
&Name->Buffer[i], sizeof(WCHAR));
- if (Count != 1 || c == 0 || RtlpIsShortIllegal(Name->Buffer[i]))
- {
- ExtBuffer[ExtLength++] = L'_';
- }
- else
- {
- ExtBuffer[ExtLength++] = c;
- }
+ if (Name->Buffer[i] != L' ')
+ {
+ ExtBuffer[ExtLength++] = RtlpUpcaseUnicodeCharIfLegal(Name->Buffer[i]);
+ }
}
}
else