.
This way is 1 on 1000 ways to do that. with basic assembly knowledge you can do this.
Code:DWORD dw_PresentStart = 0x004FB0BF; //8b 51 44 6a 00 6a 00 6a 00 50 ff d2 b8 ?? ?? ?? ?? DWORD dw_PresentReturn = ( dw_PresentStart + 0x03 ); void WINAPI startMainRender( LPDIRECT3DDEVICE9 pDevice ) { pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE ); //Your d3d stuffs... pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE ); } __declspec( naked ) HRESULT WINAPI hk_PresentEngine( void ) { __asm { mov edx, [ ecx + 0x44 ] pushad push eax call startMainRender popad jmp dw_PresentReturn } } DWORD WINAPI dwWriteHook( void *lpParameter ) { while( memcmp( ( void * ) dw_PresentStart, ( void * ) "\x8B\x51\x44", 3 ) ) Sleep( 500 ); DWORD dw_ProperAddress = NULL; for( int i = 0; !dw_ProperAddress; i++ ) if( !memcmp( ( void * ) ( dw_PresentStart + i ), ( void * ) "\xC3\xCC", 2 ) ) dw_ProperAddress = ( dw_PresentStart + i + 0x01 ); *( BYTE * ) ( dw_ProperAddress + 0x00 ) = 0xE9; *( DWORD * ) ( dw_ProperAddress + 0x01 ) = ( ( DWORD ) hk_PresentEngine - dw_ProperAddress ) - 5; *( BYTE * ) ( dw_PresentStart + 0x00 ) = 0xEB; *( BYTE * ) ( dw_PresentStart + 0x01 ) = 0x37; *( BYTE * ) ( dw_PresentStart + 0x02 ) = 0x90; return 0; }