0

I'm learning to modifying game values using C++ but now I'm stuck.

I know how to edit for example FLOAT value of Player speed:

uintptr_t _EntitiesBase = (uintptr_t)GetModuleHandle(L"EntitiesMP.dll");
uintptr_t EntityBase = _EntitiesBase + 0x3153D0;
DWORD Run = 0xDE4;
*(FLOAT*)(*(DWORD*)EntityBase + Run) = Value;

But I don't know, how to edit values, that have much offsets (Engine.dll + 0xD52AB0 + 0x48 + 0x228), because in the end it return wrong value, not that I wanted to change

For example, in Cheat Engine, the same thing looks like this:

like that:

I added Engine.dll + 0xD52AB0 as a pointer, and next add offset 0x48 and offset 0x220 and it gives me address 2DC7E488, that contains FLOAT value, that I need to change

Do you have any ideas?

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
st zxc
  • 1
  • 1
    I'm skeptical that the memory locations of the values you want to edit are consistent between program runs. In the past that used to be because games used a C/C++ global to store game or player-state, which would have predictable and consistent memory locations at runtime, but modern games and engines have much better internal engineering (pun not intended) and so won't be like that. And if it's a Java/JVM or .NET game then the offsets will change _as the program runs_ due to the GC moving objects in-memory (to reduce heap fragmentation). – Dai Nov 04 '21 at 01:38
  • Based on the screenshot you showed, it looks like the `baseAddr + 0xD52AB0` refers to a struct that contains a pointer at offset 0x48. So you would need to pull a _pointer value_ from that address (`baseAddr + 0xD52AB0 + 0x48`) and then dereference it for the next address. That then points to another structure somewhere else in memory and the data you want to modify is at offset 0x220 from that pointer. – paddy Nov 04 '21 at 01:39
  • In short: `*(float*)(*(uintptr_t*)(_EntitiesBase + 0xD52AB0 + 0x48) + 0x220) = Value;` – paddy Nov 04 '21 at 01:47
  • I've tried it, but nope, it doesn't work =( – st zxc Nov 04 '21 at 01:58

1 Answers1

0

You can use ReadProcessMemory to read process memory and WriteProcessMemory to write process memory. to do this you just need to use ReadProcessMemory for every offset then write the pointer value with WriteProcessMemory:-

uintptr_t entitybase;
uintptr_t value1;
float newValue = 100000;
ReadProcessMemory(ProcessHandle, (uintptr_t)EngineDllHandle + 0xD52AB0, &entitybase, sizeof(entitybase), 0);
ReadProcessMemory(ProcessHandle, entitybase + 0x48, &value1, sizeof(value1), 0);
WriteProcessMemory(ProcessHandle, value1 + 0x220, &newValue, sizeof(entitybase), 0);
coderx64
  • 185
  • 1
  • 11