kernelbase: Use IOCTL_CONDRV_GET_INPUT_INFO in GetConsoleOutputCP.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-08-14 13:27:00 +02:00 committed by Alexandre Julliard
parent 4faed406d4
commit 3576258402
2 changed files with 10 additions and 11 deletions

View File

@ -3632,6 +3632,11 @@ static void test_FreeConsole(void)
ok(!cp, "cp = %x\n", cp); ok(!cp, "cp = %x\n", cp);
ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError()); ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError());
SetLastError(0xdeadbeef);
cp = GetConsoleOutputCP();
ok(!cp, "cp = %x\n", cp);
ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError());
if (!skip_nt) if (!skip_nt)
{ {
SetStdHandle( STD_INPUT_HANDLE, (HANDLE)0xdeadbeef ); SetStdHandle( STD_INPUT_HANDLE, (HANDLE)0xdeadbeef );

View File

@ -658,18 +658,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetConsoleMode( HANDLE handle, DWORD *mode )
*/ */
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(void) UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(void)
{ {
UINT codepage = GetOEMCP(); /* default value */ struct condrv_input_info info;
SERVER_START_REQ( get_console_input_info ) if (!console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
{ IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL ))
req->handle = 0; return 0;
if (!wine_server_call_err( req )) return info.output_cp ? info.output_cp : GetOEMCP();
{
if (reply->output_cp) codepage = reply->output_cp;
}
}
SERVER_END_REQ;
return codepage;
} }