 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
ileandros Newbie cheater
Reputation: 0
Joined: 02 Oct 2012 Posts: 17
|
Posted: Tue Mar 01, 2016 11:03 am Post subject: Memory read issues when reading CE memory through C# |
|
|
This is my address found with CE: s24.postimg.org/fp76gd9f9/Untitled.png
(Can't post urls yet, copy paste the url of the image above)
So when I search for the base address with the module("client.dll"+02244E90) I get the same pointing address as CE.
Code: | IntPtr pointer = IntPtr.Add(nProcess.Modules[125].BaseAddress, BaseAddress);
var hp = ReadInt32(pointer, Handle); |
My only problem is that the returned address is missing 2 character in the beginning. It is something like prefix.
As you see in the picture above, CE pointing address of "client.dll"+02244E90 is 8024A7CB60.
When I do a memory read the pointing address is 24A7CB60. The two first characters, in this chase 80, are missing. They are reset every time the game is reset and they can be anything between digits and characters.
Any idea what's going on here?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25794 Location: The netherlands
|
Posted: Tue Mar 01, 2016 11:12 am Post subject: |
|
|
is hp supposed to hold the address of pointer? or just the value?
if address, int32 isn't big enough
also, make sure you compile to x64 exclusively
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
ileandros Newbie cheater
Reputation: 0
Joined: 02 Oct 2012 Posts: 17
|
Posted: Tue Mar 01, 2016 12:18 pm Post subject: |
|
|
Dark Byte wrote: | is hp supposed to hold the address of pointer? or just the value?
if address, int32 isn't big enough
also, make sure you compile to x64 exclusively |
Let me give you the full memory read sample
Code: | IntPtr pointer = IntPtr.Add(nProcess.Modules[125].BaseAddress, BaseAddress); //client.dll+0x02244E90
int hp = ReadInt32(pointer, Handle);
string hexPrefix = "80" + hp.ToString("X");
long hexToint = long.Parse(hexPrefix, NumberStyles.HexNumber);
hp = ReadInt32((IntPtr)hexToint + 0x00, Handle);
hexPrefix = "80" + hp.ToString("X");
hexToint = long.Parse(hexPrefix, NumberStyles.HexNumber);
hp = ReadInt32((IntPtr)hexToint + 0x1c0, Handle);
public static byte[] ReadBytes(IntPtr Handle, IntPtr Address, uint BytesToRead)
{
IntPtr bytesRead;
byte[] buffer = new byte[BytesToRead];
ReadProcessMemory(Handle, Address, buffer, BytesToRead, out bytesRead);
return buffer;
}
public static int ReadInt32(IntPtr Address, IntPtr Handle)
{
return BitConverter.ToInt32(ReadBytes(Handle, Address, 4), 0);
} |
So I am currently turning the hex to string, adding the prefix and the back to dec again to perform memory read.
hp final goal is to hold the value which is an integer.
|
|
Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Wed Mar 02, 2016 2:48 am Post subject: |
|
|
Your address size is too small.
Instead of Int32 try using Int64 (or better UInt64), otherwise it'll chop some digits off your target address ...
|
|
Back to top |
|
 |
ileandros Newbie cheater
Reputation: 0
Joined: 02 Oct 2012 Posts: 17
|
Posted: Fri Mar 04, 2016 4:48 am Post subject: |
|
|
hhhuut wrote: | Your address size is too small.
Instead of Int32 try using Int64 (or better UInt64), otherwise it'll chop some digits off your target address ... |
Thats what i dis but since my memory is a 4 bytes int, I have to convert the result into 32uint. But it's fine. Thanks
|
|
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
|
|