kernelbase: Use IOCTL_CONDRV_SET_INPUT_INFO in SetConsoleOutputCP.

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-17 15:07:30 +02:00 committed by Alexandre Julliard
parent c6e0cb6c72
commit 32eb41de8c
2 changed files with 9 additions and 10 deletions

View File

@ -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) );

View File

@ -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, &params, sizeof(params), NULL, 0, NULL );
}