forked from strivexjun/DriverInjectDll
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhooklib.h
More file actions
40 lines (35 loc) · 724 Bytes
/
hooklib.h
File metadata and controls
40 lines (35 loc) · 724 Bytes
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
#ifndef _HOOKLIB_H_
#define _HOOKLIB_H_
#include "_global.h"
#pragma pack(push,1)
struct HOOKOPCODES
{
#ifdef _WIN64
unsigned short int mov;
#else
unsigned char mov;
#endif
ULONG_PTR addr;
unsigned char push;
unsigned char ret;
};
#pragma pack(pop)
typedef struct HOOKSTRUCT
{
ULONG_PTR addr;
HOOKOPCODES hook;
unsigned char orig[sizeof(HOOKOPCODES)];
//SSDT extension
int SSDTindex;
LONG SSDTold;
LONG SSDTnew;
ULONG_PTR SSDTaddress;
}* HOOK;
class Hooklib
{
public:
static HOOK Hook(PVOID api, void* newfunc);
static bool Hook(HOOK hook);
static bool Unhook(HOOK hook, bool free = false);
};
#endif //_HOOKLIB_H_