Question

I'm trying to modify a value for Solitaire 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.

Was it helpful?

Solution 2

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.

OTHER TIPS

try:

volatile int * pScore = (int*)( BASE + fOFFSET + sOFFSET );
*pScore = VALUE;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top