Solved

ReadProcessMemory

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Prototype for MessageDlg in Embacadero XE 2 2 42
TCP/IP Socket - connection close results in data lost 14 140
c++ syntax question 9 52
Problem with SqlConnection 4 177
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

790 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