Jacek Caban : conhost: Signal console in process_console_input if needed.

Alexandre Julliard julliard at winehq.org
Tue Nov 24 17:01:44 CST 2020


Module: wine
Branch: master
Commit: dfe1bb7b8d90fd1e6f660232eb8ccccf8a30f05c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=dfe1bb7b8d90fd1e6f660232eb8ccccf8a30f05c

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Nov 24 17:18:01 2020 +0100

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 <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 */




More information about the wine-cvs mailing list