programs: Document the reason for the WriteConsole() fall back.
This commit is contained in:
parent
283276d6ea
commit
5bc1aff578
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue