[Solved] how to control one program from other


Well, your starting sentence was:
“I have seen trainers for games which can set health of player and spawn cars etc. I want to make something similar to that.”

Here’s a very nice reference code that does what you talked about in C++
http://www.codeproject.com/Articles/7468/Game-Wizard

First strengthen your C++ skills and then study what he does there.

A general description would be that the “victim” process memory is search for a certain value.
Usually something that represents a value that you are aware of – for example, number of bullets of your character.
Usually a big list of location in memory is found at first.
But then, you shoot a bullet, and now the list that you previously found (and only it!) is searched for the new value.
Each step discards the “false positive” finds, until in the end you know the location of the variable that you searched for.
After doing this you are able to change it as well.

Now, going to the general topic – this technique is only a specific approach, and while very helpful in some cases, many times you need stronger and different tools.

Here’s a very similar question: How can I find the data structure that represents mine layout of Minesweeper in memory?

I personally find IDA to be an amazing tool for reverse engineering and analyzing an application (both statically and dynamically).
In combination with “idapython” (ida binding for python) it feels unstoppable 🙂

Reverse engineering requires that you have at least basic knowledge of your target machine architecture – for example, x86 instructions.

Search for IDA tutorials to get the hang of it.
There are many “crackme’s” floating around, those are challenges to crack (for educational purposes) varying types of application protections.
It will teach you a lot.

You can also search google for “reverse engineering for beginners”.
The web has tons of resources on this topic. The amount of information can be intimidating at first, so make sure you find a basic site that helps you to build your skills gradually.

Another important term that you should know is “hooking”. While making it yourself will teach you the most, there are libraries that perform this operation for you.
The idea is to gain control over a certain function.
Whenever anyone calls that function, the control is first passed to your code, and you can decide what to do.
For example, you can decide to simply log this call to a file and call the original function,
or you can do more complicated things.

I found http://tuts4you.com/ to contain many useful tutorials and snippets of information.

Oh, and as people said, Java is not your friend in this case.
C/C++/Assembly probably are.

Starting a completely new topic, especially reverse engineering is tricky in the beginning, but I can assure you it’s very rewarding.

Edit:
I have a surprise for you:
http://www.uninformed.org/?v=1&a=7

I simply googled reverse engineering tutorial mine sweeper 😉

Good luck 🙂

1

solved how to control one program from other