| View previous topic :: View next topic |
| Author |
Message |
TomsonTom How do I cheat?
Reputation: 0
Joined: 28 Sep 2010 Posts: 2 Location: JBC, Czech Republic
|
Posted: Tue Sep 28, 2010 1:09 pm Post subject: [C#] Wrong address returned by ProcessModule.BaseAddress |
|
|
Hello,
I'm trying to read and write process memory, but I've got 64bit Windows 7. I need to know the base address to edit the pointers, however in Windows 7 base addresses always changes (in most applications) and so I cannot rely on 0x400000.
The thing is: How to get the base address of a process?
(For example I want to get a final address of LFS.exe+0x054D32C, but I need to know the base address of LFS.exe process.)
I used this:
| Code: | ProcessModule myProcessModule;
ProcessModuleCollection myProcessModuleCollection = hProcess.Modules;
myProcessModule = hProcess.MainModule;
int text_addr1 = 0x054D32C;
int text_addr2 = (int)myProcessModule.BaseAddress;
IntPtr text_addr = (IntPtr)(text_addr1 + text_addr2); |
Where hProcess is the game process.
It should work, however myProcessModule.BaseAddress always returns 0x400000, although it isn't correct! The Cheat Engine somehow can get the real base address, because it works. But C# always returns the same base address, which (unfortunately) always changes on Windows 7.
Can anyone help me?
Thanks! |
|
| Back to top |
|
 |
justa_dude Grandmaster Cheater
Reputation: 23
Joined: 29 Jun 2010 Posts: 893
|
Posted: Tue Sep 28, 2010 3:53 pm Post subject: |
|
|
I'm not a C# coder, but I think you need to show us how you're setting up hProcess. Try looking at the other members in myProcessModule - i.e., FileName - you might not even be looking at the correct module.
Cheers,
adude |
|
| Back to top |
|
 |
TomsonTom How do I cheat?
Reputation: 0
Joined: 28 Sep 2010 Posts: 2 Location: JBC, Czech Republic
|
Posted: Tue Sep 28, 2010 4:36 pm Post subject: |
|
|
The fact is that the address it returns is correct. My bad.
You can lock this thread. |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue Sep 28, 2010 7:48 pm Post subject: |
|
|
Locked per-request. _________________
- Retired. |
|
| Back to top |
|
 |
|