inline uintptr_t CallNative(void* func, unsigned int* data, size_t size)
{
uintptr_t low;
uintptr_t high;
uintptr_t result;
#ifdef __i386__
asm(
"MOV EDI,ESP\n"
"SUB EDI,%3\n"
"MOV ESI,%4\n"
"MOV ECX,%3\n"
"PUSH DS\n"
"POP ES\n"
"CLD\n"
"REP MOVSB\n"
"MOV ESI,ESP\n"
"SUB ESP,%3\n"
"CALL %2\n"
"MOV ESP,ESI\n"
"MOV %0,EAX\n"
"MOV %1,EDX\n"
: "=m"(low), "=m"(high)
: "m"(func), "m"(size), "m"(data)
: "eax", "edx", "ecx", "esi", "edi", "cc"
);
*reinterpret_cast<uintptr_t*>(&result) = low;
*reinterpret_cast<uintptr_t*>(((uintptr_t) &result) + 4) = high;
#endif
return result;
}