uninstaller: 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
8fdf397505
commit
14bb74cc10
|
@ -51,20 +51,20 @@ static const WCHAR PathUninstallW[] = L"Software\\Microsoft\\Windows\\CurrentVer
|
||||||
|
|
||||||
static void output_writeconsole(const WCHAR *str, DWORD len)
|
static void output_writeconsole(const WCHAR *str, DWORD len)
|
||||||
{
|
{
|
||||||
DWORD written, ret, lenA;
|
DWORD written, lenA;
|
||||||
char *strA;
|
char *strA;
|
||||||
|
|
||||||
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, len, &written, NULL);
|
if (WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, len, &written, NULL))
|
||||||
if (ret) return;
|
return;
|
||||||
|
|
||||||
/* WriteConsole fails if its output is redirected to a file.
|
/* WriteConsole fails if its output is redirected to a file.
|
||||||
* If this occurs, we should use an OEM codepage and call WriteFile.
|
* If this occurs, we should use an OEM codepage and call WriteFile.
|
||||||
*/
|
*/
|
||||||
lenA = WideCharToMultiByte(GetConsoleOutputCP(), 0, str, len, NULL, 0, NULL, NULL);
|
lenA = WideCharToMultiByte(GetOEMCP(), 0, str, len, NULL, 0, NULL, NULL);
|
||||||
strA = HeapAlloc(GetProcessHeap(), 0, lenA);
|
strA = HeapAlloc(GetProcessHeap(), 0, lenA);
|
||||||
if (strA)
|
if (strA)
|
||||||
{
|
{
|
||||||
WideCharToMultiByte(GetConsoleOutputCP(), 0, str, len, strA, lenA, NULL, NULL);
|
WideCharToMultiByte(GetOEMCP(), 0, str, len, strA, lenA, NULL, NULL);
|
||||||
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), strA, lenA, &written, FALSE);
|
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), strA, lenA, &written, FALSE);
|
||||||
HeapFree(GetProcessHeap(), 0, strA);
|
HeapFree(GetProcessHeap(), 0, strA);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue