iktov Expert Cheater
Reputation: 0
Joined: 06 Sep 2007 Posts: 231 Location: Dead
|
Posted: Sun Jul 20, 2008 11:57 pm Post subject: dll trainer template |
|
|
EDIT: hmm, this was supposed to be a response to another thread and not a whole new thread itself but oh well, maybe it will help someone.
Here is a something basic that will get your ReadProcessMemory and WriteProcessMemory purposes done. Also a Logging function included. This is just the general idea and dosen't actually refer to any particular program, just a "template" for you to add your offsets in later.
| Code: | #define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windows.h>
#include <iostream>
#include <time.h>
HANDLE MyProcess = GetCurrentProcess();
#define FILELOCATION "C:\\My_log.txt"
void __cdecl add_log(const char * fmt, ...)
{
#ifndef _NO_ADD
va_list va_alist;
char logbuf[256];
FILE * fp;
struct tm * current_tm;
time_t current_time;
time (¤t_time);
current_tm = localtime (¤t_time);
sprintf (logbuf, "[%02d:%02d:%02d] ", current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec);
va_start (va_alist, fmt);
_vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist);
va_end (va_alist);
if ( (fp = fopen ( FILELOCATION , "a")) != NULL )
{
fprintf ( fp, "%s\n", logbuf );
fclose (fp);
}
#endif _NO_ADD
}
DWORD dwBytesread;
DWORD dwMyBaseAddr;
DWORD dwMyHackAddr;
DWORD dwMyHackAddr2;
BOOL WINAPI DllMain (HINSTANCE hModule, DWORD dwAttached, LPVOID lpvReserved)
{
if (dwAttached == DLL_PROCESS_ATTACH)
{
add_log("DLL Attatched to MyProcess");
ReadProcessMemory(MyProcess, (void*)(0x123456), &dwMyBaseAddr, sizeof(dwMyBaseAddr), &dwBytesread);
add_log("Base = 0x%.8x", (DWORD)dwMyBaseAddr);
ReadProcessMemory(MyProcess, (void*)(dwMyBaseAddr+0xOFFSET), &dwMyHackAddr, sizeof(dwMyHackAddr), &dwBytesread);
add_log("MyHackAddr = 0x%.8x", dwMyHackAddr);
add_log("MyHackValue = %d", dwMyHackAddr);
}
return 1;
} |
Thats the basic idea. Everything else works just like a normal trainer, input your variables for your writeprocessmemory stuff and use the variable you stored the original information to using ReadProcessMemory(ie:MyHackAddr) to set it back to normal for toggleability.
|
|