Commit 1d8c2d28 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

kernelbase: Move console code page validation to conhost.

parent 01c17ca2
......@@ -637,7 +637,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetConsoleCP(void)
if (!console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL ))
return 0;
return info.input_cp ? info.input_cp : GetOEMCP();
return info.input_cp;
}
......@@ -710,7 +710,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetConsoleOutputCP(void)
if (!console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
IOCTL_CONDRV_GET_INPUT_INFO, NULL, 0, &info, sizeof(info), NULL ))
return 0;
return info.output_cp ? info.output_cp : GetOEMCP();
return info.output_cp;
}
......@@ -1092,12 +1092,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCP( UINT cp )
{
struct condrv_input_info_params params = { SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE };
if (!IsValidCodePage( cp ))
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
params.info.input_cp = cp;
return console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
IOCTL_CONDRV_SET_INPUT_INFO, &params, sizeof(params), NULL, 0, NULL );
......@@ -1237,12 +1231,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleOutputCP( UINT cp )
{
struct condrv_input_info_params params = { SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE };
if (!IsValidCodePage( cp ))
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
params.info.output_cp = cp;
return console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle,
IOCTL_CONDRV_SET_INPUT_INFO, &params, sizeof(params), NULL, 0, NULL );
......
......@@ -2407,9 +2407,15 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code,
TRACE( "set info\n" );
if (in_size != sizeof(*params) || *out_size) return STATUS_INVALID_PARAMETER;
if (params->mask & SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE)
{
if (!IsValidCodePage( params->info.input_cp )) return STATUS_INVALID_PARAMETER;
console->input_cp = params->info.input_cp;
}
if (params->mask & SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE)
{
if (!IsValidCodePage( params->info.output_cp )) return STATUS_INVALID_PARAMETER;
console->output_cp = params->info.output_cp;
}
return STATUS_SUCCESS;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment