-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetours.h
36 lines (31 loc) · 1014 Bytes
/
detours.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
#ifndef CPATCH_H
#define CPATCH_H
#include <windows.h>
#include <tlhelp32.h>
class CMemoryTools
{
public:
CMemoryTools();
~CMemoryTools();
DWORD dwCopyFunction(DWORD, DWORD);
DWORD dwCopyRange(DWORD, DWORD);
DWORD dwRedirectFunction(DWORD, DWORD, bool = false);
DWORD dwWriteProcess(DWORD, void *, void *, DWORD);
DWORD dwReadProcess(DWORD, void *, void *, DWORD);
DWORD dwRedirectCall(DWORD, DWORD);
DWORD dwGetPID(char *);
DWORD dwFindPattern(DWORD, DWORD, BYTE *, char *);
DWORD dwFindPattern(HMODULE hModule, BYTE* pbMask, char* szMask);
void vCreateJMP(DWORD, DWORD);
void vCreateCall(DWORD, DWORD);
void vPatchBytes(DWORD, BYTE *);
DWORD dwReconstructJMP(DWORD);
DWORD FindPattern(char *, int, DWORD, DWORD);
bool bHookEngFunc(PBYTE pbOldFunc, DWORD dwNewFunc);
private:
bool bDataCompare(const BYTE*, const BYTE*, const char*);
void vWrapMemory(DWORD, DWORD, DWORD);
DWORD dwOpcodeLength(DWORD);
};
extern CMemoryTools *pMemoryTools;
#endif