DX9 Hook by ~FALLEN~
Should be undetected, don't know, haven't used this in a while. Have fun (: *Yes you can port this to d3d8 if you know how*
Tools : Ollydbg & IDA
Credits : ~FALLEN~
Coded in : C++
Tools : Ollydbg & IDA
Credits : ~FALLEN~
Coded in : C++
Code:
struct sStack
{
sStack* PreviousStack;
DWORD ReturnAddress;
void* Arguments[ 127 ];//Maximum number of arguments to pass to a function
};
DWORD SCPtr = 0;//Table[19]
DWORD SCRet = 0;//On xp - Start of EndScene Function + 0xB9 - Vista / 7 - Start of EndScene Function + 0x9E
void __fastcall hkSceneCapture( void* ECX, void* EDX, signed int Capture )
{
IDirect3DDevice9* pDevice;//Device interface pointer
sStack* Stack;//Stack handling structure
__asm
{
MOV Stack, ESP
pushad//Preserve all General-Registers
pushfd//Preserve EFlags
}
if( Stack->ReturnAddress == SCRet )
{
if( ( pDevice = Stack->PreviousStack->Arguments[ 0 ] ) != NULL )
{
//DoShit
}
}
__asm
{
popfd//Restore EFlags
popad//Restore All General-Registers
}
return ( ( void( __thiscall* )( void*, signed int ) SCPtr )( ThisPtr, Capture );//Give control back to SceneCapture
}
DWORD Table = FindPattern( D3DModuleHandle, 0x105000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\xC7\x46\x00\x0B\x00\x00\x00\x8B\xC6" ), "xx????xx?x???xx" );//CD3DDIDX7 SCPtr = this[19]


