Add support for custom calling convention passing arguments in registers

If the compiler decided to pass an argument in a register on an internal function instead of pushing it on the stack to save time, allow us to specify the register the parameter is going to be in.

DHookAddParam received another parameter to set the register.
This commit is contained in:
Peace-Maker
2018-01-23 03:15:03 +01:00
parent 5d21350e9e
commit 1b9fa3743f
17 changed files with 555 additions and 36 deletions
+7
View File
@@ -5,6 +5,7 @@
#include <sourcehook.h>
#include <sh_vector.h>
#include <sourcehook_pibuilder.h>
#include <registers.h>
enum CallingConvention
{
@@ -92,6 +93,7 @@ struct ParamInfo
size_t size;
unsigned int flags;
SourceHook::PassInfo::PassType pass_type;
Register_t custom_register;
};
#ifdef WIN32
@@ -216,6 +218,11 @@ public:
this->callback = nullptr;
};
~HookSetup(){};
bool IsVirtual()
{
return this->offset != -1;
}
public:
unsigned int returnFlag;
ReturnType returnType;