Alexandre Julliard : kernel32: Use the proper codepage for console functions.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 16 05:22:14 CST 2007


Module: wine
Branch: master
Commit: 0df37dd9e37e157f372aac3628d4845941731f50
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0df37dd9e37e157f372aac3628d4845941731f50

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jan 15 16:49:08 2007 +0100

kernel32: Use the proper codepage for console functions.

Based on a patch by Anatoly Lyutin.

---

 dlls/kernel32/console.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index a22076e..0590cd4 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -1200,7 +1200,7 @@ BOOL WINAPI ReadConsoleA(HANDLE hConsole
     BOOL	ret;
 
     if ((ret = ReadConsoleW(hConsoleInput, ptr, nNumberOfCharsToRead, &ncr, NULL)))
-	ncr = WideCharToMultiByte(CP_ACP, 0, ptr, ncr, lpBuffer, nNumberOfCharsToRead, NULL, NULL);
+        ncr = WideCharToMultiByte(GetConsoleCP(), 0, ptr, ncr, lpBuffer, nNumberOfCharsToRead, NULL, NULL);
 
     if (lpNumberOfCharsRead) *lpNumberOfCharsRead = ncr;
     HeapFree(GetProcessHeap(), 0, ptr);
@@ -2005,13 +2005,13 @@ BOOL WINAPI WriteConsoleA(HANDLE hConsol
     LPWSTR	xstring;
     DWORD 	n;
 
-    n = MultiByteToWideChar(CP_ACP, 0, lpBuffer, nNumberOfCharsToWrite, NULL, 0);
+    n = MultiByteToWideChar(GetConsoleOutputCP(), 0, lpBuffer, nNumberOfCharsToWrite, NULL, 0);
 
     if (lpNumberOfCharsWritten) *lpNumberOfCharsWritten = 0;
     xstring = HeapAlloc(GetProcessHeap(), 0, n * sizeof(WCHAR));
     if (!xstring) return 0;
 
-    MultiByteToWideChar(CP_ACP, 0, lpBuffer, nNumberOfCharsToWrite, xstring, n);
+    MultiByteToWideChar(GetConsoleOutputCP(), 0, lpBuffer, nNumberOfCharsToWrite, xstring, n);
 
     ret = WriteConsoleW(hConsoleOutput, xstring, n, lpNumberOfCharsWritten, 0);
 
@@ -2258,7 +2258,7 @@ BOOL WINAPI ScrollConsoleScreenBufferA(H
     CHAR_INFO	ciw;
 
     ciw.Attributes = lpFill->Attributes;
-    MultiByteToWideChar(CP_ACP, 0, &lpFill->Char.AsciiChar, 1, &ciw.Char.UnicodeChar, 1);
+    MultiByteToWideChar(GetConsoleOutputCP(), 0, &lpFill->Char.AsciiChar, 1, &ciw.Char.UnicodeChar, 1);
 
     return ScrollConsoleScreenBufferW(hConsoleOutput, lpScrollRect, lpClipRect,
 				      dwDestOrigin, &ciw);




More information about the wine-cvs mailing list