|
|
@@ -12,6 +12,8 @@ static TypeBranch trueBranch = &_branch; |
|
|
|
static TypeRip_relative trueRip_Relative = &_rip_relative; |
|
|
|
static TypeAVX trueAVX = &_AVX; |
|
|
|
static TypeRDRAND trueRDRAND = &_RDRAND; |
|
|
|
static TypeLoop trueLoop = &_loop; |
|
|
|
static TypeTailRecursion trueTailRecursion = &_tail_recursion; |
|
|
|
|
|
|
|
AbstractHookEngine* g_mhook = new MHook(); |
|
|
|
|
|
|
@@ -33,25 +35,40 @@ uint64_t MHook_Hooks::hookRip_relative(void) { |
|
|
|
return trueRip_Relative(); |
|
|
|
} |
|
|
|
|
|
|
|
void MHook_Hooks::_AVX(float num, void* res) { |
|
|
|
void MHook_Hooks::hookAVX(float num, void* res) { |
|
|
|
g_mhook->avx = true; |
|
|
|
|
|
|
|
return trueAVX(num, res); |
|
|
|
} |
|
|
|
|
|
|
|
uint32_t MHook_Hooks::_RDRAND(void) { |
|
|
|
uint32_t MHook_Hooks::hookRDRAND(void) { |
|
|
|
g_mhook->rdrand = true; |
|
|
|
|
|
|
|
return trueRDRAND(); |
|
|
|
} |
|
|
|
|
|
|
|
uint32_t MHook_Hooks::hookLoop(uint32_t num, uint32_t cnt) { |
|
|
|
g_mhook->loop = true; |
|
|
|
|
|
|
|
return trueLoop(num, cnt); |
|
|
|
} |
|
|
|
|
|
|
|
uint32_t MHook_Hooks::hookTail_recursion(uint32_t x) { |
|
|
|
g_mhook->tail_recursion = true; |
|
|
|
|
|
|
|
return trueTailRecursion(x); |
|
|
|
} |
|
|
|
|
|
|
|
bool MHook::hook_all(void) { |
|
|
|
bool ret = Mhook_SetHook((PVOID*)&trueSmall, &MHook_Hooks::hookSmall); |
|
|
|
ret |= Mhook_SetHook((PVOID*)&trueBranch, &MHook_Hooks::hookBranch); |
|
|
|
ret |= Mhook_SetHook((PVOID*)&trueRip_Relative, &MHook_Hooks::hookRip_relative); |
|
|
|
|
|
|
|
ret |= Mhook_SetHook((PVOID*)&trueAVX, &MHook_Hooks::_AVX); |
|
|
|
ret |= Mhook_SetHook((PVOID*)&trueRDRAND, &MHook_Hooks::_RDRAND); |
|
|
|
ret |= Mhook_SetHook((PVOID*)&trueAVX, &MHook_Hooks::hookAVX); |
|
|
|
ret |= Mhook_SetHook((PVOID*)&trueRDRAND, &MHook_Hooks::hookRDRAND); |
|
|
|
|
|
|
|
ret |= Mhook_SetHook((PVOID*)&trueLoop, &MHook_Hooks::hookLoop); |
|
|
|
ret |= Mhook_SetHook((PVOID*)&trueTailRecursion, &MHook_Hooks::hookTail_recursion); |
|
|
|
|
|
|
|
return ret; |
|
|
|
} |
|
|
@@ -60,5 +77,7 @@ bool MHook::unhook_all() { |
|
|
|
return Mhook_Unhook((PVOID*)&trueSmall) && |
|
|
|
Mhook_Unhook((PVOID*)&trueBranch) && |
|
|
|
Mhook_Unhook((PVOID*)&trueAVX) && |
|
|
|
Mhook_Unhook((PVOID*)&trueRDRAND); |
|
|
|
Mhook_Unhook((PVOID*)&trueRDRAND) && |
|
|
|
Mhook_Unhook((PVOID*)&trueLoop) && |
|
|
|
Mhook_Unhook((PVOID*)&trueTailRecursion); |
|
|
|
} |