[KERNEL32] Fix multibyte conversion in default char (#2111)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Sat, 30 Nov 2019 06:10:10 +0000 (15:10 +0900)
committerGitHub <noreply@github.com>
Sat, 30 Nov 2019 06:10:10 +0000 (15:10 +0900)
Fix kernel32!MultiByteToWideChar function. The default character was wrong. CORE-16468

dll/win32/kernel32/winnls/string/nls.c

index c6d5372..712545f 100644 (file)
@@ -654,14 +654,9 @@ IntMultiByteToWideCharCP(UINT CodePage,
                 continue;
             }
 
-            if (MultiByteString == MbsEnd)
+            if (MultiByteString == MbsEnd || *MultiByteString == 0)
             {
-                *WideCharString++ = MultiByteTable[Char];
-            }
-            else if (*MultiByteString == 0)
-            {
-                *WideCharString++ = UNICODE_NULL;
-                MultiByteString++;
+                *WideCharString++ = CodePageTable->UniDefaultChar;
             }
             else
             {