| View previous topic :: View next topic |
| Author |
Message |
Niels8500 Grandmaster Cheater
Reputation: 0
Joined: 19 Sep 2007 Posts: 859 Location: The Netherlands
|
Posted: Mon Nov 17, 2008 10:20 am Post subject: C++ Cheat Trainer with source code |
|
|
Hello can anyone help me to make a cheat trainer, for a singleplayer game like 007 quantum of solace, like ammo hack. how i can make a trainer in C++ ty
| Code: | #include <windows.h>
#include <tlhelp32.h>
#include <conio.h>
#include <stdlib.h>
bool ChangeMemVal(const char * ProcessName, LPVOID MemAddress, int NewVal, int size);
void main()
{
printf("=== Pinball Trainer Example. Made by <your name here> ===\n\n");
if(ChangeMemVal("PINBALL.EXE", (void*) 0xA90C62, 100000000, 4))
printf("The score has been edited successfully.\n");
else
printf("An error occured while attempting edit the score.\n");
system("PAUSE");
return 0;
}
/* This function modifys a memory address according to its arguments.
Arguments :
ProcessName - the process we want to modify
MemAddress - the memory address we want to modify
NewVal - the value we want to change the memory address to
size - the size of the memory address
Returns :
the success of the edit.
*/
bool ChangeMemVal(const char * ProcessName, LPVOID MemAddress, int NewVal, int size)
{
HANDLE hProcessSnap;
HANDLE hProcess = NULL;
PROCESSENTRY32 pe32;
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
pe32.dwSize = sizeof( PROCESSENTRY32 );
Process32First(hProcessSnap, &pe32);
do
{
if(!strcmp(pe32.szExeFile, ProcessName))
{
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
break;
}
}
while(Process32Next(hProcessSnap, &pe32));
CloseHandle( hProcessSnap );
if(hProcess != NULL)
{
WriteProcessMemory(hProcess, MemAddress, &NewVal, size, NULL); // write the value
CloseHandle(hProcess);
return true;
}
return false;
} |
|
|
| Back to top |
|
 |
Spawnfestis GO Moderator
Reputation: 0
Joined: 02 Nov 2007 Posts: 1746 Location: Pakistan
|
Posted: Mon Nov 17, 2008 11:20 am Post subject: |
|
|
God, at least get the least grip of how it works before you try to make a trainer on your own. Read some basic ASM tutorials first or something.
_________________
CLICK TO HAX MAPLESTORAY ^ !!!! |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Nov 17, 2008 11:58 am Post subject: |
|
|
Pinball uses pointers FYI.
So you'd have to do something like (yes, this is the right address, assuming you're on XP sp2):
| Code: |
void SetBalls(DWORD number){
DWORD buffer;
ReadProcessMemory(handle, (LPCVOID)0x01025658, &buffer, sizeof(DWORD), 0);
buffer += 0x0146;
WriteProcessMemory(handle, (LPVOID)buffer, &number, sizeof(number), 0);
} |
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Mon Nov 17, 2008 12:56 pm Post subject: |
|
|
| Doing all that every time you want to write to the process seems a bit silly =|
|
|
| Back to top |
|
 |
Niels8500 Grandmaster Cheater
Reputation: 0
Joined: 19 Sep 2007 Posts: 859 Location: The Netherlands
|
Posted: Mon Nov 17, 2008 1:44 pm Post subject: |
|
|
| Lol iam on Vista 32BIT
|
|
| Back to top |
|
 |
sphere90 Grandmaster Cheater
Reputation: 0
Joined: 24 Jun 2006 Posts: 912
|
Posted: Mon Nov 17, 2008 8:14 pm Post subject: |
|
|
| Niels8500 wrote: | | Lol iam on Vista 32BIT |
So?
|
|
| Back to top |
|
 |
Niels8500 Grandmaster Cheater
Reputation: 0
Joined: 19 Sep 2007 Posts: 859 Location: The Netherlands
|
Posted: Tue Nov 18, 2008 7:36 am Post subject: |
|
|
But now with the problem can anyone help me
with a trainer
for like the game Command & Conquer Red alert 3
|
|
| Back to top |
|
 |
Spawnfestis GO Moderator
Reputation: 0
Joined: 02 Nov 2007 Posts: 1746 Location: Pakistan
|
Posted: Tue Nov 18, 2008 8:32 am Post subject: |
|
|
| Niels8500 wrote: | But now with the problem can anyone help me
with a trainer
for like the game Command & Conquer Red alert 3 |
No.
_________________
CLICK TO HAX MAPLESTORAY ^ !!!! |
|
| Back to top |
|
 |
Niels8500 Grandmaster Cheater
Reputation: 0
Joined: 19 Sep 2007 Posts: 859 Location: The Netherlands
|
Posted: Tue Nov 18, 2008 8:49 am Post subject: |
|
|
| Spawnfestis wrote: | | Niels8500 wrote: | But now with the problem can anyone help me
with a trainer
for like the game Command & Conquer Red alert 3 |
No.  |
Why not, i wanne make my own cheat
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
Posted: Tue Nov 18, 2008 11:02 am Post subject: |
|
|
| Code: |
__declspec(naked)void SetOffsetDword();
CONTEXT Context = {CONTEXT_FULL};
__declspec(naked)void SetOffsetDword()
{
__asm
{
add ecx,edx
mov [ecx],eax
}
SuspendThread(GetCurrentThread());
}
int Size = mlde(SetOffetDword);//mlde engine
CreateRemoteThread(blah,(LPTHREAD_START_ROUTINE)memcpy(VirtualAllocEx(,TargetProcess,blah,Size),SetOffsetDword,Size),blah);
|
Get/SetThreadContext to set params On the Thread
Base = ecx,
offset = edx,
Number = eax;
reuseable remote write process memory without WriteProcessMemory
|
|
| Back to top |
|
 |
Niels8500 Grandmaster Cheater
Reputation: 0
Joined: 19 Sep 2007 Posts: 859 Location: The Netherlands
|
Posted: Tue Nov 18, 2008 11:46 am Post subject: |
|
|
| BanMe wrote: | | Code: |
__declspec(naked)void SetOffsetDword();
CONTEXT Context = {CONTEXT_FULL};
__declspec(naked)void SetOffsetDword()
{
__asm
{
add ecx,edx
mov [ecx],eax
}
SuspendThread(GetCurrentThread());
}
int Size = mlde(SetOffetDword);//mlde engine
CreateRemoteThread(blah,(LPTHREAD_START_ROUTINE)memcpy(VirtualAllocEx(,TargetProcess,blah,Size),SetOffsetDword,Size),blah);
|
Get/SetThreadContext to set params On the Thread
Base = ecx,
offset = edx,
Number = eax;
reuseable remote write process memory without WriteProcessMemory |
to difficult...
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Nov 18, 2008 2:29 pm Post subject: |
|
|
| Code: | #include <Windows.h>
#include <iostream>
#include "trainer.h"
int main()
{
DWORD choice, num;
if(CheckProcess("PINBALL.EXE")){
std::cout << "Running." << std::endl;
std::cout << "1. Read" << std::endl;
std::cout << "2. Write" << std::endl;
std::cout << "3. Quit" << std::endl;
do{
std::cin >> choice;
switch(choice){
case 1:
std::cout << ReadBalls() << std::endl;
break;
case 2:
std::cin >> num;
WriteBalls(num);
break;
case 3:
return 0;
default:
break;
}
}while(choice != 3);
}
else{
std::cout << "Not running." << std::endl;
}
return 0;
} |
| Code: | #include <tlhelp32.h>
PROCESSENTRY32 pe;
HANDLE snapshot,
handle;
BOOL CheckProcess(char* target){
pe.dwSize = sizeof(PROCESSENTRY32);
snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
Process32First(snapshot, &pe);
while(lstrcmpi(pe.szExeFile, target) != 0){
if(!Process32Next(snapshot, &pe)){
return FALSE;
}
}CloseHandle(snapshot);
handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID);
return TRUE;
}
DWORD ReadBalls(void){
DWORD buffer = 0;
ReadProcessMemory(handle, (LPCVOID)0x01025658, &buffer, sizeof(DWORD), 0);
buffer += 0x0146;
ReadProcessMemory(handle, (LPCVOID)buffer, &buffer, sizeof(DWORD), 0);
return buffer;
}
void WriteBalls(DWORD number){
DWORD buffer = 0;
ReadProcessMemory(handle, (LPCVOID)0x01025658, &buffer, sizeof(DWORD), 0);
buffer += 0x0146;
WriteProcessMemory(handle, (LPVOID)buffer, &number, sizeof(number), 0);
} |
|
|
| Back to top |
|
 |
Niels8500 Grandmaster Cheater
Reputation: 0
Joined: 19 Sep 2007 Posts: 859 Location: The Netherlands
|
Posted: Wed Nov 19, 2008 9:48 am Post subject: |
|
|
Lol dont know what to do
with this do i have to add
buttons or something?
|
|
| Back to top |
|
 |
Spawnfestis GO Moderator
Reputation: 0
Joined: 02 Nov 2007 Posts: 1746 Location: Pakistan
|
Posted: Wed Nov 19, 2008 10:35 am Post subject: |
|
|
| Niels8500 wrote: | Lol dont know what to do
with this do i have to add
buttons or something? |
Can't someone lock this topic? The guy doesn't know jackshit, I already said in the top post that he should read the basics first.
Really, either lock it or answer him properly without feeding him source code just making it more troublesome for him and yourself.
_________________
CLICK TO HAX MAPLESTORAY ^ !!!! |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Nov 19, 2008 11:24 am Post subject: |
|
|
| Niels8500 wrote: | Lol dont know what to do
with this do i have to add
buttons or something? |
You go to www.cplusplus.com
Come back after you've attempted to help yourself.
|
|
| Back to top |
|
 |
|