| 18 | } |
| 19 | |
| 20 | bool HookAPI(const std::string& name, PVOID* ppRealFn, PVOID pMineFn) |
| 21 | { |
| 22 | Initialize(); |
| 23 | |
| 24 | DetourTransactionBegin(); |
| 25 | DetourUpdateThread(GetCurrentThread()); |
| 26 | DetourAttach(ppRealFn, pMineFn); |
| 27 | |
| 28 | if (DetourTransactionCommit() != NO_ERROR) |
| 29 | { |
| 30 | LOGE << "Error hooking API call: " << name; |
| 31 | return false; |
| 32 | } |
| 33 | |
| 34 | LOGI << "Hooked API call: " << name; |
| 35 | return true; |
| 36 | } |
| 37 | |
| 38 | bool UnhookAPI(const std::string& name, PVOID* ppRealFn, PVOID pMineFn) |
| 39 | { |