-
Notifications
You must be signed in to change notification settings - Fork 0
/
DriverMgr.h
43 lines (33 loc) · 1.04 KB
/
DriverMgr.h
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
#pragma once
#include <windows.h>
#include <winsvc.h>
namespace cchips {
#define MAX_NAME_LEN 64
#define HIPS_DRIVER_NAME "HipsMonitor"
// for kernel dll inject service, set target pid to kernel.
#define IOCTL_HIPS_SETTARGETPID (ULONG) CTL_CODE(FILE_DEVICE_FIPS,\
0x809, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_HIPS_SETTARGETCMD (ULONG) CTL_CODE(FILE_DEVICE_FIPS,\
0xAA0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
class CDriverMgr
{
public:
CDriverMgr();
~CDriverMgr();
BOOL IoControl(
DWORD dwIoControlCode,
LPVOID lpInBuffer,
DWORD nInBufferSize,
LPVOID lpOutBuffer,
DWORD nOutBufferSize,
LPDWORD lpBytesReturned = NULL
);
HANDLE GetHandle() { return m_hdevice; }
DWORD GetError() { return m_error; }
private:
HANDLE m_hdevice;
std::string m_drivername;
DWORD m_error;
BOOL OpenDevice();
};
} // namespace cchips