From f2c4b9fe0793277e8cac11e1a07538799d2daaf5 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Thu, 28 Apr 2022 11:22:40 +0200 Subject: [PATCH] icinfo: Use OEM code page for output. Signed-off-by: Eric Pouech Signed-off-by: Alexandre Julliard --- programs/icinfo/icinfo.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/programs/icinfo/icinfo.c b/programs/icinfo/icinfo.c index 01ddbfb6833..bd309bfb623 100644 --- a/programs/icinfo/icinfo.c +++ b/programs/icinfo/icinfo.c @@ -35,17 +35,13 @@ static int WINAPIV mywprintf(const WCHAR *format, ...) vswprintf(output_bufW, ARRAY_SIZE(output_bufW), format, parms); va_end(parms); - /* Try to write as unicode whenever we think it's a console */ - if (((DWORD_PTR)hout & 3) == 3) - { - res = WriteConsoleW(hout, output_bufW, lstrlenW(output_bufW), &nOut, NULL); - } - else + res = WriteConsoleW(hout, output_bufW, lstrlenW(output_bufW), &nOut, NULL); + if (!res) { DWORD convertedChars; /* Convert to OEM, then output */ - convertedChars = WideCharToMultiByte(GetConsoleOutputCP(), 0, output_bufW, -1, + convertedChars = WideCharToMultiByte(GetOEMCP(), 0, output_bufW, -1, output_bufA, sizeof(output_bufA), NULL, NULL); res = WriteFile(hout, output_bufA, convertedChars, &nOut, FALSE);