Commit 92135f66 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

fsutil: Use OEM code page for output.

parent ebd24cbb
...@@ -26,23 +26,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(fsutil); ...@@ -26,23 +26,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(fsutil);
static void output_write(const WCHAR *str, DWORD wlen) static void output_write(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;
/* On Windows WriteConsoleW() fails if the output is redirected. So fall /* On Windows WriteConsoleW() fails if the output is redirected. So fall
* back to WriteFile(), assuming the console encoding is still the right * back to WriteFile() with OEM code page.
* one in that case.
*/ */
len = WideCharToMultiByte(CP_ACP, 0, str, wlen, NULL, 0, NULL, NULL); len = WideCharToMultiByte(GetOEMCP(), 0, str, wlen, NULL, 0, NULL, NULL);
msgA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char)); msgA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char));
if (!msgA) return; if (!msgA) return;
WideCharToMultiByte(CP_ACP, 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);
HeapFree(GetProcessHeap(), 0, msgA); HeapFree(GetProcessHeap(), 0, 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