Question About Offsets

04/08/2018 16:44 Raftor1001#1
Hi, i have 1 problem with offsets in c# i want to create a tool for game to read memory address(HP,Stamina and all this stuff) and send keys to game like '1' to use potion.
My problem starts when i get base address from game and its like that : Game.exe +D57B50 and i need to use 2 offsets "230" and "CC", how i can use this 2 offsets to get the final addres i mean when im using some code like:

Code:
   
int ptroffset1 = 230;
int ptroffset2 = 0xCC    
offset = BitConverter.ToUInt32(mreader.ReadMemory((IntPtr)(pAddress + (uint)process.MainModule.BaseAddress), 4, out bytesOut), 0);
offset += (uint)ptroffset1;
 offset += (uint)ptroffset2;
it gives me the wrong address and cheat engine give me the right address
then i start to see whats wrong and i realized that te first pointeroffset in cheat engine is different i mean the base Game.exe+D57B50 = 1B888180 now [1B888180+230] = 193F3A28 <-How cheat engine get this address? i tried with calculator and the right address for +230 was 1B8883B0.
Somebody can help me to know how to get or what operation i need to do for that address and excuse me for the worst English you've ever seen.
04/08/2018 17:28 florian0#2
Quote:
Originally Posted by Raftor1001 View Post
Game.exe+D57B50 = 1B888180 now [1B888180+230] = 193F3A28 <-How cheat engine get this address? i tried with calculator and the right address for +230 was 1B8883B0.
Almost correct. You just need to call ReadMemory(0x1B8883B0) to get the correct value.

Your Pointer Chain is D57B50 -> 230 -> CC

The equivalent pseudo-codish expression would be
Code:
[ [ [Game.exe + 0xD57B50] + 0x230 ] + 0xCC ]
Each pair of brackets ( "[" and "]" ) means: Read Memory!
Code:
base = GetBase(Game.exe)
p1 = ReadMemory(base + 0xD57B50)
p2 = ReadMemory(p1 + 0x230)
p3 = ReadMemory(p2 + 0xCC)
04/08/2018 18:36 Raftor1001#3
Thank you very much you save my day ^_^
P.S. : If someone is having the same problem and still not working try to not read memory on the last PointerOffset because in my case the solution was:
Code:
[ [ [Game.exe + 0xD57B50] + 0x230 ] + 0xCC
the last dont need to call memoryreader only simple HEX sum.