how to determine the hex values?
Sorry if I'm asking this in the wrong section or something. It has to do with C++ and Assembly.
Well, here's the deal. I'm dealing with a dynamic JMP instruction in a game. Meaning, every time the game loads, the address it JMP's to changes. Here is an example:
Code:
00469F00: E9 BB76DB02 jmp mylibrary.032215C0
The JMP address is determined by a calculation: mylibrary.dll + 0x15C0.
My question is, how would I go about writing the JMP and the calculated address from C++? I can patch existing instructions, but I'm having a hard time figuring out how 'BB76DB02' is supposed to be '032215C0'. I know that 0xE9 means JMP, but its the parameter that I don't understand how its hex value is determined.
Code:
static const void *mylib_jump = (GetModuleHandle("mylibrary.dll") + 0x15C0);
BYTE bJump[] = {0xE9};
memcpy((PVOID)dwAddress,bJump,1);
// Now what to put here? possibly this?
memcpy((PVOID)dwaddress+1,mylib_jump,4);
I was as clear as possible.. sorry if you don't understand.. thanks for the help.
Re: how to determine the hex values?
It's the base address of the dll + 0x15C0, so you'll need to know where the dll is loaded.