mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 18:11:57 +00:00
[NTOSKRNL]: NtQuerySystemInformation(SystemProcessInformation) should skip zombie processes, and it should use the KTHREAD ThreadListEntry, not the ETHREAD ThreadListEntry. Fixes winetest since Idle Threads are int he former, not the latter (verified and Windows does this too).
svn path=/trunk/; revision=55731
This commit is contained in:
parent
8fa73c4dc6
commit
4e027af35c
1 changed files with 21 additions and 5 deletions
|
@ -711,7 +711,9 @@ QSI_DEF(SystemProcessInformation)
|
|||
|
||||
/* Check for overflow */
|
||||
if (Size < sizeof(SYSTEM_PROCESS_INFORMATION))
|
||||
{
|
||||
Overflow = TRUE;
|
||||
}
|
||||
|
||||
/* Zero user's buffer */
|
||||
if (!Overflow) RtlZeroMemory(Spi, Size);
|
||||
|
@ -719,14 +721,25 @@ QSI_DEF(SystemProcessInformation)
|
|||
SystemProcess = PsIdleProcess;
|
||||
Process = SystemProcess;
|
||||
Current = (PUCHAR) Spi;
|
||||
CurrentSize = 0;
|
||||
ImageNameMaximumLength = 0;
|
||||
|
||||
do
|
||||
{
|
||||
SpiCurrent = (PSYSTEM_PROCESS_INFORMATION) Current;
|
||||
|
||||
if ((Process->ProcessExiting) &&
|
||||
(Process->Pcb.Header.SignalState) &&
|
||||
!(Process->ActiveThreads) &&
|
||||
(IsListEmpty(&Process->Pcb.ThreadListHead)))
|
||||
{
|
||||
DPRINT1("Skipping zombie\n");
|
||||
goto Skip;
|
||||
}
|
||||
|
||||
ThreadsCount = 0;
|
||||
CurrentEntry = Process->ThreadListHead.Flink;
|
||||
while (CurrentEntry != &Process->ThreadListHead)
|
||||
CurrentEntry = Process->Pcb.ThreadListHead.Flink;
|
||||
while (CurrentEntry != &Process->Pcb.ThreadListHead)
|
||||
{
|
||||
ThreadsCount++;
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
|
@ -770,7 +783,9 @@ QSI_DEF(SystemProcessInformation)
|
|||
|
||||
/* Check for overflow */
|
||||
if (TotalSize > Size)
|
||||
{
|
||||
Overflow = TRUE;
|
||||
}
|
||||
|
||||
/* Fill system information */
|
||||
if (!Overflow)
|
||||
|
@ -821,10 +836,10 @@ QSI_DEF(SystemProcessInformation)
|
|||
SpiCurrent->PrivatePageCount = Process->CommitCharge;
|
||||
ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(SpiCurrent + 1);
|
||||
|
||||
CurrentEntry = Process->ThreadListHead.Flink;
|
||||
while (CurrentEntry != &Process->ThreadListHead)
|
||||
CurrentEntry = Process->Pcb.ThreadListHead.Flink;
|
||||
while (CurrentEntry != &Process->Pcb.ThreadListHead)
|
||||
{
|
||||
CurrentThread = CONTAINING_RECORD(CurrentEntry, ETHREAD,
|
||||
CurrentThread = (PETHREAD)CONTAINING_RECORD(CurrentEntry, KTHREAD,
|
||||
ThreadListEntry);
|
||||
|
||||
ThreadInfo->KernelTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.KernelTime, KeMaximumIncrement);
|
||||
|
@ -850,6 +865,7 @@ QSI_DEF(SystemProcessInformation)
|
|||
}
|
||||
|
||||
/* Handle idle process entry */
|
||||
Skip:
|
||||
if (Process == PsIdleProcess) Process = NULL;
|
||||
|
||||
Process = PsGetNextProcess(Process);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue