This code is compiled without any knowledge of the OS, except for the lookup table pointer at 0x7100
Virtual table of functions start at 0x7100
When the OS is ready it will set these addresses up and call the newly compiled code.
eg. 0x7100 points to Return44, a static function with no parameters and returns a QWORD
Here is the SystemFunction class, this resides with in the OS
Code: Select all
class tSystemFunction
{
public:
FIL void Init();
static QWORD Return44() { return 0x1234567890ABCDEF; }
};
Code: Select all
namespace SystemFunction
{
FIL QWORD __ptr(DWORD Index) { return (QWORD)(0x7100 + (Index * sizeof(void*))); }
FIL QWORD Return44()
{
typedef QWORD(Kernel::tSystemFunction::*tReturn44)();
tReturn44 vReturn44;
*(QWORD*)&vReturn44 = __ptr(0);
return vReturn44();
}
};
Thanks, Alistair