 |
C++ Trainer Creation (im a bad Teacher?)
| C / C++ Discuss, C++ Trainer Creation (im a bad Teacher?) at Programmers Lounge forum; ------------------------------ Basic C++ Trainer Tutorial -----------------
this is a tutorial on how to create a game memory modifier (trainer in ... |
| Notices | Welcome to the Gamerz Needs forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |  | | 
11-24-2007, 02:15 AM
| | Metal Axe | | | Last Online: 08-20-2008 02:17 PM Join Date: Aug 2006
Posts: 64
Thanks: 44
Thanked 14 Times in 9 Posts
Nominated 0 Times in 0 Posts TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 5 Points: 1,381.08 Bank: 0.00 Total Points: 1,381.08 | | C++ Trainer Creation (im a bad Teacher?)
------------------------------ Basic C++ Trainer Tutorial -----------------
this is a tutorial on how to create a game memory modifier (trainer in c++)
1. ima write the hole program ( its small)
2. the program-------------
#include <iostream.h>
#include <windows.h>
// now the func
void MemWrite()
{
int MemVar1 = 90000 ;// the value you want address to have .. for me 90000
LONG MemAddress1 = 0xA123123 ;// The address you want to manipulate
// MemAddress1 is what your going to use later
// ----------------- now getting the window -------(you gotta do this)---
HWND hwnd; // handle window (probly)
HANDLE phandle;// also used for window handle and later processID
DWORD pid; // proces i d = pid
hwnd = FindWindow(NULL,"3d pinball for windows - space cadet"); // gets the window
// Grabs the windows handle bars :P
if (hwnd != 0) // if this is true you grasped the windows handle bars
{
cout << " You caught the window!"<<endl; // just a message reasuring you
// now for confusing shiz
GetWindowThreadProcessId(hwnd,&pid); //gets the process id of the window you // grabbed and points it to pid (This is my way of thinking :S)
phandle = OpenProcess(PROCESS_ALL_ACCESS,0,pid);// makes the process
// you grabbed unprotected! (all access) pid is the process you opended
} else
{
cout<<"open the freakin game..."<<endl;
Sleep(1000);
}
if (phandle != 0) // okay if this is true you have suc***ully grabbed the
{ // window and extracted it proccess (Figures of speech)
// now you can manipulate the process
WriteProcessMemory(phandle,(LPVOID)MemAddress1,(LP VOID)&MemVar1,4,0);
// whew you just hacked the game !!!! ( Exploited windows debbuger?) xD
cout << " You Manipulated the Process Memory!!!"<<endl;
}
else // else/if statements dont read the rest if you dont know how to //program the basics ...
{
cout << " Loser..."<<endl; // no nice trys here 
}
}
void main()
{
MemWrite();
}
This should compile successfully!
== I wrote this myself after Analyzing a less informitive tutorial than mine
== credits to me!
== (edited out bugs it compiles now)
Last edited by blagg; 11-24-2007 at 10:33 AM..
| | The Following 4 Users Say Thank You to blagg For This Useful Post: | | 
12-03-2007, 10:49 AM
|  | Stone Axe | | | Last Online: 10-07-2008 07:49 AM Join Date: Nov 2007 Age: 16
Posts: 35
Thanks: 8
Thanked 1 Time in 1 Post
Nominated 0 Times in 0 Posts TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0 Points: 506.70 Bank: 88.58 Total Points: 595.28 | |
GJ, you really did your best 
Here's another aprouch of memory writing, because with some compilers your code gives an error. My trainer example is a minesweeper instant win trainer. You see, minesweeper is a simple game. These are the adresses used in this program:
tiles(pressed) = 0x10057A4
bombs = 0x1005194
height = 0x10056A8
base = 0x10056AC
Minesweeper example:
If i have a field of 10 by 10 = 100 tiles and i have 10 bombs. To win you need to have all tiles EXCEPT the bombs clicked. This program does the following:
read height, base and bombs.
(base*height)-bombs is the value that you need to write to the tiles(pressed) adress for instant win. Just take a look: Code: #include <windows.h> // for all the find window stuff
#include <iostream> // for the couts
using namespace std; // for the standard functions, don't think too much about it
int main() // initialyse function main
{
// LPVOID Address name = (void*) 0xAddress;
LPVOID tiles = (void*) 0x10057A4; // A void value is easier to maintain, debug and use with the readprocess later on
LPVOID bombs = (void*) 0x1005194; // "
LPVOID height = (void*) 0x10056A8; // "
LPVOID base = (void*) 0x10056AC; // "
// Var Type ( int ) variable name = value;
int bombsvalue = 0; //We need integers to calculate with the adress voids,
int heightvalue = 0; // ' '
int basevalue = 0; // ' '
cout<<endl; // it looks nice, basicly an enter after the sentence
//initialysing code for finding the window...
HWND hwnd; // No reason, it's just part of the synthaxis
HANDLE phandle; // Make a handle to use with a process
DWORD pid; // make a DWORD value, named pid
hwnd = FindWindow(NULL,"Minesweeper");
if (hwnd != 0) //if there is a WindowName window ...
{
SetWindowText(NULL,"Minesweeper Game Trainer"); // set the text on the window
GetWindowThreadProcessId(hwnd, &pid); // get the process id, store it in DWORD pid
phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid); // we need a handle to open to process to our program :p
cout << "Press enter for instant win... n";
cin.get();
}
else
{
cout << "You need to open Minesweeper first...n"; // window was not found...
cin.get(); // wait for user input
return 0; // end program
}
if (phandle != 0) // If our handle is "true" (boolean stuff, just means that 0 = not good)
{
//Gets the values from the adresses and stores them in the integer bombs, height
ReadProcessMemory(phandle, bombs, &bombsvalue, 4, NULL);
ReadProcessMemory(phandle, hoogte, &heightvalue, 4, NULL);
ReadProcessMemory(phandle, breedte, &basevalue, 4, NULL);
//Calculates the stuff we need
int totaltiles = heightvalue * basevalue; // The surface
int clicktiles = totaltiles - bombsvalue; // needed to instant win!
//Writes a value in an address
WriteProcessMemory(phandle, (LPVOID)tiles, (LPVOID) &clicktiles, 4, 0); //writes the value of clicktiles into adress tiles
cout << "Now rightclick anywhere in the gamefield :D n"; // No obvious reason, just do it
cin.get(); // wait for user input
}
else // if we don't have a handle, if our handle was false
{
cout << "Time to buy a new pc...n"; // so our handle was 0, idunno why but your pc sux
cin.get(); // wait for user input
}
}
I know it's a bit long, but you could tweak it for other games, like space pinball, and even some online games! (WT, maybe more)
Hope i helped | | The Following User Says Thank You to TheProdigy For This Useful Post: | | 
12-14-2007, 10:48 AM
| | Chick | | | Last Online: 08-06-2008 09:56 AM Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Nominated 0 Times in 0 Posts TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0 Points: 410.77 Bank: 0.00 Total Points: 410.77 | |
well thanks but i tryed the minesweeper hack but it give me 4 errors Quote:
1>------ Build started: Project: hellow, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:documents and settingswaleedmy documentsvisual studio 2008projectshellowhellowmain.cpp(26) : error C2664: 'FindWindowW' : cannot convert parameter 2 from 'const char [12]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:documents and settingswaleedmy documentsvisual studio 2008projectshellowhellowmain.cpp(30) : error C2664: 'SetWindowTextW' : cannot convert parameter 2 from 'const char [25]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:documents and settingswaleedmy documentsvisual studio 2008projectshellowhellowmain.cpp(48) : error C2065: 'hoogte' : undeclared identifier
1>c:documents and settingswaleedmy documentsvisual studio 2008projectshellowhellowmain.cpp(49) : error C2065: 'breedte' : undeclared identifier
1>Build log was saved at "file://c ocuments and SettingswaleedMy DocumentsVisual Studio 2008ProjectshellowhellowDebugBuildLog.htm"
1>hellow - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
| i fixed all the lpcwstr by adding (LPCWSTR) before the
findwindow(NULL,(LPCWSTR)"bla bla");
and before
SetWindowText(NULL,(LPCWSTR)"bla bla");
so i get 2 errors Quote:
1>------ Build started: Project: hellow, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:documents and settingswaleedmy documentsvisual studio 2008projectshellowhellowmain.cpp(48) : error C2065: 'hoogte' : undeclared identifier
1>c:documents and settingswaleedmy documentsvisual studio 2008projectshellowhellowmain.cpp(49) : error C2065: 'breedte' : undeclared identifier
1>Build log was saved at "file://c ocuments and SettingswaleedMy DocumentsVisual Studio 2008ProjectshellowhellowDebugBuildLog.htm"
1>hellow - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
| and here is my code after modifications :P Quote:
#include <windows.h> // for all the find window stuff
#include <iostream> // for the couts
using namespace std; // for the standard functions, don't think too much about it
int main() // initialyse function main
{
// LPVOID Address name = (void*) 0xAddress;
LPVOID tiles = (void*) 0x10057A4; // A void value is easier to maintain, debug and use with the readprocess later on
LPVOID bombs = (void*) 0x1005194; // "
LPVOID height = (void*) 0x10056A8; // "
LPVOID base = (void*) 0x10056AC; // "
// Var Type ( int ) variable name = value;
int bombsvalue = 0; //We need integers to calculate with the adress voids,
int heightvalue = 0; // ' '
int basevalue = 0; // ' '
cout<<endl; // it looks nice, basicly an enter after the sentence
//initialysing code for finding the window...
HWND hwnd; // No reason, it's just part of the synthaxis
HANDLE phandle; // Make a handle to use with a process
DWORD pid; // make a DWORD value, named pid
hwnd = FindWindow(NULL,(LPCWSTR)"Minesweeper");
if (hwnd != 0) //if there is a WindowName window ...
{
SetWindowText(NULL,(LPCWSTR)"Minesweeper Game Trainer"); // set the text on the window
GetWindowThreadProcessId(hwnd, &pid); // get the process id, store it in DWORD pid
phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid); // we need a handle to open to process to our program 
cout << "Press enter for instant win... n";
cin.get();
}
else
{
cout << "You need to open Minesweeper first...n"; // window was not found...
cin.get(); // wait for user input
return 0; // end program
}
if (phandle != 0) // If our handle is "true" (boolean stuff, just means that 0 = not good)
{
//Gets the values from the adresses and stores them in the integer bombs, height
ReadProcessMemory(phandle, bombs, &bombsvalue, 4, NULL);
ReadProcessMemory(phandle, hoogte, &heightvalue, 4, NULL);
ReadProcessMemory(phandle, breedte, &basevalue, 4, NULL);
//Calculates the stuff we need
int totaltiles = heightvalue * basevalue; // The surface
int clicktiles = totaltiles - bombsvalue; // needed to instant win!
//Writes a value in an address
WriteProcessMemory(phandle, (LPVOID)tiles, (LPVOID) &clicktiles, 4, 0); //writes the value of clicktiles into adress tiles
cout << "Now rightclick anywhere in the gamefield n"; // No obvious reason, just do it
cin.get(); // wait for user input
}
else // if we don't have a handle, if our handle was false
{
cout << "Time to buy a new pc...n"; // so our handle was 0, idunno why but your pc sux
cin.get(); // wait for user input
}
}
| please help | 
12-14-2007, 04:03 PM
| | Stone Axe | | | Last Online: 01-03-2008 12:36 PM Join Date: Nov 2007 Location: Arizona Age: 22
Posts: 40
Thanks: 0
Thanked 3 Times in 3 Posts
Nominated 0 Times in 0 Posts TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0 Points: 678.67 Bank: 0.00 Total Points: 678.67 | | |
I don't like how you present the code. You should teach professional, easy to read code before diving into coding itself.
| 
12-16-2007, 12:50 PM
|  | Stone Axe | | | Last Online: 07-17-2008 11:32 PM Join Date: Oct 2006
Posts: 35
Thanks: 12
Thanked 8 Times in 1 Post
Nominated 0 Times in 0 Posts TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0 Points: 156.20 Bank: 1,386.08 Total Points: 1,542.28 | | Quote:
Originally Posted by TheProdigy GJ, you really did your best 
Here's another aprouch of memory writing, because with some compilers your code gives an error. My trainer example is a minesweeper instant win trainer. You see, minesweeper is a simple game. These are the adresses used in this program:
tiles(pressed) = 0x10057A4
bombs = 0x1005194
height = 0x10056A8
base = 0x10056AC
Minesweeper example:
If i have a field of 10 by 10 = 100 tiles and i have 10 bombs. To win you need to have all tiles EXCEPT the bombs clicked. This program does the following:
read height, base and bombs.
(base*height)-bombs is the value that you need to write to the tiles(pressed) adress for instant win. Just take a look: Code: #include <windows.h> // for all the find window stuff
#include <iostream> // for the couts
using namespace std; // for the standard functions, don't think too much about it
int main() // initialyse function main
{
// LPVOID Address name = (void*) 0xAddress;
LPVOID tiles = (void*) 0x10057A4; // A void value is easier to maintain, debug and use with the readprocess later on
LPVOID bombs = (void*) 0x1005194; // "
LPVOID height = (void*) 0x10056A8; // "
LPVOID base = (void*) 0x10056AC; // "
// Var Type ( int ) variable name = value;
int bombsvalue = 0; //We need integers to calculate with the adress voids,
int heightvalue = 0; // ' '
int basevalue = 0; // ' '
cout<<endl; // it looks nice, basicly an enter after the sentence
//initialysing code for finding the window...
HWND hwnd; // No reason, it's just part of the synthaxis
HANDLE phandle; // Make a handle to use with a process
DWORD pid; // make a DWORD value, named pid
hwnd = FindWindow(NULL,"Minesweeper");
if (hwnd != 0) //if there is a WindowName window ...
{
SetWindowText(NULL,"Minesweeper Game Trainer"); // set the text on the window
GetWindowThreadProcessId(hwnd, &pid); // get the process id, store it in DWORD pid
phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid); // we need a handle to open to process to our program :p
cout << "Press enter for instant win... n";
cin.get();
}
else
{
cout << "You need to open Minesweeper first...n"; // window was not found...
cin.get(); // wait for user input
return 0; // end program
}
if (phandle != 0) // If our handle is "true" (boolean stuff, just means that 0 = not good)
{
//Gets the values from the adresses and stores them in the integer bombs, height
ReadProcessMemory(phandle, bombs, &bombsvalue, 4, NULL);
ReadProcessMemory(phandle, hoogte, &heightvalue, 4, NULL);
ReadProcessMemory(phandle, breedte, &basevalue, 4, NULL);
//Calculates the stuff we need
int totaltiles = heightvalue * basevalue; // The surface
int clicktiles = totaltiles - bombsvalue; // needed to instant win!
//Writes a value in an address
WriteProcessMemory(phandle, (LPVOID)tiles, (LPVOID) &clicktiles, 4, 0); //writes the value of clicktiles into adress tiles
cout << "Now rightclick anywhere in the gamefield :D n"; // No obvious reason, just do it
cin.get(); // wait for user input
}
else // if we don't have a handle, if our handle was false
{
cout << "Time to buy a new pc...n"; // so our handle was 0, idunno why but your pc sux
cin.get(); // wait for user input
}
}
I know it's a bit long, but you could tweak it for other games, like space pinball, and even some online games! (WT, maybe more)
Hope i helped  | Hej! I made it!
__________________
Prozix - Play Games, Create Art
| 
12-17-2007, 04:01 AM
| | Chick | | | Last Online: 08-06-2008 09:56 AM Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Nominated 0 Times in 0 Posts TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0 Points: 410.77 Bank: 0.00 Total Points: 410.77 | | |
please answer me :P
| 
12-17-2007, 10:45 PM
|  | Stone Axe | | | Last Online: 10-07-2008 07:49 AM Join Date: Nov 2007 Age: 16
Posts: 35
Thanks: 8
Thanked 1 Time in 1 Post
Nominated 0 Times in 0 Posts TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0 Points: 506.70 Bank: 88.58 Total Points: 595.28 | |
Sorry I did'nt react on your post earlier, I was busy with other stuff at my home. Now i must go to school, so ill look at it this afternoon.
@Prozix:
Why do you always say "I made it" when you and I make something together you stupid noob. I means one person, multiple persons... 
JK, JK
| 
01-01-2008, 06:03 AM
|  | Registered Users + | | | Last Online: 11-29-2008 04:48 PM Join Date: Aug 2007 Location: behind you.. why do you want to know perv?
Posts: 279
Thanks: 60
Thanked 30 Times in 22 Posts
Nominated 0 Times in 0 Posts TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 3 Points: 298.73 Bank: 520.03 Total Points: 818.76 | | Quote:
Originally Posted by TheProdigy GJ, you really did your best 
Here's another aprouch of memory writing, because with some compilers your code gives an error. My trainer example is a minesweeper instant win trainer. You see, minesweeper is a simple game. These are the adresses used in this program:
tiles(pressed) = 0x10057A4
bombs = 0x1005194
height = 0x10056A8
base = 0x10056AC
Minesweeper example:
If i have a field of 10 by 10 = 100 tiles and i have 10 bombs. To win you need to have all tiles EXCEPT the bombs clicked. This program does the following:
read height, base and bombs.
(base*height)-bombs is the value that you need to write to the tiles(pressed) adress for instant win. Just take a look: Code: #include <windows.h> // for all the find window stuff
#include <iostream> // for the couts
using namespace std; // for the standard functions, don't think too much about it
int main() // initialyse function main
{
// LPVOID Address name = (void*) 0xAddress;
LPVOID tiles = (void*) 0x10057A4; // A void value is easier to maintain, debug and use with the readprocess later on
LPVOID bombs = (void*) 0x1005194; // "
LPVOID height = (void*) 0x10056A8; // "
LPVOID base = (void*) 0x10056AC; // "
// Var Type ( int ) variable name = value;
int bombsvalue = 0; //We need integers to calculate with the adress voids,
int heightvalue = 0; // ' '
int basevalue = 0; // ' '
cout<<endl; // it looks nice, basicly an enter after the sentence
//initialysing code for finding the window...
HWND hwnd; // No reason, it's just part of the synthaxis
HANDLE phandle; // Make a handle to use with a process
DWORD pid; // make a DWORD value, named pid
hwnd = FindWindow(NULL,"Minesweeper");
if (hwnd != 0) //if there is a WindowName window ...
{
SetWindowText(NULL,"Minesweeper Game Trainer"); // set the text on the window
GetWindowThreadProcessId(hwnd, &pid); // get the process id, store it in DWORD pid
phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid); // we need a handle to open to process to our program :p
cout << "Press enter for instant win... n";
cin.get();
}
else
{
cout << "You need to open Minesweeper first...n"; // window was not found...
cin.get(); // wait for user input
return 0; // end program
}
if (phandle != 0) // If our handle is "true" (boolean stuff, just means that 0 = not good)
{
//Gets the values from the adresses and stores them in the integer bombs, height
ReadProcessMemory(phandle, bombs, &bombsvalue, 4, NULL);
ReadProcessMemory(phandle, hoogte, &heightvalue, 4, NULL);
ReadProcessMemory(phandle, breedte, &basevalue, 4, NULL);
//Calculates the stuff we need
int totaltiles = heightvalue * basevalue; // The surface
int clicktiles = totaltiles - bombsvalue; // needed to instant win!
//Writes a value in an address
WriteProcessMemory(phandle, (LPVOID)tiles, (LPVOID) &clicktiles, 4, 0); //writes the value of clicktiles into adress tiles
cout << "Now rightclick anywhere in the gamefield :D n"; // No obvious reason, just do it
cin.get(); // wait for user input
}
else // if we don't have a handle, if our handle was false
{
cout << "Time to buy a new pc...n"; // so our handle was 0, idunno why but your pc sux
cin.get(); // wait for user input
}
}
I know it's a bit long, but you could tweak it for other games, like space pinball, and even some online games! (WT, maybe more)
Hope i helped  |
I tried your code and the other guys one and it always says "failed when compiling". <iostream.h> <windows.h> do not exist for some reason
| 
01-02-2008, 07:48 AM
|  | Stone Axe | | | Last Online: 10-07-2008 07:49 AM Join Date: Nov 2007 Age: 16
Posts: 35
Thanks: 8
Thanked 1 Time in 1 Post
Nominated 0 Times in 0 Posts TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0 Points: 506.70 Bank: 88.58 Total Points: 595.28 | |
w0000t i'm so noobish... just delete the .h after these things:
#include <iostream>
#include <windows>
sorry for the late reply | 
08-27-2008, 04:54 PM
| | Chick | | | Last Online: 10-03-2008 05:03 PM Join Date: Nov 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Nominated 0 Times in 0 Posts TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0 Points: 573.00 Bank: 0.00 Total Points: 573.00 | | |
Thats a great tuorial and all. But it would be great if you can add a tutorial on how to change the op-codes in addresses, you know, like NOP'ing an address.
|  | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | |