Commit 18f9d2dd authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

start: Use OEM code page for output.

parent de548725
...@@ -38,25 +38,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(start); ...@@ -38,25 +38,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(start);
static void output(const WCHAR *message) static void output(const WCHAR *message)
{ {
DWORD count; DWORD count;
DWORD res;
int wlen = lstrlenW(message); int wlen = lstrlenW(message);
if (!wlen) return; if (!wlen) return;
res = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), message, wlen, &count, NULL);
/* If writing to console fails, assume it's file /* If writing to console fails, assume it's file
* i/o so convert to OEM codepage and output * i/o so convert to OEM codepage and output
*/ */
if (!res) if (!WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), message, wlen, &count, NULL))
{ {
DWORD len; DWORD len;
char *mesA; char *mesA;
/* Convert to OEM, then output */ /* Convert to OEM, then output */
len = WideCharToMultiByte( GetConsoleOutputCP(), 0, message, wlen, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( GetOEMCP(), 0, message, wlen, NULL, 0, NULL, NULL );
mesA = HeapAlloc(GetProcessHeap(), 0, len*sizeof(char)); mesA = HeapAlloc(GetProcessHeap(), 0, len*sizeof(char));
if (!mesA) return; if (!mesA) return;
WideCharToMultiByte( GetConsoleOutputCP(), 0, message, wlen, mesA, len, NULL, NULL ); WideCharToMultiByte( GetOEMCP(), 0, message, wlen, mesA, len, NULL, NULL );
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), mesA, len, &count, FALSE); WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), mesA, len, &count, FALSE);
HeapFree(GetProcessHeap(), 0, mesA); HeapFree(GetProcessHeap(), 0, mesA);
} }
......
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