mirror of
https://git.recroomarchive.org/Radium/libradhook.git
synced 2026-08-07 09:10:59 +00:00
20 lines
603 B
C++
20 lines
603 B
C++
#include <cassert>
|
|
#include "radhook/radhook.h"
|
|
|
|
static int fn() { return 42; }
|
|
static int detour() { return 1337; }
|
|
|
|
int main() {
|
|
RadHookHandle h = nullptr;
|
|
|
|
assert(RadHookCreate((void*)fn, (void*)detour, &h) == RadHookResult::Success);
|
|
|
|
// idempotent enable/disable behavior
|
|
assert(RadHookEnable(h) != RadHookResult::Unknown);
|
|
assert(RadHookEnable(h) == RadHookResult::AlreadyEnabled || RadHookIsEnabled(h));
|
|
|
|
assert(RadHookDisable(h) != RadHookResult::Unknown);
|
|
assert(!RadHookIsEnabled(h) || RadHookDisable(h) == RadHookResult::AlreadyDisabled);
|
|
|
|
RadHookDestroy(h);
|
|
} |