From b127702604bd69451b59b193f0e58f87444cb0a5 Mon Sep 17 00:00:00 2001 From: _xeroxz Date: Thu, 27 May 2021 00:38:30 +0000 Subject: [PATCH] Update README.md --- README.md | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5cd904a..524fe0e 100644 --- a/README.md +++ b/README.md @@ -6,19 +6,27 @@ A c++ header only library for inline hooking. Supports x86_64, x86, and arm. Sma Installing the hook/Init. ```cpp -hook::make_hook( - &WriteFile, //address to put inline hook at. - &HookWriteFile //address to jmp too. -); +__attribute__((noinline)) // very important that this is not inline! +FILE* hook_test(const char* filename, const char* open_type) +{ + std::printf("> filename = %s\n", filename); + std::printf("> open type = %s\n", open_type); + std::getchar(); + + return hook::get_func(&fopen)(filename, open_type); +} + +hook::make_hook(&fopen, &hook_test); ``` -Disabling the hook so you can call the original function. -```cpp - hook::disable(&WriteFile); - WriteFile(.....) +### Disable Hook + ``` +hook::disable(&fopen); +``` + +### Enable Hook -Enabling the hook. ``` -hook::enable(&WriteFile); +hook::enable(&fopen); ``` \ No newline at end of file