server: Add a process flag indicating whether the process is terminating, use it to block thread creation in a being terminated process.
This commit is contained in:
parent
1a697e15b9
commit
af3d73b035
|
@ -1525,7 +1525,6 @@ static void child_process(const char *dll_name, DWORD target_offset)
|
|||
|
||||
SetLastError(0xdeadbeef);
|
||||
thread = CreateThread(NULL, 0, noop_thread_proc, &dummy, 0, &ret);
|
||||
todo_wine
|
||||
ok(!thread || broken(thread != 0) /* before win7 */, "CreateThread should fail\n");
|
||||
if (!thread)
|
||||
ok(GetLastError() == ERROR_ACCESS_DENIED, "expected ERROR_ACCESS_DENIED, got %d\n", GetLastError());
|
||||
|
|
|
@ -323,6 +323,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
|
|||
process->suspend = 0;
|
||||
process->is_system = 0;
|
||||
process->debug_children = 0;
|
||||
process->is_terminating = 0;
|
||||
process->console = NULL;
|
||||
process->startup_state = STARTUP_IN_PROGRESS;
|
||||
process->startup_info = NULL;
|
||||
|
@ -570,6 +571,8 @@ static void terminate_process( struct process *process, struct thread *skip, int
|
|||
struct thread *thread;
|
||||
|
||||
grab_object( process ); /* make sure it doesn't get freed when threads die */
|
||||
process->is_terminating = 1;
|
||||
|
||||
restart:
|
||||
LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
|
||||
{
|
||||
|
|
|
@ -74,6 +74,7 @@ struct process
|
|||
int suspend; /* global process suspend count */
|
||||
unsigned int is_system:1; /* is it a system process? */
|
||||
unsigned int debug_children:1;/* also debug all child processes */
|
||||
unsigned int is_terminating:1;/* is process terminating? */
|
||||
struct list locks; /* list of file locks owned by the process */
|
||||
struct list classes; /* window classes owned by the process */
|
||||
struct console_input*console; /* console input */
|
||||
|
|
|
@ -214,6 +214,12 @@ struct thread *create_thread( int fd, struct process *process )
|
|||
{
|
||||
struct thread *thread;
|
||||
|
||||
if (process->is_terminating)
|
||||
{
|
||||
set_error( STATUS_PROCESS_IS_TERMINATING );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(thread = alloc_object( &thread_ops ))) return NULL;
|
||||
|
||||
init_thread_structure( thread );
|
||||
|
|
Loading…
Reference in New Issue