From dfe1bb7b8d90fd1e6f660232eb8ccccf8a30f05c Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 24 Nov 2020 17:18:01 +0100 Subject: [PATCH] conhost: Signal console in process_console_input if needed. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50037 Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- programs/conhost/conhost.c | 7 ++++++- programs/conhost/conhost.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 2a4de030cbb..e3a9a25eac3 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -428,6 +428,7 @@ static NTSTATUS read_complete( struct console *console, NTSTATUS status, const v } SERVER_END_REQ; if (status && (console->read_ioctl || status != STATUS_INVALID_HANDLE)) ERR( "failed: %#x\n", status ); + console->signaled = signal; console->read_ioctl = 0; console->pending_read = 0; return status; @@ -1218,6 +1219,9 @@ static NTSTATUS process_console_input( struct console *console ) case IOCTL_CONDRV_READ_FILE: break; default: + assert( !console->read_ioctl ); + if (console->record_count && !console->signaled) + read_complete( console, STATUS_PENDING, NULL, 0, TRUE ); /* signal server */ return STATUS_SUCCESS; } @@ -2534,11 +2538,12 @@ static NTSTATUS process_console_ioctls( struct console *console ) { if (status) out_size = 0; + console->signaled = console->record_count != 0; SERVER_START_REQ( get_next_console_request ) { req->handle = wine_server_obj_handle( console->server ); req->status = status; - req->signal = console->record_count != 0; + req->signal = console->signaled; wine_server_add_data( req, ioctl_buffer, out_size ); wine_server_set_reply( req, ioctl_buffer, ioctl_buffer_size ); status = wine_server_call( req ); diff --git a/programs/conhost/conhost.h b/programs/conhost/conhost.h index 7bc102b0df0..3094fd6e5f0 100644 --- a/programs/conhost/conhost.h +++ b/programs/conhost/conhost.h @@ -80,6 +80,7 @@ struct console INPUT_RECORD *records; /* input records */ unsigned int record_count; /* number of input records */ unsigned int record_size; /* size of input records buffer */ + int signaled; /* is server in signaled state */ WCHAR *read_buffer; /* buffer of data available for read */ size_t read_buffer_count; /* size of available data */ size_t read_buffer_size; /* size of buffer */