diff --git a/extensions/dhooks/dynhooks_sourcepawn.cpp b/extensions/dhooks/dynhooks_sourcepawn.cpp index 927f3d66c..6ad744d16 100644 --- a/extensions/dhooks/dynhooks_sourcepawn.cpp +++ b/extensions/dhooks/dynhooks_sourcepawn.cpp @@ -532,6 +532,7 @@ CDynamicHooksSourcePawn::CDynamicHooksSourcePawn(HookSetup *setup, CHook *pDetou this->hookType = setup->hookType; this->m_pDetour = pDetour; this->callConv = setup->callConv; + this->thisFuncCallConv = setup->callConv; } HookReturnStruct *CDynamicHooksSourcePawn::GetReturnStruct() diff --git a/extensions/dhooks/natives.cpp b/extensions/dhooks/natives.cpp index 8c3efdf5d..48a2112ce 100644 --- a/extensions/dhooks/natives.cpp +++ b/extensions/dhooks/natives.cpp @@ -1117,16 +1117,10 @@ cell_t Native_GetParamObjectPtrVar(IPluginContext *pContext, const cell_t *param } else { - /*HookSetup* setup; - if(!GetHandleIfValidOrError(g_HookSetupHandle, (void **)&setup, pContext, params[1])) - { - return pContext->ThrowNativeError("Cannot determine calling convention type, parameter 'this' is only available in member functions"); - } - - if(setup->callConv != CallConv_THISCALL) + if(paramStruct->dg->thisFuncCallConv != CallConv_THISCALL) { return pContext->ThrowNativeError("Parameter 'this' is only available in member functions, specify the calling convention type 'thiscall'"); - }*/ + } if(paramStruct->dg->thisType != ThisPointer_Address && paramStruct->dg->thisType != ThisPointer_CBaseEntity) { @@ -1213,16 +1207,10 @@ cell_t Native_SetParamObjectPtrVar(IPluginContext *pContext, const cell_t *param } else { - /*HookSetup* setup; - if(!GetHandleIfValidOrError(g_HookSetupHandle, (void **)&setup, pContext, params[1])) - { - return pContext->ThrowNativeError("Cannot determine calling convention type, parameter 'this' is only available in member functions"); - } - - if(setup->callConv != CallConv_THISCALL) + if(paramStruct->dg->thisFuncCallConv != CallConv_THISCALL) { return pContext->ThrowNativeError("Parameter 'this' is only available in member functions, specify the calling convention type 'thiscall'"); - }*/ + } if(paramStruct->dg->thisType != ThisPointer_Address && paramStruct->dg->thisType != ThisPointer_CBaseEntity) { @@ -1323,16 +1311,10 @@ cell_t Native_GetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t } else { - /*HookSetup* setup; - if(!GetHandleIfValidOrError(g_HookSetupHandle, (void **)&setup, pContext, params[1])) - { - return pContext->ThrowNativeError("Cannot determine calling convention type, parameter 'this' is only available in member functions"); - } - - if(setup->callConv != CallConv_THISCALL) + if(paramStruct->dg->thisFuncCallConv != CallConv_THISCALL) { return pContext->ThrowNativeError("Parameter 'this' is only available in member functions, specify the calling convention type 'thiscall'"); - }*/ + } if(paramStruct->dg->thisType != ThisPointer_Address && paramStruct->dg->thisType != ThisPointer_CBaseEntity) { @@ -1402,16 +1384,10 @@ cell_t Native_SetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t } else { - /*HookSetup* setup; - if(!GetHandleIfValidOrError(g_HookSetupHandle, (void **)&setup, pContext, params[1])) - { - return pContext->ThrowNativeError("Cannot determine calling convention type, parameter 'this' is only available in member functions"); - } - - if(setup->callConv != CallConv_THISCALL) + if(paramStruct->dg->thisFuncCallConv != CallConv_THISCALL) { return pContext->ThrowNativeError("Parameter 'this' is only available in member functions, specify the calling convention type 'thiscall'"); - }*/ + } if(paramStruct->dg->thisType != ThisPointer_Address && paramStruct->dg->thisType != ThisPointer_CBaseEntity) { @@ -1480,16 +1456,10 @@ cell_t Native_GetParamObjectPtrString(IPluginContext *pContext, const cell_t *pa } else { - /*HookSetup* setup; - if(!GetHandleIfValidOrError(g_HookSetupHandle, (void **)&setup, pContext, params[1])) - { - return pContext->ThrowNativeError("Cannot determine calling convention type, parameter 'this' is only available in member functions"); - } - - if(setup->callConv != CallConv_THISCALL) + if(paramStruct->dg->thisFuncCallConv != CallConv_THISCALL) { return pContext->ThrowNativeError("Parameter 'this' is only available in member functions, specify the calling convention type 'thiscall'"); - }*/ + } if(paramStruct->dg->thisType != ThisPointer_Address && paramStruct->dg->thisType != ThisPointer_CBaseEntity) { diff --git a/extensions/dhooks/vhook.h b/extensions/dhooks/vhook.h index b58f9c4ff..92dd279e8 100644 --- a/extensions/dhooks/vhook.h +++ b/extensions/dhooks/vhook.h @@ -162,6 +162,7 @@ public: int entity; ThisPointerType thisType; HookType hookType; + CallingConvention thisFuncCallConv; }; class DHooksCallback : public SourceHook::ISHDelegate, public DHooksInfo