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 › [Source]D3D9: Update on last topic

[Source]D3D9: Update on last topic

Posts 1–7 of 7 · Page 1 of 1
.::SCHiM::.
.::SCHiM::.
[Source]D3D9: Update on last topic
I've updated the library with a hook function, with it you can hook all the D3D library functions with these: Hook() & ReturnFromHook().

Hook returns the address of a 'trampoline' that is used to 'bounce' execution from the specified hook back to the original function.

The address returned by hook must be passed to ReturnFromHook(). ReturnFromHook fixes the stack and other complications that may arise. After that the program executes like it normally would.

Templates:

Code:
	DWORD _stdcall Hook(DWORD TargetAddress, DWORD HookAddress);
	DWORD _stdcall ReturnFromHook(DWORD GhookAddress, DWORD NumberOfArguments);
Hook():
TargetAddress = Address of the function you want to hook
HookAddress = Address of your hook

ReturnFromHook():
GhookAddress = Address returned by the Hook() function (This address must only be used when returning form the same hook as supplied in the Hook() function)
NumberOfArguments = May be ignored, this argument does nothing.

Tested and working:

Code:
#include <windows.h>
#include <iostream>
#include <string.h>
#include <C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\d3d9.h>
#include <C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\d3dx9.h>

#pragma comment (lib, "C:\\Program Files (x86)\\Microsoft DirectX SDK (June 2010)\\Lib\\x86\\d3dx9.lib")
#pragma comment(lib, "VtableScan.lib")

extern "C"{
	DWORD _stdcall ScanTable();
	DWORD _stdcall Hook(DWORD TargetAddress, DWORD HookAddress);
	DWORD _stdcall ReturnFromHook(DWORD GhookAddress, DWORD NumberOfArguments);
}



int MainThread();
void DisplaySomeText(LPDIRECT3DDEVICE9 pDevice);
DWORD Gmem = NULL;
LPD3DXFONT m_font;
int i = 0;

void OurHook(LPDIRECT3DDEVICE9 pDevice){

D3DXCreateFont( pDevice, 20, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &m_font ); 

DisplaySomeText(pDevice);

    ReturnFromHook(Gmem, 1);

}

BOOL APIENTRY DllMain( HANDLE hModule, DWORD  fdwReason, LPVOID lpReserved ){

	if( fdwReason == DLL_PROCESS_ATTACH){
       CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&MainThread, NULL, NULL, NULL);
	   return TRUE;
	}

    return TRUE;
}

int MainThread(){

	while(!GetModuleHandle("d3d9.dll")){
         Sleep(1000);
	}

	DWORD* Vtable = (DWORD*) ScanTable();
    Gmem = Hook((DWORD)Vtable[42], (DWORD)&OurHook);		// hook endscene


	char buffer[10] = "";
	std::string OutString = "Vtable Location: 0x";
    sprintf(&buffer[0],"%x",Vtable);
    OutString += buffer;
   	MessageBox(NULL, OutString.c_str(), "SCHiM", MB_OK);


return 0;
}


void DisplaySomeText(LPDIRECT3DDEVICE9 pDevice){

      D3DCOLOR fontColor = D3DCOLOR_ARGB(255,0,255,0);   
     
      RECT rct;
      rct.left=2;
      rct.right=780;
      rct.top=10;
      rct.bottom=rct.top+20;
       
      
      m_font->DrawText(NULL, "Hooked!", -1, &rct, 0, fontColor );
      m_font->Release();
}

Virs:

Virscan
Jotti

post back results!
#1 · 15y ago
KI
kibbles18
@AVGN approve please
#2 · 15y ago
Liz
[MPGH]Liz
@Chooka avgn has no powers here.
#3 · 15y ago
Hassan
Hassan
Quote Originally Posted by Liz View Post
@Chooka avgn has no powers here.
Chooka ? Isn't it @kibbles18 ? ;P
#4 · 15y ago
Hell_Demon
Hell_Demon
Lmao, approved
#5 · 15y ago
ST
Stephen
I love you.
#6 · 15y ago
QW
qwer1335
love your1r1r1
#7 · 15y ago
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Tags for this Thread

None