DIP / Present / SetTransform Mid Functions

Posts 1–3 of 3 · Page 1 of 1
DIP / Present / SetTransform Mid Functions
DIP:

Found at: 0x7241A2E0

Code:
DWORD DIPRet;
__declspec(naked) void myMidDip()
{
	static LPDIRECT3DDEVICE9 pDevice;
	static D3DPRIMITIVETYPE pType;
	static D3DPRIMITIVETYPE nBaseVertIndex;
	static D3DPRIMITIVETYPE nMinIndex;
	static D3DPRIMITIVETYPE nNumVertices;
	static D3DPRIMITIVETYPE nStartIndex;
	static D3DPRIMITIVETYPE nPrimitiveCount;

	__asm mov dword ptr ss:[ebp-10],esp; //Replace Code

	__asm mov esi, dword ptr ss:[ebp+0x8]; //Move esi to real device
	__asm mov pDevice esi; //Move Device to esi

	__asm mov esi, dword ptr ss:[ebp+0x0C]; //Move esi to real type
	__asm mov pType, esi; //Move Type to esi

	__asm mov esi, dword ptr ss:[ebp+0x10]; //Move esi to real basevertind
	__asm mov nBaseVertIndex, esi; //Move BaseVertind to esi

	__asm mov esi, dword ptr ss:[ebp+0x14]; //Move esi to real minind
	__asm mov nMinIndex, esi; //Move MinInd to esi

	__asm mov esi, dword ptr ss:[ebp+0x18]; //Move esi to real numvert
	__asm mov nNumVertices, esi; //Move NumVert to esi

	__asm mov esi, dword ptr ss:[ebp+0x1C]; //Move esi to real device
	__asm mov nStartIndex, esi; //Move StartInd to esi

	__asm mov esi, dword ptr ss:[ebp+0x20]; //Move esi to real primitivc
	__asm mov nPrimitiveCount,esi; //Move PrimCount to esi

	if(pDevice)
		myDIP(pDevice,pType,nBaseVertIndex,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount); //Call real DIP

	__asm jmp DIPRet; //jmp to hook
}
--------------------------------------------

Present:

Found at: 0x7246589E

Code:
DWORD PresRet;
__declspec(naked) void myMidPresent()
{
	static LPDIRECT3DDEVICE9 pDevice;

	__asm mov dword ptr ss:[ebp-10],esp; //Replace Code

	__asm mov esi, dword ptr ss:[ebp+0x8];  //Move esi to real device
	__asm mov pDevice, esi; //Move Device to esi

	if(pDevice)
		myPresent(pDevice); //Call Real Present

	__asm jmp PresRet; //jmp to hook
}

--------------------------------------------

SetTransform:

Found at: 0x72417592

Code:
DWORD TransRet;
__declspec(naked) void myMidTranSform()
{
	static LPDIRECT3DDEVICE9 pDevice;
	static D3DTRANSFORMSTATETYPE pState; 
	static D3DMATRIX* pMatrix;

	__asm mov dword ptr ss:[ebp-10],esp; //Replace Code

	__asm mov esi, dword ptr ss:[ebp+0x8]; //Move esi to real device
	__asm mov pDevice, esi; //Move Device to esi

	__asm mov eax, dword ptr ss:[ebp-0xC]; //Move esi to real state
	__asm mov pState, eax; //Move State to esi

	__asm mov eax, dword ptr ss:[ebp-0x18]; //Move esi to real matrix
	__asm mov pMatrix, eax; //Move Matrix to esi

	if(pDevice)
		mySetTransform(pDevice,pState,pMatrix);//Call Real SetTransform

	__asm jmp TransRet; //jmp to hook
}

--------------------------------------------
--------------------------------------------
--------------------------------------------

HOOK:

Code:
//---------------------------
//Call D3d9 ecc ecc
// do {
// D3d9Dll = GetModuleHandle ( .....
// } while ......
//
//

DWORD PresHook    = ( vTable[17] + 0x7 );
DWORD TransHook  = ( vTable[44] + 0x2D );
DWORD DipHook       = ( vTable[82] + 0x2A );

PresRet     = DetouringFunction( ( BYTE* ) PresHook   , ( BYTE * ) myMidPres, 5 );
TransRet    = DetouringFunction( ( BYTE* ) TransHook , ( BYTE * ) myMidTranSform, 5 );
DipRet       = DetouringFunction( ( BYTE* ) PresHook   , ( BYTE * ) myMidDip, 5 );
Thank me is you use it.
Nice Assembly Pro !
Can u make a hook for Reset ?
And works the Present hook on windows xp or only vista & 7 ?
Reset Found at: 0x732D7345

Code:
DWORD ResetRet;
__declspec(naked) void myMidReset()
{
	static LPDIRECT3DDEVICE9 pDevice;
	static D3DPRESENT_PARAMETERS* pPresentationParameters; 

	__asm mov dword ptr ss:[ebp-10],esp; //Replace Code

	__asm mov esi, dword ptr ss:[ebp+0x8]; //Move esi to real device
	__asm mov pDevice, esi; //Move Device to esi

	__asm mov eax, dword ptr ss:[ebp-0xC]; //Move esi to real state
	__asm mov pPresentationParameters, eax; //Move State to esi

	__asm jmp ResetRet; //jmp to hook
}
Code:
DWORD ResetHook = ( vTable[16] + 0xD );

ResetRet     = DetouringFunction( ( BYTE* ) ResetHook   , ( BYTE * ) myMidReset, 5 );
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us