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 › C++/C Programming › Getting started with C++ DLL hacking - Basic Memory Editing

QuestionGetting started with C++ DLL hacking - Basic Memory Editing

Posts 1–3 of 3 · Page 1 of 1
Kai13shadow
Kai13shadow
C++ DLL Problem - Program Crashing
So basically i've made a dll ready to inject into Garry's Mod (hl2.exe) but whenever i inject it into hl2.exe, hl2.exe crashes!
Could someone please tell me why my dll is making the program crash?
Here's my script for the dll:
Code:
#include <windows.h>

DWORD Base = (DWORD)GetModuleHandle((LPCTSTR)"client.dll") + (DWORD)0x5B5340;
DWORD* Address = (DWORD*)Base;

void mainthread() {
	while(1) {
		*Address = 2;
                Sleep(250);
	}
}


BOOL APIENTRY DllMain(HINSTANCE hDll, DWORD callReason, LPVOID lpReserved) {
	if(callReason == DLL_PROCESS_ATTACH) {
		CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&mainthread, 0, 0, 0);
		MessageBoxA(NULL,"Hack Injected Successfully!", "DLL Injection" ,NULL);
	}
	return 1;
}
Thanks in advance!
#1 · edited 13y ago · 13y ago
eCho'
eCho'
I'm not 100% percent sure, but I think Garry's Mod shuts down if it detects anything being edited from an exterior?

I'm not sure though.
#2 · 13y ago
Kai13shadow
Kai13shadow
Quote Originally Posted by eCho' View Post
I'm not 100% percent sure, but I think Garry's Mod shuts down if it detects anything being edited from an exterior?

I'm not sure though.
At this point, i'm pretty sure it's not just Garry's Mod. I tried using the method i have here on the cheat engine tutorial (on step 2) trying to change the amount of 'health'. The tutorial crashed as Garry's Mod did. Although, this could just be a coincidence...

---------- Post added at 01:26 PM ---------- Previous post was at 01:03 PM ----------

And still i get the same crash when i try a different method...
Code:
#include <windows.h>
#include <stdio.h>

#define ADR_Wallhack GetModuleHandle("client.dll") + 0x005B5340

void mainthread() {
	while(1) {
		DWORD OldProt;
		int WallhackOn = 2;
		int WallhackOff = 1;
		VirtualProtect((void*)ADR_Wallhack, sizeof(WallhackOn), PAGE_READWRITE, &OldProt);
		memcpy((void*)ADR_Wallhack, &WallhackOn, sizeof(WallhackOn));
		VirtualProtect((void*)ADR_Wallhack, sizeof(WallhackOn), OldProt, 0;
		Sleep(250);
	}
}


BOOL APIENTRY DllMain(HINSTANCE hDll, DWORD callReason, LPVOID lpReserved) {
	if(callReason == DLL_PROCESS_ATTACH) {
		CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&mainthread, 0, 0, 0);
		MessageBoxA(NULL,"Hack Written Successful", "DLL Injection" ,NULL);
	}
	return 1;
}
#3 · 13y ago
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

  • need help getting started with c++ and hacks.By goco79 in CrossFire Help
    2Last post 14y ago
  • Getting Started With Wall HackBy Watru in C++/C Programming
    4Last post 14y ago
  • New To Coding. Getting Starting With HackingBy Sexy-Josh in C++/C Programming
    4Last post 14y ago
  • How do i get started with Hacking on Dayz.By Maddmoe in DayZ Mod & Standalone Hacks & Cheats
    3Last post 13y ago
  • [Tutorial] Getting Started With a On Screen KeyBoardBy CoderNever in Visual Basic Programming
    11Last post 16y ago

Tags for this Thread

None