#include <windows.h>
#include <d3d9.h>
#include "detours.h"
#pragma comment(lib,"detours.lib")
#pragma comment(lib,"d3d9.lib")
typedef HRESULT(__stdcall* Real_EndScene)(LPDIRECT3DDEVICE9);
Real_EndScene oEndScene = NULL;
const D3DCOLOR textRed = D3DCOLOR_ARGB(255, 255, 0, 0);
void DrawRect (LPDIRECT3DDEVICE9 pDevice, int X, int Y, int L, int H, D3DCOLOR color)
{
D3DRECT rect = {X, Y, X+L, Y+H};
pDevice->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0);
}
HRESULT __stdcall hook_EndScene(LPDIRECT3DDEVICE9 pDevice)
{
DrawRect(pDevice, 10, 10, 20, 20, textRed);
return oEndScene(pDevice);
}
void Hook()
{
while(!GetModuleHandle("d3d9.dll"))
{
Sleep(100);
}
while( *(DWORD*)0x4FE571B0 == 0)
{
Sleep(100);
}
MessageBox(NULL,L"Hooked",L"Successful",0);
oEndScene = (Real_EndScene)DetourFunction((PBYTE)0x4FE571B0,(PBYTE)hook_EndScene);
}
bool __stdcall DllMain(HINSTANCE hInstance,DWORD reason, void* useless)
{
if(reason == DLL_PROCESS_ATTACH)
{
CreateThread(0,0,(LPTHREAD_START_ROUTINE)Hook,0,0,0);
}
if(reason == DLL_PROCESS_DETACH)
{
}
return true;
}
DWORD *VirtualTable;
while(*(DWORD*)0x06737268 == NULL)
{
Sleep(1000);
}
pDevice = *(IDirect3DDevice9**)0x06737268; //673BAE8;
VirtualTable = **(DWORD***)0x06737268; //673BAE8;

pDevice = *(IDirect3DDevice9**)0x06737268; //673BAE8; VirtualTable = **(DWORD***)0x06737268; //673BAE8;
DWORD *pDevice;
#include <windows.h>
#include <d3d9.h>
#include "detours.h"
#pragma comment(lib,"detours.lib")
#pragma comment(lib,"d3d9.lib")
DWORD *pDevice = *(IDirect3DDevice9**)0x4FE571B0;
DWORD *VirtualTable = **(DWORD***)0x4FE571B0;
typedef HRESULT(__stdcall* Real_EndScene)(LPDIRECT3DDEVICE9);
Real_EndScene oEndScene = NULL;
const D3DCOLOR textRed = D3DCOLOR_ARGB(255, 255, 0, 0);
void DrawRect (LPDIRECT3DDEVICE9 pDevice, int X, int Y, int L, int H, D3DCOLOR color)
{
D3DRECT rect = {X, Y, X+L, Y+H};
pDevice->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0);
}
HRESULT __stdcall hook_EndScene(LPDIRECT3DDEVICE9 pDevice)
{
DrawRect(pDevice, 10, 10, 20, 20, textRed);
if(GetAsyncKeyState(VK_INSERT))
{pDevice-> SetRenderState (D3DRS_FILLMODE, D3DFILL_SOLID);}
if(GetAsyncKeyState(VK_CONTROL))
{pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);}
return oEndScene(pDevice);
}
void Hook()
{
while(!GetModuleHandle("d3d9.dll"))
{
Sleep(100);
}
while( *(DWORD*)0x4FE571B0 == 0) //Device Pointer
{
Sleep(100);
}
MessageBox(NULL,"Hooked","Successful",0);
oEndScene = (Real_EndScene)DetourFunction((PBYTE)VirtualTable[42],(PBYTE)hook_EndScene); //42 for EndScene
}
bool __stdcall DllMain(HINSTANCE hInstance,DWORD reason, void* useless)
{
if(reason == DLL_PROCESS_ATTACH)
{
CreateThread(0,0,(LPTHREAD_START_ROUTINE)Hook,0,0,0);
}
if(reason == DLL_PROCESS_DETACH)
{
}
return true;
}
#include <windows.h>
#include <d3d9.h>
#include "detours.h"
#pragma comment(lib,"detours.lib")
#pragma comment(lib,"d3d9.lib")
IDirect3DDevice9 *pDevice;
DWORD *VirtualTable;
typedef HRESULT(__stdcall* Real_EndScene)(LPDIRECT3DDEVICE9);
Real_EndScene oEndScene = NULL;
const D3DCOLOR textRed = D3DCOLOR_ARGB(255, 255, 0, 0);
void DrawRect (LPDIRECT3DDEVICE9 pDevice, int X, int Y, int L, int H, D3DCOLOR color)
{
D3DRECT rect = {X, Y, X+L, Y+H};
pDevice->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0);
}
HRESULT __stdcall hook_EndScene(LPDIRECT3DDEVICE9 pDevice)
{
DrawRect(pDevice, 10, 10, 20, 20, textRed);
if(GetAsyncKeyState(VK_INSERT))
{pDevice-> SetRenderState (D3DRS_FILLMODE, D3DFILL_SOLID);}
if(GetAsyncKeyState(VK_CONTROL))
{pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);}
return oEndScene(pDevice);
}
void Hook()
{
while(!GetModuleHandle("d3d9.dll"))
{
Sleep(100);
}
while( *(DWORD*)0x4FE571B0 == 0) //Device Pointer
{
Sleep(100);
}
pDevice = *(IDirect3DDevice9**)0x4FE571B0;
VirtualTable = **(DWORD***)0x4FE571B0;//or *(DWORD**)pDevice; if you prefer.
MessageBox(NULL,"Hooked","Successful",0);
oEndScene = (Real_EndScene)DetourFunction((PBYTE)VirtualTable[42],(PBYTE)hook_EndScene); //42 for EndScene
}
bool __stdcall DllMain(HINSTANCE hInstance,DWORD reason, void* useless)
{
if(reason == DLL_PROCESS_ATTACH)
{
CreateThread(0,0,(LPTHREAD_START_ROUTINE)Hook,0,0,0);
}
if(reason == DLL_PROCESS_DETACH)
{
}
return true;
}
VirtualTable = *(IDirect3DDevice9**)0x4FE571B0;