Browse Source

fix polyhook crash

I tried to hook a member varialbe. well shit I mean it kinda has to have a similar name, doesn't it
master
aaaaaa aaaaaaa 6 years ago
parent
commit
8989abafd2
2 changed files with 9 additions and 9 deletions
  1. +8
    -8
      tester/polyhook.cpp
  2. +1
    -1
      tester/polyhook.h

+ 8
- 8
tester/polyhook.cpp View File

void PolyHook_Hooks::hookAVX(float num, void* res) { void PolyHook_Hooks::hookAVX(float num, void* res) {
g_PolyHook->avx = true; g_PolyHook->avx = true;


return trueAVX(num, res);
trueAVX(num, res);
} }


uint32_t PolyHook_Hooks::hookRDRAND(void) { uint32_t PolyHook_Hooks::hookRDRAND(void) {
} }


bool PolyHook::hook_all(void) { bool PolyHook::hook_all(void) {
bool ret = hook<decltype(&_small)>(detSmall, &_small, (void*&)trueSmall, &PolyHook_Hooks::hookSmall);
ret |= hook<decltype(&_branch)>(detBranch, &_branch, (void*&)trueBranch, &PolyHook_Hooks::hookBranch);
ret |= hook<decltype(&rip_relative)>(detRIPRelative, &rip_relative, (void*&)trueRip_Relative, &PolyHook_Hooks::hookRip_relative);
bool ret = hook<decltype(&_small)>(detSmall, &_small, trueSmall, &PolyHook_Hooks::hookSmall);
ret |= hook<decltype(&_branch)>(detBranch, &_branch, trueBranch, &PolyHook_Hooks::hookBranch);
ret |= hook<decltype(&_rip_relative)>(detRIPRelative, &_rip_relative, trueRip_Relative, &PolyHook_Hooks::hookRip_relative);


ret |= hook<decltype(&_AVX)>(detAVX, &_AVX, (void*&)trueAVX, &PolyHook_Hooks::hookAVX);
ret |= hook<decltype(&_RDRAND)>(detRDRAND, &_RDRAND, (void*&)trueRDRAND, &PolyHook_Hooks::hookRDRAND);
ret |= hook<decltype(&_AVX)>(detAVX, &_AVX, trueAVX, &PolyHook_Hooks::hookAVX);
ret |= hook<decltype(&_RDRAND)>(detRDRAND, &_RDRAND, trueRDRAND, &PolyHook_Hooks::hookRDRAND);


ret |= hook<decltype(&_loop)>(detLoop, &_loop, (void*&)trueLoop, &PolyHook_Hooks::hookLoop);
ret |= hook<decltype(&_tail_recursion)>(detTailRecursion, &_tail_recursion, (void*&)trueTailRecursion, &PolyHook_Hooks::hookTail_recursion);
ret |= hook<decltype(&_loop)>(detLoop, &_loop, trueLoop, &PolyHook_Hooks::hookLoop);
ret |= hook<decltype(&_tail_recursion)>(detTailRecursion, &_tail_recursion, trueTailRecursion, &PolyHook_Hooks::hookTail_recursion);


return ret; return ret;
} }

+ 1
- 1
tester/polyhook.h View File

detTailRecursion; detTailRecursion;


template <typename T> template <typename T>
bool hook(std::shared_ptr<PLH::Detour> det, void* func, void*& original, void* hook) {
bool hook(std::shared_ptr<PLH::Detour> det, void* func, T& original, void* hook) {
det->SetupHook((BYTE*)func, (BYTE*)hook); det->SetupHook((BYTE*)func, (BYTE*)hook);
if (!det->Hook()) { if (!det->Hook()) {
return false; return false;

Loading…
Cancel
Save