Fixed regression in process creation (std handle inheritance).
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 38f10e2..b564573 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h
@@ -190,7 +190,6 @@ { struct request_header __header; int inherit_all; - int use_handles; int create_flags; int unix_pid; obj_handle_t exe_file; @@ -3647,6 +3646,6 @@ struct open_token_reply open_token_reply; }; -#define SERVER_PROTOCOL_VERSION 118 +#define SERVER_PROTOCOL_VERSION 119 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/scheduler/process.c b/scheduler/process.c index 88b5201..9b8d1ab 100644 --- a/scheduler/process.c +++ b/scheduler/process.c
@@ -341,6 +341,10 @@ } else { + /* convert value from server: + * + 0 => INVALID_HANDLE_VALUE + * + console handle need to be mapped + */ if (!process_pmts.hStdInput) process_pmts.hStdInput = INVALID_HANDLE_VALUE; else if (VerifyConsoleIoHandle(console_handle_map(process_pmts.hStdInput))) @@ -944,7 +948,6 @@ req->inherit_all = inherit; req->create_flags = flags; - req->use_handles = (startup->dwFlags & STARTF_USESTDHANDLES) != 0; req->unix_pid = pid; req->exe_file = hFile; if (startup->dwFlags & STARTF_USESTDHANDLES)
diff --git a/server/console.c b/server/console.c index 3a295db..b9da5a6 100644 --- a/server/console.c +++ b/server/console.c
@@ -347,9 +347,11 @@ { struct console_input* console; - if ((console = (struct console_input*)get_handle_obj( parent, hconin, 0, NULL ))) + /* FIXME: should we check some access rights ? */ + if ((console = (struct console_input*)get_handle_obj( parent, hconin, + 0, &console_input_ops ))) { - if (console->renderer == parent_thread) + if (console->renderer == parent_thread) { process->console = (struct console_input*)grab_object( console ); process->console->num_proc++;
diff --git a/server/process.c b/server/process.c index 333e11c..cc4721d 100644 --- a/server/process.c +++ b/server/process.c
@@ -83,7 +83,6 @@ struct object obj; /* object header */ struct list entry; /* entry in list of startup infos */ int inherit_all; /* inherit all handles from parent */ - int use_handles; /* use stdio handles */ int create_flags; /* creation flags */ int unix_pid; /* Unix pid of new process */ obj_handle_t hstdin; /* handle for stdin */ @@ -216,14 +215,25 @@ * like if hConOut and hConIn are console handles, then they should be on the same * physical console */ - inherit_console( parent_thread, process, - (info->inherit_all || info->use_handles) ? info->hstdin : 0 ); + inherit_console( parent_thread, process, info->inherit_all ? info->hstdin : 0 ); } if (info) { - reply->hstdin = info->hstdin; - reply->hstdout = info->hstdout; - reply->hstderr = info->hstderr; + if (!info->inherit_all) + { + reply->hstdin = duplicate_handle( parent_thread->process, info->hstdin, process, + 0, TRUE, DUPLICATE_SAME_ACCESS ); + reply->hstdout = duplicate_handle( parent_thread->process, info->hstdout, process, + 0, TRUE, DUPLICATE_SAME_ACCESS ); + reply->hstderr = duplicate_handle( parent_thread->process, info->hstderr, process, + 0, TRUE, DUPLICATE_SAME_ACCESS ); + } + else + { + reply->hstdin = info->hstdin; + reply->hstdout = info->hstdout; + reply->hstderr = info->hstderr; + } } else reply->hstdin = reply->hstdout = reply->hstderr = 0; /* some handles above may have been invalid; this is not an error */ @@ -870,7 +880,6 @@ if (!(info = alloc_object( &startup_info_ops ))) return; list_add_head( &startup_info_list, &info->entry ); info->inherit_all = req->inherit_all; - info->use_handles = req->use_handles; info->create_flags = req->create_flags; info->unix_pid = req->unix_pid; info->hstdin = req->hstdin;
diff --git a/server/protocol.def b/server/protocol.def index bf672b7..4cc823d 100644 --- a/server/protocol.def +++ b/server/protocol.def
@@ -204,7 +204,6 @@ /* Create a new process from the context of the parent */ @REQ(new_process) int inherit_all; /* inherit all handles from parent */ - int use_handles; /* use stdio handles */ int create_flags; /* creation flags */ int unix_pid; /* Unix pid of new process */ obj_handle_t exe_file; /* file handle for main exe */
diff --git a/server/trace.c b/server/trace.c index 22b542a..3dd62ca 100644 --- a/server/trace.c +++ b/server/trace.c
@@ -371,7 +371,6 @@ static void dump_new_process_request( const struct new_process_request *req ) { fprintf( stderr, " inherit_all=%d,", req->inherit_all ); - fprintf( stderr, " use_handles=%d,", req->use_handles ); fprintf( stderr, " create_flags=%d,", req->create_flags ); fprintf( stderr, " unix_pid=%d,", req->unix_pid ); fprintf( stderr, " exe_file=%p,", req->exe_file );