Hi guys, i know this is stupid but i've been trying to convert this block of asm code in c++ for an hour or two and im stuck
//////////////////////////////////////////////////////////////////////////////////////////////
/////// This routine write the value returned by GetProcAddress() at the address p ///////////
//////////////////////////////////////////////////////////////////////////////////////////////
bool SetProcAddress(HINSTANCE dll, void *p, char *name)
{
UINT *res = (UINT*)ptr;
void *f = GetProcAddress(dll, name);
if(!f)
return false;
_asm {
push ebx
push edx
mov ebx, f
mov edx, p
mov [ebx], edx // <--- put edx at the address pointed by ebx
pop edx
pop ebx
}
return res != 0;
}
...
// ie:
SetProcAddress(hDll, &some_function, "function_name");
I tried:
memcmp(p, f, sizeof(p));
and
UINT *i1 = (*UINT)p;
UINT *i2 = (*UINT)f;
*f = *p;
The first one dosent seem to give the right retult, and the second one won't compile.
Any idea?
↧