-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path【USER】publicInterfaces.c
62 lines (55 loc) · 1.33 KB
/
【USER】publicInterfaces.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
#include "publicInterface.h"
HANDLE global_main_hDevice = NULL;
VOID (*functionsBeginStub[DRIVER_USER_INTERACTION_MODULES_NUM])(HANDLE* hDevice) = {
debuggerBeginStub,
injectionBeginStub,
processHideBeginStub,
listProcessModuleThreadBeginStub,
memoryScannerBeginStub,
getHandleInKernelBeginStub,
readWriteMemoryBeginStub,
rebuildDebugSystemBeginStub
};
VOID (*functionsReleaseStub[DRIVER_USER_INTERACTION_MODULES_NUM])(VOID) = {
debuggerReleaseStub,
injectionReleaseStub,
processHideReleaseStub,
listProcessModuleThreadReleaseStub,
memoryScannerReleaseStub,
getHandleInKernelReleaseStub,
readWriteMemoryReleaseStub,
rebuildDebugSystemReleaseStub
};
BOOL initializeGlobalKernelFileHandle(
VOID
)
{
global_main_hDevice = CreateFile(L"\\\\.\\ANYIFEI_SYMBOLINK_NAME", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (!global_main_hDevice)
{
return FALSE;
}
return TRUE;
}
BOOL closeGlobalKernelFileHandle(
VOID
)
{
DeviceIoControl(global_main_hDevice, ____$_UNLOAD_DRIVER_PREPARE_$____, NULL, 0, NULL, 0, NULL, NULL);
CloseHandle(global_main_hDevice);
return TRUE;
}
VOID beginStub(
DRIVER_MODULES index
)
{
functionsBeginStub[index](&global_main_hDevice);
return;
}
VOID releaseStub(
DRIVER_MODULES index
)
{
functionsReleaseStub[index]();
return;
}