angerist Grandmaster Cheater Supreme
Reputation: 0
Joined: 18 Jun 2007 Posts: 1011 Location: Australia.
|
Posted: Sat Jun 13, 2009 1:36 am Post subject: [C++] Help with asm dll source |
|
|
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 .
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;
} |
_________________
|
|