Add more detailed comment about ThreadListEntry so people don't get
confused liek I did
Modified: trunk/reactos/ntoskrnl/ke/kthread.c
Modified: trunk/reactos/ntoskrnl/ps/thread.c
_____
Modified: trunk/reactos/ntoskrnl/ke/kthread.c
--- trunk/reactos/ntoskrnl/ke/kthread.c 2005-04-23 16:17:27 UTC (rev
14778)
+++ trunk/reactos/ntoskrnl/ke/kthread.c 2005-04-23 16:23:57 UTC (rev
14779)
@@ -782,7 +782,11 @@
/* Set the Thread to initalized */
Thread->State = Initialized;
- /* Insert the Thread into the Process's Thread List */
+ /*
+ * Insert the Thread into the Process's Thread List
+ * Note, this is the KTHREAD Thread List. It is removed in
+ * ke/kthread.c!KeTerminateThread.
+ */
InsertTailList(&Process->ThreadListHead, &Thread->ThreadListEntry);
DPRINT("Thread initalized\n");
}
_____
Modified: trunk/reactos/ntoskrnl/ps/thread.c
--- trunk/reactos/ntoskrnl/ps/thread.c 2005-04-23 16:17:27 UTC (rev
14778)
+++ trunk/reactos/ntoskrnl/ps/thread.c 2005-04-23 16:23:57 UTC (rev
14779)
@@ -250,7 +250,11 @@
KernelStack);
}
- /* Insert into Process List */
+ /*
+ * Insert the Thread into the Process's Thread List
+ * Note, this is the ETHREAD Thread List. It is removed in
+ * ps/kill.c!PspExitThread.
+ */
DPRINT("Inserting into Process Thread List \n");
InsertTailList(&Process->ThreadListHead, &Thread->ThreadListEntry);
Move removing process from active list to PspDeleteProcess instead of
PspExitProcess. This way we don't have to do it manually after
ObInsertObject failure in PspCreateProces. Also, set the Process Query
Time at the end of Process Creation, since the process doesn't really
exist before then. Thanks to Hartmut for finding the bugs.
Modified: trunk/reactos/ntoskrnl/ps/kill.c
_____
Modified: trunk/reactos/ntoskrnl/ps/kill.c
--- trunk/reactos/ntoskrnl/ps/kill.c 2005-04-23 16:16:59 UTC (rev
14777)
+++ trunk/reactos/ntoskrnl/ps/kill.c 2005-04-23 16:17:27 UTC (rev
14778)
@@ -148,6 +148,11 @@
DPRINT("PiDeleteProcess(ObjectBody %x)\n", ObjectBody);
+ /* Remove it from the Active List */
+ ExAcquireFastMutex(&PspActiveProcessMutex);
+ RemoveEntryList(&Process->ProcessListEntry);
+ ExReleaseFastMutex(&PspActiveProcessMutex);
+
/* Delete the CID Handle */
if(Process->UniqueProcessId != NULL) {
@@ -411,12 +416,7 @@
DPRINT("PspExitProcess 0x%x\n", Process);
PspRunCreateProcessNotifyRoutines(Process, FALSE);
-
- /* Remove it from the Active List */
- ExAcquireFastMutex(&PspActiveProcessMutex);
- RemoveEntryList(&Process->ProcessListEntry);
- ExReleaseFastMutex(&PspActiveProcessMutex);
-
+
/* close all handles associated with our process, this needs to be
done
when the last thread still runs */
ObKillProcess(Process);
Move removing process from active list to PspDeleteProcess instead of
PspExitProcess. This way we don't have to do it manually after
ObInsertObject failure in PspCreateProces. Also, set the Process Query
Time at the end of Process Creation, since the process doesn't really
exist before then. Thanks to Hartmut for finding the bus.
Modified: trunk/reactos/ntoskrnl/ps/process.c
_____
Modified: trunk/reactos/ntoskrnl/ps/process.c
--- trunk/reactos/ntoskrnl/ps/process.c 2005-04-23 16:09:06 UTC (rev
14776)
+++ trunk/reactos/ntoskrnl/ps/process.c 2005-04-23 16:16:59 UTC (rev
14777)
@@ -287,8 +287,6 @@
/* Clean up the Object */
DPRINT("Cleaning Process Object\n");
RtlZeroMemory(Process, sizeof(EPROCESS));
-
- KeQuerySystemTime(&Process->CreateTime);
/* Inherit stuff from the Parent since we now have the object
created */
if (pParentProcess)
@@ -411,13 +409,13 @@
if (!NT_SUCCESS(Status))
{
DPRINT1("Could not get a handle to the Process Object\n");
- ExAcquireFastMutex(&PspActiveProcessMutex);
- RemoveEntryList(&Process->ProcessListEntry);
- ExReleaseFastMutex(&PspActiveProcessMutex);
ObDereferenceObject(Process);
goto exitdereferenceobjects;
}
+ /* Set the Creation Time */
+ KeQuerySystemTime(&Process->CreateTime);
+
DPRINT("Done. Returning handle: %x\n", hProcess);
_SEH_TRY
{