-
Notifications
You must be signed in to change notification settings - Fork 16
/
Driver.c
80 lines (71 loc) · 1.98 KB
/
Driver.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*------------------------------------------------------------------------
* ¤å¥ó¦WºÙ : Driver.c
* ½sĶÀô¹Ò : WDK 7600.16385.1
/-------------------------------------------------------------------------
* File Name : Driver.c
* Building environment : WDK 7600.16385.1
-------------------------------------------------------------------------*/
#include <ntddk.h>
#include <Function.h>
#include <NtOpenProcess.h>
#include <NtOpenProcess_Win7.h>
#include <NtReadVirtualMemory.h>
#include <NtWriteVirtualMemory.h>
#include <NtProtectVirtualMemory.h>
///////////////////////////////////////////////////
VOID OnUnload(IN PDRIVER_OBJECT DriverObject);
///////////////////////////////////////////////////
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject,PUNICODE_STRING RegistryPath)
{
NTSTATUS status = STATUS_SUCCESS;
DriverObject->DriverUnload = OnUnload;
//DbgPrint("Driver Powered By Vip235689!\n");
DbgPrint("Driver Load!\n");
InitCallNumber();
//DbgPrint("[SystemVersion] : 0x%x\n",SystemVersion);
if (SystemVersion == 2) //WinXp
{
NtOpenProcess_Hook();
NtReadVirtualMemory_Hook();
NtWriteVirtualMemory_Hook();
NtProtectVirtualMemory_Hook();
return status;
}
else if (SystemVersion == 4) //Win7
{
NtOpenProcess_Win7_Hook();
NtReadVirtualMemory_Hook();
NtWriteVirtualMemory_Hook();
NtProtectVirtualMemory_Hook();
return status;
}
else
{
DbgPrint("System Not Support! Driver Fail!!\n");
return status;
}
}
/////////////////////////////////////////////////////
VOID OnUnload(IN PDRIVER_OBJECT DriverObject)
{
if (SystemVersion == 2) //WinXp
{
NtOpenProcess_UnHook();
NtReadVirtualMemory_UnHook();
NtWriteVirtualMemory_UnHook();
NtProtectVirtualMemory_UnHook();
}
else if (SystemVersion == 4) //Win7
{
NtOpenProcess_Win7_UnHook();
NtReadVirtualMemory_UnHook();
NtWriteVirtualMemory_UnHook();
NtProtectVirtualMemory_UnHook();
}
else
{
//
}
DbgPrint("Driver UnLoad!\n");
}
/////////////////////////////////////////////////////