Solved

ReadProcessMemory

Posted on 2006-07-21
3
309 Views
Last Modified: 2008-02-01
I would like to read a processes memory.  Now, I know I should use ReadProcessMemory, but I really don't know where
to beyond this.  For example, say we want to take a look at MineSweeper.  How would I go about first finding how many
bombs there are in the game?  Not where, just how many, a basic game has 10.  I assume this would take a lot of monitoring,
but I don't know how to start with that.

Then, lets say I found the address I want, how do I go about creating another program which ONLY searches this value.  So
that I can have a program which attaches to MineSweeper for the sole purpose of saying, this game has 10 bombs, 11 bombs,
or however many?
0
Comment
Question by:List244
  • 2
3 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 17155067
You'd have to reverse-engineer winmine.exe - coincidentially, that was an issue on EE a could of years ago, see NickRepin's page at http://skyscraper.fortunecity.com/gigo/311/winprog.html#minesweep and the code (which also uses 'ReadProcessMemory()') at http://skyscraper.fortunecity.com/gigo/311/winprog/wmplay.zip
0
 
LVL 8

Author Comment

by:List244
ID: 17155191
Alright, so what if I already have the address, then how would I go about grabbing that value from its memory?
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 17155349
You need the full linear address as in the code sample, e.g.

const LPDWORD pWidth=LPDWORD(0x28B51B0);     // Field width (cells)
const LPDWORD pHeight=LPDWORD(0x28B51B4);    // Field height (cells)

   // Obtain current size of field
   ReadProcessMemory(hProcess,pWidth,szField,izeof(szField),0);

See also

http://www.codeproject.com/threads/int64_memsteal.asp ("Stealing Program's Memory")
http://www.codeproject.com/threads/MDumpAll.asp ("Performing a hex dump of another process's memory")
http://www.codeproject.com/threads/CmdLine.asp ("Navigating the PEB")
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now