Post: [C++] Make a Game Trainer (Memory Editor , Game Hack)
12-08-2013, 12:48 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Hey everyone today I will be teaching you on how to make a Game trainer with C++ (Console app)...

So let´s start...

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 Smile

    if (Option > 1)
{
cout << "There is no option higher than 1..." << endl;
system("Pause");
}
if (Option == 1)
{
...
}


Ok Smile
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 Smile ...

You have just made a memory editor!!!

Final source : You must login or register to view this content.


Video version :



*Yes this was copied from my blog and "adapted" to NGU

Original (Blog) Version : You must login or register to view this content.
Last edited by MW2TopTenWORLD ; 12-14-2013 at 02:50 PM.

The following 2 users say thank you to MW2TopTenWORLD for this useful post:

milky4444, QuantumDev
01-06-2014, 08:27 PM #11
Complete Speed
Do a barrel roll!
Originally posted by TheUnexpected View Post
DevC++ is outdated and is shit. I don't like Visual Studio lol. I use MinGW haha, all command line Happy


Actually devc++ use mingw to compile.
01-06-2014, 10:01 PM #12
Originally posted by Complete
Actually devc++ use mingw to compile.


Real C++ developers don't use it at all. Most use Code::Blocks, MinGW, or VS.
01-06-2014, 10:19 PM #13
Complete Speed
Do a barrel roll!
Originally posted by TheUnexpected View Post
Real C++ developers don't use it at all. Most use Code::Blocks, MinGW, or VS.


Okay? I was just stating the fact that Devc++ and Code::Blocks both use MinGW to compile on windows. MinGW is just gnu gcc for windows.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo