Fixed regression in process creation (std handle inheritance).
This commit is contained in:
parent
9b8a0595bc
commit
449d10fd79
@ -190,7 +190,6 @@ struct new_process_request
|
|||||||
{
|
{
|
||||||
struct request_header __header;
|
struct request_header __header;
|
||||||
int inherit_all;
|
int inherit_all;
|
||||||
int use_handles;
|
|
||||||
int create_flags;
|
int create_flags;
|
||||||
int unix_pid;
|
int unix_pid;
|
||||||
obj_handle_t exe_file;
|
obj_handle_t exe_file;
|
||||||
@ -3647,6 +3646,6 @@ union generic_reply
|
|||||||
struct open_token_reply open_token_reply;
|
struct open_token_reply open_token_reply;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SERVER_PROTOCOL_VERSION 118
|
#define SERVER_PROTOCOL_VERSION 119
|
||||||
|
|
||||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||||
|
@ -341,6 +341,10 @@ static BOOL process_init( char *argv[] )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* convert value from server:
|
||||||
|
* + 0 => INVALID_HANDLE_VALUE
|
||||||
|
* + console handle need to be mapped
|
||||||
|
*/
|
||||||
if (!process_pmts.hStdInput)
|
if (!process_pmts.hStdInput)
|
||||||
process_pmts.hStdInput = INVALID_HANDLE_VALUE;
|
process_pmts.hStdInput = INVALID_HANDLE_VALUE;
|
||||||
else if (VerifyConsoleIoHandle(console_handle_map(process_pmts.hStdInput)))
|
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->inherit_all = inherit;
|
||||||
req->create_flags = flags;
|
req->create_flags = flags;
|
||||||
req->use_handles = (startup->dwFlags & STARTF_USESTDHANDLES) != 0;
|
|
||||||
req->unix_pid = pid;
|
req->unix_pid = pid;
|
||||||
req->exe_file = hFile;
|
req->exe_file = hFile;
|
||||||
if (startup->dwFlags & STARTF_USESTDHANDLES)
|
if (startup->dwFlags & STARTF_USESTDHANDLES)
|
||||||
|
@ -347,7 +347,9 @@ void inherit_console(struct thread *parent_thread, struct process *process, obj_
|
|||||||
{
|
{
|
||||||
struct console_input* console;
|
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)
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,6 @@ struct startup_info
|
|||||||
struct object obj; /* object header */
|
struct object obj; /* object header */
|
||||||
struct list entry; /* entry in list of startup infos */
|
struct list entry; /* entry in list of startup infos */
|
||||||
int inherit_all; /* inherit all handles from parent */
|
int inherit_all; /* inherit all handles from parent */
|
||||||
int use_handles; /* use stdio handles */
|
|
||||||
int create_flags; /* creation flags */
|
int create_flags; /* creation flags */
|
||||||
int unix_pid; /* Unix pid of new process */
|
int unix_pid; /* Unix pid of new process */
|
||||||
obj_handle_t hstdin; /* handle for stdin */
|
obj_handle_t hstdin; /* handle for stdin */
|
||||||
@ -216,15 +215,26 @@ 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
|
* like if hConOut and hConIn are console handles, then they should be on the same
|
||||||
* physical console
|
* physical console
|
||||||
*/
|
*/
|
||||||
inherit_console( parent_thread, process,
|
inherit_console( parent_thread, process, info->inherit_all ? info->hstdin : 0 );
|
||||||
(info->inherit_all || info->use_handles) ? info->hstdin : 0 );
|
|
||||||
}
|
}
|
||||||
if (info)
|
if (info)
|
||||||
|
{
|
||||||
|
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->hstdin = info->hstdin;
|
||||||
reply->hstdout = info->hstdout;
|
reply->hstdout = info->hstdout;
|
||||||
reply->hstderr = info->hstderr;
|
reply->hstderr = info->hstderr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else reply->hstdin = reply->hstdout = reply->hstderr = 0;
|
else reply->hstdin = reply->hstdout = reply->hstderr = 0;
|
||||||
/* some handles above may have been invalid; this is not an error */
|
/* some handles above may have been invalid; this is not an error */
|
||||||
if (get_error() == STATUS_INVALID_HANDLE) clear_error();
|
if (get_error() == STATUS_INVALID_HANDLE) clear_error();
|
||||||
@ -870,7 +880,6 @@ DECL_HANDLER(new_process)
|
|||||||
if (!(info = alloc_object( &startup_info_ops ))) return;
|
if (!(info = alloc_object( &startup_info_ops ))) return;
|
||||||
list_add_head( &startup_info_list, &info->entry );
|
list_add_head( &startup_info_list, &info->entry );
|
||||||
info->inherit_all = req->inherit_all;
|
info->inherit_all = req->inherit_all;
|
||||||
info->use_handles = req->use_handles;
|
|
||||||
info->create_flags = req->create_flags;
|
info->create_flags = req->create_flags;
|
||||||
info->unix_pid = req->unix_pid;
|
info->unix_pid = req->unix_pid;
|
||||||
info->hstdin = req->hstdin;
|
info->hstdin = req->hstdin;
|
||||||
|
@ -204,7 +204,6 @@ typedef struct
|
|||||||
/* Create a new process from the context of the parent */
|
/* Create a new process from the context of the parent */
|
||||||
@REQ(new_process)
|
@REQ(new_process)
|
||||||
int inherit_all; /* inherit all handles from parent */
|
int inherit_all; /* inherit all handles from parent */
|
||||||
int use_handles; /* use stdio handles */
|
|
||||||
int create_flags; /* creation flags */
|
int create_flags; /* creation flags */
|
||||||
int unix_pid; /* Unix pid of new process */
|
int unix_pid; /* Unix pid of new process */
|
||||||
obj_handle_t exe_file; /* file handle for main exe */
|
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 )
|
static void dump_new_process_request( const struct new_process_request *req )
|
||||||
{
|
{
|
||||||
fprintf( stderr, " inherit_all=%d,", req->inherit_all );
|
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, " create_flags=%d,", req->create_flags );
|
||||||
fprintf( stderr, " unix_pid=%d,", req->unix_pid );
|
fprintf( stderr, " unix_pid=%d,", req->unix_pid );
|
||||||
fprintf( stderr, " exe_file=%p,", req->exe_file );
|
fprintf( stderr, " exe_file=%p,", req->exe_file );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user