Commit 09ff2436 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Pass console handle to the child process.

parent 06c3e7e4
......@@ -3724,7 +3724,6 @@ static void test_AttachConsole_child(DWORD console_pid)
ok(!res && GetLastError() == ERROR_ACCESS_DENIED,
"AttachConsole returned: %x(%u)\n", res, GetLastError());
todo_wine
ok(RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle != NULL, "ConsoleHandle is NULL\n");
res = FreeConsole();
ok(res, "FreeConsole failed: %u\n", GetLastError());
......
......@@ -620,8 +620,8 @@ int free_console( struct process *process )
* 2/ parent is a renderer which launches process, and process should attach to the console
* rendered by parent
*/
void inherit_console( struct thread *parent_thread, struct process *parent, struct process *process,
obj_handle_t hconin )
obj_handle_t inherit_console( struct thread *parent_thread, struct process *parent, struct process *process,
obj_handle_t hconin )
{
int done = 0;
......@@ -652,6 +652,10 @@ void inherit_console( struct thread *parent_thread, struct process *parent, stru
process->console = (struct console_input *)grab_object( parent->console );
process->console->num_proc++;
}
if (!process->console) return 0;
return alloc_handle( process, process->console,
SYNCHRONIZE | FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES, 0 );
}
struct thread *console_get_renderer( struct console_input *console )
......
......@@ -1224,7 +1224,8 @@ DECL_HANDLER(new_process)
* like if hConOut and hConIn are console handles, then they should be on the same
* physical console
*/
inherit_console( parent_thread, parent, process, req->inherit_all ? info->data->hstdin : 0 );
info->data->console = inherit_console( parent_thread, parent,
process, req->inherit_all ? info->data->hstdin : 0 );
}
if (!req->inherit_all && !(req->create_flags & CREATE_NEW_CONSOLE))
......
......@@ -131,8 +131,8 @@ extern void detach_debugged_processes( struct thread *debugger );
extern void enum_processes( int (*cb)(struct process*, void*), void *user);
/* console functions */
extern void inherit_console( struct thread *parent_thread, struct process *parent,
struct process *process, obj_handle_t hconin );
extern obj_handle_t inherit_console( struct thread *parent_thread, struct process *parent,
struct process *process, obj_handle_t hconin );
extern int free_console( struct process *process );
extern struct thread *console_get_renderer( struct console_input *console );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment