forked from pyq881120/wow64dm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wow64dm.h
102 lines (73 loc) · 1.87 KB
/
wow64dm.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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "Wow64Local.h"
namespace ds_wow64
{
class WoW64dm
{
public:
WoW64dm(void);
~WoW64dm(void);
/*
*/
bool Attach(DWORD pid);
/*
*/
void Attach(HANDLE hProcess);
/*
*/
DWORD64 getPEB64(PEB64& peb);
/*
*/
DWORD64 getTEB64(HANDLE hThread, TEB64& teb);
/*
*/
NTSTATUS VirtualQueryEx64(DWORD64 lpAddress, MEMORY_BASIC_INFORMATION64* lpBuffer, DWORD dwLength);
/*
*/
NTSTATUS VirtualProtectEx64(DWORD64 lpAddress, DWORD64 dwSize, DWORD flProtect, DWORD* flOld);
/*
*/
NTSTATUS VirtualAllocEx64(DWORD64& lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
/*
*/
NTSTATUS VirtualFreeEx64(DWORD64 lpAddress, DWORD dwSize, DWORD dwFreeType);
/*
*/
NTSTATUS ReadProcessMemory64(DWORD64 lpBaseAddress, LPVOID lpBuffer, DWORD nSize, DWORD64 *lpNumberOfBytesRead );
/*
*/
NTSTATUS WriteProcessMemory64(DWORD64 lpBaseAddress, LPVOID lpBuffer, DWORD nSize, DWORD64 *lpNumberOfBytesWritten );
/*
*/
NTSTATUS GetThreadContext64(HANDLE hThread, _CONTEXT64* lpContext);
/*
*/
NTSTATUS SetThreadContext64(HANDLE hThread, _CONTEXT64* lpContext);
/*
*/
DWORD64 GetModuleHandle64( const wchar_t* lpModuleName, DWORD* pSize = nullptr );
/*
*/
DWORD64 GetProcAddress64( DWORD64 hModule, DWORD size, const char* funcName );
/*
*/
BOOL CreateRemoteThread64( DWORD64 address, DWORD64 arg, DWORD64& exitStatus, bool wait = false );
/*
*/
DWORD64 LoadLibrary64( const wchar_t* path );
/*
*/
static Wow64Local& local() { return _local; }
private:
/*
*/
DWORD64 LoadLibraryRemoteWOW64( const wchar_t* path );
private:
HANDLE _hProcess;
DWORD _pid;
static
Wow64Local _local;
};
}