From: Jacek Caban Subject: [PATCH 5/5] server: Remove no longer needed hack for inheriting console from stdin. Message-Id: <31060814-d0f3-8bd3-6b70-84540a959e3d@codeweavers.com> Date: Fri, 20 Nov 2020 15:40:40 +0100 Signed-off-by: Jacek Caban --- server/console.c | 30 ------------------------------ server/process.c | 12 +++--------- server/process.h | 2 -- 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/server/console.c b/server/console.c index 799d31c6fde..9190dcc02dd 100644 --- a/server/console.c +++ b/server/console.c @@ -595,36 +595,6 @@ int free_console( struct process *process ) return 1; } -/* let process inherit the console from parent... this handle two cases : - * 1/ generic console inheritance - * 2/ parent is a renderer which launches process, and process should attach to the console - * rendered by parent - */ -obj_handle_t inherit_console( struct thread *parent_thread, obj_handle_t handle, struct process *process, - obj_handle_t hconin ) -{ - struct console_input *console = NULL; - - if (handle) return duplicate_handle( current->process, handle, process, 0, 0, DUP_HANDLE_SAME_ACCESS ); - - /* if parent is a renderer, then attach current process to its console - * a bit hacky.... - */ - if (hconin && parent_thread) - { - /* FIXME: should we check some access rights ? */ - if (!(console = (struct console_input *)get_handle_obj( parent_thread->process, hconin, - 0, &console_input_ops ))) - clear_error(); /* ignore error */ - } - if (!console) return 0; - - process->console = console; - console->num_proc++; - return alloc_handle( process, process->console, - SYNCHRONIZE | GENERIC_READ | GENERIC_WRITE, 0 ); -} - struct thread *console_get_renderer( struct console_input *console ) { return console->renderer; diff --git a/server/process.c b/server/process.c index 1786493a814..d5b9a2548cf 100644 --- a/server/process.c +++ b/server/process.c @@ -1254,15 +1254,9 @@ DECL_HANDLER(new_process) connect_process_winstation( process, parent_thread, parent ); /* set the process console */ - if (!(req->create_flags & (DETACHED_PROCESS | CREATE_NEW_CONSOLE))) - { - /* FIXME: some better error checking should be done... - * like if hConOut and hConIn are console handles, then they should be on the same - * physical console - */ - info->data->console = inherit_console( parent_thread, info->data->console, - process, req->inherit_all ? info->data->hstdin : 0 ); - } + if (info->data->console > 3) + info->data->console = duplicate_handle( parent, info->data->console, process, + 0, 0, DUPLICATE_SAME_ACCESS ); if (!req->inherit_all && !(req->create_flags & CREATE_NEW_CONSOLE)) { diff --git a/server/process.h b/server/process.h index 56092e5b1ac..7e8c1d3beb7 100644 --- a/server/process.h +++ b/server/process.h @@ -132,8 +132,6 @@ extern void detach_debugged_processes( struct thread *debugger ); extern void enum_processes( int (*cb)(struct process*, void*), void *user); /* console functions */ -extern obj_handle_t inherit_console( struct thread *parent_thread, obj_handle_t handle, - struct process *process, obj_handle_t hconin ); extern int free_console( struct process *process ); extern struct thread *console_get_renderer( struct console_input *console );