Results 1 to 3 of 3
  1. #1
    bagpiperdude90's Avatar
    Join Date
    Apr 2007
    Posts
    217
    Reputation
    10
    Thanks
    1

    Help with C++ Trainer - CODE INSIDE

    oook. So, I've got a trainer that works for static addresses. here's the code (credits to whomever it is due):

    Code:
    // trainer_tut1.cpp : Defines the entry point for the console application.
    //
    
    #include "stdafx.h"
    /* --------- 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 = 1;	// will store the stamina value
    
    bool dostamina = false;		// determines if user activated stamina freezing
    
    LPVOID stamina_addr =	(void*) 0x00943A16;		// memory address of the stamina value in the WarRock process
    
    void screen()	// output
    {
    	printf("Hello World! This is my first WarRock trainer!  \n\n");
    	
    	if(dostamina) printf("[1] - Get Scope [ENABLED]\n");	// if user enabled stamina freeze, let him know!
    	else printf("[1] - Get Scope [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 
    
    	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
    
    			}
    
    			stamina = 1;
    			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
    }

    But, I want to let me edit addresses with pointers (offsets, whatever you wanna call them). So, i found something else to try, and integrated it into my code. Here's the full code:

    Code:
    // my trainerDlg.cpp : implementation file
    //
    
    #include "stdafx.h"
    #include <windows.h>
    #include <conio.h>
    #include <dos.h>
    #include <tlhelp32.h>
    #include <stdio.h>
    
    long addy = 0x008B5288;
    short offset = 180;
    int value = 10000;
    long maddy;
    long saddy;
    
    long stamina = 1;	// will store the stamina value
    
    bool dostamina = false;		// determines if user activated stamina freezing
    
    
    void screen()	// output
    {
    	printf("Trainer test ver. 1.3  \n\n");
    	
    	if(dostamina) printf("[1] - SuperJump [ENABLED]\n");	// if user enabled stamina freeze, let him know!
    	else printf("[1] - SuperJump [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 
    
    	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, (LPVOID*)(DWORD) addy, &maddy, sizeof(maddy), 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
    			{
    				saddy = maddy + offset;
    				value = 10000;
    				WriteProcessMemory(hProcess, (LPVOID*)(DWORD) saddy, &value, 4, NULL);
    			}
    		}
    
    		CloseHandle(hProcess);	// close the handle
    		
    	}
    
    	return 0;	// THE END
    }
    the first one, static addresses, works beautifully. However, when I try to use pointers, nothing happens at all. What am I doing wrong?

    BTW: both compile fine in Microsoft Visual C++ 2005 Express Edition, which is free, of off MS website. Just google it.

    Also, this is C++ NOT VISUAL BASIC. Couldn't for the life of me figure out Microsoft Visual Basic 2005 Express Edition.

    Before you accuse me of coming here trying to find an easy way out, I've looked to freaking page 30 on google, using multiple searches. Also, I am fluent in PHP, so I know what I'm doing... sorta.

    First code sets scope, second code should set superjump. Whats wrong?

  2. #2
    cjg333's Avatar
    Join Date
    Apr 2007
    Location
    indianapolis
    Posts
    300
    Reputation
    17
    Thanks
    54
    yo you probly have to define your offset or create the function for a pointer,not really sure is this a win32 app,or mfc app?,well hit me up il try to help you msn cjg9590@hotmail.com

  3. #3
    bagpiperdude90's Avatar
    Join Date
    Apr 2007
    Posts
    217
    Reputation
    10
    Thanks
    1
    figured it out. thanks for the offer, though!

Similar Threads

  1. need help with some quick codes
    By ravinghippie in forum Anti-Cheat
    Replies: 1
    Last Post: 05-13-2009, 09:24 AM
  2. [b]Need Some Help With My Trainer[/b]
    By shanky1 in forum Visual Basic Programming
    Replies: 2
    Last Post: 08-10-2007, 01:11 AM
  3. Help with my Trainer...
    By tolb in forum WarRock - International Hacks
    Replies: 12
    Last Post: 06-10-2007, 09:51 PM
  4. Help With KWR Trainer
    By Synns in forum WarRock Korea Hacks
    Replies: 7
    Last Post: 05-13-2007, 08:58 PM
  5. help with makeing trainers
    By damanis1 in forum WarRock - International Hacks
    Replies: 4
    Last Post: 04-19-2007, 04:59 AM