2011-07-17 03:00:29 -06:00
|
|
|
#ifndef FUNCTIONCALL__H
|
|
|
|
#define FUNCTIONCALL__H
|
|
|
|
#include <vector>
|
|
|
|
using std::vector;
|
2011-08-08 15:30:30 -06:00
|
|
|
using std::size_t;
|
2011-07-17 03:00:29 -06:00
|
|
|
class FunctionCaller
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum callconv
|
|
|
|
{
|
|
|
|
STD_CALL, //__stdcall - all in stack
|
|
|
|
FAST_CALL, //__fastcall - as much in registers as fits
|
|
|
|
THIS_CALL, //__thiscall - eax ptr to this, rest in stack
|
|
|
|
CDECL_CALL //__cdecl - same as stdcall but no stack realign
|
|
|
|
};
|
|
|
|
|
|
|
|
FunctionCaller(size_t base):base_(base){};
|
|
|
|
|
|
|
|
int CallFunction(size_t func_ptr,callconv conv,const vector<int> &arguments);
|
2011-07-19 07:45:54 -06:00
|
|
|
|
2011-07-17 03:00:29 -06:00
|
|
|
private:
|
2011-07-19 07:45:54 -06:00
|
|
|
int CallF(size_t count,callconv conv,void* f,const vector<int> &arguments);
|
2011-07-17 03:00:29 -06:00
|
|
|
size_t base_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //FUNCTIONCALL__H
|