forked from xiaobo93/DriverFunction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Process_HuiDiao.c
38 lines (36 loc) · 896 Bytes
/
Process_HuiDiao.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<ntddk.h>
VOID ProcessPre (
IN HANDLE ParentId,
IN HANDLE ProcessId,
IN BOOLEAN Create
)
{
UNREFERENCED_PARAMETER(ParentId);
UNREFERENCED_PARAMETER(ProcessId);
if (Create == TRUE) //Create Process
{
KdPrint(("Create process\n"));
}else{
KdPrint(("Delete process\n"));
}
}
VOID Unload(IN PDRIVER_OBJECT pDriverObject)
{
UNREFERENCED_PARAMETER(pDriverObject);
KdPrint(("unload driver \n"));
PsSetCreateProcessNotifyRoutine(ProcessPre,TRUE);
}
NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject,IN PUNICODE_STRING pRegistryPath)
{
UNREFERENCED_PARAMETER(pDriverObject);
UNREFERENCED_PARAMETER(pRegistryPath);
NTSTATUS re = STATUS_SUCCESS;
pDriverObject->DriverUnload = Unload;
re = PsSetCreateProcessNotifyRoutine(ProcessPre,FALSE);
if (!NT_SUCCESS(re))
{
KdPrint(("PsSetCreateProcessNotifyRoutine is error \n"));
}
KdPrint(("hello world\n"));
return re;
}