I am rewriting my detour class atm, and was looking for a nice way to write instructions to the target functions ending up with the following:
pseudocode:
Code:
#pragma push(1)
class Asm_Jmp
{
char opcode;
DWORD address;
void apply(DWORD jmpAddr)
{
opcode = 0xE9;
// calculate realtive addr
address = jmpAddr;
}
}
#pragma push()
//using it like that
reinterpret_cast<Asm_Jmp*>(addrInstruction)->apply(jmpTarget);
I works nice in my test Application, but i can“t test it in wow atm. so i would like to know if it can work in any target, or may the memory layout different for other targets.
Suggestions about up/downsides of this are welcome.
Thanks in advance