So I'm trying to hook this function:
Code:
void *__usercall WardenModule__Load<eax>(const void *modulePointer<eax>, unsigned int moduleSize<edx>, int a3<ecx>)
I realize that the return value is actually stored in eax, and I can't simply just hook the function as above, i.e. I may need to save all the registers, then restore them before finishing my hook function. Is there a guide posted somewhere on this?
Or should I literally just hook the function with NO arguments, and then read values from the registers via assembly to save, do some work, then restore to the previous value? And if so, are there certain registers I have to store?
Thanks in advance!
Edit: Found this thread: http://www.mmowned.com/forums/world-...ow-code-c.html
So I'm assuming I just need to do:
Code:
push 0xDEADBABE // Placeholder for the return address
pushfd // Save the flags and registers
pushad
//-- Something useful goes here :)
popad // Restore the registers and flags
popfd
ret // Return control to the hijacked thread