diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2023-12-27 11:43:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-27 11:43:04 +0100 |
| commit | 7474c819587a138b458e898847fbce93e1dd1d65 (patch) | |
| tree | ee77dc61ba2d6e76fc97506a6d77b9f2c3d3ef6d /src/plugins/HookSystem.hpp | |
| parent | 191fa587f4daf9f3bf3e3f791de9e2dc5e95a459 (diff) | |
pluginapi: Trampoline hooks %rip patching improvements (#4256)
---------
Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
Diffstat (limited to 'src/plugins/HookSystem.hpp')
| -rw-r--r-- | src/plugins/HookSystem.hpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/plugins/HookSystem.hpp b/src/plugins/HookSystem.hpp index 00494733..8714ac32 100644 --- a/src/plugins/HookSystem.hpp +++ b/src/plugins/HookSystem.hpp @@ -22,21 +22,31 @@ class CFunctionHook { void* m_pOriginal = nullptr; private: - void* m_pSource = nullptr; - void* m_pFunctionAddr = nullptr; - void* m_pTrampolineAddr = nullptr; - void* m_pDestination = nullptr; - size_t m_iHookLen = 0; - size_t m_iTrampoLen = 0; - HANDLE m_pOwner = nullptr; - bool m_bActive = false; + void* m_pSource = nullptr; + void* m_pFunctionAddr = nullptr; + void* m_pTrampolineAddr = nullptr; + void* m_pDestination = nullptr; + size_t m_iHookLen = 0; + size_t m_iTrampoLen = 0; + HANDLE m_pOwner = nullptr; + bool m_bActive = false; - std::vector<std::pair<size_t, std::string>> m_vTrampolineRIPUses; + void* m_pOriginalBytes = nullptr; - void* m_pOriginalBytes = nullptr; + struct SInstructionProbe { + size_t len = 0; + std::string assembly = ""; + std::vector<size_t> insSizes; + }; - size_t probeMinimumJumpSize(void* start, size_t min); - size_t getInstructionLenAt(void* start); + struct SAssembly { + std::vector<char> bytes; + }; + + SInstructionProbe probeMinimumJumpSize(void* start, size_t min); + SInstructionProbe getInstructionLenAt(void* start); + + SAssembly fixInstructionProbeRIPCalls(const SInstructionProbe& probe); friend class CHookSystem; }; |
