Author: ion
Date: Sun Feb 19 20:08:11 2012
New Revision: 55719
URL:
http://svn.reactos.org/svn/reactos?rev=55719&view=rev
Log:
[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.
Modified:
trunk/reactos/ntoskrnl/ps/query.c
Modified: trunk/reactos/ntoskrnl/ps/query.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=55…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] Sun Feb 19 20:08:11 2012
@@ -2279,12 +2279,19 @@
_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)
{