blob: b7d2c43c840ce3303404b6c2c16e1de2b611f85b (
plain)
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
|
#include <cstdio>
#include <subhook.h>
extern void foo();
extern void foo_hooked();
typedef void (*foo_func_t)();
subhook::Hook foo_hook;
int main() {
std::printf("Testing initial install\n");
foo_hook.Install((void *)foo, (void *)foo_hooked);
foo();
foo_hook.Remove();
foo();
std::printf("Testing re-install\n");
foo_hook.Install();
foo();
foo_hook.Remove();
foo();
std::printf("Testing trampoline\n");
foo_func_t foo_ptr = (foo_func_t)foo_hook.GetTrampoline();
foo_ptr();
}
|