mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:33:01 +00:00
- PsKillMostProcesses must be running in the context of the system process.
- The thread terminating apc is a special user mode apc. svn path=/trunk/; revision=16626
This commit is contained in:
parent
d3493295ab
commit
2adf26048d
1 changed files with 8 additions and 4 deletions
|
@ -84,6 +84,8 @@ PspKillMostProcesses(VOID)
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
PEPROCESS current;
|
PEPROCESS current;
|
||||||
|
|
||||||
|
ASSERT(PsGetCurrentProcessId() == PsInitialSystemProcess->UniqueProcessId);
|
||||||
|
|
||||||
/* Acquire the Active Process Lock */
|
/* Acquire the Active Process Lock */
|
||||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
ExAcquireFastMutex(&PspActiveProcessMutex);
|
||||||
|
|
||||||
|
@ -94,8 +96,7 @@ PspKillMostProcesses(VOID)
|
||||||
current = CONTAINING_RECORD(current_entry, EPROCESS, ActiveProcessLinks);
|
current = CONTAINING_RECORD(current_entry, EPROCESS, ActiveProcessLinks);
|
||||||
current_entry = current_entry->Flink;
|
current_entry = current_entry->Flink;
|
||||||
|
|
||||||
if (current->UniqueProcessId != PsInitialSystemProcess->UniqueProcessId &&
|
if (current->UniqueProcessId != PsInitialSystemProcess->UniqueProcessId)
|
||||||
current->UniqueProcessId != PsGetCurrentProcessId())
|
|
||||||
{
|
{
|
||||||
/* Terminate all the Threads in this Process */
|
/* Terminate all the Threads in this Process */
|
||||||
PspTerminateProcessThreads(current, STATUS_SUCCESS);
|
PspTerminateProcessThreads(current, STATUS_SUCCESS);
|
||||||
|
@ -211,6 +212,7 @@ PspExitThread(NTSTATUS ExitStatus)
|
||||||
PEPROCESS CurrentProcess;
|
PEPROCESS CurrentProcess;
|
||||||
PTERMINATION_PORT TerminationPort;
|
PTERMINATION_PORT TerminationPort;
|
||||||
PTEB Teb;
|
PTEB Teb;
|
||||||
|
KIRQL oldIrql;
|
||||||
|
|
||||||
DPRINT("PspExitThread(ExitStatus %x), Current: 0x%x\n", ExitStatus, PsGetCurrentThread());
|
DPRINT("PspExitThread(ExitStatus %x), Current: 0x%x\n", ExitStatus, PsGetCurrentThread());
|
||||||
|
|
||||||
|
@ -321,9 +323,11 @@ PspExitThread(NTSTATUS ExitStatus)
|
||||||
/* If the Processor Control Block's NpxThread points to the current thread
|
/* If the Processor Control Block's NpxThread points to the current thread
|
||||||
* unset it.
|
* unset it.
|
||||||
*/
|
*/
|
||||||
|
KeRaiseIrql(DISPATCH_LEVEL, &oldIrql);
|
||||||
InterlockedCompareExchangePointer(&KeGetCurrentPrcb()->NpxThread,
|
InterlockedCompareExchangePointer(&KeGetCurrentPrcb()->NpxThread,
|
||||||
NULL,
|
NULL,
|
||||||
(PKPROCESS)CurrentThread);
|
(PKPROCESS)CurrentThread);
|
||||||
|
KeLowerIrql(oldIrql);
|
||||||
|
|
||||||
/* Rundown Mutexes */
|
/* Rundown Mutexes */
|
||||||
KeRundownThread();
|
KeRundownThread();
|
||||||
|
@ -398,14 +402,14 @@ PspTerminateThreadByPointer(PETHREAD Thread,
|
||||||
/* Allocate the APC */
|
/* Allocate the APC */
|
||||||
Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_TERMINATE_APC);
|
Apc = ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), TAG_TERMINATE_APC);
|
||||||
|
|
||||||
/* Initialize a Kernel Mode APC to Kill the Thread */
|
/* Initialize a User Mode APC to Kill the Thread */
|
||||||
KeInitializeApc(Apc,
|
KeInitializeApc(Apc,
|
||||||
&Thread->Tcb,
|
&Thread->Tcb,
|
||||||
OriginalApcEnvironment,
|
OriginalApcEnvironment,
|
||||||
PsExitSpecialApc,
|
PsExitSpecialApc,
|
||||||
NULL,
|
NULL,
|
||||||
PspExitNormalApc,
|
PspExitNormalApc,
|
||||||
KernelMode,
|
UserMode,
|
||||||
(PVOID)ExitStatus);
|
(PVOID)ExitStatus);
|
||||||
|
|
||||||
/* Insert it into the APC Queue */
|
/* Insert it into the APC Queue */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue