extensions/bintools/CallWrapper.h
changeset 739 d22243bb5864
child 740 04a39f9db33c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extensions/bintools/CallWrapper.h	Fri May 04 21:39:05 2007 +0000
     1.3 @@ -0,0 +1,58 @@
     1.4 +/**
     1.5 + * vim: set ts=4 :
     1.6 + * ===============================================================
     1.7 + * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC. 
     1.8 + * All rights reserved.
     1.9 + * ===============================================================
    1.10 + *
    1.11 + *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be 
    1.12 + * used or modified under the Terms and Conditions of its License Agreement, 
    1.13 + * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative 
    1.14 + * works must be licensed under the GNU General Public License (version 2 or 
    1.15 + * greater).  A copy of the GPL is included under public/licenses/GPL.txt.
    1.16 + * 
    1.17 + * To view the latest information, see: http://www.sourcemod.net/license.php
    1.18 + *
    1.19 + * Version: $Id$
    1.20 + */
    1.21 +
    1.22 +#ifndef _INCLUDE_SOURCEMOD_CCALLWRAPPER_H_
    1.23 +#define _INCLUDE_SOURCEMOD_CCALLWRAPPER_H_
    1.24 +
    1.25 +#include <IBinTools.h>
    1.26 +
    1.27 +using namespace SourceMod;
    1.28 +
    1.29 +#define ADDR_CALLEE			0
    1.30 +#define ADDR_CODEBASE		1
    1.31 +
    1.32 +struct VtableInfo 
    1.33 +{
    1.34 +	unsigned int vtblIdx;
    1.35 +	unsigned int vtblOffs;
    1.36 +	unsigned int thisOffs;
    1.37 +};
    1.38 +
    1.39 +class CallWrapper : public ICallWrapper
    1.40 +{
    1.41 +public:
    1.42 +	CallWrapper(CallConvention cv, const PassInfo *paramInfo, const PassInfo *retInfo, unsigned int numParams);
    1.43 +	~CallWrapper();
    1.44 +public: //ICallWrapper
    1.45 +	CallConvention GetCallConvention();
    1.46 +	const PassEncode *GetParamInfo(unsigned int num);
    1.47 +	const PassInfo *GetReturnInfo();
    1.48 +	unsigned int GetParamCount();
    1.49 +	void Execute(void *vParamStack, void *retBuffer);
    1.50 +public:
    1.51 +	inline void deleteThis() { delete this; }
    1.52 +	void *m_Addrs[4];
    1.53 +	VtableInfo m_VtInfo;
    1.54 +private:
    1.55 +	CallConvention m_Cv;
    1.56 +	PassEncode *m_Params;
    1.57 +	PassInfo *m_RetParam;
    1.58 +	unsigned int m_NumParams;
    1.59 +};
    1.60 +
    1.61 +#endif //_INCLUDE_SOURCEMOD_CCALLWRAPPER_H_
    1.62 \ No newline at end of file