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

This commit is contained in:
Francois Gouget 2011-08-24 14:29:31 +02:00 committed by Alexandre Julliard
parent 283276d6ea
commit 5bc1aff578
4 changed files with 16 additions and 0 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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));

View File

@ -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);