Results 1 to 5 of 5
  1. #1
    Lyoto Machida's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Far away with girls
    Posts
    3,734
    Reputation
    133
    Thanks
    1,621
    My Mood
    Aggressive

    Most simple d3d hook

    Can someone give me the most simple d3d hook posssible?
    Like, for a game that doesnt even have anti cheat?

    Just want to learn it..

  2. #2
    shadow9231's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    8
    Reputation
    8
    Thanks
    7
    My Mood
    Amused
    btw its me @whit .. ive been perm'ad on all my accounts
    but try this

    Code:
    DWORD * vTable = ***(DWORD****) Device Pointer;
    pFunction = (oFunction) DetourCreate(( BYTE* ) vTable[whatever], ( BYTE* )HookFunction, DETOUR_TYPE_JMP );

  3. The Following User Says Thank You to shadow9231 For This Useful Post:

    Lyoto Machida (07-07-2011)

  4. #3
    Lyoto Machida's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Far away with girls
    Posts
    3,734
    Reputation
    133
    Thanks
    1,621
    My Mood
    Aggressive
    Quote Originally Posted by shadow9231 View Post
    btw its me @whit .. ive been perm'ad on all my accounts
    but try this

    Code:
    DWORD * vTable = ***(DWORD****) Device Pointer;
    pFunction = (oFunction) DetourCreate(( BYTE* ) vTable[whatever], ( BYTE* )HookFunction, DETOUR_TYPE_JMP );
    Thanks, Since you're banned, Can someone else explain a litle bit more?
    btw why you permbaneed ?

  5. #4
    PizzaKirby's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    4

    d3d hook

    I think this should work :
    Code:
    #include <windows.h>
    #include <detours.h>
    #include <d3d9.h>
    #include <d3dx9.h>
    #include <cstdio>
    
    #pragma comment (lib,"detours.lib")
    #pragma comment (lib,"d3d9.lib")
    #pragma comment (lib,"d3dx9.lib")
    
    using namespace std;
    
    typedef HRESULT (WINAPI* EndSceneType)(LPDIRECT3DDEVICE9);
    EndSceneType EndScene_orig = NULL;
    
    
    bool bDataCompare(const BYTE* pData,const BYTE* bMask,const char* szMask)
    {
    	for(;*szMask;++szMask,++pData,++bMask)
    		if(*szMask == 'x' && *pData != *bMask)
    			return false;
    	return (*szMask) == NULL;
    }
    
    DWORD dwFindPattern(DWORD dwAddress,DWORD dwLen, BYTE *bMask,char * szMask)
    {
    	for(DWORD i = 0; i < dwLen; i++)
    		if(bDataCompare((BYTE*)(dwAddress+i),bMask,szMask))
    			return (DWORD)(dwAddress + i);
    	return 0;
    }
    
    
    HRESULT WINAPI EndSceneDetour(LPDIRECT3DDEVICE9 pDevice)
    {
    	return EndScene_orig(pDevice);
    }
    
    int initHook(void)
    {
    	DWORD *vTable;
    	HMODULE hMod;
    
    	do{
    		hMod = GetModuleHandleA("d3d9.dll");
    		Sleep(50);
    	}while(!hMod);
    
    	DWORD addy = dwFindPattern((DWORD)hMod,0x128000,(PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86","xx????xx????xx");
    	if(addy)
    	{
    		memcpy(&vTable,(void *)(addy +0x2),4);
    		EndScene_orig = (EndSceneType)DetourFunction((PBYTE)vTable[42],(PBYTE)EndSceneDetour);
    	}
    	return true;
    }
    
    BOOL APIENTRY DllMain(HINSTANCE module,DWORD reason,LPVOID reserved)
    {
    	switch(reason)
    	{
    		case DLL_PROCESS_ATTACH:
    			CreateThread(NULL,NULL,(LPTHREAD_START_ROUTINE)initHook,NULL,NULL,NULL);
    			break;
    		case DLL_PROCESS_DETACH:
    			break;
    	}
    	return TRUE;
    }
    Also MSDetours 1.5 is required ( i'll upload it as attachment)

    And here the two Virus Scans :

    VirusTotal - Free Online Virus, Malware and URL Scanner

    MSDetours15.zip - Jottis Malwarescanner
    Last edited by PizzaKirby; 07-09-2011 at 10:08 AM.

  6. The Following 4 Users Say Thank You to PizzaKirby For This Useful Post:

    darman77184 (01-03-2015),Lyoto Machida (07-09-2011),trojan.win128 (05-13-2013),xgongya (06-18-2013)

  7. #5
    Nissan's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Posts
    71
    Reputation
    2
    Thanks
    15
    You can try mid hook but must knowledgeable with asm.

  8. The Following User Says Thank You to Nissan For This Useful Post:

    Lyoto Machida (07-09-2011)

Similar Threads

  1. CF:Simple D3d Hook
    By Hungry in forum CrossFire Hacks & Cheats
    Replies: 9
    Last Post: 02-17-2010, 07:23 AM
  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