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 › MultiPlayer Game Hacks & Cheats › Call of Duty Hacks & Cheats › Call of Duty 6 - Modern Warfare 2 (MW2) Hacks › Call of Duty Modern Warfare 2 Coding / Programming / Source Code › Hooking DX9 Present & Reset

QuestionHooking DX9 Present & Reset

Posts 1–2 of 2 · Page 1 of 1
EX
exp111
Hooking DX9 Present & Reset
Hey,

I've started now writing some stuff for MW2 and I now wanted to make a gui/ingame menu.
As I like the ImGui menus (and have some menus already written for it) and wanted to use it here to.

The problem is I just can't seem to get it working.
I'm swapping the pointer to the original present/reset to my own functions (in the gameoverlayrenderer.dll) but they don't seem to get called.

My code to swap them (should work for all dx9 games):
Code:
Hooks::present_addr = FindPattern("gameoverlayrenderer.dll", Signatures::Present) + 2;
Hooks::reset_addr = FindPattern("gameoverlayrenderer.dll", Signatures::Reset) + 2;

Hooks::original_present = **reinterpret_cast<decltype(&Hooks::original_present)*>(Hooks::present_addr);
Hooks::original_reset = **reinterpret_cast<decltype(&Hooks::original_reset)*>(Hooks::reset_addr);

**reinterpret_cast<void***>(Hooks::present_addr) = reinterpret_cast<void*>(&Hooks::user_present);
**reinterpret_cast<void***>(Hooks::reset_addr) = reinterpret_cast<void*>(&Hooks::user_reset);
The original functions addresses are found but it doesn't get called. It's weird as the Steam overlay works fine

Did anyone get it an ImGui menu working? Appreciate any help
#1 · 8y ago
MO
moofmonkey
Sorry if late, but there's some info.
1. Hook release in GameOverlayRenderer64.dll \x48\x89\x05\xCC\xCC\xCC\xCC\x48\x8D\x15\xCC\xCC\x CC\xCC\x48\x8B\x4B\x68 xxx????xxx????xxxx (x64 pattern for variable reference)
2. Do things here: init WndProc, hook EndScene, etc.
For me that code is... (comments aren't mine)
Code:
ULONG __stdcall hkRelease(IDirect3DDevice9* thisptr) {
	// Perform general setup tasks when this function is called for the first time.
	static bool is_initialized = false;
	static bool init_running = false;

	if (!is_initialized) {
		while (init_running) Sleep(40);
		if (is_initialized) goto skip;
		init_running = true;

		static HWND console_hwnd = GetConsoleHwnd();
		EnumWindows([](HWND hwnd, LPARAM game_pid) -> BOOL {
			// Skip windows not belonging to the game process.
			DWORD hwnd_pid = NULL;

			GetWindowThreadProcessId(hwnd, &hwnd_pid);

			if (hwnd_pid != game_pid || hwnd == console_hwnd)
				return TRUE;

			// Set the target window handle and stop the callback.
			game_hwnd = hwnd;

			return FALSE;
		}, GetCurrentProcessId());

		if (game_hwnd != NULL) {
			// Swap out the window message handler for our own, allowing us to intercept input events.
			game_wndproc = reinterpret_cast<WNDPROC>(SetWindowLongPtr(game_hwnd, GWLP_WNDPROC, LONG_PTR(hkWndProc)));
			g_pRenderer = new Renderer(thisptr);
			pOriginalRender = (HRESULT(__stdcall*)(IDirect3DDevice9*)) DetourPointer(pOriginalRender_Restore = *(void***)thisptr + 42, hkRender); // endscene

			// Perform final ImGui setup tasks and..
			ImGui_ImplDX9_Init(game_hwnd, thisptr);

			// ..we're all done!
			is_initialized = true;
		}
		init_running = false;
		skip:;
	}

	return pOriginalRelease(thisptr);
}
3. ???
4. PROFIT
#2 · 8y ago
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

  • All hooks work, except for Reset (D3D9)By diesel3009 in DirectX/D3D Development
    6Last post 13y ago
  • Information about hooking present / resetBy PgSQL in CrossFire Europe Hack Source Code
    0Last post 14y ago
  • Engine Hook - Reset, Present, BeginScene, EndScene and DrawIndexedPrimitiveBy [H]aaBX in Combat Arms EU Hack Coding/Source Code
    3Last post 13y ago
  • Hook Present EngineBy Avene in CrossFire Hack Coding / Programming / Source Code
    16Last post 13y ago
  • Hook Present Engine 6/9/2012By Avene in CrossFire Hack Coding / Programming / Source Code
    14Last post 13y ago

Tags for this Thread

None