 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
AnonTakesOver How do I cheat?
Reputation: 0
Joined: 12 May 2014 Posts: 2
|
Posted: Mon May 12, 2014 8:00 am Post subject: I cannot read the value of a pointer in C# |
|
|
Okay, I have searched this forum, and allot of people post this.. but allot of the answers are specific to their problem. So it's hard for me to mix it up for my goal. I am learning how to use memory etc in C#, I am able to write memory to the game I am hacking, I just need to read the value of a static pointer, I can't really post my code, because well, I don't have any to show, but I am using this I got off a tutorial, I used it to write memory which works:
pastebin*.*com/ZeQ3mqPv
Any help will be gratefully appreciated, I have searched for a few hours now, tried many ways, some ways didn't work, so ways returned a value, which didn't even exist because I would search cheat engine the value it returned and I would get no results.
|
|
| Back to top |
|
 |
zm0d Master Cheater
Reputation: 7
Joined: 06 Nov 2013 Posts: 423
|
|
| Back to top |
|
 |
ProjectEz Newbie cheater
Reputation: 0
Joined: 03 Dec 2011 Posts: 18 Location: Phlippines
|
Posted: Mon May 12, 2014 9:43 am Post subject: |
|
|
hello, i am also creating a trainer for a game, and its just 2 weeks since i started studying memory scanning, luckily using C# too...
just to make it clear, you want to read memory from a pointer?
the once with base address and offsets, right?
or you just want to read memory from an address?
coz i got the code for reading values from addresses
edit * here it is, this is in float, so if you want int, just change those floats to int
| Code: |
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] float[] lpBuffer, int dwSize, out int lpNumberOfBytesRead);
public static float[] ReadMemory(Process process, int address, int numOfBytes, out int bytesRead)
{
IntPtr hProc = OpenProcess(ProcessAccessFlags.All, false, process.Id);
float[] buffer = new float[numOfBytes];
ReadProcessMemory(hProc, new IntPtr(address), buffer, numOfBytes, out bytesRead);
return buffer;
}
public static float ReadValue(string baseAdd, int ProcID)
{
//here you call the process ID, you can change by processName
Process mProc = Process.GetProcessById(ProcID);
int address = Convert.ToInt32(baseAdd, 16);
int bytesRead;
float[] value = ReadMemory(mProc, address, 4, out bytesRead);
return value[0];
}
|
so here is how you call the process
| Code: |
txtAddressVal.Text = ReadValue(Address,processID).ToString();
|
hope this helps
|
|
| Back to top |
|
 |
AnonTakesOver How do I cheat?
Reputation: 0
Joined: 12 May 2014 Posts: 2
|
Posted: Mon May 12, 2014 5:06 pm Post subject: |
|
|
Hey, it works! I love you! But.... it's in float form, so it's like 1.25473E-43
That's an example, it's pretty much that.
How do I convert this to it's original form, as a string.
|
|
| Back to top |
|
 |
ProjectEz Newbie cheater
Reputation: 0
Joined: 03 Dec 2011 Posts: 18 Location: Phlippines
|
Posted: Tue May 13, 2014 8:13 am Post subject: |
|
|
i dont know how to make it string, but I remember doing it in bytes first, i would be glad if we can discuss about these, for I am doing and studying same topics,
please add me fb(dot)com/kai.ecollidex
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Wed May 14, 2014 3:48 am Post subject: |
|
|
Why are you reading it as a float array?
use that prototype
| Code: |
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, out byte[] lpBuffer, int dwSize, out int lpNumberOfBytesRead);
|
when you get the result, use BitConvert.ToInt32 with the byte array
then use it however you want
_________________
Stylo |
|
| 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
|
|