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 › D3D EndScene Hook dont work

D3D EndScene Hook dont work

Posts 1–9 of 9 · Page 1 of 1
inmate
inmate
D3D EndScene Hook dont work
Hey, this is the source of purple.d1amonds d3d9 Hook Tutorial.
I inject the .dll in the wow process, but nothing happend. Can anyone say me where the error is please ? The .dll is successfully loading, i have test it with a messagebox.

Code:
#include "stdafx.h"
#include <windows.h>
#include <cstdio>
#include <d3d9.h>
#include <d3dx9.h>

typedef HRESULT(__stdcall* EndScene_t)(LPDIRECT3DDEVICE9);
EndScene_t pEndScene;

void DrawRect(LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color){

	D3DRECT rect = {X,Y,X+L,Y+H};

}


bool hkEndScene(LPDIRECT3DDEVICE9 pDevice){

const D3DCOLOR txtPink = D3DCOLOR_ARGB(255,255, 0, 255);

DrawRect( pDevice, 10, 10, 200, 200, txtPink);

return pEndScene(pDevice);

 }


void* DetourFunc(BYTE *src, const BYTE *dst, const int len)
{
	BYTE *jmp = (BYTE*)malloc(len+5);
	DWORD dwback;

	VirtualProtect(src, len, PAGE_READWRITE, &dwback);

	memcpy(jmp, src, len);	jmp += len;

	jmp[0] = 0xE9;
	*(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;

	src[0] = 0xE9;
	*(DWORD*)(src+1) = (DWORD)(dst - src) - 5;

	VirtualProtect(src, len, dwback, &dwback);

	return (jmp-len);
}



void InitHook()
{

	HMODULE hModule;

	hModule = GetModuleHandleA("d3d9.dll");

unsigned dwBeginScene;
unsigned dwEndScene;
unsigned dwReset;
unsigned dwDrawIndexedPrimitive;
unsigned dwSetViewPort;
dwBeginScene = (DWORD)hModule + 0x87010;
dwEndScene = (DWORD)hModule + 0x871A0;
dwReset = (DWORD)hModule + 0x636B0;
dwDrawIndexedPrimitive = (DWORD)hModule + 0x88830;
dwSetViewPort = (DWORD)hModule + 0x82F70 ;



				
               
				pEndScene = (EndScene_t)(DetourFunc((PBYTE)dwEndScene,(PBYTE)hkEndScene, 5));


MessageBoxA(NULL, "Funktion wurde aufgerufen","Done",NULL);

}


BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpvReserved)
{
	if (fdwReason == DLL_PROCESS_ATTACH)
	{
		
  CreateThread(0,0,(LPTHREAD_START_ROUTINE) InitHook,0,0,0);


	}
	return TRUE;
}


Thanks

N1GHTLIFE
#1 · 16y ago
CT
ctpsolo
Just a guess, could be other errors as well:

Code:
hModule = GetModuleHandleA("d3d9.dll");
Maybe it hasnt loaded when you inject. Try:

Code:
while(!hModule){
hModule = GetModuleHandleA("d3d9.dll");
}
#2 · 16y ago
inmate
inmate
Thanks for answer, but the .dll loaded successfully , i tried it with a messagebox at the end of the InitHook function .

Regards
#3 · 16y ago
inmate
inmate
is it possible that wow don´t use d3d9 ? It whoud be nice if anyone of you can test it with another game

offtopic: Where is the Edit button ?! ;D

Regards.
#4 · 16y ago
Hell_Demon
Hell_Demon
You're not drawing the rect
#5 · 16y ago
inmate
inmate


you confuse me , how do you mean this ? I draw the rect in the hooked endscene funktion:

Code:
bool hkEndScene(LPDIRECT3DDEVICE9 pDevice){

const D3DCOLOR txtPink = D3DCOLOR_ARGB(255,255, 0, 255);

DrawRect( pDevice, 10, 10, 200, 200, txtPink);

return pEndScene(pDevice);

 }
Or not oO ?

Regards
#6 · 16y ago
Hell_Demon
Hell_Demon
Quote Originally Posted by inmate View Post


you confuse me , how do you mean this ? I draw the rect in the hooked endscene funktion:

Code:
bool hkEndScene(LPDIRECT3DDEVICE9 pDevice){

const D3DCOLOR txtPink = D3DCOLOR_ARGB(255,255, 0, 255);

DrawRect( pDevice, 10, 10, 200, 200, txtPink);

return pEndScene(pDevice);

 }
Or not oO ?

Regards
This is the drawrect you use:
Code:
void DrawRect(LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color)
{

	D3DRECT rect = {X,Y,X+L,Y+H};

}
All that does is a make D3DRECT rect with the width/length height and stuff, not actually draw it.

Here's are DrawRect and DrawFilledRect that I use(written from memory, i'll check for you later)

Code:
ID3DXLine *pLine = NULL;
void DrawRect(int X, int Y, int Width, int Height, D3DCOLOR col)
{
	D3DXVECTOR2 rect[5] = { {X, Y}, {X+Width, Y}, {X+Width, Y+Height}, {X, Y+Height}, {X, Y}};
	pLine->Begin();
	pLine->Draw(rect, 5, col);
	pLine->End();
}

void DrawFilledRect(int X, int Y, int Width, int Height, D3DCOLOR col)
{
	D3DXVECTOR2 rect[2] = { {X+Width/2, Y}, {X+Width/2, Y+Height} };

	pLine->SetWidth((float)Width);

	pLine->Begin();
	pLine->Draw(rect, 2, col);
	pLine->End();

	pLine->SetWidth(1.0f);
}

void InitializeD3DCrap(void)
{
	D3DXCreateLine( pDevice, &pLine );
	pLine->SetWidth(1.0f);
	pLine->SetPattern(0xFFFFFFFF); //solid line
	pLine->SetAntialias(false); //increases speed
	pLine->SetGLLines(true); //increases speed
}
Call InitializeD3DCrap() somewhere after the device has been made(and only once), then you can use DrawRect and DrawFilledRect
#7 · edited 16y ago · 16y ago
Melodia
Melodia
Quote Originally Posted by inmate View Post


you confuse me , how do you mean this ? I draw the rect in the hooked endscene funktion:

Code:
bool hkEndScene(LPDIRECT3DDEVICE9 pDevice){

const D3DCOLOR txtPink = D3DCOLOR_ARGB(255,255, 0, 255);

DrawRect( pDevice, 10, 10, 200, 200, txtPink);

return pEndScene(pDevice);

 }
Or not oO ?

Regards
You need to make your DrawRect Function sir .
#8 · 16y ago
inmate
inmate
Ahhh damn ok i understand

Okay hmm but why is this don´t work:

Code:
#include "stdafx.h"
#include <windows.h>
#include <cstdio>
#include <d3d9.h>
#include <d3dx9.h>

typedef HRESULT(__stdcall* EndScene_t)(LPDIRECT3DDEVICE9);
EndScene_t pEndScene;




bool hkEndScene(LPDIRECT3DDEVICE9 pDevice){

MessageBoxA(NULL, "function successfully called","Done",NULL);  // <- This messagebox


return pEndScene(pDevice);

 }


void* DetourFunc(BYTE *src, const BYTE *dst, const int len)
{
	BYTE *jmp = (BYTE*)malloc(len+5);
	DWORD dwback;

	VirtualProtect(src, len, PAGE_READWRITE, &dwback);

	memcpy(jmp, src, len);	jmp += len;

	jmp[0] = 0xE9;
	*(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;

	src[0] = 0xE9;
	*(DWORD*)(src+1) = (DWORD)(dst - src) - 5;

	VirtualProtect(src, len, dwback, &dwback);

	return (jmp-len);
}




void InitHook()
{

	HMODULE hModule;

	hModule = GetModuleHandleA("d3d9.dll");

unsigned dwBeginScene;
unsigned dwEndScene;
unsigned dwReset;
unsigned dwDrawIndexedPrimitive;
unsigned dwSetViewPort;
dwBeginScene = (DWORD)hModule + 0x87010;
dwEndScene = (DWORD)hModule + 0x871A0;
dwReset = (DWORD)hModule + 0x636B0;
dwDrawIndexedPrimitive = (DWORD)hModule + 0x88830;
dwSetViewPort = (DWORD)hModule + 0x82F70 ;



				
               
				pEndScene = (EndScene_t)(DetourFunc((PBYTE)dwEndScene,(PBYTE)hkEndScene, 5));




}


BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpvReserved)
{
	if (fdwReason == DLL_PROCESS_ATTACH)
	{
		
  CreateThread(0,0,(LPTHREAD_START_ROUTINE) InitHook,0,0,0);


	}
	return TRUE;
}
I think the messagebox must be pop up. but it dont work :-/...
#9 · 16y ago
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Similar Threads

  • all bypasses dont work?By theplayer45 in WarRock - International Hacks
    18Last post 19y ago
  • Hacks dont workBy blackmarth in WarRock Korea Hacks
    3Last post 19y ago
  • (NEW PATCH) Trainer dont work anymoreBy miregal in WarRock - International Hacks
    19Last post 19y ago
  • Your D3D8/9 SDK For D3D/Client Hooks!By WarPunk in C++/C Programming
    2Last post 18y ago
  • My Hotkeys Dont Work!By ltkort213 in WarRock - International Hacks
    3Last post 19y ago

Tags for this Thread

None