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 


[C++] Help with asm dll source

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
angerist
Grandmaster Cheater Supreme
Reputation: 0

Joined: 18 Jun 2007
Posts: 1011
Location: Australia.

PostPosted: Sat Jun 13, 2009 1:36 am    Post subject: [C++] Help with asm dll source Reply with quote

I've just finished coding the shell to the trainer that I'm making including the Automated dll injection. Now its time for the last step(the hardest one in my books), which is coding the dll's in c++. What i need is for someone to explain to me where to put addresses and how to modify the source bellow. Just some usefull information would be nice Smile.

The code bellow is for minesweeper. But I need to use it for other things.


Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#pragma comment(linker, "/ENTRY:DllMain")

#define MakeJmp(frm, to) (int)(((int)to - (int)frm) - 5);
DWORD dwFlagRet = NULL;

void _declspec(naked) __stdcall FlagCave()
{
   __asm
   {
      push eax
      mov eax, 0x1005194
      mov [eax], 0xa
      pop eax
      jmp dwFlagRet
   }
}

DWORD CreateCodeCave()
{
   //
   // Unprotect Original Flag Code
   //
   DWORD dwOldProtect = NULL;
   VirtualProtect( (LPVOID)0x100346e, 0x1000, PAGE_EXECUTE_READWRITE, &dwOldProtect );

   //
   // Create Jump And Return
   //
   BYTE* bJmpSpeed = (BYTE*)((char*)0x100346e);
   *(BYTE*)bJmpSpeed = 0xe9;
   *(int*)(INT_PTR)(bJmpSpeed+1) = MakeJmp((INT_PTR)bJmpSpeed, (INT_PTR)FlagCave);
   *(BYTE*)(bJmpSpeed+5) = 0x90;
   dwFlagRet = (DWORD)(DWORD_PTR)(bJmpSpeed+6);

   return ERROR_SUCCESS;
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwMsg, LPVOID lpReserved)
{
   UNREFERENCED_PARAMETER( hModule );
   UNREFERENCED_PARAMETER( lpReserved );

   switch( dwMsg )
   {
   case DLL_PROCESS_ATTACH:
      DisableThreadLibraryCalls( hModule );
      CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)CreateCodeCave, NULL, 0, 0 );
      return TRUE;
   case DLL_PROCESS_DETACH:
      return TRUE;
   }
   return TRUE;
}

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming 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