Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[HELP]How to read value of Address in C++

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
vegito616
Expert Cheater
Reputation: 0

Joined: 08 Jan 2006
Posts: 109

PostPosted: Wed Dec 05, 2007 6:21 pm    Post subject: [HELP]How to read value of Address in C++ Reply with quote

How would I obtain the value of a certain address of a process like CE would?
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Dec 05, 2007 6:26 pm    Post subject: Reply with quote

ReadProcessMemory
Back to top
View user's profile Send private message
vegito616
Expert Cheater
Reputation: 0

Joined: 08 Jan 2006
Posts: 109

PostPosted: Thu Dec 06, 2007 2:05 pm    Post subject: Reply with quote

Could someone provide an example of how to read the value of 006F6D59 (random address) and retrieve an int value.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Dec 06, 2007 3:19 pm    Post subject: Reply with quote

Code:
#include <iostream>
#include <windows.h>
using namespace std;

DWORD pid;
HWND gameWindow;
HANDLE gameProcess;
DWORD dongs;

int main(void)
{
   gameWindow = FindWindow(NULL, TEXT("Minesweeper"));
   if (gameWindow == NULL){
      std::cout << "Oh god.\n";      
   }
   GetWindowThreadProcessId(gameWindow, &pid);
   gameProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);

   ReadProcessMemory (gameProcess, (void*)0x0100579C, &dongs, sizeof dongs, NULL);
   std::cout << dongs << "\nDone.\n";
   return 0;
}


bored. quick example, reads your time in minesweeper. modify as you see fit.
Back to top
View user's profile Send private message
rump
Expert Cheater
Reputation: 0

Joined: 03 Oct 2007
Posts: 169

PostPosted: Fri Dec 07, 2007 3:12 am    Post subject: Reply with quote

I assume the readprocess/writeprocess memory method works somewhat the same in C#?
_________________
C# boot camp, PM me if you want a simple application made and I'll give it a try!
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Dec 07, 2007 4:20 am    Post subject: Reply with quote

rump wrote:
I assume the readprocess/writeprocess memory method works somewhat the same in C#?


Heres a few examples of reading / writing to memory via C#:
http://www.codeproject.com/KB/trace/minememoryreader.aspx
http://www.codeproject.com/KB/trace/freecellreader.aspx
http://www.codeproject.com/KB/cs/sojaner_memory_scanner.aspx

The API will be setup the same, the method of using it might be a little different in each language such as importing it to be usable and so on. But the params and call are all static to the API and don't change unless the operating system changes them in an update.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
rump
Expert Cheater
Reputation: 0

Joined: 03 Oct 2007
Posts: 169

PostPosted: Fri Dec 07, 2007 9:47 am    Post subject: Reply with quote

Thanks alot Wiccan, "right on the spot" links Smile
_________________
C# boot camp, PM me if you want a simple application made and I'll give it a try!
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Fri Dec 07, 2007 10:32 am    Post subject: Reply with quote

pinvoke.net is your (read: lazy way out) friend when it comes to using API's in C#.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites