Author: mjmartin
Date: Tue Feb 3 03:09:06 2009
New Revision: 39301
URL:
http://svn.reactos.org/svn/reactos?rev=39301&view=rev
Log:
- Change MultiByteToWideChar to match windows behavior. Fix part 1 of ? for bug #3740.
Modified:
trunk/reactos/dll/win32/kernel32/misc/nls.c
Modified: trunk/reactos/dll/win32/kernel32/misc/nls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/nl…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/nls.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/nls.c [iso-8859-1] Tue Feb 3 03:09:06 2009
@@ -523,6 +523,14 @@
if (WideCharCount == 0)
return MultiByteCount;
+ /* Fill the WideCharString buffer with what will fit: Verified on WinXP */
+ for (TempLength = (WideCharCount < MultiByteCount) ? WideCharCount :
MultiByteCount;
+ TempLength > 0;
+ MultiByteString++, TempLength--)
+ {
+ *WideCharString++ =
CodePageTable->MultiByteTable[(UCHAR)*MultiByteString];
+ }
+
/* Adjust buffer size. Wine trick ;-) */
if (WideCharCount < MultiByteCount)
{
@@ -530,15 +538,7 @@
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return 0;
}
-
- for (TempLength = MultiByteCount;
- TempLength > 0;
- MultiByteString++, TempLength--)
- {
- *WideCharString++ =
CodePageTable->MultiByteTable[(UCHAR)*MultiByteString];
- }
-
- return MultiByteCount;
+ return MultiByteCount;
}
}