[NTOSKRNL]: The ExitTime in ETHREAD is unionized and only valid if the thread actually exited, so don't always return the raw value -- return 0 if the thread is still alive. Fixes code which uses ExitTime != 0 to tell if a thread is still alive or not -- everyone always thought all ReactOS threads are always dead.

svn path=/trunk/; revision=55719
This commit is contained in:
Alex Ionescu 2012-02-19 20:08:11 +00:00
parent 682a93c9f9
commit 339ee42bae

View file

@ -2279,12 +2279,19 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
_SEH2_TRY
{
/* Copy time information from ETHREAD/KTHREAD */
ThreadTime->KernelTime.QuadPart = Thread->Tcb.KernelTime *
100000LL;
ThreadTime->UserTime.QuadPart = Thread->Tcb.UserTime *
100000LL;
ThreadTime->KernelTime.QuadPart = Thread->Tcb.KernelTime * KeMaximumIncrement;
ThreadTime->UserTime.QuadPart = Thread->Tcb.UserTime * KeMaximumIncrement;
ThreadTime->CreateTime = Thread->CreateTime;
ThreadTime->ExitTime = Thread->ExitTime;
/* Exit time is in a union and only valid on actual exit! */
if (KeReadStateThread(&Thread->Tcb))
{
ThreadTime->ExitTime = Thread->ExitTime;
}
else
{
ThreadTime->ExitTime.QuadPart = 0;
}
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{