Jacek Caban : server: Support unbound console input device.
Alexandre Julliard
julliard at winehq.org
Thu Nov 12 15:17:45 CST 2020
Module: wine
Branch: master
Commit: 4e4872d59d0124544ad0bd8b446be8195ae8e780
URL: https://source.winehq.org/git/wine.git/?a=commit;h=4e4872d59d0124544ad0bd8b446be8195ae8e780
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Nov 12 19:56:18 2020 +0100
server: Support unbound console input device.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernelbase/console.c | 3 +--
server/console.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c
index f812b2b9a55..ed5550bb0b6 100644
--- a/dlls/kernelbase/console.c
+++ b/dlls/kernelbase/console.c
@@ -237,8 +237,7 @@ static BOOL init_console_std_handles( BOOL override_all )
if (override_all || !GetStdHandle( STD_INPUT_HANDLE ))
{
- /* FIXME: Use unbound console handle */
- RtlInitUnicodeString( &name, L"\\Device\\ConDrv\\CurrentIn" );
+ RtlInitUnicodeString( &name, L"\\Device\\ConDrv\\Input" );
status = NtCreateFile( &handle, FILE_READ_DATA | FILE_WRITE_DATA | SYNCHRONIZE | FILE_READ_ATTRIBUTES |
FILE_WRITE_ATTRIBUTES, &attr, &iosb, NULL, FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_CREATE,
diff --git a/server/console.c b/server/console.c
index ebcc8beb97c..bc93809ab97 100644
--- a/server/console.c
+++ b/server/console.c
@@ -283,6 +283,36 @@ static const struct object_ops console_device_ops =
no_destroy /* destroy */
};
+static void input_device_dump( struct object *obj, int verbose );
+static struct object *input_device_open_file( struct object *obj, unsigned int access,
+ unsigned int sharing, unsigned int options );
+static int input_device_add_queue( struct object *obj, struct wait_queue_entry *entry );
+static struct fd *input_device_get_fd( struct object *obj );
+
+static const struct object_ops input_device_ops =
+{
+ sizeof(struct object), /* size */
+ input_device_dump, /* dump */
+ console_device_get_type, /* get_type */
+ input_device_add_queue, /* add_queue */
+ NULL, /* remove_queue */
+ NULL, /* signaled */
+ no_satisfied, /* satisfied */
+ no_signal, /* signal */
+ input_device_get_fd, /* get_fd */
+ no_map_access, /* map_access */
+ default_get_sd, /* get_sd */
+ default_set_sd, /* set_sd */
+ no_get_full_name, /* get_full_name */
+ no_lookup_name, /* lookup_name */
+ directory_link_name, /* link_name */
+ default_unlink_name, /* unlink_name */
+ input_device_open_file, /* open_file */
+ no_kernel_obj_list, /* get_kernel_obj_list */
+ no_close_handle, /* close_handle */
+ no_destroy /* destroy */
+};
+
struct console_connection
{
struct object obj; /* object header */
@@ -1065,6 +1095,7 @@ static struct object *console_device_lookup_name( struct object *obj, struct uni
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 inputW[] = {'I','n','p','u','t'};
static const WCHAR screen_bufferW[] = {'S','c','r','e','e','n','B','u','f','f','e','r'};
static const WCHAR serverW[] = {'S','e','r','v','e','r'};
@@ -1096,6 +1127,12 @@ static struct object *console_device_lookup_name( struct object *obj, struct uni
return grab_object( obj );
}
+ if (name->len == sizeof(inputW) && !memcmp( name->str, inputW, name->len ))
+ {
+ name->len = 0;
+ return alloc_object( &input_device_ops );
+ }
+
if (name->len == sizeof(screen_bufferW) && !memcmp( name->str, screen_bufferW, name->len ))
{
if (!current->process->console)
@@ -1141,6 +1178,37 @@ static struct object *console_device_open_file( struct object *obj, unsigned int
return is_output ? grab_object( current->process->console->active ) : grab_object( current->process->console );
}
+static void input_device_dump( struct object *obj, int verbose )
+{
+ fputs( "console Input device\n", stderr );
+}
+
+static int input_device_add_queue( struct object *obj, struct wait_queue_entry *entry )
+{
+ if (!current->process->console)
+ {
+ set_error( STATUS_ACCESS_DENIED );
+ return 0;
+ }
+ return add_queue( ¤t->process->console->obj, entry );
+}
+
+static struct fd *input_device_get_fd( struct object *obj )
+{
+ if (!current->process->console)
+ {
+ set_error( STATUS_ACCESS_DENIED );
+ return 0;
+ }
+ return get_obj_fd( ¤t->process->console->obj );
+}
+
+static struct object *input_device_open_file( struct object *obj, unsigned int access,
+ unsigned int sharing, unsigned int options )
+{
+ return grab_object( obj );
+}
+
struct object *create_console_device( struct object *root, const struct unicode_str *name,
unsigned int attr, const struct security_descriptor *sd )
{
More information about the wine-cvs
mailing list