mirror of
https://git.recroomarchive.org/Radium/libradhook.git
synced 2026-08-07 09:10:59 +00:00
21 lines
394 B
C++
21 lines
394 B
C++
#include <cassert>
|
|
#include "radhook/radhook.h"
|
|
|
|
static int fn() { return 42; }
|
|
static int detour() { return 1337; }
|
|
|
|
int main() {
|
|
RadHookHandle h = nullptr;
|
|
|
|
RadHookCreate((void*)fn, (void*)detour, &h);
|
|
|
|
for (int i = 0; i < 10000; i++) {
|
|
RadHookEnable(h);
|
|
assert(fn() == 1337);
|
|
|
|
RadHookDisable(h);
|
|
assert(fn() == 42);
|
|
}
|
|
|
|
RadHookDestroy(h);
|
|
} |