Commit bac0387d authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

server: Fail to set process affinity mask if the process is terminating.

parent af3d73b0
...@@ -1958,7 +1958,7 @@ todo_wine ...@@ -1958,7 +1958,7 @@ todo_wine
/* Checking process state without waiting for process termination /* Checking process state without waiting for process termination
* leads to different results due to a race condition. * leads to different results due to a race condition.
*/ */
ret = WaitForSingleObject(pi.hProcess, 100); ret = WaitForSingleObject(pi.hProcess, 1000);
ok(ret == WAIT_OBJECT_0, "WaitForSingleObject failed: %x\n", ret); ok(ret == WAIT_OBJECT_0, "WaitForSingleObject failed: %x\n", ret);
memset(&pbi, 0, sizeof(pbi)); memset(&pbi, 0, sizeof(pbi));
...@@ -1967,7 +1967,6 @@ todo_wine ...@@ -1967,7 +1967,6 @@ todo_wine
ok(pbi.ExitStatus == 198, "expected 198, got %lu\n", pbi.ExitStatus); ok(pbi.ExitStatus == 198, "expected 198, got %lu\n", pbi.ExitStatus);
affinity = 1; affinity = 1;
ret = pNtSetInformationProcess(pi.hProcess, ProcessAffinityMask, &affinity, sizeof(affinity)); ret = pNtSetInformationProcess(pi.hProcess, ProcessAffinityMask, &affinity, sizeof(affinity));
todo_wine
ok(ret == STATUS_PROCESS_IS_TERMINATING, "expected STATUS_PROCESS_IS_TERMINATING, got %#x\n", ret); ok(ret == STATUS_PROCESS_IS_TERMINATING, "expected STATUS_PROCESS_IS_TERMINATING, got %#x\n", ret);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
......
...@@ -1122,6 +1122,12 @@ static void set_process_affinity( struct process *process, affinity_t affinity ) ...@@ -1122,6 +1122,12 @@ static void set_process_affinity( struct process *process, affinity_t affinity )
{ {
struct thread *thread; struct thread *thread;
if (!process->running_threads)
{
set_error( STATUS_PROCESS_IS_TERMINATING );
return;
}
process->affinity = affinity; process->affinity = affinity;
LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry ) LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
......
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