Results 1 to 3 of 3
  1. #1
    DirecTX_'s Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    99
    Reputation
    66
    Thanks
    51
    My Mood
    Daring

    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.
    Last edited by DirecTX_; 11-22-2011 at 02:29 PM.

  2. The Following 3 Users Say Thank You to DirecTX_ For This Useful Post:

    n4n033 (11-22-2011),R3dLine (11-22-2011),TetrisHero (02-04-2017)

  3. #2
    Mr.CyberRazzer's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    Nice Assembly Pro !
    Can u make a hook for Reset ?
    And works the Present hook on windows xp or only vista & 7 ?

  4. #3
    DirecTX_'s Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    99
    Reputation
    66
    Thanks
    51
    My Mood
    Daring
    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 );
    Last edited by DirecTX_; 11-23-2011 at 02:11 PM.

Similar Threads

  1. [Help] Mid-Hook Function Help [Solved]
    By 258456 in forum C++/C Programming
    Replies: 34
    Last Post: 11-15-2011, 10:43 AM
  2. [Help] Mid function hook
    By giniyat202 in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 17
    Last Post: 08-07-2011, 04:33 AM
  3. [Release] DIP Mid-Func Hook
    By MasterXxX in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 2
    Last Post: 08-02-2011, 10:11 AM
  4. Hook Function for DIP?
    By ipwnuuaal5 in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 12
    Last Post: 08-06-2010, 03:52 AM
  5. Late birthday present
    By Dave84311 in forum General
    Replies: 6
    Last Post: 07-11-2010, 07:14 AM