kernelbase: Use IOCTL_CONDRV_GET_INPUT_INFO in GetConsoleCP.

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:26:53 +02:00 committed by Alexandre Julliard
parent 00b4a51fcc
commit 4faed406d4
2 changed files with 11 additions and 11 deletions

View File

@ -3590,6 +3590,7 @@ static void test_GetConsoleScreenBufferInfoEx(HANDLE std_output)
static void test_FreeConsole(void)
{
HANDLE handle;
UINT cp;
BOOL ret;
ok(RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle != NULL, "ConsoleHandle is NULL\n");
@ -3626,6 +3627,11 @@ static void test_FreeConsole(void)
ok(handle == INVALID_HANDLE_VALUE && GetLastError() == ERROR_INVALID_HANDLE,
"CreateConsoleScreenBuffer returned: %p (%u)\n", handle, GetLastError());
SetLastError(0xdeadbeef);
cp = GetConsoleCP();
ok(!cp, "cp = %x\n", cp);
ok(GetLastError() == ERROR_INVALID_HANDLE, "last error %u\n", GetLastError());
if (!skip_nt)
{
SetStdHandle( STD_INPUT_HANDLE, (HANDLE)0xdeadbeef );

View File

@ -585,18 +585,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH GenerateConsoleCtrlEvent( DWORD event, DWORD group
*/
UINT WINAPI DECLSPEC_HOTPATCH GetConsoleCP(void)
{
UINT codepage = GetOEMCP(); /* default value */
struct condrv_input_info info;
SERVER_START_REQ( get_console_input_info )
{
req->handle = 0;
if (!wine_server_call_err( req ))
{
if (reply->input_cp) codepage = reply->input_cp;
}
}
SERVER_END_REQ;
return codepage;
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();
}