This is an example d3d base using engine hook, for learning purpose.
pictures
[Only admins are allowed to see this link]
#include <windows.h>
#include <stdio.h>
#include <d3d9.h>
#include <d3dx9.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
#define PresentEngine 0x004C41AF
DWORD retPresentEngine = ( PresentEngine + 0x5 );
#define Red D3DCOLOR_ARGB( 255, 255, 255, 000 )
#define Green D3DCOLOR_ARGB( 255, 000, 255, 000 )
#define Blue D3DCOLOR_ARGB( 255, 000, 000, 255 )
#define Yellow D3DCOLOR_ARGB( 255, 255, 255, 000 )
#define Black D3DCOLOR_ARGB( 255, 000, 000, 000 )
typedef struct{
int index;
char * title;
int *hack;
int hackmaxval;
int hacktype;
DWORD HCOLOR;
}ITEM;
int hackcount;
int selector;
int x,y,w,h;
DWORD COLOR;
ITEM HACKITEM[99];
char hackrval[256];
int xFontOffSet = 15;
int hackopt1;
int MenuHeight = 10;
int show = 0;
int hack1, hack2, hack3;
LPDIRECT3DDEVICE9 pDevice;
LPD3DXFONT Font;
VOID StartFont( LPDIRECT3DDEVICE9 pDevice )
{
if( Font )
{
Font->Release();
Font = NULL;
}
if( !Font )
{
D3DXCreateFont( pDevice,
14,
0,
FW_BOLD,
1,
0,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE,
"Arial",
&Font );
}
}
VOID WriteText(char pString[], INT x, INT y, DWORD color )
{
RECT rect;
SetRect( &rect, x, y, x, y );
Font->DrawText( NULL, pString, -1, &rect, DT_NOCLIP | DT_LEFT, color );
}
void CreateItem(int index, char * title, int *hack, int hackmaxval,int hacktype)
{
hackcount++;
HACKITEM[hackcount].index = index;
HACKITEM[hackcount].hack = hack;
HACKITEM[hackcount].hackmaxval = hackmaxval;
HACKITEM[hackcount].hacktype = hacktype;
WriteText(title, xFontOffSet, index*15,HACKITEM[hackcount].HCOLOR); //If you want to move the menu opts down do something like this (index*15)+20 and to move it left or right just add/subtract from font offset.
}
void RenderMenu()
{
if(GetAsyncKeyState(VK_DOWN)&1)
selector++;
if(GetAsyncKeyState(VK_UP)&1)
if(selector > 1)
selector--;
if (GetAsyncKeyState(VK_RIGHT)<0)
{
for(int i=0;i < (hackcount+1);i++)
{
if(selector == HACKITEM[i].index)
{
if(*HACKITEM[i].hack < HACKITEM[i].hackmaxval)
*HACKITEM[i].hack += 1;
}
}
}
if (GetAsyncKeyState(VK_LEFT)<0)
{
for(int i=0;i < (hackcount+1);i++)
{
if(selector == HACKITEM[i].index)
{
*HACKITEM[i].hack = 0;
Sleep(20);
}
}
}
for(int i=0;i < (hackcount+1);i++)
{
if(selector == HACKITEM[i].index)
HACKITEM[i].HCOLOR = Green;
else
HACKITEM[i].HCOLOR = Red;
}
for(int i=1; i<(hackcount+1); i++)
{
if(HACKITEM[i].hacktype == 0)
{
if(*HACKITEM[i].hack == 1) //to move the opts down do something like this (HACKITEM[i].index*15)+20
WriteText("On", xFontOffSet+100, HACKITEM[i].index*15,Yellow);
else
WriteText("Off", xFontOffSet+100, HACKITEM[i].index*15,Red);
}
}
for(int i=1; i<(hackcount+1); i++)
{
if(HACKITEM[i].hackmaxval >1 && HACKITEM[i].hacktype == 1)
{
sprintf_s(hackrval, "%i", *HACKITEM[i].hack);
WriteText(hackrval, xFontOffSet+100, HACKITEM[i].index*15,Red);
}
}
if(selector < 1)
selector = 1;
if(selector > hackcount)
selector = 1;
hackcount = 0;
}
void BuildMenu(char * menuname, int x, int y, int h, int w, DWORD TITLECOL, DWORD BACKCOLOR, DWORD BORDERCOLOR, LPDIRECT3DDEVICE9 pDevice)
{
if(GetAsyncKeyState(VK_INSERT)&1) show=(!show);
if(!show)
{
WriteText(menuname, 5, 2, TITLECOL);
return;
}
WriteText(menuname, x+10, y+2, TITLECOL);
CreateItem(1,"Player Chams", &hack1, 1, 0);
CreateItem(2,"Asus Wallhack", &hack2, 1, 0);
CreateItem(3,"Fullbright", &hack3, 1, 0);
RenderMenu();
}
/*void MemoryHackHere()
{
//load modules & continue with hacks
if(hack3)
{
}
//do not put sleep()
}
*/
__declspec( naked ) HRESULT WINAPI PresentMidfunction( )
{
static LPDIRECT3DDEVICE9 pDevice;
__asm
{
MOV ECX, DWORD PTR DS:[EAX]
MOV EDX, DWORD PTR DS:[ECX + 0x44]
MOV DWORD PTR DS:[pDevice], EAX
PUSH 0
PUSHAD
}
//================================================================================== font
StartFont( pDevice );
//================================================================================== menu
BuildMenu("Avene D3D Menu Crossfire 6/9/2012",0,0,180,200,Red,Black,Green,pDevice);
//================================================================================== hack
//MemoryHackHere();
__asm
{
POPAD
JMP retPresentEngine
}
}
VOID *DetourCreate( BYTE *src, CONST BYTE *dst, CONST INT len )
{
BYTE *jmp =( BYTE * ) malloc( len + 5 );
DWORD dwBack;
VirtualProtect( src, len, PAGE_READWRITE, &dwBack );
memcpy( jmp, src, len );
jmp += len;
jmp[0] = 0xE9;
*( DWORD * )( jmp + 1 ) = ( DWORD )( src + len - jmp ) - 5;
src[0] = 0xE9;
*( DWORD * )( src + 1 ) = ( DWORD )( dst - src ) - 5;
for( INT i = 5; i < len; i++ )
src[i] = 0x90;
VirtualProtect( src, len, dwBack, &dwBack );
return( jmp - len );
}
DWORD WINAPI StartRoutine( LPVOID )
{
while( TRUE )
{
if( memcmp( ( VOID * )PresentEngine, ( VOID * )( PBYTE )"\x8B\x51", 2 ) == 0 )
{
Sleep( 100 );
DetourCreate( ( PBYTE )PresentEngine, ( PBYTE )PresentMidfunction, 5 );
}
Sleep( 50 );
}
return 0;
}
BOOL WINAPI DllMain( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
if( dwReason == DLL_PROCESS_ATTACH )
{
DisableThreadLibraryCalls( hDll );
//MessageBox( 0, "Avene D3D Menu", "Crossfire", 0 );
CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)StartRoutine, 0, 0, 0 );
}
return TRUE;
}
[Only admins are allowed to see this link]
pictures
[Only admins are allowed to see this link]
#include <windows.h>
#include <stdio.h>
#include <d3d9.h>
#include <d3dx9.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
#define PresentEngine 0x004C41AF
DWORD retPresentEngine = ( PresentEngine + 0x5 );
#define Red D3DCOLOR_ARGB( 255, 255, 255, 000 )
#define Green D3DCOLOR_ARGB( 255, 000, 255, 000 )
#define Blue D3DCOLOR_ARGB( 255, 000, 000, 255 )
#define Yellow D3DCOLOR_ARGB( 255, 255, 255, 000 )
#define Black D3DCOLOR_ARGB( 255, 000, 000, 000 )
typedef struct{
int index;
char * title;
int *hack;
int hackmaxval;
int hacktype;
DWORD HCOLOR;
}ITEM;
int hackcount;
int selector;
int x,y,w,h;
DWORD COLOR;
ITEM HACKITEM[99];
char hackrval[256];
int xFontOffSet = 15;
int hackopt1;
int MenuHeight = 10;
int show = 0;
int hack1, hack2, hack3;
LPDIRECT3DDEVICE9 pDevice;
LPD3DXFONT Font;
VOID StartFont( LPDIRECT3DDEVICE9 pDevice )
{
if( Font )
{
Font->Release();
Font = NULL;
}
if( !Font )
{
D3DXCreateFont( pDevice,
14,
0,
FW_BOLD,
1,
0,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE,
"Arial",
&Font );
}
}
VOID WriteText(char pString[], INT x, INT y, DWORD color )
{
RECT rect;
SetRect( &rect, x, y, x, y );
Font->DrawText( NULL, pString, -1, &rect, DT_NOCLIP | DT_LEFT, color );
}
void CreateItem(int index, char * title, int *hack, int hackmaxval,int hacktype)
{
hackcount++;
HACKITEM[hackcount].index = index;
HACKITEM[hackcount].hack = hack;
HACKITEM[hackcount].hackmaxval = hackmaxval;
HACKITEM[hackcount].hacktype = hacktype;
WriteText(title, xFontOffSet, index*15,HACKITEM[hackcount].HCOLOR); //If you want to move the menu opts down do something like this (index*15)+20 and to move it left or right just add/subtract from font offset.
}
void RenderMenu()
{
if(GetAsyncKeyState(VK_DOWN)&1)
selector++;
if(GetAsyncKeyState(VK_UP)&1)
if(selector > 1)
selector--;
if (GetAsyncKeyState(VK_RIGHT)<0)
{
for(int i=0;i < (hackcount+1);i++)
{
if(selector == HACKITEM[i].index)
{
if(*HACKITEM[i].hack < HACKITEM[i].hackmaxval)
*HACKITEM[i].hack += 1;
}
}
}
if (GetAsyncKeyState(VK_LEFT)<0)
{
for(int i=0;i < (hackcount+1);i++)
{
if(selector == HACKITEM[i].index)
{
*HACKITEM[i].hack = 0;
Sleep(20);
}
}
}
for(int i=0;i < (hackcount+1);i++)
{
if(selector == HACKITEM[i].index)
HACKITEM[i].HCOLOR = Green;
else
HACKITEM[i].HCOLOR = Red;
}
for(int i=1; i<(hackcount+1); i++)
{
if(HACKITEM[i].hacktype == 0)
{
if(*HACKITEM[i].hack == 1) //to move the opts down do something like this (HACKITEM[i].index*15)+20
WriteText("On", xFontOffSet+100, HACKITEM[i].index*15,Yellow);
else
WriteText("Off", xFontOffSet+100, HACKITEM[i].index*15,Red);
}
}
for(int i=1; i<(hackcount+1); i++)
{
if(HACKITEM[i].hackmaxval >1 && HACKITEM[i].hacktype == 1)
{
sprintf_s(hackrval, "%i", *HACKITEM[i].hack);
WriteText(hackrval, xFontOffSet+100, HACKITEM[i].index*15,Red);
}
}
if(selector < 1)
selector = 1;
if(selector > hackcount)
selector = 1;
hackcount = 0;
}
void BuildMenu(char * menuname, int x, int y, int h, int w, DWORD TITLECOL, DWORD BACKCOLOR, DWORD BORDERCOLOR, LPDIRECT3DDEVICE9 pDevice)
{
if(GetAsyncKeyState(VK_INSERT)&1) show=(!show);
if(!show)
{
WriteText(menuname, 5, 2, TITLECOL);
return;
}
WriteText(menuname, x+10, y+2, TITLECOL);
CreateItem(1,"Player Chams", &hack1, 1, 0);
CreateItem(2,"Asus Wallhack", &hack2, 1, 0);
CreateItem(3,"Fullbright", &hack3, 1, 0);
RenderMenu();
}
/*void MemoryHackHere()
{
//load modules & continue with hacks
if(hack3)
{
}
//do not put sleep()
}
*/
__declspec( naked ) HRESULT WINAPI PresentMidfunction( )
{
static LPDIRECT3DDEVICE9 pDevice;
__asm
{
MOV ECX, DWORD PTR DS:[EAX]
MOV EDX, DWORD PTR DS:[ECX + 0x44]
MOV DWORD PTR DS:[pDevice], EAX
PUSH 0
PUSHAD
}
//================================================================================== font
StartFont( pDevice );
//================================================================================== menu
BuildMenu("Avene D3D Menu Crossfire 6/9/2012",0,0,180,200,Red,Black,Green,pDevice);
//================================================================================== hack
//MemoryHackHere();
__asm
{
POPAD
JMP retPresentEngine
}
}
VOID *DetourCreate( BYTE *src, CONST BYTE *dst, CONST INT len )
{
BYTE *jmp =( BYTE * ) malloc( len + 5 );
DWORD dwBack;
VirtualProtect( src, len, PAGE_READWRITE, &dwBack );
memcpy( jmp, src, len );
jmp += len;
jmp[0] = 0xE9;
*( DWORD * )( jmp + 1 ) = ( DWORD )( src + len - jmp ) - 5;
src[0] = 0xE9;
*( DWORD * )( src + 1 ) = ( DWORD )( dst - src ) - 5;
for( INT i = 5; i < len; i++ )
src[i] = 0x90;
VirtualProtect( src, len, dwBack, &dwBack );
return( jmp - len );
}
DWORD WINAPI StartRoutine( LPVOID )
{
while( TRUE )
{
if( memcmp( ( VOID * )PresentEngine, ( VOID * )( PBYTE )"\x8B\x51", 2 ) == 0 )
{
Sleep( 100 );
DetourCreate( ( PBYTE )PresentEngine, ( PBYTE )PresentMidfunction, 5 );
}
Sleep( 50 );
}
return 0;
}
BOOL WINAPI DllMain( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
if( dwReason == DLL_PROCESS_ATTACH )
{
DisableThreadLibraryCalls( hDll );
//MessageBox( 0, "Avene D3D Menu", "Crossfire", 0 );
CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)StartRoutine, 0, 0, 0 );
}
return TRUE;
}
[Only admins are allowed to see this link]
Thu Sep 06, 2012 7:47 am by alvin-vince
» Undetected DIP Hook
Sat Sep 01, 2012 6:07 pm by alvin-vince
» Deleted Cshell => CF still working ?!
Sat Aug 25, 2012 11:11 am by alvin-vince
» My Base Wall hack working, NoWeaponChangeDelay not working
Fri Aug 24, 2012 7:35 am by alvin-vince
» Why you make a loob for every hack .. i fixed for you try this >>
Fri Aug 24, 2012 7:33 am by alvin-vince
» -[I]fLuX Undetected CrossFire Base after patch
Fri Aug 24, 2012 7:28 am by alvin-vince
» (My First Hack) Simple Hack for CFPH - With Key And Sound
Sun Aug 19, 2012 9:07 am by alvin-vince
» [ New ] Release Glenox Public Cheat v9.2(Alvin-vince)
Sun Aug 19, 2012 8:13 am by alvin-vince
» Mamo`s Hack V1.8 | Wallhack + Fast Knife + OHK Knife ++MORE | Original Sound |
Fri Aug 10, 2012 5:30 pm by alvin-vince