View Single Post
  #1  
Old 19-03-2007, 09:32
pikachu5501 pikachu5501 is offline
Senior Member
 
Join Date: Oct 2006
Location: canada
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
pikachu5501 is on a distinguished road
Lightbulb A simple "poke" in c++ for you trainer.

Ok many ask how to create a trainer. I wont explain here how to search and all. I will just give my main poke function that i find on internet and make simplier. It does write in a certain place in memory in a certain process (a game for example).

It work well with the free Borland Builder but should work with mingw or cygwin also. just copy the code snipet bellow and put it in you program. Should work without any problems in console or in Windows mode.

parameter explanation:
Wname: name of the process, just look in task manager if you are not sure.

addr: adress to be writen in

newbyte: byte to be writen in a string. let say you want to write 0x90, 0x90 so you write it this way "\x90\x90"

nbyte: number of byte to be writen. Make sure it match with the number of byte you insert in newbyte.

here an example:
poke_window("Robin Hood: Defender Of The Crown", 0x00425B8A, "\x90\x90",2 )

One last thing. Make sure that there is a delay between writes (or write just once in code segment). or it will slow down you game.


Code:
//include those in order to make it work
#include <iostream.h>
#include <windows.h>

int poke_window(char wname[50], DWORD addr, BYTE newbyte[12],int nbyte)
{
HWND Wnd=0;		
LPDWORD PID;	
DWORD Proc=0;	
HANDLE Hproc;	

DWORD MWritte; 


	
Wnd = FindWindow(NULL, wname); 	// see if it exist

if ( Wnd )
{
	Proc = GetWindowThreadProcessId(Wnd,(LPDWORD) &PID); //get a PROCESS number
	if (Proc)
	{
		Hproc= OpenProcess(PROCESS_ALL_ACCESS,NULL,(DWORD)PID);
		if(Hproc)
		WriteProcessMemory (Hproc, (LPVOID)addr, newbyte, nbyte,&MWritte);
	}
}

return(0);	
}
enjoy!

Last edited by pikachu5501; 19-03-2007 at 09:35.
Reply With Quote
Sponsored Links