conhost: Implement IOCTL_CONDRV_SET_MODE.

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-24 13:20:53 +02:00 committed by Alexandre Julliard
parent 2105602edf
commit 5a151b060a
2 changed files with 30 additions and 7 deletions

View File

@ -3945,6 +3945,29 @@ static void test_AllocConsole(void)
CloseHandle(pipe_write);
}
static void test_pseudo_console_child(HANDLE input)
{
DWORD mode;
BOOL ret;
ret = GetConsoleMode(input, &mode);
ok(ret, "GetConsoleMode failed: %u\n", GetLastError());
ok(mode == (ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT |
ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS | ENABLE_AUTO_POSITION),
"mode = %x\n", mode);
ret = SetConsoleMode(input, mode & ~ENABLE_AUTO_POSITION);
ok(ret, "SetConsoleMode failed: %u\n", GetLastError());
ret = GetConsoleMode(input, &mode);
ok(ret, "GetConsoleMode failed: %u\n", GetLastError());
ok(mode == (ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT |
ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS), "mode = %x\n", mode);
ret = SetConsoleMode(input, mode | ENABLE_AUTO_POSITION);
ok(ret, "SetConsoleMode failed: %u\n", GetLastError());
}
static DWORD WINAPI read_pipe_proc( void *handle )
{
char buf[64];
@ -4118,13 +4141,7 @@ START_TEST(console)
if (using_pseudo_console)
{
DWORD mode;
ret = GetConsoleMode(hConIn, &mode);
ok(ret, "GetConsoleMode failed: %u\n", GetLastError());
ok(mode == (ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT |
ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS | ENABLE_AUTO_POSITION),
"mode = %x\n", mode);
test_pseudo_console_child(hConIn);
return;
}

View File

@ -67,6 +67,12 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code,
return STATUS_SUCCESS;
}
case IOCTL_CONDRV_SET_MODE:
if (in_size != sizeof(unsigned int) || *out_size) return STATUS_INVALID_PARAMETER;
console->mode = *(unsigned int *)in_data;
TRACE( "set %x mode\n", console->mode );
return STATUS_SUCCESS;
default:
FIXME( "unsupported ioctl %x\n", code );
return STATUS_NOT_SUPPORTED;