views:

1095

answers:

5

im trying to learn to modify games in C++ not the game just the memory its using to get ammo whatnot so can someone point me to books

A: 

There are enough programs available that let you modify memory of running programs. And they are often used for cheating. But be carefull using those on online games, because most cheats will be detected and you are banned without a warning.

If you like to create them yourself, just look at books that describe the windows API. You will find enough information there.

Gamecat
Valve's Anti-Cheat used to use some heuristics of some kind to check if a mod could be used for cheating, but after a non-cheating mod resulted in bans, they now only use known cheats. So he'd possibly be safe if he wrote his own and kept it to himself.
Devin Jeanpierre
A: 

Not my area but maybe you should have a look over here

epatel
A: 

It can done using hooks on windows to access the memory space of a process.

HyperCas
+4  A: 

Injecting Code:

I think the best method is to modify the exe to inject code into one of the loaded modules. Check this tutorial

Short related story:

Over 10 years ago though, I do remember successfully modifying my score in solitaire in windows with a simple C++ program. I did this by starting an int * pointer at some base address and iterating through memory addresses (with a try /catch to catch exceptions).

I would look for what my current score was in one of those pointer variables, and replace it with a new integer value. I just made sure that my current score was some obscure value that wouldn't be contained in many memory addresses.

Once I found a set of memory addresses that matched my score, I would change my score manually in solitaire and only look through the memory addresses that were found in the last iteration. Usually this would narrow down to a single memory address that contained the score. At this point I had the magical simple line of code *pCode = MY_DESIRED_SCORE;

This may not be possible anymore though with new memory security models. But the method worked pretty good with a 10-20 line C++ program and it only took about a minute to modify my score.

Brian R. Bondy
+9  A: 

The most convenient way to manipulate a remote process' memory is to create a thread within the context of that program. This is usually accomplished by forcibly injecting a dll into the target process. Once you have code executing inside the target application you are free to use standard memory routines. e.g (memcpy, malloc, memset).

I can tell you right now that the most convenient and easy to implement method is the CreateRemoteThread / LoadLibrary trick.

As other people have mentioned, simple hacks can be performed by scanning memory for known values. But if you want to perform anything more advanced you will need to look into debugging and dead-list analysis. (Tools: ollydbg and IDA pro, respectively).

You have scratched the surface of a very expansive hacking topic, there is a wealth of knowledge out there..

First a few internet resources:

gamedeception.net - A community dedicated to game RE (Reverse Engineering) and hacking.

http://www.edgeofnowhere.cc/viewtopic.php?p=2483118 - An excellent tutorial on various DLL injection methods.

Openrce.org - Community for reverse code engineering.

I can also recommend a book to you - http://www.exploitingonlinegames.com/

Windows API Routines you should research (msdn.com):

CreateRemoteThread
LoadLibraryA
VirtualAllocEx
VirtualProtectEx
WriteProcessMemory
ReadProcessMemory
CreateToolhelp32Snapshot
Process32First
Process32Next
Victor Teissler