From 12cb5ea79a9e99c7352401d9cb2776985c21dbc9 Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Fri, 23 Nov 2007 15:26:00 +0000 Subject: [PATCH] Fixed wrong this pointer on destruction of forcedbyref params (this ptr was eip!) --HG-- branch : hookman_autogen extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/branches/hookman_autogen%40572 --- sourcehook/sourcehook_hookmangen.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sourcehook/sourcehook_hookmangen.cpp b/sourcehook/sourcehook_hookmangen.cpp index a3f4449..4e61f59 100644 --- a/sourcehook/sourcehook_hookmangen.cpp +++ b/sourcehook/sourcehook_hookmangen.cpp @@ -390,9 +390,12 @@ namespace SourceHook if (pi.type == PassInfo::PassType_Object && (pi.flags & PassInfo::PassFlag_ODtor) && (pi.flags & PassInfo::PassFlag_ByVal) && (pi.flags & PassFlag_ForcedByRef)) { + // Actually, this is only for GCC (see line above: ForcedByRef) IA32_Lea_DispRegImmAuto(&m_HookFunc, REG_ECX, REG_EBP, fbrr_base + GetForcedByRefParamOffset(i)); + IA32_Push_Reg(&m_HookFunc, REG_ECX); IA32_Mov_Reg_Imm32(&m_HookFunc, REG_EAX, DownCastPtr(pi.pDtor)); IA32_Call_Reg(&m_HookFunc, REG_EAX); + IA32_Pop_Reg(&m_HookFunc, REG_ECX); } } }