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

regedit: Use OEM code page for output.

parent b421477d
...@@ -30,21 +30,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(regedit); ...@@ -30,21 +30,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(regedit);
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;
/* WriteConsole() fails on Windows if its output is redirected. If this occurs, /* WriteConsole() fails on Windows if its output is redirected. If this occurs,
* we should call WriteFile() and assume the console encoding is still correct. * we should call WriteFile() with OEM code page.
*/ */
len = WideCharToMultiByte(GetConsoleOutputCP(), 0, str, wlen, NULL, 0, NULL, NULL); len = WideCharToMultiByte(GetOEMCP(), 0, str, wlen, NULL, 0, NULL, NULL);
msgA = heap_xalloc(len); msgA = heap_xalloc(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);
heap_free(msgA); heap_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