From 21c99970f3c423e2b8b1f92b2b44c5dce7cc28bf Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 27 Aug 2020 15:05:36 +0200 Subject: [PATCH] conhost: Implement IOCTL_CONDRV_SET_MODE. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/kernel32/tests/console.c | 10 ++++++++++ programs/conhost/conhost.c | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 5efe4ee38cf..a8c07dcae78 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3971,6 +3971,16 @@ static void test_pseudo_console_child(HANDLE input, HANDLE output) ok(ret, "GetConsoleMode failed: %u\n", GetLastError()); ok(mode == (ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT), "mode = %x\n", mode); + ret = SetConsoleMode(output, mode & ~ENABLE_WRAP_AT_EOL_OUTPUT); + ok(ret, "SetConsoleMode failed: %u\n", GetLastError()); + + ret = GetConsoleMode(output, &mode); + ok(ret, "GetConsoleMode failed: %u\n", GetLastError()); + ok(mode == ENABLE_PROCESSED_OUTPUT, "mode = %x\n", mode); + + ret = SetConsoleMode(output, mode | ENABLE_WRAP_AT_EOL_OUTPUT); + ok(ret, "SetConsoleMode failed: %u\n", GetLastError()); + test_console_title(); test_WriteConsoleInputW(input); } diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 06d2b15d2ac..7c20cd4eb35 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -244,6 +244,12 @@ static NTSTATUS screen_buffer_ioctl( struct screen_buffer *screen_buffer, unsign return STATUS_SUCCESS; } + case IOCTL_CONDRV_SET_MODE: + if (in_size != sizeof(unsigned int) || *out_size) return STATUS_INVALID_PARAMETER; + screen_buffer->mode = *(unsigned int *)in_data; + TRACE( "set %x mode\n", screen_buffer->mode ); + return STATUS_SUCCESS; + default: FIXME( "unsupported ioctl %x\n", code ); return STATUS_NOT_SUPPORTED;