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

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

regsvr32: 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/regsvr32/regsvr32.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/programs/regsvr32/regsvr32.c b/programs/regsvr32/regsvr32.c
index 0efa6bcd839..81caeb2c820 100644
--- a/programs/regsvr32/regsvr32.c
+++ b/programs/regsvr32/regsvr32.c
@@ -41,7 +41,7 @@ static void WINAPIV output_write(UINT id, ...)
     WCHAR fmt[1024];
     va_list va_args;
     WCHAR *str;
-    DWORD len, nOut, ret;
+    DWORD len, nOut;
 
     if (Silent) return;
 
@@ -61,21 +61,19 @@ static void WINAPIV output_write(UINT id, ...)
         return;
     }
 
-    ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, len, &nOut, NULL);
-
     /* WriteConsole fails if its output is redirected to a file.
      * If this occurs, we should use an OEM codepage and call WriteFile.
      */
-    if (!ret)
+    if (!WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, len, &nOut, NULL))
     {
         DWORD lenA;
         char *strA;
 
-        lenA = WideCharToMultiByte(GetConsoleOutputCP(), 0, str, len, NULL, 0, NULL, NULL);
+        lenA = WideCharToMultiByte(GetOEMCP(), 0, str, len, NULL, 0, NULL, NULL);
         strA = HeapAlloc(GetProcessHeap(), 0, lenA);
         if (strA)
         {
-            WideCharToMultiByte(GetConsoleOutputCP(), 0, str, len, strA, lenA, NULL, NULL);
+            WideCharToMultiByte(GetOEMCP(), 0, str, len, strA, lenA, NULL, NULL);
             WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), strA, lenA, &nOut, FALSE);
             HeapFree(GetProcessHeap(), 0, strA);
         }




More information about the wine-cvs mailing list