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 › DLL Injection - Getting started

DLL Injection - Getting started

Posts 1–12 of 12 · Page 1 of 1
XK
xKarma
DLL Injection - Getting started
What is DLL injection?

DLL injection is a powerful technique where we inject a DLL inside another process in order to execute our own code from within that process.

For example, if we injected a DLL with this code...

Code:
MessageBox(NULL, L"Message Text", L"Message Title", MB_OK);
...into notepad, it would make notepad call that code, thus show the messagebox. And this is exactly what we're going to do in this tutorial.

Heed my words...

...DLL injection is anything but a safe method, and not knowing what you're doing could very easily result into a system wide disaster. Therefore it is highly recommended that you have at least a basic understanding of the Windows operating system and the c++ programming language before you continue.

Setup

With that out of the way, we can finally get started! Download our DLL injector here.

You will also need a c++ compiler to create the DLL to inject. I use Microsoft's Visual C++ IDE in this tutorial, but are free to use any compiler you like.

Create a new Win32 project and name it 'InjectDLL'.



For type, select 'DLL' and click 'Finish'.



A new project is created. Tap 'dllmain.cpp' open.



You should now see this piece of code:

Code:
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                                         )
{
        switch (ul_reason_for_call)
        {
        case DLL_PROCESS_ATTACH:
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
                break;
        }
        return TRUE;
}
As you can see, the compiler has generated the DllMain function for you. This is the very function that first gets called by a process when your DLL is injected into it. More precisely, the
Code:
case DLL_PROCESS_ATTACH:
part. So let's write the code for our MessageBox there.

Code:
case DLL_PROCESS_ATTACH:
        MessageBox(NULL, L"Hello from notepad!", L"notepad", MB_OK);
Build the project.



Fire up notepad and the DLL injector. Hit the browse button of 'DLL Path' and find your "InjectDLL.dll". Click OK.



Now we're all set to inject, so click "Inject". This is what should happen:



Notepad shows a MessageBox 'Hello from notepad!'. Notepad's UI is frozen until you click "OK", just like any other application that shows a MessageBox. InjectDLL.dll is added to the injector's list of injected DLLs. From that list you can eject the DLL by selecting it and clicking the "Uninject" button. When you uninject a DLL, the 'case DLL_PROCESS_DETACH:' part of your DLL's code gets called. That's where you do all the required cleanup. In this case, we don't need any.

Conclusion

You now have successfully injected a DLL with your own code into an external process to manipulate it's behavior, forcing the poor notepad to create a MessageBox of your your liking.

But you have just scratched the surface here. Think outside the box. Like I said, with this technique you can wreak unlimited havoc inside a process. When you think about what you can/can't do with DLL injection, think about what you can/can't do with creating a function inside your own program and callintg it. There is no limits. You can, for example, call or intercept the functions that already exist(this is called hooking).

Remember to take great care when you use this technique. Like I said earlier, doing it wrong can cause unexpected, disastrous behavior.

Tutorial from:
UGSoft - Game Hacking Tutorials
#1 · 14y ago
Darkzz12
Darkzz12
Ill try It...
#2 · 14y ago
OB
ObeA
Lol.
Idk why but it doesn't work ._.
#3 · 14y ago
RE
Reflex-
Quote Originally Posted by ObeA View Post
Lol.
Idk why but it doesn't work ._.
What did you try doing?
#4 · 14y ago
MarkHC
MarkHC
Quote Originally Posted by ObeA View Post
Lol.
Idk why but it doesn't work ._.
you obviously did something wrong then...
#5 · 14y ago
OB
ObeA
Code:
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
        MessageBox(NULL, L"Hello from notepad!", L"notepad", MB_OK);
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
== my code.
#6 · 14y ago
PO
PopupsAndRegistrationSuck
Quote Originally Posted by ObeA View Post
Code:
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
        MessageBox(NULL, L"Hello from notepad!", L"notepad", MB_OK);
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
== my code.
Same, doesn't work for me either:/
#7 · 13y ago
Olevnik
Olevnik
You've got some kind of error guys?
It's probably because you're trying to inject it to 64bit notepad, try injecting it into 32bit application, Notepad++ for example.
#8 · 13y ago
Boost4lol
Boost4lol
I really need to get read this, thanks.
#9 · 12y ago
RA
rats487
Cool, 1 qeustion though: How would one see the source code of the game, isn't it needed to know how variables and such are named?
#10 · 12y ago
Express.
Express.
Thanks for the tutorial, even though you're banned.
#11 · 12y ago
ME
medo.soleman
thanks alot for your work
#12 · 11y ago
Posts 1–12 of 12 · Page 1 of 1

Post a Reply

Similar Threads

  • when i inject my DLL. i get a couldnt find patc and crashBy atomisticxkid in Vindictus Help
    3Last post 15y ago
  • Got VB 6, I see new Adress thread, how to get started?By soulbind4 in WarRock - International Hacks
    10Last post 18y ago
  • Need help getting startedBy skittlznick2 in Combat Arms Hacks & Cheats
    2Last post 18y ago
  • Crash at Dll injectBy CyberStriker in WarRock - International Hacks
    1Last post 18y ago
  • DLL injection FailledBy aynal in WarRock - International Hacks
    1Last post 20y ago

Tags for this Thread

#beginner#dll#injection#tutorial