detour

Posts 1–15 of 18 · Page 1 of 2
detour
can anyone teach me how to make a detour or have a detour i can use?
im getting so many errors... it says the arguments for getModuleHandle has to be lpcwstr but we r inputing a const char...

if( GetModuleHandle( "Kernel32.dll" ) != NULL
&& GetModuleHandle( "d3d9.dll" ) != NULL
&& GetModuleHandle( "Engine.exe" ) != NULL
&& GetModuleHandle( "CShell.dll" ) != NULL
&& GetModuleHandle( "Clientfx.fxd" ) != NULL )

i get error at all the underlined... im getting like 30 errors idk what to do

- - - Updated - - -

hey can you take a look at the code you sent me? i dont know how to fix the errors...
Quote Originally Posted by brohizi View Post
im getting so many errors... it says the arguments for getModuleHandle has to be lpcwstr but we r inputing a const char...

if( GetModuleHandle( "Kernel32.dll" ) != NULL
&& GetModuleHandle( "d3d9.dll" ) != NULL
&& GetModuleHandle( "Engine.exe" ) != NULL
&& GetModuleHandle( "CShell.dll" ) != NULL
&& GetModuleHandle( "Clientfx.fxd" ) != NULL )

i get error at all the underlined... im getting like 30 errors idk what to do

- - - Updated - - -

hey can you take a look at the code you sent me? i dont know how to fix the errors...
wow thank you

- - - Updated - - -

i still need to find a detour... i couldnt find one that wouldnt give me errors

- - - Updated - - -

tpresent becomes unidentified when i put a different detour in...
Quote Originally Posted by brohizi View Post
wow thank you

- - - Updated - - -

i still need to find a detour... i couldnt find one that wouldnt give me errors

- - - Updated - - -

tpresent becomes unidentified when i put a different detour in...
You are making something wrong, the detours posted don´t have errors
LPVOID 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] = '\xE9';
*(DWORD*)(jmp + 1) = (DWORD)(src + len - jmp) - 5;

src[0] = '\x90';
src[1] = '\xD1';
src[2] = '\xC8';
src[3] = '\x85';
src[4] = '\xC0';
src[5] = '\xE9';

*(DWORD*)(&src[6]) = (DWORD)(dst - src) - 10;
for (INT i = 10; i < len; i++) src[i] = 0x90;
VirtualProtect(src, len, dwBack, &dwBack);

return (jmp - len);
}

LPVOID 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] = '\xE9';
*(DWORD*)(jmp + 1) = (DWORD)(src + len - jmp) - 5;

src[0] = '\xD1';
src[1] = '\xC8';
src[2] = '\x85';
src[3] = '\xC0';
src[4] = '\x90';
src[5] = '\xE9';

*(DWORD*)(&src[6]) = (DWORD)(dst - src) - 10;
for (INT i = 10; i < len; i++) src[i] = 0x90;
VirtualProtect(src, len, dwBack, &dwBack);

return (jmp - len);
}

LPVOID 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] = '\xE9';
*(DWORD*)(jmp + 1) = (DWORD)(src + len - jmp) - 5;

src[0] = '\xD1';
src[1] = '\xC8';
src[2] = '\x90';
src[3] = '\x85';
src[4] = '\xC0';
src[5] = '\xE9';

*(DWORD*)(&src[6]) = (DWORD)(dst - src) - 10;
for (INT i = 10; i < len; i++) src[i] = 0x90;
VirtualProtect(src, len, dwBack, &dwBack);

return (jmp - len);
}


this is the detour im using... i get errors... i just paste this in to the detour.h and build it but then it gives me errors about tpresent in main.cpp...
the only error i get in detour.h is: function 'LPVOID DetourCreate(BYTE *,const BYTE *,const INT)' already has a body line 30
You already have a detours with name DetourCreate
Just rename do DetourCreate2, DetourCreate3..
more errors!!

term does not evaluate to a function taking 5 arguments line 100
syntax error : missing ';' before identifier 'DetourCreate' line 105
syntax error : missing ';' before identifier 'oPresent' line 12
'DeviceIndex': identifier not found 105
missing type specifier - int assumed. Note: C++ does not support default-int line 12
expected a ';' 105
identifier "tPresent" is undefined line 12
identifier "tPresent" is undefined line 105

code:

#include "others.h"
#include "detours.h"

int names, cross, caixa, distance, kill;

bool nxchams, menu = true;

tPresent oPresent;

VOID MEMCPY( LPVOID ADDR, LPVOID byte, INT size )
{
DWORD dwBack;
VirtualProtect( ( LPVOID )ADDR, size, PAGE_EXECUTE_READWRITE, &dwBack );
memcpy( ( LPVOID )ADDR, byte, size );
VirtualProtect( ( LPVOID )ADDR, size, dwBack, &dwBack );
}

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 Funcs(LPDIRECT3DDEVICE9 pDevice)
{
AddKey (VK_F5, names);
AddKey (VK_F6, caixa);
AddKey (VK_F7, distance);
AddKey (VK_F8, cross);
AddKey (VK_F9, kill);

TeleKillFull(kill, pDevice);

Esp(caixa, distance, names, pDevice);

if (cross)
{
D3DVIEWPORT9 Viewport;
pDevice->GetViewport(&Viewport);
DrawBox(Viewport.Width / 2 - 23, Viewport.Height / 2, 50, 5, TBlack,TBlack, pDevice);
DrawBox(Viewport.Width / 2, (Viewport.Height / 2) - 23, 5, 50,TBlack,TBlack, pDevice);
}
}

void Menu(LPDIRECT3DDEVICE9 pDevice)
{

Funcs(pDevice);

if (GetAsyncKeyState(VK_INSERT)&1)
menu =! menu;

if ( menu )
{
DrawBox(PosX,PosY - 5,105,20,TBlack,Red,pDevice); // title
WriteText( pDevice, PosX + 14, PosY, Red, "Coder.Fail v0.1");

DrawBox(PosX,PosY + 20,105,115,TBlack,Red,pDevice); // menu

AddItem("Box", caixa, 0, pDevice);
AddItem("Distance", distance, 15, pDevice);
AddItem("Names", names, 30, pDevice);
AddItem("CrossHair", cross, 45, pDevice);
AddItem("TeleKill", kill, 60, pDevice);
}
}

HRESULT WINAPI hkPresent(LPDIRECT3DDEVICE9 pDevice, const RECT *a, const RECT *b, HWND c, const RGNDATA *d)
{
{
StartFont(pDevice);
pDrawPrimitive = *(CILTDrawPrim **)DrawPrimitive;

Menu(pDevice);
}

return oPresent(pDevice, a, b, c, d);
}

VOID Hook(void)
{
oPresent = (tPresent) DetourCreate((BYTE*) DeviceIndex(17), (BYTE*) hkPresent, 10);
}

bool IsGameReady( void )
{
if( GetModuleHandle( "Kernel32.dll" ) != NULL
&& GetModuleHandle( "d3d9.dll" ) != NULL
&& GetModuleHandle( "Engine.exe" ) != NULL
&& GetModuleHandle( "CShell.dll" ) != NULL
&& GetModuleHandle( "Clientfx.fxd" ) != NULL )
return true;

return false;
}

DWORD WINAPI Bypass( LPVOID lpArgs )
{

while( memcmp( ( CONST VOID * )ADDR_BYPASS, ( CONST VOID * )"\x0F\x84\xB4\x00\x00\x00", 6 ) != 0 )
Sleep(100);

MEMCPY( ( LPVOID )ADDR_BYPASS, "\xE9\x19\x01\x00\x00\x90", 6 );

while( !IsGameReady() )
Sleep( 25 );

Hook();

return 0;
}

BOOL WINAPI DllMain( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
if( dwReason == DLL_PROCESS_ATTACH )
{
DisableThreadLibraryCalls( hDll );
MessageBox( 0, "Simple CANA", "CombatArms", 0 );
CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)&Bypass, 0, 0, 0 );
}

return TRUE;
}
Man, learn a basic of c++
Quote Originally Posted by brohizi View Post
i have learned
Learn more, if you know a basic of c++, you solve it all
i solved it all but it crashed when i injected it...
Quote Originally Posted by brohizi View Post
i solved it all but it crashed when i injected it...
If the hack crashed, you didn´t solved
well... time to search

- - - Updated - - -

idk what to do... how do i fix?
Posts 1–15 of 18 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us