Which is what I'm doing here...
(not all my code - credit goes to wherever it is due. When I release trainer, I'll give official credit, and to you guys, too, if you help me solve this).
Code:
// my trainerDlg.cpp : implementation file
//
#include "stdafx.h"
#include <windows.h>
#include <conio.h>
#include <dos.h>
#include <tlhelp32.h>
#include <stdio.h>
#include <iostream>
long addy = 0x008B5288;
short offset = 0x180;
int value = 100000;
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");
//std::cout << &maddy;
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 = 100000;
WriteProcessMemory(hProcess, (LPVOID*)(DWORD) saddy, &value, sizeof(saddy), NULL);
}
}
CloseHandle(hProcess); // close the handle
}
return 0; // THE END
}
Also, lets say the offset is 0xH54 (defined at the top). It won't let me add it - gives me these errors:
error C2153: hex constants must have at least one hex digit
error C2059: syntax error : 'bad suffix on number'
error C2146: syntax error : missing ';' before identifier 'H54'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Seems like i'm having in-and-out luck with writing the z address (in the code above). Worked in Nerbil like a charm, but in marien, it lowered me through the floor. I find it hard to believe that the map floor is above 100,000 Z!? Even in nerbil, it only sent me up a little bit.
Using Microsoft Visual C++ Express Edition
thanks!