回调监控进线程创建和退出
两个注册回调的函数:PsSetCreateProcessNotifyRoutine 进程回调PsSetCreateThreadNotifyRoutine 线程回调分别对应的回调函数类型:
VOID MyCreateProcessNotify
(
IN HANDLE ParentId,
IN HANDLE ProcessId,
IN BOOLEAN Create
)
{
if (Create) {
DbgPrint("[monitor_create_process_x64]进程创建! PID=%ld;PPID=%ld\n", ProcessId, ParentId);
}
else {
DbgPrint("[monitor_create_process_x64]进程退出! PID=%ld;PPID=%ld\n", ProcessId, ParentId);
}
}
VOID MyCreateThreadNotify
(
IN HANDLE ProcessId,
IN HANDLE ThreadId,
IN BOOLEAN Create
)
{
if (Create) {
DbgPrint("[monitor_create_process_x64]线程创建! PID=%ld;TID=%ld\n", ProcessId, ThreadId);
}
else {
DbgPrint("[monitor_create_process_x64]线程退出! PID=%ld;TID=%ld\n", ProcessId, ThreadId);
}
}
注册回调:
PsSetCreateProcessNotifyRoutine(MyCreateProcessNotify, FALSE);