Commit 449d10fd authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Fixed regression in process creation (std handle inheritance).

parent 9b8a0595
......@@ -190,7 +190,6 @@ struct new_process_request
{
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 @@ union generic_reply
struct open_token_reply open_token_reply;
};
#define SERVER_PROTOCOL_VERSION 118
#define SERVER_PROTOCOL_VERSION 119
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -341,6 +341,10 @@ static BOOL process_init( char *argv[] )
}
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 @@ static BOOL create_process( HANDLE hFile, LPCSTR filename, LPSTR cmd_line, LPCST
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)
......
......@@ -347,9 +347,11 @@ void inherit_console(struct thread *parent_thread, struct process *process, obj_
{
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++;
......
......@@ -83,7 +83,6 @@ struct startup_info
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 @@ static int set_process_console( struct process *process, struct thread *parent_t
* 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 @@ DECL_HANDLER(new_process)
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;
......
......@@ -204,7 +204,6 @@ typedef struct
/* 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 */
......
......@@ -371,7 +371,6 @@ typedef void (*dump_func)( const void *req );
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 );
......
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