netstat: Use OEM code page for output.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9ac9ea5914
commit
b421477d33
|
@ -125,7 +125,7 @@ static int WINAPIV NETSTAT_wprintf(const WCHAR *format, ...)
|
|||
}
|
||||
|
||||
/* Convert to OEM, then output */
|
||||
convertedChars = WideCharToMultiByte(GetConsoleOutputCP(), 0, output_bufW,
|
||||
convertedChars = WideCharToMultiByte(GetOEMCP(), 0, output_bufW,
|
||||
len, output_bufA, MAX_WRITECONSOLE_SIZE,
|
||||
"?", &usedDefaultChar);
|
||||
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), output_bufA, convertedChars,
|
||||
|
|
|
@ -51,22 +51,20 @@ const struct reg_type_rels type_rels[] =
|
|||
|
||||
void output_writeconsole(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(GetConsoleOutputCP(), 0, str, wlen, NULL, 0, NULL, NULL);
|
||||
len = WideCharToMultiByte(GetOEMCP(), 0, str, wlen, NULL, 0, NULL, NULL);
|
||||
msgA = malloc(len);
|
||||
|
||||
WideCharToMultiByte(GetConsoleOutputCP(), 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);
|
||||
free(msgA);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue