Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Programming Tutorials › [Tut(C++)] Hooking Functions

[Tut(C++)] Hooking Functions

Posts 1–4 of 4 · Page 1 of 1
radnomguywfq3
radnomguywfq3
[Tut(C++)] Hooking Functions
Hooking Functions
Requested Knowledge :
- Quite a bit of C++ Programming knowledge
- Debugging Knowledge
- Know how DLLs work and inject
- Knows what a function is.
- Can locate functions in a debugger

Required Tools :
- C++ Compiler(NOT DEV-C++,does't compile DLLs that work)
- OllyDbg(Or an alternative debugger)
- Detour.h\detour.cpp files (Download in attachments)
- DLL Injector
- TargetApplication.exe(Download In Attachments)



Whats is 'Hooking A Function"?

Hooking a function is simply replacing a function with yours, or having your function called
before\after the targeted function, you could also pass paramters to the targeted function when its called.

Step one, locating the function of our target.

Well, we can run the application and you will see that the text "Hello" pops up, and when you hit return, it adds another line with the text "Hello", eventually creating an array of lines with the text "Hello". Finding this function is quite easy to do, we could step through it and examine the program, or we could just search for the ASCII string "hello" in out hex dump. We will find it at 00401082. And a reference to it at 00401082. There you should see an array of pushes followed by a call.

401080 PUSH ESI
401081 PUSH EDI
401082 PUSH 004120B0
401087 PUSH 00413DF0
40108C CALL 00401AA0


and you can see that 00401080 is the start of our function, thus thats the one we need to hook.


Step Two, Creating the hook.

#include <windows.h>
#include "detours.h"
int (__stdcall* HelloFunction)(void);
void HookHelloFunction(void)
{
MessageBox(0, "You called the function : \"Hello\"", "Function Called", MB_OK);
return;
}

BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
HelloFunction = (int (__stdcall*)(void))DetourFunction((PBYTE)0x0040108 0, (PBYTE)HookHelloFunction);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
DetourRemove((PBYTE)0x00401080, (PBYTE)HelloFunction); //Remove hook
break;
}
return TRUE;
}

A couple new things, first of all the :
int (__stdcall* HelloFunction)(void);
Thats basically the structure of our targeted function.

Then you see void HookHelloFunction(void), thats basically the function where hooking.
The rest should be quite strait forward.
DetourFunction(FunctionWithinProcess, FunctionToReplaceItWith)
and
DetourRemove(HookedFunction,HelloFunction)
#1 · edited 17y ago · 18y ago
SY
Synns
401080 Is the PBLC Address?
#2 · 18y ago
radnomguywfq3
radnomguywfq3
Hooking functions doesn't mean making a bypass. Nor does detouring something.
#3 · edited 18y ago · 18y ago
OL
olie122333
can you exlpain how to use this to detour War Rock's version of Punk Buster plz ?


I can teach you 2 ways of making a bypass in return
#4 · 18y ago
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

  • Hook Function for DIP?By ipwnuuaal5 in Combat Arms Hack Coding / Programming / Source Code
    12Last post 16y ago
  • [Help]Hooking FunctionsBy aanthonyz in C++/C Programming
    3Last post 15y ago
  • Using GDI functions on hooked Direct3D applications?By ThePro in General Game Hacking
    1Last post 16y ago
  • finding and hooking an unknown functionBy JonnyD in General Game Hacking
    1Last post 16y ago
  • tut How to hook tut 6By llvengancell in WarRock - International Hacks
    1Last post 19y ago

Tags for this Thread

#functions#hooking#tutc