Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky

    [GUIDE]Hooking the source engine.

    Hai guys, I'll be teaching you how to make a source engine hook(CS: Source, National Bloodsports, Hidden: Source)
    The game I'll be using for this tutorial is Hidden: Source
    The same can be applied to the orange box, altho orange box games have some extra protections on stuff like CUserCMD.

    Installing the Source SDK
    Go to the Tools tab in steam and right click -> install 'Source SDK' if you don't already have it.

    Installing the code
    Launch the source SDK and make sure you've set up the engine version matches the game you're going to code for.
    Now that you've set up the correct engine version click 'Create a Mod' and click 'Source code only'.
    Install it into an empty folder so it is easily accesible.
    After it's finished copying you can close the SDK.
    Finally open up the Game_HL2-2005.sln in Visual Studio 2005.

    Setting up the project
    Since we'll be coding for the client only, we won't need the server part of the SDK, so delete the server folder from the project.
    We won't be using the .cpp files either since we will write our own, so remove all of them from the project(Yes, I know its alot of work :P)
    Open up the project's settings, go to the Custom Build Steps under the submenu Configuration Properties and clear out the 3 properties.
    Don't close the settings just yet, first go to the Linker tab and replace output dir with $(OutDir)/MyLeetVIPHax.dll.
    Under the C/C++ submenu, turn off precompiled headers.

    Note: You can delete the headers from the project aslong as you make sure they aren't removed from your harddrive. I removed these to make things easier to manage.

    Lets get started!
    Create main.cpp and SDK.h.
    SDK.h will contain all the header's we're going to use, main.cpp will the file where we do our hooking.
    Open up SDK.h and add the following code:
    Code:
    #pragma once
    #include <windows.h>
    And open up main.cpp and add the following:
    Code:
    #include "SDK.h"
    
    void MainThread(void)
    {
    	HMODULE hClient = NULL;
    	// Wait for the process to load its client.dll, which we'll use for fun.
    	while(hClient == NULL)
    	{
    		hClient = GetModuleHandle("client.dll");
    		Sleep(100);
    	}
    }
    
    BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved )
    {
    	if( dwReason == DLL_PROCESS_ATTACH )
    	{
    		CreateThread( NULL, NULL, (LPTHREAD_START_ROUTINE)MainThread, NULL, NULL, NULL);
    	}
    	return TRUE;
    }
    Now this in itself doesn't do a whole lot, besides waiting for your target to load up client.dll.

    Doing some usefull stuff
    Since the above doesn't do a whole lot of usefull stuff, lets do something usefull like writing to the game's console =D

    Normally if you would do this from scratch you'd have to open up your target game and search for console related strings.
    You'd find a CreateInterface call in 'gameui.dll' with a "GameConsole003", which is the interface version the game is requesting.
    The CreateInterface call returns a pointer to a class, and if you check out that pointer you'll see a vtable with 7 functions.
    By watching calls you can then figure out which does what, and by looking at the disassembly you could see how many arguments the function takes etc.

    Now, here's the console class(create a new file called IGameConsole.h):
    Code:
    #pragma once
    class IGameConsole : public IBaseInterface
    {
    public:
        virtual void Show() = 0;
        virtual void Init() = 0;
        virtual void Hide() = 0;
        virtual void Clear() = 0;
        virtual bool IsShown() = 0;
    
        // ???
        virtual void UnknownA() = 0;
        virtual void UnknownB() = 0;
    };
    
    #define GAMECONSOLE_INTERFACE_VERSION "GameConsole003"
    The class IGameConsole is an extention of IBaseInterface, which is located in interface.h

    Now, we haven't hooked the console yet, we'll need the following code to do that.
    Place this at the top:
    Code:
    IGameConsole *g_pIGameConsole=NULL;
    And place this in MainThread:
    Code:
    	CreateInterfaceFn ConCreateInterface = (CreateInterfaceFn)GetProcAddress(GetModuleHandle("gameui.dll"), "CreateInterface");
    	g_pIGameConsole = (IGameConsole *)ConCreateInterface(GAMECONSOLE_INTERFACE_VERSION, NULL);
    	if (g_pIGameConsole == NULL) return;
    	if (g_pIGameConsole->IsConsoleShown() == false)
    	{
    		g_pIGameConsole->Show();
    		ConMsg(0, "Our hook has been loaded :D\n");
    	}
    To use CreateInterface we'll have to include interface.h and to use our console class, we'll have to include IGameConsole.h.
    We'll also need to include tier0/dbg.h, because we used ConMsg.

    Here's the new SDK.h
    Code:
    #pragma once
    
    #include <windows.h>
    #include "tier0/dbg.h"
    #undef CreateThread
    #include "interface.h"
    
    #include "IGameConsole.h"
    Notice the #undef CreateThread? We'll need to do that because tier0/dbg.h makes some weird defines that conflict with what we want to do ;(

    That will be it for now(tired), I'll write up some stuff about hooking CInput and using CUserCMD for fun stuff like spinbots
    Ah we-a blaze the fyah, make it bun dem!

  2. The Following 10 Users Say Thank You to Hell_Demon For This Useful Post:

    dnjswjd777 (04-21-2011),falzarex (02-23-2010),HaxAttaxxx (05-28-2012),jz3 (10-26-2015),kibbles18 (12-17-2010),magicb0y (07-01-2012),mookamoka3 (02-14-2011),Void (02-22-2010),why06 (02-22-2010),|-|3|_][({}PT3R12 (02-22-2010)

  3. #2
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Finally! I've been waiting for this forever! wo_Ot! Thanks HD. I will read the whole thing and write a 1 paragraph summary to be turned in Tuesday for 20% of my grade. \___*____*___/

    Will add to tut list soon :P

    EDIT: Read, so this first part is about hooking the console. Neat trick
    Last edited by why06; 02-22-2010 at 12:29 PM.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  4. #3
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Quote Originally Posted by why06 View Post
    Finally! I've been waiting for this forever! wo_Ot! Thanks HD. I will read the whole thing and write a 1 paragraph summary to be turned in Tuesday for 20% of my grade. \___*____*___/

    Will add to tut list soon :P

    EDIT: Read, so this first part is about hooking the console. Neat trick
    Next part will be about hooking CL_DrawHud and CL_CreateMove, drawhud being used for ESP and other drawings, and createmove being used for aimbots, spinbots and that kinda crap
    Ah we-a blaze the fyah, make it bun dem!

  5. #4
    |-|3|_][({}PT3R12's Avatar
    Join Date
    Nov 2008
    Gender
    male
    Location
    UnkwOwnS
    Posts
    449
    Reputation
    12
    Thanks
    472
    My Mood
    Twisted
    Quote Originally Posted by Hell_Demon View Post
    Next part will be about hooking CL_DrawHud and CL_CreateMove, drawhud being used for ESP and other drawings, and createmove being used for aimbots, spinbots and that kinda crap


    Whats a spinbot??


    Nice job

  6. #5
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Quote Originally Posted by |-|3|_][({}PT3R12 View Post
    Whats a spinbot??


    Nice job
    people that spectate you will see you spin extremely hard, while you see urself walking like u normally wud :P
    Ah we-a blaze the fyah, make it bun dem!

  7. #6
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    dat be it :l... pardon crappy vid.

    [YOUTUBE]<object width="425" height="344"><param name="movie" value="https://www.youtube.com/v/S9YJxwxZsQI&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="https://www.youtube.com/v/S9YJxwxZsQI&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>[/YOUTUBE]

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  8. #7
    |-|3|_][({}PT3R12's Avatar
    Join Date
    Nov 2008
    Gender
    male
    Location
    UnkwOwnS
    Posts
    449
    Reputation
    12
    Thanks
    472
    My Mood
    Twisted
    Quote Originally Posted by Hell_Demon View Post
    people that spectate you will see you spin extremely hard, while you see urself walking like u normally wud :P

    Hmmm.... Aimbot seems more useful haha

  9. #8
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    added to list.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  10. #9
    Generist's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    My compiler
    Posts
    41
    Reputation
    10
    Thanks
    10
    My Mood
    Paranoid
    Quote Originally Posted by why06 View Post
    dat be it :l... pardon crappy vid.

    [YOUTUBE]<object width="425" height="344"><param name="movie" value="https://www.youtube.com/v/S9YJxwxZsQI&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="https://www.youtube.com/v/S9YJxwxZsQI&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>[/YOUTUBE]
    How exactly does that help you ingame?

  11. #10
    falzarex's Avatar
    Join Date
    Apr 2008
    Gender
    male
    Location
    here
    Posts
    417
    Reputation
    14
    Thanks
    145
    Just asking but is it true that all game engines have their own consoles?
    Quote Originally Posted by falzarex aka myself
    GTFO FUCKER U DONT BELONG IN THE INTERNETZ WORLD COZ ITS MINE


    This is an epic fail resume
    Hello VBfags.
    A 'member' of the almighty C++ section will soon join you, he is 13 year old, has the IQ and typing skills of a VBfag, so I thought he would fit in here nicely.

    A few reasons why he should be in this section instead of the C++ section:
    1) He has the IQ of a VBfag.
    2) He has no sense of grammer/spelling at all.
    3) He thinks he is pro(like most of the people in here)
    4) He thinks copy pasting is fun(exactly what you guys do)
    5) He loves it up the ass(he will keep you VBfags nice and warm)

  12. #11
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by falzarex View Post
    Just asking but is it true that all game engines have their own consoles?
    Hmmm... for the most part yeah, but they can be removed or hidden sometimes. Even if there's not a console there still usually has to be a game object or something.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  13. #12
    axel fox's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Posts
    60
    Reputation
    10
    Thanks
    1
    My Mood
    Amused
    not bad i like it)

  14. #13
    |-|3|_][({}PT3R12's Avatar
    Join Date
    Nov 2008
    Gender
    male
    Location
    UnkwOwnS
    Posts
    449
    Reputation
    12
    Thanks
    472
    My Mood
    Twisted
    Quote Originally Posted by why06 View Post
    Hmmm... for the most part yeah, but they can be removed or hidden sometimes. Even if there's not a console there still usually has to be a game object or something.
    Yeh most fps will have them

  15. #14
    falzarex's Avatar
    Join Date
    Apr 2008
    Gender
    male
    Location
    here
    Posts
    417
    Reputation
    14
    Thanks
    145
    Ahh u just need to kno wad game engine the game is built on then u can determine the way of hooking it
    like unreal engine 3?
    combat arms lithtech engine?
    cryengine? Etcetc
    Quote Originally Posted by falzarex aka myself
    GTFO FUCKER U DONT BELONG IN THE INTERNETZ WORLD COZ ITS MINE


    This is an epic fail resume
    Hello VBfags.
    A 'member' of the almighty C++ section will soon join you, he is 13 year old, has the IQ and typing skills of a VBfag, so I thought he would fit in here nicely.

    A few reasons why he should be in this section instead of the C++ section:
    1) He has the IQ of a VBfag.
    2) He has no sense of grammer/spelling at all.
    3) He thinks he is pro(like most of the people in here)
    4) He thinks copy pasting is fun(exactly what you guys do)
    5) He loves it up the ass(he will keep you VBfags nice and warm)

  16. #15
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    ye
    ¹³³7 POST TOO SHORT ¹³³7
    Ah we-a blaze the fyah, make it bun dem!

Page 1 of 2 12 LastLast

Similar Threads

  1. [Help] client hook [source engine]
    By bluedog9 in forum C++/C Programming
    Replies: 0
    Last Post: 07-19-2011, 01:04 PM
  2. can some 1 teach me how to use the cheat engine 5.4
    By klk101 in forum WarRock - International Hacks
    Replies: 16
    Last Post: 09-17-2008, 11:38 AM
  3. I Need The Real Engine.exe
    By kimodragon in forum Combat Arms Hacks & Cheats
    Replies: 6
    Last Post: 08-28-2008, 09:39 PM
  4. How can i hook the punkbuster?
    By TheRedEye in forum WarRock - International Hacks
    Replies: 5
    Last Post: 05-27-2007, 12:34 PM