diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 38ec621da65..1adf4af0644 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3644,6 +3644,10 @@ static void test_FreeConsole(void) ret = SetConsoleCP(GetOEMCP()); ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "SetConsoleCP returned %x(%u)\n", ret, GetLastError()); + SetLastError(0xdeadbeef); + ret = SetConsoleOutputCP(GetOEMCP()); + ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "SetConsoleCP returned %x(%u)\n", ret, GetLastError()); + SetLastError(0xdeadbeef); memset( title, 0xc0, sizeof(title) ); size = GetConsoleTitleW( title, ARRAY_SIZE(title) ); diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c index 536f1912e9d..2611fd5864f 100644 --- a/dlls/kernelbase/console.c +++ b/dlls/kernelbase/console.c @@ -1222,22 +1222,17 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode( HANDLE handle, DWORD mode ) */ BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleOutputCP( UINT cp ) { - BOOL ret; + struct condrv_input_info_params params = { SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE }; if (!IsValidCodePage( cp )) { SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } - SERVER_START_REQ( set_console_input_info ) - { - req->handle = 0; - req->mask = SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE; - req->output_cp = cp; - ret = !wine_server_call_err( req ); - } - SERVER_END_REQ; - return ret; + + params.info.output_cp = cp; + return console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle, + IOCTL_CONDRV_SET_INPUT_INFO, ¶ms, sizeof(params), NULL, 0, NULL ); }