mirror of
https://github.com/reactos/reactos.git
synced 2025-07-15 15:14:02 +00:00
- Advance the CurrentEntry pointer before terminating thread in PspTerminateProcessThreads.
- Lock the process in NtTerminateProcess to prevent race conditions. svn path=/trunk/; revision=14256
This commit is contained in:
parent
561b4db8e9
commit
49b1d66ec3
1 changed files with 7 additions and 3 deletions
|
@ -93,6 +93,9 @@ PspTerminateProcessThreads(PEPROCESS Process,
|
||||||
/* Get the Current Thread */
|
/* Get the Current Thread */
|
||||||
Thread = CONTAINING_RECORD(CurrentEntry, ETHREAD, ThreadListEntry);
|
Thread = CONTAINING_RECORD(CurrentEntry, ETHREAD, ThreadListEntry);
|
||||||
|
|
||||||
|
/* Move to the Next Thread */
|
||||||
|
CurrentEntry = CurrentEntry->Flink;
|
||||||
|
|
||||||
/* Make sure it's not the one we're in */
|
/* Make sure it's not the one we're in */
|
||||||
if (Thread != CurrentThread) {
|
if (Thread != CurrentThread) {
|
||||||
|
|
||||||
|
@ -107,9 +110,6 @@ PspTerminateProcessThreads(PEPROCESS Process,
|
||||||
KeForceResumeThread(&Thread->Tcb);
|
KeForceResumeThread(&Thread->Tcb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move to the Next Thread */
|
|
||||||
CurrentEntry = CurrentEntry->Flink;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,6 +419,8 @@ NtTerminateProcess(IN HANDLE ProcessHandle OPTIONAL,
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PsLockProcess(Process, FALSE);
|
||||||
|
|
||||||
if(Process->ExitTime.QuadPart) {
|
if(Process->ExitTime.QuadPart) {
|
||||||
|
|
||||||
DPRINT1("Process has an exit time!\n");
|
DPRINT1("Process has an exit time!\n");
|
||||||
|
@ -432,6 +434,8 @@ NtTerminateProcess(IN HANDLE ProcessHandle OPTIONAL,
|
||||||
/* Save the Exit Time */
|
/* Save the Exit Time */
|
||||||
KeQuerySystemTime(&Process->ExitTime);
|
KeQuerySystemTime(&Process->ExitTime);
|
||||||
|
|
||||||
|
PsUnlockProcess(Process);
|
||||||
|
|
||||||
/* Only master thread remains... kill it off */
|
/* Only master thread remains... kill it off */
|
||||||
if (PsGetCurrentThread()->ThreadsProcess == Process) {
|
if (PsGetCurrentThread()->ThreadsProcess == Process) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue