|
|
|
|
|
|
|
|
static TypeSmall trueSmall = &_small; |
|
|
static TypeSmall trueSmall = &_small; |
|
|
static TypeBranch trueBranch = &_branch; |
|
|
static TypeBranch trueBranch = &_branch; |
|
|
static TypeRip_relative trueRip_Relative = &_rip_relative; |
|
|
static TypeRip_relative trueRip_Relative = &_rip_relative; |
|
|
|
|
|
static TypeAVX trueAVX = &_AVX; |
|
|
|
|
|
static TypeRDRAND trueRDRAND = &_RDRAND; |
|
|
|
|
|
|
|
|
AbstractHookEngine* g_mhook = new MHook(); |
|
|
AbstractHookEngine* g_mhook = new MHook(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return trueRip_Relative(); |
|
|
return trueRip_Relative(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void MHook_Hooks::_AVX(float num, void* res) { |
|
|
|
|
|
g_mhook->avx = true; |
|
|
|
|
|
|
|
|
|
|
|
return trueAVX(num, res); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
uint32_t MHook_Hooks::_RDRAND(void) { |
|
|
|
|
|
g_mhook->rdrand = true; |
|
|
|
|
|
|
|
|
|
|
|
return trueRDRAND(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
bool MHook::hook_all(void) { |
|
|
bool MHook::hook_all(void) { |
|
|
bool ret = Mhook_SetHook((PVOID*)&trueSmall, &MHook_Hooks::hookSmall); |
|
|
bool ret = Mhook_SetHook((PVOID*)&trueSmall, &MHook_Hooks::hookSmall); |
|
|
ret |= Mhook_SetHook((PVOID*)&trueBranch, &MHook_Hooks::hookBranch); |
|
|
ret |= Mhook_SetHook((PVOID*)&trueBranch, &MHook_Hooks::hookBranch); |
|
|
ret |= Mhook_SetHook((PVOID*)&trueRip_Relative, &MHook_Hooks::hookRip_relative); |
|
|
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); |
|
|
|
|
|
|
|
|
return ret; |
|
|
return ret; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool MHook::unhook_all() { |
|
|
bool MHook::unhook_all() { |
|
|
return Mhook_Unhook((PVOID*)&trueSmall) && |
|
|
return Mhook_Unhook((PVOID*)&trueSmall) && |
|
|
Mhook_Unhook((PVOID*)&trueBranch) && |
|
|
Mhook_Unhook((PVOID*)&trueBranch) && |
|
|
Mhook_Unhook((PVOID*)&trueRip_Relative); |
|
|
|
|
|
|
|
|
Mhook_Unhook((PVOID*)&trueAVX) && |
|
|
|
|
|
Mhook_Unhook((PVOID*)&trueRDRAND); |
|
|
} |
|
|
} |