| View previous topic :: View next topic |
| Author |
Message |
yoyonerd Grandmaster Cheater
Reputation: 0
Joined: 26 Apr 2008 Posts: 699 Location: -->formerly yoyonerd<--
|
Posted: Thu Jul 09, 2009 2:24 pm Post subject: [C#]Read Pointers |
|
|
Base Address: 0a200e68
Offset: 30
I can't figure out how to read it =/
Any way I try even if it compiles it doesn't return the correct value.
_________________
|
|
| Back to top |
|
 |
mStorm Expert Cheater
Reputation: 0
Joined: 21 Feb 2009 Posts: 107
|
Posted: Thu Jul 09, 2009 2:32 pm Post subject: |
|
|
Not exact code but you'll get the idea:
intptr base;
intptr addy;
ReadProcessMemory (0x0a200e68, &base, 4)
ReadProcessMemory(base+0x30, &addy, 4)
|
|
| Back to top |
|
 |
yoyonerd Grandmaster Cheater
Reputation: 0
Joined: 26 Apr 2008 Posts: 699 Location: -->formerly yoyonerd<--
|
Posted: Thu Jul 09, 2009 2:57 pm Post subject: |
|
|
Erm, I understand what you are trying to say but perhaps a slightly more complete snippet would give me a better concept of the idea.
_________________
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Thu Jul 09, 2009 3:11 pm Post subject: |
|
|
| Code: |
IntPtr Base = 0x0A200E68, Offset = 0x30;
int BaseValue,OffsetValue,dwReadBytes;
ReadProcessMemory(Process.Handle,Base,out BaseValue,4,out dwReadBytes);
ReadProcessMemory(Process.Handle,BaseValue + Offset,out OffsetValue,4, out dwBytesRead);
|
i'm pretty sure in C# it goes like that
|
|
| Back to top |
|
 |
yoyonerd Grandmaster Cheater
Reputation: 0
Joined: 26 Apr 2008 Posts: 699 Location: -->formerly yoyonerd<--
|
Posted: Thu Jul 09, 2009 3:45 pm Post subject: |
|
|
Can I see the signature you use to import?
I seem to have a different one.
_________________
|
|
| Back to top |
|
 |
hehewaffles How do I cheat?
Reputation: 0
Joined: 23 Apr 2009 Posts: 5
|
Posted: Thu Jul 09, 2009 4:47 pm Post subject: |
|
|
| Code: |
//using System.Runtime.InteropServices;
[DllImport("kernel32.dll", SetLastError = true)]
internal static bool ReadProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
ref byte[] lpBuffer,
uint nSize,
ount uint lpNumberOfBytesRead
);
public int ReadValue(IntPtr hProcess)
{
byte[] val = new byte[4]; uint BytesRead;
if (!ReadProcessMemory(hProcess, 0x0A200E68, ref val, 4, out BytesRead) || BytesRead != 4)
throw new Exception("Unable to read process! Error code: " + Marshal.GetLastWin32Error());
if (!ReadProcessMemory(hProcess, BitConverter.ToInt32(val, 0) + 0x30, ref val, 4, out BytesRead) || BytesRead != 4)
throw new Exception("Unable to read process! Error code: " + Marshal.GetLastWin32Error());
return BitConverter.ToInt32(val, 0);
}
|
|
|
| Back to top |
|
 |
yoyonerd Grandmaster Cheater
Reputation: 0
Joined: 26 Apr 2008 Posts: 699 Location: -->formerly yoyonerd<--
|
Posted: Thu Jul 09, 2009 11:06 pm Post subject: |
|
|
anybody know what error code 6 is?
_________________
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Thu Jul 09, 2009 11:28 pm Post subject: |
|
|
i believe it's an invalid handle using
could you post your whole code here?
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Fri Jul 10, 2009 7:45 am Post subject: |
|
|
you probably opened your process with PROCESS_ALL_ACCESS flag
you should use PROCESS_VM_READ flag
|
|
| Back to top |
|
 |
yoyonerd Grandmaster Cheater
Reputation: 0
Joined: 26 Apr 2008 Posts: 699 Location: -->formerly yoyonerd<--
|
Posted: Fri Jul 10, 2009 1:57 pm Post subject: |
|
|
| 1qaz wrote: | you probably opened your process with PROCESS_ALL_ACCESS flag
you should use PROCESS_VM_READ flag |
| Code: | private void Form1_Load(object sender, EventArgs e)
{
WindowHandle = FindWindow("WindowClass", null); // Establish a Window Handle (hWnd)
GetWindowThreadProcessId(WindowHandle, out ProcID); // Get the Process ID (PID) from the targeted window/window class
ProcessHandle = OpenProcess(0x1F0FFF, 1, ProcID); // Gain access to the process memory with OpenProcess() using Process ID as an entry
this.Text = ReadValue(ProcessHandle).ToString();
} |
i think you are right, err i was just testing code thats why i make it set form title
_________________
|
|
| Back to top |
|
 |
|