|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Darkwizzard70 How do I cheat? Reputation: 0
Joined: 18 Oct 2007 Posts: 2
|
Posted: Mon Feb 17, 2014 6:52 pm Post subject: [C#] Reading/Writing multi level pointer |
|
|
So I've really tried my best, googled a lot and I've tried around 3-5 classes that were made by others to write/read pointers etc but I managed to do it wrong every time I guess.
So here is the base address and the offsets (IMAGE OF CE):
https://www(dot)dropbox(dot)com/s/rk39htan940694d/Height%20Pointer-Offsets.png
The C# code:
Code: | Process[] pname = Process.GetProcessesByName("GameName");
IntPtr pHandle = pname[0].Handle; //Get the process handle
IntPtr bytesRead;
string hexValue;
byte[] buffer = new byte[4];
int BaseAddress = 0x01D93424;
hexValue = BaseAddress.ToString("X");
int address;
ReadProcessMemory(pHandle, (IntPtr)BaseAddress, buffer, 4, out bytesRead);
address = BitConverter.ToInt32(buffer, 0);
hexValue = address.ToString("X"); //Hexvalue is not necessarily but its easier for me to read the address (Comparing it with CE)
ReadProcessMemory(pHandle, (IntPtr)BaseAddress + 0x58, buffer, 4, out bytesRead);
address = BitConverter.ToInt32(buffer, 0);
hexValue = address.ToString("X"); //01D934B4
ReadProcessMemory(pHandle, (IntPtr)address + 0x424, buffer, 4, out bytesRead);
address = BitConverter.ToInt32(buffer, 0);
hexValue = address.ToString("X"); //01D938FC
ReadProcessMemory(pHandle, (IntPtr)address + 0x1C, buffer, 4, out bytesRead);
address = BitConverter.ToInt32(buffer, 0);
hexValue = address.ToString("X"); //01D938E0
ReadProcessMemory(pHandle, (IntPtr)address + 0xEC, buffer, 4, out bytesRead);
address = BitConverter.ToInt32(buffer, 0);
hexValue = address.ToString("X"); //01D93A04
ReadProcessMemory(pHandle, (IntPtr)address + 0x2F0, buffer, 4, out bytesRead);
address = BitConverter.ToInt32(buffer, 0);
hexValue = address.ToString("X"); //01D93D14
ReadProcessMemory(pHandle, (IntPtr)address + 0x64, buffer, 4, out bytesRead);
address = BitConverter.ToInt32(buffer, 0);
hexValue = address.ToString("X"); //45FB9000
//All went well until the code below has been executed (I've checked the addresses from each result from the codes above)
//They are all correct (Compared it with CheatEngine results)
//It goes wrong here somehow, the address is currently 45FB9000, adding that with the offset 5C should change it to 45FB905C according to Cheat Engine (Look at my image)
//However.. I get a totally different address when I debug my code. Cheat Engine itself clearly shows me that 45FB9000 + 5C = 45FB905C
//Everything else from the addresses here above goes good though..
ReadProcessMemory(pHandle, (IntPtr)address + 0x5C, buffer, 4, out bytesRead);
address = BitConverter.ToInt32(buffer, 0);
hexValue = address.ToString("X"); //Should be 45FB905C but it was different |
So yeah read the comments that I wrote there in the code.
It all goes well until it tries to get the latest address. I'm sure that I did something wrong but can anyone tell me what I did wrong?
I've worked with C# for few years but I just started memory hacking few days ago.
Oh and I've restarted the game several times but the multi level pointer still works so I guess that my pointer is right, right..? With "still works" I mean that I can see & adjust the value with Cheat Engine. It somehow just goes wrong somewhere when I try this in C#. _________________
Thank me + rep me if i help ya |
|
Back to top |
|
|
Hatschi Master Cheater Reputation: 2
Joined: 28 Jan 2010 Posts: 327
|
Posted: Tue Feb 18, 2014 4:57 am Post subject: |
|
|
This code isn't well written. Declare an array of byte with your pointer offsets and make a loop, check if you're at the last entry of the array if so, don't read instead just add the offset the current address. That's all. |
|
Back to top |
|
|
Darkwizzard70 How do I cheat? Reputation: 0
Joined: 18 Oct 2007 Posts: 2
|
Posted: Wed Feb 19, 2014 1:04 pm Post subject: |
|
|
Thanks, will try it out tonight. If I get it to work, I'll post the solution here. _________________
Thank me + rep me if i help ya |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|