A function to find d3d8/d3d9 device pointer
DWORD_PTR * FindDevice(VOID)
{
DWORD Base = (DWORD)LoadLibraryW(L"d3d8.dll");
for(DWORD i = 0; i < 0x128000; i++ )
{
if ( (*(BYTE *)(Base+i+0x00))==0xC7
&& (*(BYTE *)(Base+i+0x01))==0x06
&& (*(BYTE *)(Base+i+0x06))==0x89
&& (*(BYTE *)(Base+i+0x07))==0x86
&& (*(BYTE *)(Base+i+0x0C))==0x89
&& (*(BYTE *)(Base+i+0x0D))==0x86 )
return (DWORD_PTR *)(Base + i + 2);
}
return NULL;
}
How To Use
DWORD_PTR * VtablePtr = FindDevice();
if (VtablePtr = NULL )
{
MessageBoxW(L"Device Not Found !",0,0,0);
ExitProcess(0); //or it will crash anyway
}
DWORD_PTR * VTable ;
*(DWORD_PTR *)&VTable = *(DWORD_PTR *)VtablePtr;
//and then
Vtable[35];//endscene