Jacek Caban : server: Support creating console reference from console connection object.

Alexandre Julliard julliard at winehq.org
Wed Sep 16 15:37:34 CDT 2020


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Sep 16 20:39:35 2020 +0200

server: Support creating console reference from console connection object.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 server/console.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/server/console.c b/server/console.c
index b9fb0fb448..5346c7cb8f 100644
--- a/server/console.c
+++ b/server/console.c
@@ -367,6 +367,7 @@ struct console_connection
 
 static void console_connection_dump( struct object *obj, int verbose );
 static struct fd *console_connection_get_fd( struct object *obj );
+static struct object *console_connection_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr );
 static struct object *console_connection_open_file( struct object *obj, unsigned int access,
                                                     unsigned int sharing, unsigned int options );
 static int console_connection_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
@@ -386,7 +387,7 @@ static const struct object_ops console_connection_ops =
     no_map_access,                    /* map_access */
     default_get_sd,                   /* get_sd */
     default_set_sd,                   /* set_sd */
-    no_lookup_name,                   /* lookup_name */
+    console_connection_lookup_name,   /* lookup_name */
     directory_link_name,              /* link_name */
     default_unlink_name,              /* unlink_name */
     console_connection_open_file,     /* open_file */
@@ -2353,6 +2354,24 @@ static struct fd *console_connection_get_fd( struct object *obj )
     return (struct fd *)grab_object( connection->fd );
 }
 
+static struct object *console_connection_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr )
+{
+    static const WCHAR referenceW[] = {'R','e','f','e','r','e','n','c','e'};
+
+    if (name->len == sizeof(referenceW) && !memcmp( name->str, referenceW, name->len ))
+    {
+        if (!current->process->console)
+        {
+            set_error( STATUS_INVALID_HANDLE );
+            return NULL;
+        }
+        name->len = 0;
+        return grab_object( current->process->console );
+    }
+
+    return NULL;
+}
+
 static struct object *console_connection_open_file( struct object *obj, unsigned int access,
                                                     unsigned int sharing, unsigned int options )
 {




More information about the wine-cvs mailing list