Jacek Caban : server: Allow creating screen buffer using NtCreateFile.

Alexandre Julliard julliard at winehq.org
Tue Jul 21 15:40:21 CDT 2020


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Jul 21 14:56:57 2020 +0200

server: Allow creating screen buffer using NtCreateFile.

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

---

 server/console.c | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/server/console.c b/server/console.c
index df84334448..9f102968a1 100644
--- a/server/console.c
+++ b/server/console.c
@@ -525,7 +525,7 @@ static void generate_sb_initial_events( struct console_input *console_input )
     console_input_events_append( console_input, &evt );
 }
 
-static struct screen_buffer *create_console_output( struct console_input *console_input, int fd )
+static struct object *create_console_output( struct console_input *console_input, int fd )
 {
     struct screen_buffer *screen_buffer;
     int	i;
@@ -592,7 +592,7 @@ static struct screen_buffer *create_console_output( struct console_input *consol
 	console_input->active = (struct screen_buffer*)grab_object( screen_buffer );
         generate_sb_initial_events( console_input );
     }
-    return screen_buffer;
+    return &screen_buffer->obj;
 }
 
 /* free the console for this process */
@@ -1809,10 +1809,11 @@ 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 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'};
-    static const WCHAR rendererW[]    = {'R','e','n','d','e','r','e','r'};
+    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'};
+    static const WCHAR rendererW[]      = {'R','e','n','d','e','r','e','r'};
+    static const WCHAR screen_bufferW[] = {'S','c','r','e','e','n','B','u','f','f','e','r'};
 
     if (name->len == sizeof(current_inW) && !memcmp( name->str, current_inW, name->len ))
     {
@@ -1848,6 +1849,17 @@ static struct object *console_device_lookup_name( struct object *obj, struct uni
         return create_console_input_events();
     }
 
+    if (name->len == sizeof(screen_bufferW) && !memcmp( name->str, screen_bufferW, name->len ))
+    {
+        if (!current->process->console)
+        {
+            set_error( STATUS_INVALID_HANDLE );
+            return NULL;
+        }
+        name->len = 0;
+        return create_console_output( current->process->console, -1 );
+    }
+
     return NULL;
 }
 
@@ -2056,9 +2068,9 @@ DECL_HANDLER(get_console_input_history)
 /* creates a screen buffer */
 DECL_HANDLER(create_console_output)
 {
-    struct console_input*	console;
-    struct screen_buffer*	screen_buffer;
-    int                         fd;
+    struct console_input *console;
+    struct object        *screen_buffer;
+    int                   fd;
 
     if (req->fd != -1)
     {




More information about the wine-cvs mailing list