| View previous topic :: View next topic |
| Author |
Message |
kokkinogenis Advanced Cheater
Reputation: 0
Joined: 10 Sep 2015 Posts: 82 Location: Greece
|
Posted: Mon Sep 19, 2016 4:50 pm Post subject: Problem with reading multi-level pointer [C#] |
|
|
Hello ! I found this valid multi-level pointer on a game that i play:
http://prntscr.com/cjzlhf
I am trying to read the dynamic address with this following C# code:
| Code: | ProcessMemoryReader preader = new ProcessMemoryReader();
Process[] myprocess = Process.GetProcessesByName("plugin-container");
preader.ReadProcess = myprocess[0];
preader.OpenProcess();
int byteswritten;
int bytesread;
int value;
int pointerbase;
byte[] memory;
int PointerAddress = 0x007AFC74;
int[] OffsetList = { 0x4, 0x60, 0x58, 0x3c, 0x28 };
for (int i = 0; i < OffsetList.Length -1; i++)
{
memory = preader.ReadProcessMemory((IntPtr)PointerAddress, 4, out bytesread);
pointerbase = BitConverter.ToInt32(memory, 0);
pointerbase += OffsetList[i];
memory = preader.ReadProcessMemory((IntPtr)pointerbase, 4, out bytesread);
pointerbase = BitConverter.ToInt32(memory, 0);
PointerAddress = pointerbase;
} |
In order to check the result... i added a messagebox after the loop to check the value of PointerAddress variable. And the value.. was 0. I spent over 5 hours on this. What i am doing wrong ?? Thanks !
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25820 Location: The netherlands
|
Posted: Mon Sep 19, 2016 5:10 pm Post subject: |
|
|
you're not adding the address of reddot dll to 007afc74
_________________
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 |
|
 |
kokkinogenis Advanced Cheater
Reputation: 0
Joined: 10 Sep 2015 Posts: 82 Location: Greece
|
Posted: Tue Sep 20, 2016 7:08 am Post subject: |
|
|
I found a good article in msdn on how to find base address of a module on a process. This is my code now:
| Code: | ProcessMemoryReader preader = new ProcessMemoryReader();
Process[] myProcess = Process.GetProcessesByName("mygameProcess");
preader.ReadProcess = myProcess[0];
preader.OpenProcess();
IntPtr DllBaseAddress = (IntPtr)0;
Process mProc = myProcess[0];
IntPtr hProc = mProc.Handle;
ProcessModuleCollection myProcessModuleCollection = myProcess[0].Modules;
for (int i = 0; i < myProcessModuleCollection.Count; i++)
{
if(myProcessModuleCollection[i].FileName.Contains("frosty_player.dll")) // the module name
{
DllBaseAddress = myProcessModuleCollection[i].BaseAddress;
break;
}
}
int FrostyPlayerDll = DllBaseAddress.ToInt32();
int byteswritten;
int bytesread;
int value;
int pointerbase;
byte[] memory;
int PointerAddress = FrostyPlayerDll + 0x007AFC74;
int[] OffsetList = { 0x4, 0x60, 0x58, 0x3c, 0x28 };
for (int i = 0; i < OffsetList.Length -1; i++)
{
memory = preader.ReadProcessMemory((IntPtr)PointerAddress, 4, out bytesread);
pointerbase = BitConverter.ToInt32(memory, 0);
pointerbase += OffsetList[i];
// preader.WriteProcessMemory((IntPtr)pointerbase, memory, out byteswritten);
memory = preader.ReadProcessMemory((IntPtr)pointerbase, 4, out bytesread);
pointerbase = BitConverter.ToInt32(memory, 0);
PointerAddress = pointerbase;
}
MessageBox.Show(PointerAddress.ToString()); |
Also, i tried this:
| Code: |
ProcessMemoryReader preader = new ProcessMemoryReader();
Process[] myProcess = Process.GetProcessesByName("mygameProcess");
preader.ReadProcess = myProcess[0];
preader.OpenProcess();
IntPtr DllBaseAddress = (IntPtr)0;
Process mProc = myProcess[0];
IntPtr hProc = mProc.Handle;
ProcessModuleCollection myProcessModuleCollection = myProcess[0].Modules;
for (int i = 0; i < myProcessModuleCollection.Count; i++)
{
if(myProcessModuleCollection[i].FileName.Contains("frosty_player.dll"))
{
DllBaseAddress = myProcessModuleCollection[i].BaseAddress;
MessageBox.Show(myProcessModuleCollection[i].BaseAddress.ToString());
break;
}
}
int PlayerDll = DllBaseAddress.ToInt32();
int byteswritten;
int bytesread;
int value;
int pointerbase;
byte[] memory;
int PointerAddress = 0x007AFC74;
int[] OffsetList = { 0x4, 0x60, 0x58, 0x3c, 0x28 };
int temp;
for (int i = 0; i < OffsetList.Length -1; i++)
{
//memory = preader.ReadProcessMemory((IntPtr)PointerAddress, 4, out bytesread);
//pointerbase = BitConverter.ToInt32(memory, 0);
//pointerbase += OffsetList[i];
// preader.WriteProcessMemory((IntPtr)pointerbase, memory, out byteswritten);
temp = PlayerDll + PointerAddress + OffsetList[i];
memory = preader.ReadProcessMemory((IntPtr)temp, 4, out bytesread);
pointerbase = BitConverter.ToInt32(memory, 0);
PointerAddress = pointerbase;
}
MessageBox.Show(PointerAddress.ToString()); |
Both of these... return 0 as a result. I am out of ideas
|
|
| Back to top |
|
 |
kokkinogenis Advanced Cheater
Reputation: 0
Joined: 10 Sep 2015 Posts: 82 Location: Greece
|
Posted: Wed Sep 21, 2016 4:10 pm Post subject: |
|
|
No one can help ??
|
|
| Back to top |
|
 |
Ed1717 How do I cheat?
Reputation: 1
Joined: 20 Sep 2016 Posts: 2
|
Posted: Wed Sep 21, 2016 4:37 pm Post subject: General idea |
|
|
I have very little experience with C# and I do all of my programming for game exploits and such in C++. The general process is to 1.) Get the base address of a module, and a base offset that when added to the address of the module will yield another address 2.) The address from 1 will point to another address of which you add the next offset. 3.) Repeat 2 until last offset added and the address of the value you want is found.
Example C++:
#include <windows.h>
//Data type typedefs incase you aren't familiar with winapi types
typedef unsigned long DWORD;
typedef unsigned long* PDWORD; //DWORD for 32-bit addresses and offsets
typedef unsigned long long DWORD_PTR;
typedef unsigned long long* PDWORD_PTR; //DWORD_PTR for 64-bit addresses
void* GetHealth(void)
{
DWORD base_offset = 0x265A4C;
DWORD offset1 = 0xA4;
DWORD offset2 = 0x58C;
DWORD offset3 = 0x45;
//GetModuleHandle can be cast to void* to get the module address
DWORD_PTR base_module = (DWORD_PTR)((LPVOID)GetModuleHandle("module.dll"));
PDWORD_PTR pAddress1 = (PDWORD_PTR)(base_module+base_offset);
DWORD_PTR dwValue1 = *pAddress1;
PDWORD_PTR pAddress2 = (PDWORD_PTR)(dwValue1+offset1);
DWORD_PTR dwValue2 = *pAddress2;
PDWORD_PTR pAddress3 = (PDWORD_PTR)(dwValue2+offset2);
DWORD_PTR dwValue3 = *pAddress3;
void* pHealth = (void*)(dwValue3+offset3);
return pHealth;
}
Please forgive any format problems in my typing. Doing this on my iPad.
|
|
| Back to top |
|
 |
kokkinogenis Advanced Cheater
Reputation: 0
Joined: 10 Sep 2015 Posts: 82 Location: Greece
|
Posted: Thu Sep 22, 2016 6:21 pm Post subject: |
|
|
| Ed1717 thank you very much for your reply. Unfortunetely i can understand very little from your code. I cannot uderstand for example what PWDWORD_PTR is(google doesn't seem to find it) and also * thing before the address. But... i can understand the logic of your program and what you do... and the thing is that i am getting always random addresses or zeros.
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4711
|
Posted: Thu Sep 22, 2016 8:00 pm Post subject: |
|
|
That method is applicable if you've injected a dll into the process and you're working from within the process's virtual address space.
The question of "how to find the base address of a module" is a very frequently asked question in gamehacking. Given the vast amount of information already available, I'm not surprised you're not getting any help.
After spending 10 seconds to google the phrase "C# get module base address", I found this that should help. If you still can't get it to work, you should be capable of debugging your program and finding out exactly where it fails.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
kokkinogenis Advanced Cheater
Reputation: 0
Joined: 10 Sep 2015 Posts: 82 Location: Greece
|
Posted: Fri Sep 23, 2016 6:05 am Post subject: |
|
|
| ParkourPenguin wrote: | That method is applicable if you've injected a dll into the process and you're working from within the process's virtual address space.
The question of "how to find the base address of a module" is a very frequently asked question in gamehacking. Given the vast amount of information already available, I'm not surprised you're not getting any help.
After spending 10 seconds to google the phrase "C# get module base address", I found this that should help. If you still can't get it to work, you should be capable of debugging your program and finding out exactly where it fails. |
I found how to get the base address after some time... with this code:
| Quote: | Process[] foundProcesses = Process.GetProcessesByName("gameProcess");
ProcessModuleCollection modules = foundProcesses[0].Modules;
ProcessModule DllBaseAddress = null;
foreach (ProcessModule i in modules)
{
if (i.ModuleName == "game_module.dll")
{
DllBaseAddress = i;
}
}
IntPtr WebPlayerDll = DllBaseAddress.BaseAddress; |
The thing is that when i am trying to read the DllBaseAddress + PointerAddress i don't get the same output like the cheat engine. For example, i try with this line of code to Read the address of the DllBaseAddress + Pointer address with this line of code:
| Quote: | | ReadWritingMemory.ReadInteger("gameProcess", (int)GameDllBaseAddress + PointerAddress); |
and the output is this:
http://prntscr.com/cldz2x
EDIT:
Is there a way to get the dynamic address of my ammo(this is what i am looking to "change" through my trainer) through AOB like cheat engine cheats somehow ? I cannot find a way out with pointers.
EDIT2:
I found the solution here: http://www.mpgh.net/forum/showthread.php?t=466630 Thank you all for your help !
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4711
|
Posted: Fri Sep 23, 2016 8:31 am Post subject: |
|
|
I would like to point out the number you were getting is the exact same number CE was getting. Your output was in base 10, CE's output was in base 16. 122,503,496 == 0x74D4148
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
kokkinogenis Advanced Cheater
Reputation: 0
Joined: 10 Sep 2015 Posts: 82 Location: Greece
|
Posted: Fri Sep 23, 2016 1:09 pm Post subject: |
|
|
OMG you are right. I tested it. I am so dump. Thank you very much
|
|
| Back to top |
|
 |
|