Results 1 to 4 of 4
  1. #1
    blaztphoenix's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Posts
    8
    Reputation
    10
    Thanks
    0

    How to make a hook for d3d9 hack game

    Hello there,
    I have some problem with hooking game, and i dunno how make a hook for my D3D menu,
    coz my menu did'nt work on my game... i guess maybe the hook has not work again,
    i want to ask how to find new hook and make hook in c++ ...

    Thanks before

  2. #2
    topblast's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Far from around you Programmer: C++ | VB | C# | JAVA
    Posts
    3,607
    Reputation
    149
    Thanks
    5,053
    My Mood
    Cool
    I have to ask, are you looking for a new way to hook or are you just looking for a new detour function?

    Often people mistake these things, a new detour function might just be using different operands instead of just "JMP [distance]" and a new hook might use your old detour function but maybe unhook sometimes and rehook or hook a different part of the desired function.

    Also your game could have an anti cheat system that could interfere with the hooking process.
    I just like programming, that is all.

    Current Stuff:

    • GPU Programmer (Cuda)
    • Client/Server (Cloud Server)
    • Mobile App Development

  3. #3
    Fakentc's Avatar
    Join Date
    Jun 2014
    Gender
    male
    Posts
    12
    Reputation
    10
    Thanks
    6
    My Mood
    Bored
    perhaps the game protection that is not letting you hookar it, tried to use the same in some other game?, you bypasseou protection?, what protection is?, x-trap?

     

    Code:
    HRESULT __stdcall nReset ( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters );
    typedef HRESULT ( APIENTRY* Reset_t ) ( LPDIRECT3DDEVICE8 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters );
    Reset_t pReset;
    
    
    HRESULT __stdcall nPresent ( LPDIRECT3DDEVICE9 pDevice,CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion );
    typedef HRESULT ( APIENTRY* Present_t)( LPDIRECT3DDEVICE9 pDevice,CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion );
    Present_t pPresent;
    
    
    
    HRESULT __stdcall nReset ( LPDIRECT3DDEVICE9 pDevice , D3DPRESENT_PARAMETERS* pPresentationParameters )
    {
    _asm PUSHAD;
    
    Tools.AddLog("Hook Reset\n");
    
    _asm POPAD;
    
    return pReset(pDevice, pPresentationParameters);
    }
    
    
    
    HRESULT __stdcall nPresent ( LPDIRECT3DDEVICE9 pDevice,CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion )
    {
    _asm PUSHAD;
    
    Tools.AddLog("Hook Present\n");
    
    _asm POPAD;
    
    return pPresent (pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
    }
    
    
    DWORD_PTR * Hook :: FindDevice ( DWORD Base, DWORD Len )
    {
    unsigned long i = 0, n = 0;
    
    for( i = 0; i < Len; i++ )
    {
    if(*(BYTE *)(Base+i+0x00)==0xC7)n++;
    if(*(BYTE *)(Base+i+0x01)==0x06)n++;
    if(*(BYTE *)(Base+i+0x06)==0x89)n++;
    if(*(BYTE *)(Base+i+0x07)==0x86)n++;
    if(*(BYTE *)(Base+i+0x0C)==0x89)n++;
    if(*(BYTE *)(Base+i+0x0D)==0x86)n++;
    if( n == 6 ) return ( DWORD_PTR * ) ( Base + i + 2 ); n = 0;
    }
    return(0);
    }
    
    
    int __fastcall StaticHook ( void )
    {
    
    HMODULE hD3D9Dll;
    do{
    Tools.AddLog("%s - Loading d3d9.dll->",Tools.AddTime());
    hD3D9Dll = GetModuleHandle("d3d9.dll");
    Sleep(20);
    Tools.AddLog("OK!\n");
    } while(!hD3D9Dll);
    
    Tools.AddLog("%s - Enable Device d3d9->",Tools.AddTime());
    DWORD_PTR * VtablePtr = cHook.FindDevice((DWORD)hD3D9Dll,0x128000);
    Tools.AddLog("OK!\n");
    
    if ( VtablePtr == NULL )
    {
    MessageBox(NULL,"Device Not Found !! Please try again",0,MB_ICONSTOP);
    ExitProcess(TRUE);
    }
    
    Tools.AddLog("%s - Type Device->",Tools.AddTime());
    DWORD_PTR* VTable = 0;
    *(DWORD_PTR*)&VTable = *(DWORD_PTR *)VtablePtr;
    Tools.AddLog("OK!\n");
    
    Tools.AddLog("%s - Hooking Class->",Tools.AddTime());
    pPresent = (Present_t) Tools.bDetourA((PBYTE)VTable[17],(LPBYTE)nPresent,6);
    pReset = (Reset_t) Tools.bDetourA((PBYTE)VTable[16],(LPBYTE)nReset,6);
    Tools.AddLog("OK!\n");
    
    
    return(0);
    }
    credits darkopp
    Last edited by Fakentc; 06-05-2014 at 02:51 AM.

  4. #4
    blaztphoenix's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Posts
    8
    Reputation
    10
    Thanks
    0
    Game Protection is Game Guard. how to create or search hook undetected by game guard?
    please teach me step by step. or videos how to find it.

Similar Threads

  1. # How to make a aimbot for any FPS game '
    By FoxxyStyleWC in forum CrossFire Tutorials
    Replies: 9
    Last Post: 04-27-2012, 01:44 PM
  2. How to Make ANTI leech for your hacks
    By boboben1 in forum Operation 7 General
    Replies: 7
    Last Post: 09-26-2010, 04:37 PM
  3. How to make a menu for combat arms hacks
    By jermy1810 in forum Programming Tutorial Requests
    Replies: 1
    Last Post: 06-07-2010, 07:40 AM
  4. FarCry 2 | How to make it work for all!!
    By netanel1000 in forum General
    Replies: 1
    Last Post: 10-25-2008, 06:56 AM
  5. How to make C++ trainers for Warrock
    By cjg333 in forum C++/C Programming
    Replies: 52
    Last Post: 10-15-2008, 10:10 AM