Eric Pouech : start: 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: 18f9d2dd9df6864b23332610aa5be63029e83f8d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=18f9d2dd9df6864b23332610aa5be63029e83f8d

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Thu Apr 28 11:22:40 2022 +0200

start: 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/start/start.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/programs/start/start.c b/programs/start/start.c
index 835128ebf28..62804917941 100644
--- a/programs/start/start.c
+++ b/programs/start/start.c
@@ -38,25 +38,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(start);
 static void output(const WCHAR *message)
 {
 	DWORD count;
-	DWORD   res;
 	int    wlen = lstrlenW(message);
 
 	if (!wlen) return;
 
-	res = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), message, wlen, &count, NULL);
-
 	/* If writing to console fails, assume it's file
          * i/o so convert to OEM codepage and output
          */
-	if (!res)
+	if (!WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), message, wlen, &count, NULL))
 	{
 		DWORD len;
 		char  *mesA;
 		/* 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));
 		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);
 		HeapFree(GetProcessHeap(), 0, mesA);
 	}




More information about the wine-cvs mailing list