Eric Pouech : regedit: Use OEM code page for output.
Alexandre Julliard
julliard at winehq.org
Mon May 2 16:02:09 CDT 2022
Module: wine
Branch: master
Commit: b111fab95315238d794b2ea6933622efd0b2a1a2
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b111fab95315238d794b2ea6933622efd0b2a1a2
Author: Eric Pouech <eric.pouech at gmail.com>
Date: Thu Apr 28 11:22:40 2022 +0200
regedit: Use OEM code page for output.
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/regedit/regedit.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/programs/regedit/regedit.c b/programs/regedit/regedit.c
index 6a50a63226f..cc31f83c903 100644
--- a/programs/regedit/regedit.c
+++ b/programs/regedit/regedit.c
@@ -30,21 +30,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(regedit);
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 (!ret)
+ if (!WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, wlen, &count, NULL))
{
DWORD len;
char *msgA;
/* 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);
+ 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);
heap_free(msgA);
}
More information about the wine-cvs
mailing list