From: Rémi Bernon <rbernon@codeweavers.com> --- server/request.c | 2 +- server/thread.c | 12 +++++++----- server/thread.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/server/request.c b/server/request.c index 432a5918892..89bba1d9faa 100644 --- a/server/request.c +++ b/server/request.c @@ -563,7 +563,7 @@ static void master_socket_poll_event( struct fd *fd, int event ) fcntl( client, F_SETFL, O_NONBLOCK ); if ((process = create_process( client, NULL, 0, NULL, NULL, NULL, 0, NULL ))) { - create_thread( -1, process, NULL ); + create_thread( -1, process, 0, NULL ); release_object( process ); } } diff --git a/server/thread.c b/server/thread.c index 3aed496450a..ad59361e53b 100644 --- a/server/thread.c +++ b/server/thread.c @@ -501,7 +501,8 @@ static struct context *create_thread_context( struct thread *thread ) /* create a new thread */ -struct thread *create_thread( int fd, struct process *process, const struct security_descriptor *sd ) +struct thread *create_thread( int fd, struct process *process, unsigned int flags, + const struct security_descriptor *sd ) { struct desktop *desktop; struct thread *thread; @@ -578,6 +579,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */ add_process_thread( thread->process, thread ); + + if (flags & THREAD_CREATE_FLAGS_CREATE_SUSPENDED) thread->suspend++; + thread->dbg_hidden = !!(flags & THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER); + thread->bypass_proc_suspend = !!(flags & THREAD_CREATE_FLAGS_BYPASS_PROCESS_FREEZE); return thread; error: @@ -1696,12 +1701,9 @@ DECL_HANDLER(new_thread) goto done; } - if ((thread = create_thread( request_fd, process, sd ))) + if ((thread = create_thread( request_fd, process, req->flags, sd ))) { thread->system_regs = current->system_regs; - if (req->flags & THREAD_CREATE_FLAGS_CREATE_SUSPENDED) thread->suspend++; - thread->dbg_hidden = !!(req->flags & THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER); - thread->bypass_proc_suspend = !!(req->flags & THREAD_CREATE_FLAGS_BYPASS_PROCESS_FREEZE); reply->tid = get_thread_id( thread ); if ((reply->handle = alloc_handle_no_access_check( current->process, thread, req->access, objattr->attributes ))) diff --git a/server/thread.h b/server/thread.h index 77ea355483d..317979fc6cd 100644 --- a/server/thread.h +++ b/server/thread.h @@ -105,7 +105,7 @@ extern struct thread *current; /* thread functions */ -extern struct thread *create_thread( int fd, struct process *process, +extern struct thread *create_thread( int fd, struct process *process, unsigned int flags, const struct security_descriptor *sd ); extern struct thread *get_thread_from_id( thread_id_t id ); extern struct thread *get_thread_from_handle( obj_handle_t handle, unsigned int access ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10058