Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Using the memory functions! PLEASE HELP!

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Using the memory functions! PLEASE HELP!
#3740
Posted by: IceCreamFlavor 2004-04-05 12:18:11
Ok, Ive been workin on this problem for the past week, and have put a lot of time into it:

I plan on making a trainer (a program that edits in-game variables) for the game "Diablo II." Those veriables are, as far as I know, stored on the RAM (which would make sence), so I need to be able to view\edit data stored on the RAM.
My first attempt at solving this problem led me to using MS Windows functions (tlhelp32), but that just got me really, really confussed.

Is there ANYONE that can help me solve this problem, or KNOW a solution to it?

ANY HELP IS APPRECIATED!  Thank you.

P.S. This is BlakkSyn, I changed my s\n
______________________
   /              \
    IceCreamFlavor
   \______________/
______________________

I'll schoot the ground, make you scared!

I will chop your nuts off!
Message2. Re: Using the memory functions! PLEASE HELP!
#3752
Posted by: upCASE 2004-04-06 02:43:15
Hi!
Check the win32 API for
OpenProcess()
CreateProcess()
ReadProcessMemory()
WriteProcessMemory()

You should be able to accomplish what you want with these functions.
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: Using the memory functions! PLEASE HELP!
#3757
Posted by: IceCreamFlavor 2004-04-07 08:20:53
Thank you very much for your help upCASE; however, Im still VERY confussed!

I researched the OpenProcess(), ReadProcessMemory(), etc for several hours looking for examples that would compile on Dev-C++, but to no avail.

I have read the decription and usage of every single Toolhelp function, so to gain a basic understanding of it so I could write a simple application, but the "tlhelp32.h" header file included with Dev-C++ has problems with "Process32Next" "Thread32Next" and the other 'next' and 'previous' functions.

So my request from anyone that is willing, is for someone to write a small application using the ReadProcessMemory() and OpenProcess() functions.

THANK YOU VERY MUCH!
______________________
   /              \
    IceCreamFlavor
   \______________/
______________________

I'll schoot the ground, make you scared!

I will chop your nuts off!
Message4. Re: Using the memory functions! PLEASE HELP!
#3761
Posted by: upCASE 2004-04-07 16:11:21
Hi!
Well, since you got me interested in this topic I spend some time playing with the toolhelp functions and reviewed the "normal" ReadProcessMemory() and WriteProcessMemory().
First of all I'm not sure where you looked, but I found a nice example for the toolhelp stuff at MSDN. Everything compiles fine here ( gcc 3.3.1 (mingw special 20030804-1)), except that you'll have to link libth32.a in in order to get Toolhelp32ReadProcessMemory() to work.
I guess one doesn't have to use Toolhelp32ReadProcessMemory(), because you'll want to patch memory later on, it would be better to use OpenProcess() on one of the running processes (get the list with the toolhelp functions) and use ReadProcessMemory and WriteProcessMemory(). Although Toolhelp32ReadProcessMemory() isn't bad to get a quick dump of the memory.
I hacked up a small app that displays a list of all running processes and dumps the memory into a text control. I'll do a little more work on that and if you're interested, I'll explain it here.
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message5. Re: Using the memory functions! PLEASE HELP!
#3762
Posted by: IceCreamFlavor 2004-04-07 23:33:00
Thank you!

You have helped me tremendously!  It turns out that the problem with compilation was due to me not linking libth32.a.

And if your willing to show me your app, Id appreciate that very much!

You are the master upCASE!
______________________
   /              \
    IceCreamFlavor
   \______________/
______________________

I'll schoot the ground, make you scared!

I will chop your nuts off!
Message6. Re: Using the memory functions! PLEASE HELP!
#3779
Posted by: IceCreamFlavor 2004-04-09 10:46:04
One more thing, I was trying to read the memory into a buffer, but it doesnt work at all, here's my code:
char DaBuffer[100];

if (!Toolhelp32ReadProcessMemory(me.th32ProcessID,
    me.modBaseAddr,
    DaBuffer,
    me.modBaseSize,
    NULL))
{
    cout << "\n\nIt failed!  What the?!?\n\n";
    system("PAUSE");
    return 0;
}
It never succeds, what the?!?
______________________
   /              \
    IceCreamFlavor
   \______________/
______________________

I'll schoot the ground, make you scared!

I will chop your nuts off!
Message7. Re: Using the memory functions! PLEASE HELP!
#3796
Posted by: 2004-04-10 21:04:06
Hi!
Well, maybe a buffer of 100 char is a bit small.
Try:

char DaBuffer[me.modBaseSize];
if (!Toolhelp32ReadProcessMemory(me.th32ProcessID,
    me.modBaseAddr,
    DaBuffer,
    me.modBaseSize,
    NULL))
{
    cout << "\n\nIt failed!  What the?!?\n\n";
    system("PAUSE");
    return 0;
}

The buffer will have to be at least as big as the size you specified to be read by Toolhelp32ReadProcessMemory().

upCASE
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2021-9-21  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0