Commit bf6e8815 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

hostname: Use CP_ACP for non-console output encoding.

parent f24499eb
...@@ -47,14 +47,13 @@ static int hostname_vprintfW(const WCHAR *msg, __ms_va_list va_args) ...@@ -47,14 +47,13 @@ static int hostname_vprintfW(const WCHAR *msg, __ms_va_list va_args)
* 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, msg_buffer, wlen, len = WideCharToMultiByte(CP_ACP, 0, msg_buffer, wlen,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
msgA = HeapAlloc(GetProcessHeap(), 0, len); msgA = HeapAlloc(GetProcessHeap(), 0, len);
if (!msgA) if (!msgA)
return 0; return 0;
WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen, msgA, len, WideCharToMultiByte(CP_ACP, 0, msg_buffer, wlen, msgA, len, NULL, NULL);
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