forked from chinosk/gkms-local
21 lines
1.8 KiB
C++
21 lines
1.8 KiB
C++
#include "shadowhook.h"
|
|
#include <android/log.h>
|
|
|
|
#define ADD_HOOK(name, addr) \
|
|
name##_Addr = reinterpret_cast<name##_Type>(addr); \
|
|
if (addr) { \
|
|
auto stub = hookInstaller->InstallHook(reinterpret_cast<void*>(addr), \
|
|
reinterpret_cast<void*>(name##_Hook), \
|
|
reinterpret_cast<void**>(&name##_Orig)); \
|
|
if (stub == NULL) { \
|
|
int error_num = shadowhook_get_errno(); \
|
|
const char *error_msg = shadowhook_to_errmsg(error_num); \
|
|
Log::ErrorFmt("ADD_HOOK: %s at %p failed: %s", #name, addr, error_msg); \
|
|
} \
|
|
else { \
|
|
hookedStubs.emplace(stub); \
|
|
GakumasLocal::Log::InfoFmt("ADD_HOOK: %s at %p", #name, addr); \
|
|
} \
|
|
} \
|
|
else GakumasLocal::Log::ErrorFmt("Hook failed: %s is NULL", #name, addr); \
|
|
if (Config::lazyInit) UnityResolveProgress::classProgress.current++ |