Skip to content

Commit 7b1803b

Browse files
Spoof return address when calling the original function in MinHook::callOriginal()
1 parent 05a94b3 commit 7b1803b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Source/Hooks/MinHook.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
#include <cstddef>
44
#include <memory>
55

6+
#ifdef _WIN32
7+
#include <x86RetSpoof.h>
8+
#endif
9+
10+
#include "../Memory.h"
611
#include "../SDK/Platform.h"
712

813
class MinHook {
@@ -20,7 +25,11 @@ class MinHook {
2025
template<typename T, std::size_t Idx, typename ...Args>
2126
constexpr auto callOriginal(Args... args) const noexcept
2227
{
28+
#ifdef _WIN32
29+
return x86RetSpoof::invokeThiscall<T, Args...>(std::uintptr_t(base), originals[Idx], memory->jmpEbxGadgetInClient, args...);
30+
#else
2331
return getOriginal<T, Idx>(args...)(base, args...);
32+
#endif
2433
}
2534

2635
private:

0 commit comments

Comments
 (0)