tags:

views:

97

answers:

3

I have used trainers in the past to gain things like extra lives in games, it is my understanding that trainers work by hacking or freezing the memory address that the game uses to track such things.

My questions are:

  1. Could memory hacks be used to manipulate controls in a program (i.e. play, pause, next song for a media app)?
  2. And are the addresses consistent? Could they be used on any computer with the same OS?

Thank you for any help! :)

+1  A: 

Keep in mind that the memory addresses in question can change after any update/patch. Many online games will force new versions on you when available, so keeping such memory hacks up-to-date requires a commitment.

Eric J.
Not to mention that, for online/multiplayer games, such hacks are quite unethical.
JAB
Yeah I play FFXI and they have banned quite a few accounts for making this type of mod.
Eric J.
A: 

For media apps, you are often better off with apis that search for the windows/buttons/controls you are out for by enumerating the childwindows in the app until you find the button you want. When you have the handle to the control, you literally have the power.

Many media apps (winamp for example) listen to windows message-events so you can control them just by sending a well formatted sendmessage/postmessage to the application. But even if the application does not, you can just find the handle to the button and post a click-event to the button or something like that.

Not that this answer was an answer to the memory-question, but I have built many apps that controlled other media apps so thats my angle of the "control a media app"-part of the question.

Stefan
Thanks for the comment anyway, as this would be a great alternative for the goal I had in mind... essentially to create a program for controlling other programs.
Timu-chan
In that case, you should look up the API SendMessage, PostMessage, Findwindow, FindWindowEx, EnumWindows and EnumChildWindows. Microsoft has recently published a API-codepack that may help you get started if you are an .Net-developer: http://code.msdn.microsoft.com/WindowsAPICodePack/Wiki/View.aspx
Stefan
A: 

In general, memory addresses will be consistent from run-to-run on the same computer, and also from one computer to the next, assuming all OS and library versions are identical. Any changes to the program will potentially alter the addresses of variables.

Things get trickier when the program uses dynamic libraries. Normally, preferred library load addresses are set up such that no two libraries want to load at the same address. When a new version of a library comes out, it may no longer fit, causing other libraries to get shuffled around in memory. So, even an update to a system component can change where some library is loaded.

Many Operating Systems are now providing address space randomization, which changes the layout of the memory map in unpredictable ways, specifically to make this sort of trickery harder.

Mark Bessey