Results 1 to 10 of 10
  1. #1
    Hungry's Avatar
    Join Date
    Feb 2010
    Gender
    female
    Location
    aus
    Posts
    2
    Reputation
    10
    Thanks
    0

    Talking CF:Simple D3d Hook

    Maybe Usefull for someone making hack.
    Creds:Strife, Fatboy88


    #include <Windows.h>
    #include <d3d9.h>
    #include <detours.h>

    #pragma comment (lib, "d3d9.lib")


    IDirect3DDevice9 * pGameDevice;

    ////////////////
    ///BeginScene///
    ////////////////
    typedef HRESULT(WINAPI* BeginScene_)(LPDIRECT3DDEVICE9 pDevice);
    BeginScene_ pBeginScene;
    HRESULT WINAPI nBeginScene(LPDIRECT3DDEVICE9 pDevice)
    {
    _asm NOP;
    HRESULT hRet = pBeginScene(pDevice);






    return hRet;
    }

    /************************************************** ************************************************/

    //////////////
    ///EndScene///
    //////////////
    typedef HRESULT(WINAPI* EndScene_)(LPDIRECT3DDEVICE9 pDevice);
    EndScene_ pEndScene;
    HRESULT WINAPI nEndScene(LPDIRECT3DDEVICE9 pDevice)
    {

    HRESULT hRet = pEndScene(pDevice);




    return hRet;
    }

    /************************************************** ************************************************/

    //////////////////////////
    ///DrawIndexedPrimitive///
    //////////////////////////
    typedef HRESULT(WINAPI* DrawIndexedPrimitive_)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex,
    UINT NumVertices, UINT StartIndex, UINT PrimitiveCount);
    DrawIndexedPrimitive_ pDrawIndexedPrimitive;
    HRESULT WINAPI nDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex,
    UINT NumVertices, UINT StartIndex, UINT PrimitiveCount)
    {


    {

    pDevice->SetRenderState( D3DRS_FOGENABLE, false );//useless engine has it set to 0 Tablefog is on tho


    }



    IDirect3DVertexBuffer9* pStreamData = NULL;

    UINT iOffsetInBytes,iStride;

    pDevice->GetStreamSource(0,&pStreamData,&iOffsetInBytes, &i Stride);

    if ( iStride == 40 )


    {


    pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
    pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER );


    }






    return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimitiveCount);


    }

    /************************************************** ************************************************/

    /////////////////////
    ///SetStreamSource///
    /////////////////////
    typedef HRESULT(WINAPI* SetStreamSource_)(LPDIRECT3DDEVICE9 pDevice, UINT StreamNumber, IDirect3DVertexBuffer9 * pStreamData, UINT OffsetInBytes, UINT Stride);
    SetStreamSource_ pSetStreamSource;
    HRESULT WINAPI nSetStreamSource(LPDIRECT3DDEVICE9 pDevice, UINT StreamNumber, IDirect3DVertexBuffer9 * pStreamData, UINT OffsetInBytes, UINT Stride)
    {
    _asm NOP;
    HRESULT hRet = pSetStreamSource(pDevice, StreamNumber, pStreamData, OffsetInBytes, Stride);

    return hRet;
    }

    /************************************************** ************************************************/

    ///////////
    ///Reset///
    ///////////
    typedef HRESULT(WINAPI* Reset_)(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
    Reset_ pReset;
    HRESULT WINAPI nReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
    {
    _asm NOP;
    HRESULT hRet = pReset(pDevice, pPresentationParameters);

    return hRet;
    }

    /************************************************** ************************************************/


    DWORD dwWait(LPVOID lpArgs)
    {

    DWORD Base = NULL;

    for (;Base == NULL;Sleep(100))
    Base = (DWORD)GetModuleHandle("crossfire.exe");

    for(;pGameDevice == NULL; Sleep(10000))
    {
    DWORD dwProtect;
    VirtualProtect((void*)(0x70A440), 4, PAGE_EXECUTE_READWRITE, &dwProtect);
    memcpy(&pGameDevice, (void*)(0x70A440), 4);
    VirtualProtect((void*)(0x70A440), 4, dwProtect, NULL);
    }




    DWORD* pdwNewDevice = *(DWORD**)pGameDevice;
    pdwNewDevice = (DWORD*)pdwNewDevice[0]; //turn our pointer into an array for the vtable*/


    // pReset = (Reset_)DetourFunction((PBYTE)pdwNewDevice[16],(PBYTE)nReset);
    // pBeginScene = (BeginScene_)DetourFunction((PBYTE)pdwNewDevice[41],(PBYTE)nBeginScene);
    pEndScene = (EndScene_)DetourFunction((PBYTE)pdwNewDevice[42],(PBYTE)nEndScene);
    // pDrawIndexedPrimitive = (DrawIndexedPrimitive_)DetourFunction((PBYTE)pdwNe wDevice[82],(PBYTE)nDrawIndexedPrimitive);
    // pSetStreamSource = (SetStreamSource_)DetourFunction((PBYTE)pdwNewDevi ce[100],(PBYTE)nSetStreamSource);

    return 0;
    }

    bool WINAPI DllMain(HMODULE hMod, DWORD dwReason, LPVOID lpReserved)
    {
    if(dwReason == DLL_PROCESS_ATTACH)
    {

    CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)dwWait, NULL, NULL, NULL);

    return true;
    }

    return false;
    }

  2. #2
    AsianNick's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Location
    San Diego, CA
    Posts
    617
    Reputation
    14
    Thanks
    97
    My Mood
    Amused
    There's a coding section for this and anyone who wants to compile it

    Bloodshed ftw

  3. #3
    HowHate's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Under the rock
    Posts
    1,342
    Reputation
    11
    Thanks
    234
    My Mood
    Angelic
    Upload the DLL not the source code lol!
    enjoy please


  4. #4
    konefke's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Florence, Italy
    Posts
    49
    Reputation
    10
    Thanks
    9
    My Mood
    Tired
    Quote Originally Posted by HowHate View Post
    Upload the DLL not the source code lol!
    agree 100%.
    **__ ghost_mode for minion __**

  5. #5
    CrossRaiders's Avatar
    Join Date
    May 2009
    Gender
    male
    Posts
    1,586
    Reputation
    29
    Thanks
    1,214
    Quote Originally Posted by HowHate View Post
    Upload the DLL not the source code lol!
    Quote Originally Posted by konefke View Post
    agree 100%.
    I agree 101% Lol

  6. #6
    Amy_x's Avatar
    Join Date
    Jan 2010
    Gender
    female
    Location
    Right behind you!
    Posts
    307
    Reputation
    10
    Thanks
    16
    My Mood
    Chatty
    This needs in the coding section
    I should say nice work..
    But i dnt get a fuck of this XD

  7. #7
    buraks's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    mpgh.Net
    Posts
    270
    Reputation
    10
    Thanks
    15
    My Mood
    Angelic
    *gives Amy a headshot* good enough? LOL

  8. #8
    icones's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    163
    Reputation
    12
    Thanks
    231
    My Mood
    Aggressive
    upload is dll please

  9. #9
    lukekis015's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Posts
    6
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by icones View Post
    upload is dll please
    i agree 250%

  10. #10
    TaBz3's Avatar
    Join Date
    Jun 2009
    Gender
    female
    Posts
    836
    Reputation
    12
    Thanks
    782

    Talking

    Quote Originally Posted by abel09 View Post
    I agree 101% Lol
    102% :P

Similar Threads

  1. [Request] Most simple d3d hook
    By Lyoto Machida in forum C++/C Programming
    Replies: 4
    Last Post: 07-09-2011, 08:07 PM
  2. WR D3D Hook - =o - 09/21/07
    By Dave84311 in forum Hack/Release News
    Replies: 26
    Last Post: 05-16-2008, 04:01 PM
  3. WR D3D Hook - =o - 03/22/07
    By Dave84311 in forum Hack/Release News
    Replies: 14
    Last Post: 10-06-2007, 09:59 AM
  4. WR D3D Hook Updated to include Punkbuster Hardware Bypass!
    By Dave84311 in forum Hack/Release News
    Replies: 3
    Last Post: 10-05-2007, 01:33 AM
  5. D3D hooking tutorial 5 i think
    By llvengancell in forum WarRock - International Hacks
    Replies: 7
    Last Post: 06-26-2007, 03:09 PM