conhost: Implement IOCTL_CONDRV_GET_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-27 15:05:25 +02:00 committed by Alexandre Julliard
parent eb293d7645
commit e5bd1ba4ad
2 changed files with 18 additions and 2 deletions

View File

@ -3945,7 +3945,7 @@ static void test_AllocConsole(void)
CloseHandle(pipe_write);
}
static void test_pseudo_console_child(HANDLE input)
static void test_pseudo_console_child(HANDLE input, HANDLE output)
{
DWORD mode;
BOOL ret;
@ -3967,6 +3967,10 @@ static void test_pseudo_console_child(HANDLE input)
ret = SetConsoleMode(input, mode | ENABLE_AUTO_POSITION);
ok(ret, "SetConsoleMode failed: %u\n", GetLastError());
ret = GetConsoleMode(output, &mode);
ok(ret, "GetConsoleMode failed: %u\n", GetLastError());
ok(mode == (ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT), "mode = %x\n", mode);
test_console_title();
test_WriteConsoleInputW(input);
}
@ -4144,7 +4148,7 @@ START_TEST(console)
if (using_pseudo_console)
{
test_pseudo_console_child(hConIn);
test_pseudo_console_child(hConIn, hConOut);
return;
}

View File

@ -67,6 +67,7 @@ struct screen_buffer
{
struct console *console; /* console reference */
unsigned int id; /* screen buffer id */
unsigned int mode; /* output mode */
unsigned int width; /* size (w-h) of the screen buffer */
unsigned int height;
struct wine_rb_entry entry; /* map entry */
@ -102,6 +103,7 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int
if (!(screen_buffer = malloc( sizeof(*screen_buffer) ))) return NULL;
screen_buffer->console = console;
screen_buffer->id = id;
screen_buffer->mode = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT;
screen_buffer->width = width;
screen_buffer->height = height;
@ -232,6 +234,16 @@ static NTSTATUS screen_buffer_ioctl( struct screen_buffer *screen_buffer, unsign
screen_buffer->console->active = screen_buffer;
return STATUS_SUCCESS;
case IOCTL_CONDRV_GET_MODE:
{
DWORD *mode;
TRACE( "returning mode %x\n", screen_buffer->mode );
if (in_size || *out_size != sizeof(*mode)) return STATUS_INVALID_PARAMETER;
if (!(mode = alloc_ioctl_buffer( *out_size ))) return STATUS_NO_MEMORY;
*mode = screen_buffer->mode;
return STATUS_SUCCESS;
}
default:
FIXME( "unsupported ioctl %x\n", code );
return STATUS_NOT_SUPPORTED;