Francois Gouget : programs: Document the reason for the WriteConsole() fall back.

Alexandre Julliard julliard at winehq.org
Wed Aug 24 14:05:27 CDT 2011


Module: wine
Branch: master
Commit: 5bc1aff578f1754a1834d221ae9fe6fcefbcef5f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5bc1aff578f1754a1834d221ae9fe6fcefbcef5f

Author: Francois Gouget <fgouget at free.fr>
Date:   Wed Aug 24 14:29:31 2011 +0200

programs: Document the reason for the WriteConsole() fall back.

---

 programs/hostname/hostname.c |    4 ++++
 programs/ipconfig/ipconfig.c |    4 ++++
 programs/reg/reg.c           |    4 ++++
 programs/taskkill/taskkill.c |    4 ++++
 4 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/programs/hostname/hostname.c b/programs/hostname/hostname.c
index 77ff23b..8bf8676 100644
--- a/programs/hostname/hostname.c
+++ b/programs/hostname/hostname.c
@@ -53,6 +53,10 @@ static int hostname_vprintfW(const WCHAR *msg, va_list va_args)
         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.
+         */
         len = WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen,
             NULL, 0, NULL, NULL);
         msgA = HeapAlloc(GetProcessHeap(), 0, len);
diff --git a/programs/ipconfig/ipconfig.c b/programs/ipconfig/ipconfig.c
index 14974ae..37e7099 100644
--- a/programs/ipconfig/ipconfig.c
+++ b/programs/ipconfig/ipconfig.c
@@ -40,6 +40,10 @@ static int ipconfig_vprintfW(const WCHAR *msg, va_list va_args)
         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.
+         */
         len = WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen,
             NULL, 0, NULL, NULL);
         msgA = HeapAlloc(GetProcessHeap(), 0, len);
diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index 0f8aa15..8a6ffc4 100644
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -38,6 +38,10 @@ static int reg_printfW(const WCHAR *msg, ...)
         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.
+         */
         len = WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen,
             NULL, 0, NULL, NULL);
         msgA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char));
diff --git a/programs/taskkill/taskkill.c b/programs/taskkill/taskkill.c
index 1dc1fcc..c6423c4 100644
--- a/programs/taskkill/taskkill.c
+++ b/programs/taskkill/taskkill.c
@@ -50,6 +50,10 @@ static int taskkill_vprintfW(const WCHAR *msg, va_list va_args)
         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.
+         */
         len = WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen,
             NULL, 0, NULL, NULL);
         msgA = HeapAlloc(GetProcessHeap(), 0, len);




More information about the wine-cvs mailing list