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?