-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhookserver.h
49 lines (40 loc) · 965 Bytes
/
hookserver.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
#pragma once
#include <string>
#include <vector>
#include "Promise.h"
struct HookedProcess
{
std::wstring name;
std::uint32_t pid;
};
class HookTask : public Task<HookedProcess>
{
private:
std::wstring _process_name;
std::wstring _dll_path;
std::uint32_t _pid;
std::size_t _proc_offset;
public:
HookTask(const std::wstring& name, const std::wstring& path, std::uint32_t pid, std::size_t offset)
: _process_name(name)
, _dll_path(path)
, _pid(pid)
, _proc_offset(offset)
{}
virtual ~HookTask() {}
virtual HookedProcess Run();
};
class RemoveHookTask : public Task<void>
{
private:
std::vector<std::uint32_t> _pids;
std::wstring _dll_path;
public:
template<typename T>
RemoveHookTask(T&& pids, const std::wstring& path, std::uint32_t pid)
: _pids(std::forward<T>(pids))
, _dll_path(path)
{}
virtual ~RemoveHookTask() {}
virtual void Run();
};