Solved

ReadProcessMemory

Posted on 2006-07-21
3
311 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

947 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

20 Experts available now in Live!

Get 1:1 Help Now