Results 1 to 15 of 47

Threaded View

  1. #1
    l0ngcat's Avatar
    Join Date
    Apr 2007
    Posts
    96
    Reputation
    13
    Thanks
    23

    Writing your own C++ Trainer

    Here is a tutorial teaching your the very basics of making a trainer, namely how to find a process and write shit into it at the correct address. what it doesn't cover is making a GUI-based (graphic user interface) trainer with hotkey hooks that work when the program is in the background.

    you need a C++ compiler, like MS Visual C++ or whatever, to compile the attached source code. copy it and save as OMFG_thanks_dude_for_this_tut.cpp or something.

    Code:
    /* --------- TUTORIAL: Making your first Trainer -------- */
    /* --------- by Anonymous - posted on mpgh.net   -------- */
    
    #include <windows.h>
    #include <conio.h>
    #include <dos.h>
    #include <tlhelp32.h>
    #include <stdio.h>
    
    
    int stamina;	// will store the stamina value
    
    bool dostamina = false;		// determines if user activated stamina freezing
    
    LPVOID stamina_addr =	(void*) 0x007F1110;		// memory address of the stamina value in the WarRock process
    
    void screen()	// output
    {
    	system("cls");	// clear the screen
    	printf("Hello World! This is my first WarRock trainer!  \n\n");
    	
    	if(dostamina) printf("[1] - freeze stamina [ENABLED]\n");	// if user enabled stamina freeze, let him know!
    	else printf("[1] - freeze stamina [disabled]\n");			// same if it's disabled
    }
    
    int main(int argc, char* argv[])
    {	
    	HANDLE hProcessSnap;	// will store a snapshot of all processes
    	HANDLE hProcess = NULL;	// we will use this one for the WarRock process
    	PROCESSENTRY32 pe32;	// stores basic info of a process, using this one to read the ProcessID from
    	
    	hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );	// make process snapshot
    
    	pe32.dwSize = sizeof( PROCESSENTRY32 );		// correct size
    
    	Process32First(hProcessSnap, &pe32);	// read info about the first process into pe32
    
    	do	// loop to find the WarRock process
    	{		
    		if(strcmp(pe32.szExeFile, "WarRock.exe") == 0)	// if WarRock was found
    		{
    			hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);	// open it, assigning to the hProcess handle
    			break;	// break the loop
    		}
    	}
    	while(Process32Next(hProcessSnap, &pe32));	// loop continued until Process32Next deliver NULL or its interrupted with the "break" above
    
    	CloseHandle( hProcessSnap );	// close the handle (just fuckin do it)
    
    	if(hProcess == NULL)	// self explanatory tbh
    	{
    		printf("WarRock not found\n\n");
    		getch();	// wait for a key press. otherwise the app will just close so fast when the process is not found, you wont know wtf happened.
    	}
    	else
    	{
    		screen();	// print the display
    		
    		char key = ' ';	// make a key variable to store pressed keys
    		
    		while(key != VK_ESCAPE)	// loop until user presses Escape
    		{
    			
    			if(kbhit())		// if a key was pressed
    			{
    				key = getch();	// it is saved into "key"
    
    				switch(key)		// here the commands are handled depending on the key that was pressed
    				{				// case '1': ... break;  case '2': ... break; and so on
    				case '1':
    					dostamina = !dostamina;		// flip the dostamina value true<->false to enable/disable it
    					ReadProcessMemory(hProcess, stamina_addr, &stamina, 4, NULL);	// read the stamina value from the memory into the "stamina" variable
    					break;			
    				}
    
    				screen();	// print the display after each key press
    
    			}
    
    			if(dostamina)	// if stamina freeze is activated
    				WriteProcessMemory(hProcess, stamina_addr, &stamina, 4, NULL);	// write the stamina value that was saved before with the key press into memory
    		}
    
    		CloseHandle(hProcess);	// close the handle
    		
    	}
    
    	return 0;	// THE END
    }
    Last edited by l0ngcat; 05-08-2007 at 10:52 PM.

  2. The Following 22 Users Say Thank You to l0ngcat For This Useful Post:

    77manos7 (10-10-2010),Devonius (03-28-2009),dikosgr (08-06-2009),Extermenater (08-23-2008),frono15 (11-04-2007),guyzar (07-08-2009),hantuafiq (02-26-2010),KissU (08-07-2011),malloc84 (09-09-2018),martijno0o0 (01-06-2010),N3tsky (10-03-2012),nepito (03-13-2010),nofallll (09-21-2008),ooblushy88oo (07-28-2009),pbsucks (11-03-2007),pingwasha (04-30-2009),reversflux (06-17-2009),rwkeith (07-27-2009),silent1990 (12-18-2008),snak302 (02-22-2008),Taranis (02-14-2008),zhaoyun333 (04-13-2009)

Similar Threads

  1. Writing your own Visual Basics (v5 or v6) Trainer
    By TheRedEye in forum Game Hacking Tutorials
    Replies: 29
    Last Post: 12-09-2013, 09:56 AM
  2. compile error :/ from [Writing your own C++ Trainer]
    By FantaBrause in forum C++/C Programming
    Replies: 7
    Last Post: 07-06-2009, 11:09 PM
  3. [Tutorial] Programming your own FSEK Virus
    By FluffyStuff in forum Spammers Corner
    Replies: 19
    Last Post: 07-17-2007, 07:12 PM
  4. Make your own Warrock Cross hairs!!
    By llvengancell in forum WarRock - International Hacks
    Replies: 3
    Last Post: 05-26-2007, 10:59 PM
  5. How to make your own radiostation?
    By nasir91 in forum General
    Replies: 3
    Last Post: 04-30-2007, 07:25 AM