Adding Base Address + Offsets to Modify Value
I'm trying to modify a value for S开发者_如何学Colitaire such as the score.
Anyways I found the addresses (using CheatEngine) that the pointers point to but I'm having difficult injecting code to modify the score. I'm almost certain it's the way I'm adding the offsets to the base value and not Windows DEP, my injecting method, or anything else.
Here's the code I'm using.
#define BASE 0xFFAEAFA8
#define fOFFSET 0x50
#define sOFFSET 0x14
#define VALUE 55555
*(int*)(((*(int*) BASE) + fOFFSET) + sOFFSET) = VALUE;
Whenever I inject this code my game crashes. Works fine if I modify the values in Cheat Engine but not in code.
try:
volatile int * pScore = (int*)( BASE + fOFFSET + sOFFSET );
*pScore = VALUE;
What I was doing wrong:
I needed to use the ReadProcessMemory()
API to find the address that a pointer points to. And then add the offsets.
精彩评论