Hello everyone!
Today I will be teaching you on how to make a game hack in C++!!
We will be making one for Steam MW2...
First add some includes...
#include <iostream>
#include <windows.h>
Now just add the usual namespace :P
using namespace std;
Now add your main function
int main()
{
}
Alright now let´s make a cout...
cout << "Make sure Modern Warfare 2 is Opened before opening the tool! << endl;
system("Pause");
Now let´s create a FindWindow function (WINDOW NAME NOT PROCESS NAME!!)!
LPCWSTR Fuck = L"Modern Warfare 2";
HWND hwnd = FindWindow(0, Fuck);
Now we need to create some basic if code to determinate if the Window is opened or not...
if (hwnd == 0)
{
cout << "The game has not been found... please open it before opening the tool next time..." << endl;
system("Pause");
}
else
{
cout << "Modern Warfare 2 has been found... Enjoy the tool!" << endl;
}
Great!
Now you need to add a DWORD , a Function that gets the process ID and writes it to the DWORD and a
Handle function...
DWORD process_ID;
GetWindowThreadProcessId(hwnd, &process_ID);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, process_ID);
Now populate it with options!
I will just be doing XP here...
cout << "Type 1 for XP" << endl;
cout << "Type : ";
int Option;
cin >> Option;
Now let´s make the options if code and the actual write memory code :)
if (Option > 1)
{
cout << "There is no option higher than 1..." << endl;
system("Pause");
}
if (Option == 1)
{
...
}
Ok :)
Now let´s make a cout that ask us how much XP do we want to write..
cout << "What do you want to set your XP as?" << endl;
cout << "Type : ";
int XP;
cin >> XP;
Alright now you need to convert the XP to a byte....
by doing this :
DWORD newdatasize = sizeof(XP);
Now finally we are going to write process memory!!
if (WriteProcessMemory(hProcess, (LPVOID)0x01B2C89C, &XP, newdatasize, NULL))
{
cout << "The XP has been written sucessfully!!" << endl;
system("Pause");
}
else
{
cout << "There was an error writing the XP..." << endl;
system("Pause");
}
Basicly we are doing if code so we dont get a nasty error when something goes wrong..
Also il explain the WriteProcessMemory syntax... :
WriteProcessMemory(ToThisProcessID, (LPVOID)ToThisOffset, &XP , WithTheseBytes, NULL))...
Now just add the "looping" main(); and a return 0; code :) ...
You have just made a memory editor!!!
Final source :
http://pastebin.com/EU6yrXpe
Video version :
http://www.youtube.com/watch?v=Rq89e07N74g