From 2ba221b6a383b46b81d2c2470b394b476cca4a59 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Tue, 23 Jan 2018 13:40:55 +0100 Subject: [PATCH] Fix passing this pointer to callback even if the detour was setup to ignore it The this pointer was always passed to the plugin callback if the calling convention was a thiscall. Even if the plugin author set the this pointer type to ThisPointer_Ignore. --- dynhooks_sourcepawn.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dynhooks_sourcepawn.cpp b/dynhooks_sourcepawn.cpp index 6c73a07..fd7782e 100644 --- a/dynhooks_sourcepawn.cpp +++ b/dynhooks_sourcepawn.cpp @@ -277,7 +277,7 @@ ReturnAction_t HandleDetour(HookType_t hookType, CHook* pDetour) ke::AutoPtr tempRetBuf(new uint8_t[pDetour->m_pCallingConvention->m_returnType.size]); // Find the this pointer. - if (pWrapper->callConv == CallConv_THISCALL) + if (pWrapper->callConv == CallConv_THISCALL && pWrapper->thisType != ThisPointer_Ignore) { void *thisPtr = pDetour->GetArgument(0); cell_t thisAddr = GetThisPtr(thisPtr, pWrapper->thisType);