[PATCH 5/6] conhost: Support creating consoles with no window.

Torge Matthies openglfreak at googlemail.com
Mon Apr 4 21:06:42 CDT 2022


Signed-off-by: Torge Matthies <openglfreak at googlemail.com>
---
 programs/conhost/conhost.c | 9 +++++++--
 programs/conhost/conhost.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index d494e3f53a5..9b47f87cb4c 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -2650,7 +2650,7 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code,
             TRACE( "get window\n" );
             if (in_size || *out_size != sizeof(*result)) return STATUS_INVALID_PARAMETER;
             if (!(result = alloc_ioctl_buffer( sizeof(*result )))) return STATUS_NO_MEMORY;
-            if (!console->win) init_message_window( console );
+            if (!console->win && !console->no_window) init_message_window( console );
             *result = condrv_handle( console->win );
             return STATUS_SUCCESS;
         }
@@ -2897,6 +2897,11 @@ int __cdecl wmain(int argc, WCHAR *argv[])
             if ((!height && !console.is_unix) || height > 0xffff || *end) return 1;
             continue;
         }
+        if (!wcscmp( argv[i], L"--no-window"))
+        {
+            console.no_window = 1;
+            continue;
+        }
         if (!wcscmp( argv[i], L"--signal" ))
         {
             if (++i == argc) return 1;
@@ -2932,7 +2937,7 @@ int __cdecl wmain(int argc, WCHAR *argv[])
         init_tty_output( &console );
         if (!console.is_unix && !ensure_tty_input_thread( &console )) return 1;
     }
-    else
+    else if (!console.no_window)
     {
         STARTUPINFOW si;
         if (!init_window( &console )) return 1;
diff --git a/programs/conhost/conhost.h b/programs/conhost/conhost.h
index 8ca09bb80d0..252c01de501 100644
--- a/programs/conhost/conhost.h
+++ b/programs/conhost/conhost.h
@@ -79,6 +79,7 @@ struct console
     struct screen_buffer  *active;              /* active screen buffer */
     int                    is_unix;             /* UNIX terminal mode */
     int                    use_relative_cursor; /* use relative cursor positionning */
+    int                    no_window;           /* do now allocate a window */
     INPUT_RECORD          *records;             /* input records */
     unsigned int           record_count;        /* number of input records */
     unsigned int           record_size;         /* size of input records buffer */
-- 
2.35.1




More information about the wine-devel mailing list