Page 1 of 4 123 ... LastLast
Results 1 to 15 of 56
  1. #1
    Swag's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Location
    Netherlands
    Posts
    1,619
    Reputation
    19
    Thanks
    1,865
    My Mood
    Amused

    How To Make A D3D Hook (a little complement to Dead Hells hooking tut)

    Hey guys,

    I saw Dead Hell posted a hook tutorial and i thought: let i make a little complement
    Here we go:


    Step 1: Make ofc. a new project (empty dll project)
    Step 2: Make Includes.h
    Step 3: Make Main.cpp
    Step 4: Include SDK to your project


    Okay, Put this in Includes.h:
    Code:
    #include <Windows.h>
    #include <stdio.h>
    #include <d3d9.h>
    #include <d3dx9.h>
    Lets start with the main part
    Add this in Main.cpp:

    Code:
    #include "Includes.h"
    #include "Funtions.h"
    
    BYTE CheckWindowsVersion();
    
    #define WINDOWS_XP  5
    #define WINDOWS_7   6
    
    DWORD* DIP_hook = NULL;
    DWORD DIP_return = NULL;
    
    bool WallHack = true;
    And now we are going to make the wallhack function:
    Code:
    void myDIP(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
    {
        IDirect3DVertexBuffer9* pStreamData = NULL;
        UINT iOffsetInBytes,iStride;
        pDevice->GetStreamSource(0,&pStreamData,&iOffsetInBytes,&iStride);
    
        if(WallHack)
        if ((iStride==40)||(iStride==44))
        {
            pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE );
            pDevice->SetRenderState(D3DRS_ZFUNC,   D3DCMP_NEVER);
        }
    }
    Okay, we have make the wallhack function and now we are going to make the hook.
    We are going to make a Windows XP hook and a Windows Vista+7 hook


    Windows 7 part:
    Code:
    _declspec(naked) void myDIP_hook7()
    {
    	__asm
    	{
    		//Call myDIP
    		MOV EAX, DWORD PTR [ESP+40];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+40];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+40];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+40];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+40];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+40];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+40];
    		PUSH EAX;
    		CALL myDIP;
    		ADD ESP, 28;
    
    		MOV EAX,DWORD PTR FS:[0];
    
    		PUSH EAX;
    		SUB ESP,0x20;
    
    		JMP DIP_return;
    	}
    }
    Windows XP Part:
    Code:
    _declspec(naked) void myDIP_hookxp()
    {
    	__asm
    	{
    		//Call myDIP
    		MOV EAX, DWORD PTR [ESP+44];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+44];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+44];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+44];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+44];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+44];
    		PUSH EAX;
    		MOV EAX, DWORD PTR [ESP+44];
    		PUSH EAX;
    		CALL myDIP;
    		ADD ESP, 28;
    
    		MOV EAX,DWORD PTR FS:[0];
    
    		MOV DWORD PTR FS:[0],ESP;
    		SUB ESP, 0x12;
    
    		JMP DIP_return;
    	}
    }
    We are going to add some functions now..
    Make a new .H file and give it the name: Functions.h

    Put this codes in Functions.h:

    Include:
    Code:
    #include "Includes.h"
    Function bCompare
    Code:
    bool bCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
    {
    	for(;*szMask;++szMask,++pData,++bMask)
    		if(*szMask=='x' && *pData!=*bMask)   return 0;
    	return (*szMask) == NULL;
    }
    Function FindPattern
    Code:
    DWORD FindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
    {
    	for(DWORD i=0; i<dwLen; i++)
    		if (bCompare((BYTE*)(dwAddress+i),bMask,szMask))  return (DWORD)(dwAddress+i);
    	return 0;
    }
    MakeJMP Function
    Code:
    void MakeJMP( BYTE *pAddress, DWORD dwJumpTo, DWORD dwLen )
    {
        DWORD dwOldProtect, dwBkup, dwRelAddr;
        
        VirtualProtect(pAddress, dwLen, PAGE_EXECUTE_READWRITE, &dwOldProtect);
        dwRelAddr = (DWORD) (dwJumpTo - (DWORD) pAddress) - 5;
        *pAddress = 0xE9;
        
        *((DWORD *)(pAddress + 0x1)) = dwRelAddr;
        for(DWORD x = 0x5; x < dwLen; x++) *(pAddress + x) = 0x90;
        VirtualProtect(pAddress, dwLen, dwOldProtect, &dwBkup);
        
        return;
    }
    CheckWindowsVersion Function:
    Code:
    BYTE CheckWindowsVersion()
    {
    	HKEY key = NULL;
    	DWORD size = 100;
    	char buffer[200] = {NULL};
    	RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", NULL, KEY_ALL_ACCESS, &key);
    	RegQueryValueExA(key, "CurrentVersion", NULL, NULL, (LPBYTE)&buffer, &size);
    	RegCloseKey(key);
    	if ((!strcmp(buffer, "5.1")) || (!strcmp(buffer, "5.2")))
    		return WINDOWS_XP;
    
    	if ((!strcmp(buffer, "6.0")) || (!strcmp(buffer, "6.1")))
    		return WINDOWS_7;
    	return NULL;
    }
    Okay, that was Function.h
    Go back to Main.cpp and add this:

    Code:
    void D3Dhook()
    {
        LoadLibraryA("d3d9.dll");
        DWORD D3D9, adr, *VTable;
        do
        {
            D3D9 = (DWORD)LoadLibraryA("d3d9.dll");
            Sleep(100);
        } while (D3D9 == NULL);
    
        adr = FindPattern(D3D9, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x8", "xx????xx????xx");
        if (adr) {
            memcpy(&VTable,(void *)(adr+2),4);
    
            if (CheckWindowsVersion() == WINDOWS_7) {
            MakeJMP((BYTE *)0x4FF51658, (DWORD)myDIP_hook7, 0x6);
            DWORD dwJMPback = 0x4FF51659;
    	}
    	else if (CheckWindowsVersion() == WINDOWS_XP)
    	{
            MakeJMP((BYTE *)0x4FF51658, (DWORD)myDIP_hookxp, 0x6);
            DWORD dwJMPback = 0x4FF51659;
     		}
    	}
    }
    And a DLLMain:
    Code:
    extern "C" __declspec(dllexport) BOOL APIENTRY DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID lpvReserved)
    {
    	if (dwReason == DLL_PROCESS_ATTACH)
    
    	{
    		DisableThreadLibraryCalls(hDll);
    		
    		D3Dhook();
    
    	}else if(dwReason == DLL_PROCESS_DETACH) {
    	}
    	return TRUE;
    }
    DeadHell showed you guys how to make a hook and i showed in this tutorial how to make a Windows XP and Windows 7 hook..

    Did i make a foult in this Tut.? Please PM me!

    Credits:
    I don't use this hook but i toke the codes from @Dead(H)ell Tutorial so the first credits go to him.
    Ow, and DeadHell, in you tutorial you jump back at the same rule as you're hooking on.. I should jump back on the next rule
    And Ofc. @giniyat101
    And my great friend xD @Royku

    I hope you guys like it...
    Please press thanks and/or Rep


    @Scata
    @Royku
    @Hero
    @Jigsaw

    Request Sticky

    Thanks!
    Last edited by Swag; 03-29-2012 at 01:48 PM.

  2. The Following 12 Users Say Thank You to Swag For This Useful Post:

    -iFaDy..* (03-31-2012),deniz617 (04-01-2012),eppi (03-29-2012),farcast (09-22-2012),kbasd46 (04-21-2014),mslol (03-30-2012),pDevice (06-22-2012),ranger35 (08-23-2016),Red_A (08-31-2018),user44 (03-30-2012),Vincent Dominguez (10-24-2013),_Coder. (03-29-2012)

  3. #2
    darkness99's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    ASM Part
    Posts
    235
    Reputation
    10
    Thanks
    211
    OMG! i was going to post a tutorial in windows xp i was creating it :S

    good job

  4. #3
    Swag's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Location
    Netherlands
    Posts
    1,619
    Reputation
    19
    Thanks
    1,865
    My Mood
    Amused
    Quote Originally Posted by darkness99 View Post
    OMG! i was going to post a tutorial in windows xp i was creating it :S

    good job
    Oow, sorry ..
    But thanks

  5. #4
    Royku's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    G-Force.dll
    Posts
    3,015
    Reputation
    381
    Thanks
    3,308
    My Mood
    Devilish
    where are my credits

  6. The Following 5 Users Say Thank You to Royku For This Useful Post:

    -iFaDy..* (03-31-2012),CFhackerfree (03-29-2012),Geometrical (11-09-2012),user44 (03-30-2012),Vahan96 (09-15-2012)

  7. #5
    Swag's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Location
    Netherlands
    Posts
    1,619
    Reputation
    19
    Thanks
    1,865
    My Mood
    Amused
    Quote Originally Posted by Royku View Post
    where are my credits
    Oops, sorry bro
    Edited/

  8. #6
    UltraPGNoob's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    671
    Reputation
    15
    Thanks
    612
    My Mood
    Fine
    another way to check if you're using win seven or xp

    Code:
    enum Version {
    	VISTA_SEVEN,
    	XP
    };
    
    char VISTA_PATH[MAX_PATH];
    
    int CheckWindowsVersion()
    {
    	sprintf_s(VISTA_PATH, MAX_PATH, "C:\\Users\\%s\\AppData\\Roaming", getenv("USERNAME"));
    
    	if (strcmp(VISTA_PATH, getenv("AppData")) == 0)
    		return VISTA_SEVEN;
    	else
    		return XP;
    }
    Last edited by UltraPGNoob; 03-29-2012 at 10:30 AM. Reason: removed useless codes
    My Threads:

    - CrossFire Mods:
    Wooden Knife

    - CrossFire Tutorials:
    How to make a logger
    Total number of guns in weaponmgr

    - CrossFire NA Addies:
    Video Settings (not useful but just wanted to share) OUTDATED

    - CrossFire NA Hacks:
    UltraPGNoob Public Hack v1 DETECTED (02-24-2011)
    UltraPGNoob Public Hack v2 DETECTED (06-22-2011)
    UltraPGNoob Public Hack v3 DETECTED (07-04-2011)

    - CrossFire EU Hacks:
    UltraPGNoob Public Hack - Special Edition (Knife Weapon Hack) DETECTED (02-26-2012)

  9. #7
    Coder[Vb10e]'s Avatar
    Join Date
    Jul 2011
    Gender
    male
    Location
    Crossfire Alaska
    Posts
    1,577
    Reputation
    -10
    Thanks
    349
    My Mood
    Fine
    nice tut

  10. #8
    MysteryCoder's Avatar
    Join Date
    Mar 2012
    Gender
    male
    Posts
    31
    Reputation
    10
    Thanks
    0
    OMG I Wrote All The Things My Self But Am Getting An Error On:
    if ((!strcmp(buffer, "5.1")) || (!strcmp(buffer, "5.2")))
    return WINDOWS_XP;

    if ((!strcmp(buffer, "6.0")) || (!strcmp(buffer, "6.1")))
    return WINDOWS_7;

    WINDOWS_XP
    WINDOWS_7

    Can Anyone Help?

    ---------- Post added at 07:30 PM ---------- Previous post was at 07:09 PM ----------

    BTW Good Job I Liked The TuT Your Great

  11. #9
    UltraPGNoob's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    671
    Reputation
    15
    Thanks
    612
    My Mood
    Fine
    did you define those two variables? if yes, it shouldn't do that.
    maybe change the func type to int?
    My Threads:

    - CrossFire Mods:
    Wooden Knife

    - CrossFire Tutorials:
    How to make a logger
    Total number of guns in weaponmgr

    - CrossFire NA Addies:
    Video Settings (not useful but just wanted to share) OUTDATED

    - CrossFire NA Hacks:
    UltraPGNoob Public Hack v1 DETECTED (02-24-2011)
    UltraPGNoob Public Hack v2 DETECTED (06-22-2011)
    UltraPGNoob Public Hack v3 DETECTED (07-04-2011)

    - CrossFire EU Hacks:
    UltraPGNoob Public Hack - Special Edition (Knife Weapon Hack) DETECTED (02-26-2012)

  12. #10
    MysteryCoder's Avatar
    Join Date
    Mar 2012
    Gender
    male
    Posts
    31
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by UltraPGNoob View Post
    did you define those two variables? if yes, it shouldn't do that.
    maybe change the func type to int?
    What U Mean?

  13. #11
    darkness99's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    ASM Part
    Posts
    235
    Reputation
    10
    Thanks
    211
    Quote Originally Posted by MysteryCoder View Post
    OMG I Wrote All The Things My Self But Am Getting An Error On:
    if ((!strcmp(buffer, "5.1")) || (!strcmp(buffer, "5.2")))
    return WINDOWS_XP;

    if ((!strcmp(buffer, "6.0")) || (!strcmp(buffer, "6.1")))
    return WINDOWS_7;

    WINDOWS_XP
    WINDOWS_7

    Can Anyone Help?

    ---------- Post added at 07:30 PM ---------- Previous post was at 07:09 PM ----------

    BTW Good Job I Liked The TuT Your Great
    so ur who write them


    ---------- Post added at 04:38 PM ---------- Previous post was at 04:38 PM ----------

    Windows XP = 5 Returns
    Windows 7 = 6 Returns

  14. #12
    UltraPGNoob's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    671
    Reputation
    15
    Thanks
    612
    My Mood
    Fine
    did you wrote this :

    Code:
    #define WINDOWS_XP  5
    #define WINDOWS_7   6
    btw you didn't really announced which error you got?
    My Threads:

    - CrossFire Mods:
    Wooden Knife

    - CrossFire Tutorials:
    How to make a logger
    Total number of guns in weaponmgr

    - CrossFire NA Addies:
    Video Settings (not useful but just wanted to share) OUTDATED

    - CrossFire NA Hacks:
    UltraPGNoob Public Hack v1 DETECTED (02-24-2011)
    UltraPGNoob Public Hack v2 DETECTED (06-22-2011)
    UltraPGNoob Public Hack v3 DETECTED (07-04-2011)

    - CrossFire EU Hacks:
    UltraPGNoob Public Hack - Special Edition (Knife Weapon Hack) DETECTED (02-26-2012)

  15. #13
    MysteryCoder's Avatar
    Join Date
    Mar 2012
    Gender
    male
    Posts
    31
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by darkness99 View Post


    so ur who write them


    ---------- Post added at 04:38 PM ---------- Previous post was at 04:38 PM ----------

    Windows XP = 5 Returns
    Windows 7 = 6 Returns
    ???????????????????????????

    ---------- Post added at 07:40 PM ---------- Previous post was at 07:39 PM ----------

    Quote Originally Posted by UltraPGNoob View Post
    did you wrote this :

    Code:
    #define WINDOWS_XP  5
    #define WINDOWS_7   6
    btw you didn't really announced which error you got?
    dude tv me and solve the prob plz?

    ---------- Post added at 07:40 PM ---------- Previous post was at 07:40 PM ----------

    error C2065: 'WINDOWS_XP' : undeclared identifier
    error C2065: 'WINDOWS_7' : undeclared identifier

  16. #14
    UltraPGNoob's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    671
    Reputation
    15
    Thanks
    612
    My Mood
    Fine
    I can't tv you from school. I'm on a restricted network. sry

    don't need to tv you it's a declaration problem

    just add that :

    Code:
    #define WINDOWS_XP  5
    #define WINDOWS_7   6
    it's written in the first post you didn't clearly read Swag's post
    Last edited by UltraPGNoob; 03-29-2012 at 10:42 AM.
    My Threads:

    - CrossFire Mods:
    Wooden Knife

    - CrossFire Tutorials:
    How to make a logger
    Total number of guns in weaponmgr

    - CrossFire NA Addies:
    Video Settings (not useful but just wanted to share) OUTDATED

    - CrossFire NA Hacks:
    UltraPGNoob Public Hack v1 DETECTED (02-24-2011)
    UltraPGNoob Public Hack v2 DETECTED (06-22-2011)
    UltraPGNoob Public Hack v3 DETECTED (07-04-2011)

    - CrossFire EU Hacks:
    UltraPGNoob Public Hack - Special Edition (Knife Weapon Hack) DETECTED (02-26-2012)

  17. #15
    MysteryCoder's Avatar
    Join Date
    Mar 2012
    Gender
    male
    Posts
    31
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by UltraPGNoob View Post
    I can't tv you from school. I'm on a restricted network. sry

    don't need to tv you it's a declaration problem

    just add that :

    Code:
    #define WINDOWS_XP  5
    #define WINDOWS_7   6
    it's written in the first post you didn't clearly read Swag's post

    i did bro, but still am getting the same error

    error C2065: 'WINDOWS_XP' : undeclared identifier
    error C2065: 'WINDOWS_7' : undeclared identifier

Page 1 of 4 123 ... LastLast

Similar Threads

  1. [Tutorial] How To Make A D3D Hook [ Complete Tutorial ]
    By Dead(H)ell in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 56
    Last Post: 09-09-2012, 01:01 PM
  2. [Tutorial] How To Make A D3D Menu in VB.NET for CF[Doesnt Require A Hook]
    By Dead(H)ell in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 68
    Last Post: 08-04-2012, 10:48 AM
  3. [Tutorial] How to Make a D3D Crosshair
    By sam22 in forum Alliance of Valiant Arms (AVA) Hacks & Cheats
    Replies: 7
    Last Post: 11-29-2010, 11:13 AM
  4. How To Make Warrock D3d Menu Hack with all hack functions
    By srinuv in forum Programming Tutorial Requests
    Replies: 5
    Last Post: 09-15-2010, 08:12 AM
  5. [Tutorial] How To Make Longevity's ca hook to work
    By dillster7879 in forum Combat Arms Hacks & Cheats
    Replies: 14
    Last Post: 12-10-2009, 05:47 PM