pluginapi: Trampoline hooks %rip patching improvements (#4256)
--------- Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
This commit is contained in:
parent
191fa587f4
commit
7474c81958
2 changed files with 114 additions and 60 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue