int kill(int pid,int sig) { return PsTerminateProcess( pid, sig ); }
VOID ExpDebuggerWorker( IN PVOID Context ) /*++ Routine Description: This is a worker thread for the kernel debugger that can be used to perform certain tasks on the target machine asynchronously. This is necessary when the machine needs to run at Dispatch level to perform certain operations, such as paging in data. Arguments: Context - not used as this point. Return Value: None. --*/ { NTSTATUS Status; KAPC_STATE ApcState; volatile UCHAR Data; PRKPROCESS KillProcess = (PRKPROCESS) ExpDebuggerProcessKill; PRKPROCESS AttachProcess = (PRKPROCESS) ExpDebuggerProcessAttach; PUCHAR PageIn = (PUCHAR) ExpDebuggerPageIn; PEPROCESS Process; ExpDebuggerProcessKill = 0; ExpDebuggerProcessAttach = 0; ExpDebuggerPageIn = 0; UNREFERENCED_PARAMETER (Context); #if DBG if (ExpDebuggerWork != 2) { DbgPrint("ExpDebuggerWorker being entered with state != 2\n"); } #endif ExpDebuggerWork = 0; Process = NULL; if (AttachProcess || KillProcess) { for (Process = PsGetNextProcess (NULL); Process != NULL; Process = PsGetNextProcess (Process)) { if (&Process->Pcb == AttachProcess) { KeStackAttachProcess (AttachProcess, &ApcState); break; } if (&Process->Pcb == KillProcess) { PsTerminateProcess(Process, DBG_TERMINATE_PROCESS); PsQuitNextProcess (Process); return; } } } if (PageIn) { try { Data = ProbeAndReadUchar (PageIn); } except (EXCEPTION_EXECUTE_HANDLER) { Status = GetExceptionCode(); } } DbgBreakPointWithStatus(DBG_STATUS_WORKER); if (Process != NULL) { KeUnstackDetachProcess (&ApcState); PsQuitNextProcess (Process); } return; }