From 3217abd7a57e2b6bc3d7eb6c3de3d570cd5b86f8 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 16 Sep 2020 20:39:10 +0200 Subject: [PATCH] server: Allow creating unbound console connection objects. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- server/console.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/server/console.c b/server/console.c index 50698a727fc..95c087ae154 100644 --- a/server/console.c +++ b/server/console.c @@ -1330,8 +1330,11 @@ static struct object *create_console_connection( struct console_input *console ) if (!(connection = alloc_object( &console_connection_ops ))) return NULL; - current->process->console = (struct console_input *)grab_object( console ); - console->num_proc++; + if (console) + { + current->process->console = (struct console_input *)grab_object( console ); + console->num_proc++; + } return &connection->obj; } @@ -2305,6 +2308,7 @@ static void console_device_dump( struct object *obj, int verbose ) static struct object *console_device_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr ) { + static const WCHAR connectionW[] = {'C','o','n','n','e','c','t','i','o','n'}; static const WCHAR consoleW[] = {'C','o','n','s','o','l','e'}; static const WCHAR current_inW[] = {'C','u','r','r','e','n','t','I','n'}; static const WCHAR current_outW[] = {'C','u','r','r','e','n','t','O','u','t'}; @@ -2363,6 +2367,12 @@ static struct object *console_device_lookup_name( struct object *obj, struct uni return create_console_server(); } + if (name->len == sizeof(connectionW) && !memcmp( name->str, connectionW, name->len )) + { + name->len = 0; + return create_console_connection( NULL ); + } + return NULL; }