Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


dll trainer template

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
iktov
Expert Cheater
Reputation: 0

Joined: 06 Sep 2007
Posts: 231
Location: Dead

PostPosted: Sun Jul 20, 2008 11:57 pm    Post subject: dll trainer template Reply with quote

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 (&current_time);
   current_tm = localtime (&current_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.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites