Initial
This commit is contained in:
55
hookproc/APIENTRY.CPP
Normal file
55
hookproc/APIENTRY.CPP
Normal file
@@ -0,0 +1,55 @@
|
||||
#include <hookproc/apientry.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
void APIEntry::createThunk(DWORD stackLength)
|
||||
{
|
||||
pushEBP();
|
||||
movEBPESP();
|
||||
jmp(0x0008);
|
||||
encodeDD();
|
||||
encodeDD();
|
||||
movEAX(FirstArgument);
|
||||
addEAX(stackLength);
|
||||
subEAX(0x0004);
|
||||
cmpEAX(0x0004);
|
||||
je(0x0013);
|
||||
pushEBPEAXPLUS(0);
|
||||
subEAX(4);
|
||||
cmpEAX(FirstArgument);
|
||||
jnl(-19);
|
||||
push(base()+tell()+0x0014);
|
||||
movECXOFFSETCS(base()+IATInstance);
|
||||
movEAXOFFSETCS(base()+IATOffset);
|
||||
pushEAX();
|
||||
retn();
|
||||
popEBP();
|
||||
retn();
|
||||
}
|
||||
#else
|
||||
void APIEntry::createThunk(DWORD stackLength)
|
||||
{
|
||||
pushEBP();
|
||||
movEBPESP();
|
||||
jmp(0x0008);
|
||||
encodeDD();
|
||||
encodeDD();
|
||||
movEAX(FirstArgument);
|
||||
addEAX(stackLength);
|
||||
subEAX(0x0004);
|
||||
cmpEAX(0x0004);
|
||||
je(0x0013);
|
||||
pushEBPEAXPLUS(0);
|
||||
subEAX(4);
|
||||
cmpEAX(FirstArgument);
|
||||
jnl(-19);
|
||||
movECXOFFSETCS(base()+IATInstance);
|
||||
pushECX();
|
||||
push(base()+tell()+0x000D);
|
||||
movEAXOFFSETCS(base()+IATOffset);
|
||||
pushEAX();
|
||||
retn();
|
||||
addESP(stackLength+sizeof(void*));
|
||||
popEBP();
|
||||
retn(stackLength);
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user