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 


writing .dll files in C++
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Sat Aug 18, 2007 12:29 pm    Post subject: Reply with quote

oib, explain what you are trying to do.

All the information you should need is:
A) the info on the MSDN page.
B) basic C syntax knowledge.

Do you want to read memory of the process you are injecting the DLL into? If that is what you want to do, you do not need ReadProcessMemory.

As for the "loop" comment:
Do you want to read a big piece of memory? ReadProcessMemory reads a specified number of bytes (4th argument).
Do you want to read a bunch of different (non-adjacent) pieces of memory? Then you can do them all in a row or use a loop with a bunch of arrays storing the arguments. Either way, it is entirely non-specific to ReadProcessMemory. Just to be nice though, here is an example:
Code:

HANDLE hProcess = OpenProcess(...);
void* lpBaseAddress[] = 0x004000,0x004010,0x004020;
int nSize[] = 5,6,7;
void* lpBuffer[] = malloc(nSize[0]),malloc(nSize[1]),malloc(nSize[2]);
for(int i = 0; i<2; i++)
{
  ReadProcessMemory(
    hProcess,
    lpBaseAddress[i],
    lpBuffer[i],
    nSize[i],
    NULL
);

}


This should read 3 pieces of memory located at 0x004000, 0x004010, and 0x004020 respectively, with sizes 5, 6, and 7 bytes.
To access them, dereference the pointer to where they are stored like so: ((char*)lpBuffer[1]+i)*, where i is which byte to read.

~nog_lorp

_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
kittonkicker
I post too much
Reputation: 1

Joined: 19 Apr 2006
Posts: 2171

PostPosted: Sat Aug 18, 2007 1:41 pm    Post subject: Reply with quote

You want to learn JUST how to use ReadProcessMemory?

I think you should learn a programming language first (which isn't VB), and then learn about standard calling conventions.
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
Goto page Previous  1, 2
Page 2 of 2

 
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