In the unHook function, m_userTrampVar is clear, cause crash when hook again
cnsheds opened this issue · 2 comments
cnsheds commented
bool Detour::unHook() {
if (!m_hooked) {
Log::log("Detour unhook failed: no hook present", ErrorLevel::SEV);
return false;
}
MemoryProtector prot(m_fnAddress, calcInstsSz(m_originalInsts), ProtFlag::R | ProtFlag::W | ProtFlag::X, *this);
ZydisDisassembler::writeEncoding(m_originalInsts, *this);
if (m_trampoline != NULL) {
delete[](uint8_t*) m_trampoline;
m_trampoline = NULL;
}
if (m_userTrampVar != nullptr) {
*m_userTrampVar = NULL;
m_userTrampVar = nullptr; // This line should be deleted. ?
}
m_hooked = false;
return true;
}
stevemk14ebr commented
Hey thanks! Can you send a PR to fix?
cnsheds commented
OK