Преглед на файлове

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 години
родител
ревизия
8989abafd2
променени са 2 файла, в които са добавени 9 реда и са изтрити 9 реда
  1. +8
    -8
      tester/polyhook.cpp
  2. +1
    -1
      tester/polyhook.h

+ 8
- 8
tester/polyhook.cpp Целия файл

@@ -40,7 +40,7 @@ uint64_t PolyHook_Hooks::hookRip_relative(void) {
void PolyHook_Hooks::hookAVX(float num, void* res) {
g_PolyHook->avx = true;

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

uint32_t PolyHook_Hooks::hookRDRAND(void) {
@@ -62,15 +62,15 @@ uint32_t PolyHook_Hooks::hookTail_recursion(uint32_t x) {
}

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;
}

+ 1
- 1
tester/polyhook.h Целия файл

@@ -21,7 +21,7 @@ private:
detTailRecursion;

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);
if (!det->Hook()) {
return false;

Loading…
Отказ
Запис