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

This commit is contained in:
Dmitry Timoshkov 2013-05-06 15:40:34 +09:00 committed by Alexandre Julliard
parent af3d73b035
commit bac0387d29
2 changed files with 7 additions and 2 deletions

View File

@ -1958,7 +1958,7 @@ todo_wine
/* Checking process state without waiting for process termination
* 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);
memset(&pbi, 0, sizeof(pbi));
@ -1967,7 +1967,6 @@ todo_wine
ok(pbi.ExitStatus == 198, "expected 198, got %lu\n", pbi.ExitStatus);
affinity = 1;
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);
SetLastError(0xdeadbeef);

View File

@ -1122,6 +1122,12 @@ static void set_process_affinity( struct process *process, affinity_t affinity )
{
struct thread *thread;
if (!process->running_threads)
{
set_error( STATUS_PROCESS_IS_TERMINATING );
return;
}
process->affinity = affinity;
LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )