[NTOS:PS] Address FIXME in ps\kill.c, move JOB_OBJECT_MSG_EXIT_PROCESS to the right place

This fixes an unexpected overlapped in the WINE test.
This commit is contained in:
Gleb Surikov 2024-11-19 15:19:27 +02:00
parent 5da317c3fe
commit a6c90d7973
2 changed files with 15 additions and 14 deletions

View File

@ -473,17 +473,6 @@ PspExitProcessFromJob(
InterlockedOr((PLONG)&Process->JobStatus, JOB_NOT_REALLY_ACTIVE);
}
/* If the job has a completion port, notify it of the process exit */
if (Job->CompletionPort)
{
IoSetIoCompletion(Job->CompletionPort,
Job->CompletionKey,
NULL,
STATUS_SUCCESS,
JOB_OBJECT_MSG_EXIT_PROCESS,
FALSE);
}
/* If no active processes remain, notify the job completion port */
if (Job->ActiveProcesses == 0 && Job->CompletionPort)
{

View File

@ -1120,10 +1120,22 @@ PspExitProcess(IN BOOLEAN LastThread,
ZwSetTimerResolution(KeMaximumIncrement, 0, &Actual);
}
/* Check if we are part of a Job that has a completion port */
if ((Process->Job) && (Process->Job->CompletionPort))
/* Check if we are part of a Job that has a completion port
and do I/O completion if needed */
if (Process->Job &&
Process->Job->CompletionPort &&
!(Process->JobStatus & JOB_NOT_REALLY_ACTIVE))
{
/* FIXME: Check job status code and do I/O completion if needed */
ExEnterCriticalRegionAndAcquireResourceShared(&Process->Job->JobLock);
IoSetIoCompletion(Process->Job->CompletionPort,
Process->Job->CompletionKey,
Process->UniqueProcessId,
STATUS_SUCCESS,
JOB_OBJECT_MSG_EXIT_PROCESS,
FALSE);
ExReleaseResourceAndLeaveCriticalRegion(&Process->Job->JobLock);
}
/* FIXME: Notify the Prefetcher */