diff options
| author | Vaxry <vaxry@vaxry.net> | 2025-10-07 12:37:21 +0100 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2025-10-07 12:49:36 +0100 |
| commit | 5a208621264cff4d4fe6f1d5f018b28ca43e88bd (patch) | |
| tree | 5e3dd6356fe879ad2a8015c87d530f74a217328e /src/plugins/HookSystem.hpp | |
| parent | c3747fab5615ede222559a00501160773b82a2c2 (diff) | |
hookSystem: use a full trampo setup for hooks
instead of planting a longjmp at the fn head, make a shortjmp to a launch trampo
this helps with shortjmps that can be in the fn and will break when relocated. They are very unlikely to occur within the first 5 bytes (jmp rel32) but can happen in the first 10 or so (longjmp)
fixes csgo-vk-fix on latest main with release building on gcc / clang
Diffstat (limited to 'src/plugins/HookSystem.hpp')
| -rw-r--r-- | src/plugins/HookSystem.hpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/HookSystem.hpp b/src/plugins/HookSystem.hpp index 95b4c972..cf098dd1 100644 --- a/src/plugins/HookSystem.hpp +++ b/src/plugins/HookSystem.hpp @@ -6,7 +6,7 @@ #include "../helpers/memory/Memory.hpp" #define HANDLE void* -#define HOOK_TRAMPOLINE_MAX_SIZE 64 +#define HOOK_TRAMPOLINE_MAX_SIZE 32 class CFunctionHook { public: @@ -24,13 +24,13 @@ class CFunctionHook { void* m_original = nullptr; private: - void* m_source = nullptr; - void* m_trampolineAddr = nullptr; - void* m_destination = nullptr; - size_t m_hookLen = 0; - size_t m_trampoLen = 0; - HANDLE m_owner = nullptr; - bool m_active = false; + void* m_source = nullptr; + void* m_launchTrampolineAddr = nullptr; + void* m_landTrampolineAddr = nullptr; + void* m_destination = nullptr; + size_t m_hookLen = 0; + HANDLE m_owner = nullptr; + bool m_active = false; std::vector<unsigned char> m_originalBytes; |
