MCPcopy Create free account
hub / github.com/D4stiny/PeaceMaker / TerminateProcessInHistory

Method TerminateProcessInHistory

PeaceMaker Kernel/ImageHistoryFilter.cpp:354–395  ·  view source on GitHub ↗

Set a process to terminated, still maintain the history. @param ProcessId - The process ID of the process being terminated. */

Source from the content-addressed store, hash-verified

352 @param ProcessId - The process ID of the process being terminated.
353*/
354VOID
355ImageHistoryFilter::TerminateProcessInHistory (
356 _In_ HANDLE ProcessId
357 )
358{
359 PPROCESS_HISTORY_ENTRY currentProcessHistory;
360
361 if (ImageHistoryFilter::destroying)
362 {
363 return;
364 }
365
366 //
367 // Acquire a shared lock to iterate processes.
368 //
369 FltAcquirePushLockShared(&ImageHistoryFilter::ProcessHistoryLock);
370
371 //
372 // Iterate histories for a match.
373 //
374 if (ImageHistoryFilter::ProcessHistoryHead)
375 {
376 currentProcessHistory = ImageHistoryFilter::ProcessHistoryHead;
377 do
378 {
379 //
380 // Find the process history with the same PID and then set it to terminated.
381 //
382 if (currentProcessHistory->ProcessId == ProcessId)
383 {
384 currentProcessHistory->ProcessTerminated = TRUE;
385 break;
386 }
387 currentProcessHistory = RCAST<PPROCESS_HISTORY_ENTRY>(currentProcessHistory->ListEntry.Blink);
388 } while (currentProcessHistory && currentProcessHistory != ImageHistoryFilter::ProcessHistoryHead);
389 }
390
391 //
392 // Release the lock.
393 //
394 FltReleasePushLock(&ImageHistoryFilter::ProcessHistoryLock);
395}
396
397/**
398 Notify routine called on new process execution.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected