Solved

ReadProcessMemory

Posted on 2006-07-21
3
320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

726 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