ExclamationUndedected D3D Hook

Posts 1–15 of 22 · Page 1 of 2
Undedected D3D Hook
Main.cpp

Code:
#include "Functions.h"

DWORD ret_myMid;

void D3D(LPDIRECT3DDEVICE9 pDevice)
{
	IDirect3DVertexBuffer9* pStreamData = NULL; 
	UINT iOffsetInBytes,iStride;
	pDevice->GetStreamSource(0,&pStreamData,&iOffsetInBytes,&iStride);

if(iStride ==44 || iStride == 40)
{
			pDevice->SetRenderState(D3DRS_ZENABLE,D3DZB_FALSE);
 }
		
}
_declspec(naked) void MyMid()
{
 static LPDIRECT3DDEVICE9 pDevice;
 __asm 
 {
  mov edi, edi
  push ebp
  mov ebp, esp
  MOV EAX,DWORD PTR [EBP + 0x8]
  MOV pDevice,EAX
 }
 D3D(pDevice);
 _asm
{
JMP ret_myMid 
}
}
void Hacks(void)
{
	DWORD hD3D;  
 do { hD3D = (DWORD)LoadLibraryA("d3d9.dll");} while(!hD3D);
DWORD Address = FindPattern(hD3D, 0x128000,(PBYTE)"PATTERN","MASK"); <- You have to find it shelf in d3d9.dll :D If you find you can Post 
	if(Address)
	{
		ret_myMid = Address + 5;
		DetourCreate((PBYTE)Address,(PBYTE)MyMid,5);
		Beep(750,300);
	}
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
	DisableThreadLibraryCalls(hDll);
	if (dwReason==DLL_PROCESS_ATTACH)
	{
		CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)Hacks, NULL, NULL, NULL);
	}
	return TRUE;
}
Functions.h

Code:
#include <windows.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
#include <fstream>
#include <d3d9.h>
#include <d3dx9.h>
#include <time.h>
#pragma comment (lib,"d3dx9.lib")
#pragma comment (lib,"d3d9.lib")

HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
{
if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED,
ppD3Dtex, NULL)) )
return E_FAIL;
WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
|(WORD)(((colour32>>20)&0xF)<<8)
|(WORD)(((colour32>>12)&0xF)<<4)
|(WORD)(((colour32>>4)&0xF)<<0);
D3DLOCKED_RECT d3dlr;
(*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
WORD *pDst16 = (WORD*)d3dlr.pBits;
for(int xy=0; xy < 8*8; xy++)
*pDst16++ = colour16;
(*ppD3Dtex)->UnlockRect(0);
return S_OK;
}
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 );
}
void MakeCall(BYTE* paddress, DWORD yourfunction, DWORD dwlen)
{
    DWORD dwOldProtect, dwBkup, dwRelAddr;
    VirtualProtect(paddress, dwlen, PAGE_EXECUTE_READWRITE, &dwOldProtect);
    dwRelAddr = (DWORD) (yourfunction - (DWORD) paddress) - 5;
    *paddress = 0xE8;
    *((DWORD*) (paddress + 0x1)) = dwRelAddr;
    for(DWORD x = 0x5; x < dwlen; x++) *(paddress + x) = 0x90;
 VirtualProtect(paddress, dwlen, dwOldProtect, &dwBkup);
    return;
}
void MakeJMP(BYTE *pAddress, DWORD dwJumpTo, DWORD dwLen)
{
    DWORD dwOldProtect, dwBkup, dwRelAddr;
    VirtualProtect(pAddress, dwLen, PAGE_EXECUTE_READWRITE, &dwOldProtect);
    dwRelAddr = (DWORD) (dwJumpTo - (DWORD) pAddress) - 5;
    *pAddress = 0xE9;
    *((DWORD *)(pAddress + 0x1)) = dwRelAddr;
    for(DWORD x = 0x5; x < dwLen; x++) *(pAddress + x) = 0x90;
    VirtualProtect(pAddress, dwLen, dwOldProtect, &dwBkup);
    return;
}
bool bDataCompare(const BYTE* pData,const BYTE* bMask,const char* szMasK)
{
	for(;*szMasK;++szMasK,++pData,++bMask)
	{
		if(*szMasK=='x' && *pData!=*bMask) return false;
	}
	return (*szMasK) == NULL;
}
DWORD FindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMASK,char * szMask)
{
	for(DWORD i=0;i<dwLen;i++)
	{
		if(bDataCompare((BYTE*)(dwAddress+i),bMASK,szMask)) return (DWORD)(dwAddress+i);
	}
	return 0;
}
bool IsGameReadyForHook()
{
	if( GetModuleHandleA( "ClientFX.fxd" ) != NULL && GetModuleHandleA( "CShell.dll" ) != NULL ){return true;}
	return false;
}
Credits : Me(ALL),-IfluX(ASM)
Quote Originally Posted by 6ixth View Post
This hook is not the D3D9?
Of course this d3d9 , But this not hooking for D3D
This CODE is partly a function of D3D remember ( this not hooking for d3d )

HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
{
if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED,
ppD3Dtex, NULL)) )
return E_FAIL;
WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
|(WORD)(((colour32>>20)&0xF)<<8)
|(WORD)(((colour32>>12)&0xF)<<4)
|(WORD)(((colour32>>4)&0xF)<<0);
D3DLOCKED_RECT d3dlr;
(*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
WORD *pDst16 = (WORD*)d3dlr.pBits;
for(int xy=0; xy < 8*8; xy++)
*pDst16++ = colour16;
(*ppD3Dtex)->UnlockRect(0);
return S_OK;
}
Quote Originally Posted by Qmo View Post


Of course this d3d9 , But this not hooking for D3D
This CODE is partly a function of D3D remember ( this not hooking for d3d )

HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
{
if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED,
ppD3Dtex, NULL)) )
return E_FAIL;
WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
|(WORD)(((colour32>>20)&0xF)<<8)
|(WORD)(((colour32>>12)&0xF)<<4)
|(WORD)(((colour32>>4)&0xF)<<0);
D3DLOCKED_RECT d3dlr;
(*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
WORD *pDst16 = (WORD*)d3dlr.pBits;
for(int xy=0; xy < 8*8; xy++)
*pDst16++ = colour16;
(*ppD3Dtex)->UnlockRect(0);
return S_OK;
}
This Is From Menu D3D ^_^
Quote Originally Posted by Qmo View Post


Of course this d3d9 , But this not hooking for D3D
This CODE is partly a function of D3D remember ( this not hooking for d3d )

Thanks very much!
Quote Originally Posted by ayawmanmik View Post
This Is From Menu D3D ^_^
partly a function of D3D
Quote Originally Posted by Qmo View Post


partly a function of D3D
Yap Im using this In All Of My Menu d3d
He stole this one from me
Already reported him

He dont got the pattern & the wrong asm because i manipulated the source before i showed him via Teamviewer

He tried Copy&Paste steal
Quote Originally Posted by Aldimann View Post
He stole this one from me
Already reported him

He dont got the pattern & the wrong asm because i manipulated the source before i showed him via Teamviewer

He tried Copy&Paste steal

HAHA If you want to Steel my Codes !


I say i give you NoFallDmg and Other Source i gave you 2 Source + Unpacked CShell + Unpacked Crossfire.exe and you won*t give me the working one :-D
You tried to steal mine Undetected DIP Hook and blame me?
Shame on you

But I think everyone that CoderCf(vinke) just steal codes etc

Proof that i got mine own look into attachments
Code:
C7 06  ??  ??  ??  ?? 89 86  ??  ??  ??  ?? 89 86
Quote Originally Posted by CoderCf View Post
HAHA If you want to Steel my Codes !


I say i give you NoFallDmg and Other Source i gave you 2 Source + Unpacked CShell + Unpacked Crossfire.exe and you won*t give me the working one :-D
neeewbs ..
thats no full d3d hook every d3d hook is like that you posted just other address and maybe other mid everyone can say search the pointer by yourself but the pointer is the only thing that xtrap will detected... so this isn't helpfully for neewbes
Quote Originally Posted by -[I
fLuX;8140712]thats no full d3d hook every d3d hook is like that you posted just other address and maybe other mid everyone can say search the pointer by yourself but the pointer is the only thing that xtrap will detected... so this isn't helpfully for neewbes
its a FULL d3d hook .. so its helpful for newbs like you
Posts 1–15 of 22 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

Need help?