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

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

fsutil: 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/fsutil/main.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/programs/fsutil/main.c b/programs/fsutil/main.c
index 94151ae9b42..8de7027ee0e 100644
--- a/programs/fsutil/main.c
+++ b/programs/fsutil/main.c
@@ -26,23 +26,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(fsutil);
 
 static void output_write(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;
 
         /* On Windows WriteConsoleW() fails if the output is redirected. So fall
-         * back to WriteFile(), assuming the console encoding is still the right
-         * one in that case.
+         * back to WriteFile() with OEM code page.
          */
-        len = WideCharToMultiByte(CP_ACP, 0, str, wlen, NULL, 0, NULL, NULL);
+        len = WideCharToMultiByte(GetOEMCP(), 0, str, wlen, NULL, 0, NULL, NULL);
         msgA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char));
         if (!msgA) return;
 
-        WideCharToMultiByte(CP_ACP, 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);
         HeapFree(GetProcessHeap(), 0, msgA);
     }




More information about the wine-cvs mailing list