-
Notifications
You must be signed in to change notification settings - Fork 0
/
Driver.hpp
71 lines (57 loc) · 1.48 KB
/
Driver.hpp
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
#pragma once
#include "../Driver/driver.h"
#include "../DriverControl/DriverControl.h"
#pragma comment(lib,"DriverControl.lib")
class Driver :public DriverControl
{
public:
HANDLE DriverHandle = NULL;
Driver() :DriverControl()
{
driverFilePath = L"C:\\Users\\lw\\source\\repos\\Fantasy\\x64\\Release\\Driver.sys";
symboliLinkName = L"\\\\.\\" SYMBOLIC_LINK_SHORT_NAME;
//printf("%ws\n", L"123132");
if (!insert()) {
printf("%ws\n", getMessage());
}
if (!start()) {
printf("%ws\n", getMessage());
}
}
virtual ~Driver()
{
stop();
unload();
}
BOOL readVirtualMemory(ULONG Address, PVOID Response, SIZE_T Size)
{
READ_VIRTUAL_MEMORY_STRUCT rvms;
rvms.Response = Response;
rvms.Address = Address;
rvms.Size = Size;
return control(READ_VIRTUAL_MEMORY, &rvms, sizeof(rvms), &rvms, sizeof(rvms));
}
BOOL writeVirtualMemory(ULONG Address, PVOID Value, SIZE_T Size)
{
WRITE_VIRTUAL_MEMORY_STRUCT wvms;
BOOL result = TRUE;
wvms.Address = Address;
wvms.Value = Value;
wvms.Size = Size;
result = control(WRITE_VIRTUAL_MEMORY, &wvms, sizeof(wvms), &wvms, sizeof(wvms));
return result;
}
BOOL protectTheCurrentProcess()
{
return control(PROTECT_THE_CURRENT_PROCESS, 0, 0, 0, 0);
}
BOOL unprotectTheCurrentProcess()
{
return control(UNPROTECT_THE_CURRENT_PROCESS, 0, 0, 0, 0);
}
BOOL camouflageCurrentProcess(ULONG targetProcessId)
{
return control(CAMOUFLAGE_CURRENT_PROCESS, &targetProcessId, sizeof(targetProcessId), 0, 0);
}
private:
};