Commit ebd24cbb authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

chcp: Use OEM code page for output.

parent 8f06c1c6
...@@ -26,10 +26,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(chcp); ...@@ -26,10 +26,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(chcp);
static void output_writeconsole(const WCHAR *str, DWORD wlen) static void output_writeconsole(const WCHAR *str, DWORD wlen)
{ {
DWORD count, ret; DWORD count;
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, wlen, &count, NULL); if (!WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, wlen, &count, NULL))
if (!ret)
{ {
DWORD len; DWORD len;
char *msgA; char *msgA;
...@@ -38,10 +37,11 @@ static void output_writeconsole(const WCHAR *str, DWORD wlen) ...@@ -38,10 +37,11 @@ static void output_writeconsole(const WCHAR *str, DWORD wlen)
* back to WriteFile(), assuming the console encoding is still the right * back to WriteFile(), assuming the console encoding is still the right
* one in that case. * one in that case.
*/ */
len = WideCharToMultiByte(GetConsoleOutputCP(), 0, str, wlen, NULL, 0, NULL, NULL); len = WideCharToMultiByte(GetOEMCP(), 0, str, wlen, NULL, 0, NULL, NULL);
msgA = malloc(len); msgA = malloc(len);
if (!msgA) return;
WideCharToMultiByte(GetConsoleOutputCP(), 0, str, wlen, msgA, len, NULL, NULL); WideCharToMultiByte(GetOEMCP(), 0, str, wlen, msgA, len, NULL, NULL);
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), msgA, len, &count, FALSE); WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), msgA, len, &count, FALSE);
free(msgA); free(msgA);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment