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 › Combat Arms Hacks & Cheats › [Source]Vtable Hook?

[Source]Vtable Hook?

Posts 1–15 of 18 · Page 1 of 2
SO
SoreBack
[Source]Chams w/ Vtable
Code:
#include <Windows.h>
#include <d3d9.h>
#include <detours.h>
#include "stdafx.h"
#pragma comment (lib, "d3d9.lib")

IDirect3DDevice9 * pGameDevice;
LPDIRECT3DTEXTURE9  Red,Yellow,Green,Blue,Purple,Pink,Orange;
UINT iStride;
bool Chams = true;

 
//============================================================//
HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
{
    if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex)) )
        return E_FAIL;
 
    WORD colour16 =    ((WORD)((colour32>>28)&0xF)<<12)
            |(WORD)(((colour32>>20)&0xF)<<8)
            |(WORD)(((colour32>>12)&0xF)<<4)
            |(WORD)(((colour32>>4)&0xF)<<0);
 
    D3DLOCKED_RECT d3dlr;    
    (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
    WORD *pDst16 = (WORD*)d3dlr.pBits;
 
    for(int xy=0; xy < 8*8; xy++)
        *pDst16++ = colour16;
 
    (*ppD3Dtex)->UnlockRect(0);
 
    return S_OK;
}//==================================Texture=========================//
////////////////
///BeginScene///
////////////////
typedef HRESULT(WINAPI* BeginScene_)(LPDIRECT3DDEVICE9 pDevice);
BeginScene_ pBeginScene;
HRESULT WINAPI nBeginScene(LPDIRECT3DDEVICE9 pDevice)
{
	_asm NOP;
	HRESULT hRet = pBeginScene(pDevice);
	if (GetAsyncKeyState(VK_F1)&1)
{
	Chams = !Chams;
}

	return hRet;
}

/**************************************************************************************************/

//////////////
///EndScene///
//////////////
typedef HRESULT(WINAPI* EndScene_)(LPDIRECT3DDEVICE9 pDevice);
EndScene_ pEndScene;
HRESULT WINAPI nEndScene(LPDIRECT3DDEVICE9 pDevice)
{	
	if(Chams)
{ 
GenerateTexture(pDevice, &Red,      D3DCOLOR_ARGB    (255   ,   255  ,     0      ,    0      ));
GenerateTexture(pDevice, &Yellow,   D3DCOLOR_ARGB    (255   ,   255  ,     255    ,    0      ));
GenerateTexture(pDevice, &Green,    D3DCOLOR_ARGB    (255   ,   0    ,     255    ,    0      ));
GenerateTexture(pDevice, &Blue,     D3DCOLOR_ARGB    (255   ,   0    ,     0      ,    255    ));
GenerateTexture(pDevice, &Purple,   D3DCOLOR_ARGB    (255   ,   102  ,     0      ,    153    ));
GenerateTexture(pDevice, &Pink,     D3DCOLOR_ARGB    (255   ,   255  ,     20      ,   147    ));
GenerateTexture(pDevice, &Orange,   D3DCOLOR_ARGB    (255   ,   255  ,     165      ,  0      ));
Color=false; 
}
 
return pEndScene(pDevice);
}

/**************************************************************************************************/

//////////////////////////
///DrawIndexedPrimitive///
//////////////////////////
typedef HRESULT(WINAPI* DrawIndexedPrimitive_)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex,
											  UINT NumVertices, UINT StartIndex, UINT PrimitiveCount);
DrawIndexedPrimitive_ pDrawIndexedPrimitive;
HRESULT WINAPI nDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex,
									UINT NumVertices, UINT StartIndex, UINT PrimitiveCount)
{	
	
	
	
	
	{	

		pDevice->SetRenderState( D3DRS_FOGENABLE, false );

	}	



	IDirect3DVertexBuffer9* pStreamData = NULL;

	UINT iOffsetInBytes,iStride; 

	pDevice->GetStreamSource(0,&pStreamData,&iOffsetInBytes,&iStride); 

	if (Chams) 
	{
		if (iStride == 44)
		{
             DWORD dwOldZEnable = D3DZB_TRUE;
             pDevice->SetTexture(0, Orange);
             pDevice->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable);
             pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
			 pDevice->DrawIndexedPrimitive(Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
             pDevice->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
             pDevice->SetTexture(0, Red);
}
	}

	
	
	
	
	return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimitiveCount);
			
	
}

/**************************************************************************************************/

/////////////////////
///SetStreamSource///
/////////////////////
typedef HRESULT(WINAPI* SetStreamSource_)(LPDIRECT3DDEVICE9 pDevice, UINT StreamNumber, IDirect3DVertexBuffer9 * pStreamData, UINT OffsetInBytes, UINT Stride);
SetStreamSource_ pSetStreamSource;
HRESULT WINAPI nSetStreamSource(LPDIRECT3DDEVICE9 pDevice, UINT StreamNumber, IDirect3DVertexBuffer9 * pStreamData, UINT OffsetInBytes, UINT Stride)
{	
	_asm NOP;
	HRESULT hRet = pSetStreamSource(pDevice, StreamNumber, pStreamData, OffsetInBytes, Stride);
if( StreamNumber == 0 ){iStride = Stride;}

	return hRet;
}

/**************************************************************************************************/

///////////
///Reset///
///////////
typedef HRESULT(WINAPI* Reset_)(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
Reset_ pReset;
HRESULT WINAPI nReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
{
	_asm NOP;
	HRESULT hRet = pReset(pDevice, pPresentationParameters);

	return hRet;
}

/**************************************************************************************************/


DWORD dwWait(LPVOID lpArgs)
{
	
	DWORD Base = NULL;

	for (;Base == NULL;Sleep(100))           
		Base = (DWORD)GetModuleHandle("Engine.exe//Whatever the processname is");  
	
	for(;pGameDevice == NULL; Sleep(10000))  
	{
		DWORD dwProtect;
		VirtualProtect((void*)(0x7D0840), 4, PAGE_EXECUTE_READWRITE, &dwProtect);
		memcpy(&pGameDevice, (void*)(0x7D0840), 4);
		VirtualProtect((void*)(0x7D0840), 4, dwProtect, NULL);
	}
			
		


	DWORD* pdwNewDevice  =(DWORD*)*(DWORD*)pGameDevice;
	pdwNewDevice = (DWORD*)pdwNewDevice[0];  //turn our pointer into an array for the vtable
	
	
	pReset = (Reset_)DetourFunction((PBYTE)pdwNewDevice[16],(PBYTE)nReset);
	pBeginScene = (BeginScene_)DetourFunction((PBYTE)pdwNewDevice[41],(PBYTE)nBeginScene);
	pEndScene = (EndScene_)DetourFunction((PBYTE)pdwNewDevice[42],(PBYTE)nEndScene);
	pDrawIndexedPrimitive = (DrawIndexedPrimitive_)DetourFunction((PBYTE)pdwNewDevice[82],(PBYTE)nDrawIndexedPrimitive);
	pSetStreamSource = (SetStreamSource_)DetourFunction((PBYTE)pdwNewDevice[100],(PBYTE)nSetStreamSource);
	
	return 0;
}

bool WINAPI DllMain(HMODULE hMod, DWORD dwReason, LPVOID lpReserved)
{
	if(dwReason == DLL_PROCESS_ATTACH)
	{
				
		CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)dwWait, NULL, NULL, NULL);
		
		return true;
	}
	
	return false;
}
It has errors, i dont know if it still works.

This isnt flawless, identify the errors and fix it. I dont want to make it a easy c/p..

Have fun. Hopefully you'll get the base idea.

Credits for Strife for the base.

Credits to fatboy for his D3D8 offsets tutorial.
I did this on the top of my head.
#1 · edited 17y ago · 17y ago
Obama
Obama
Quote Originally Posted by SoreBack View Post
Code:
#include <Windows.h>
#include <d3d9.h>
#include <detours.h>
#include "stdafx.h"
#pragma comment (lib, "d3d9.lib")

IDirect3DDevice9 * pGameDevice;
LPDIRECT3DTEXTURE9  Red,Yellow,Green,Blue,Purple,Pink,Orange;
UINT iStride;
bool Chams = true;

 
//============================================================//
HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
{
    if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex)) )
        return E_FAIL;
 
    WORD colour16 =    ((WORD)((colour32>>28)&0xF)<<12)
            |(WORD)(((colour32>>20)&0xF)<<8)
            |(WORD)(((colour32>>12)&0xF)<<4)
            |(WORD)(((colour32>>4)&0xF)<<0);
 
    D3DLOCKED_RECT d3dlr;    
    (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
    WORD *pDst16 = (WORD*)d3dlr.pBits;
 
    for(int xy=0; xy < 8*8; xy++)
        *pDst16++ = colour16;
 
    (*ppD3Dtex)->UnlockRect(0);
 
    return S_OK;
}//==================================Texture=========================//
////////////////
///BeginScene///
////////////////
typedef HRESULT(WINAPI* BeginScene_)(LPDIRECT3DDEVICE9 pDevice);
BeginScene_ pBeginScene;
HRESULT WINAPI nBeginScene(LPDIRECT3DDEVICE9 pDevice)
{
	_asm NOP;
	HRESULT hRet = pBeginScene(pDevice);
	if (GetAsyncKeyState(VK_F1)&1)
{
	Chams = !Chams;
}

	return hRet;
}

/**************************************************************************************************/

//////////////
///EndScene///
//////////////
typedef HRESULT(WINAPI* EndScene_)(LPDIRECT3DDEVICE9 pDevice);
EndScene_ pEndScene;
HRESULT WINAPI nEndScene(LPDIRECT3DDEVICE9 pDevice)
{	
	if(Chams)
{ 
GenerateTexture(pDevice, &Red,      D3DCOLOR_ARGB    (255   ,   255  ,     0      ,    0      ));
GenerateTexture(pDevice, &Yellow,   D3DCOLOR_ARGB    (255   ,   255  ,     255    ,    0      ));
GenerateTexture(pDevice, &Green,    D3DCOLOR_ARGB    (255   ,   0    ,     255    ,    0      ));
GenerateTexture(pDevice, &Blue,     D3DCOLOR_ARGB    (255   ,   0    ,     0      ,    255    ));
GenerateTexture(pDevice, &Purple,   D3DCOLOR_ARGB    (255   ,   102  ,     0      ,    153    ));
GenerateTexture(pDevice, &Pink,     D3DCOLOR_ARGB    (255   ,   255  ,     20      ,   147    ));
GenerateTexture(pDevice, &Orange,   D3DCOLOR_ARGB    (255   ,   255  ,     165      ,  0      ));
Color=false; 
}
 
return pEndScene(pDevice);
}

/**************************************************************************************************/

//////////////////////////
///DrawIndexedPrimitive///
//////////////////////////
typedef HRESULT(WINAPI* DrawIndexedPrimitive_)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex,
											  UINT NumVertices, UINT StartIndex, UINT PrimitiveCount);
DrawIndexedPrimitive_ pDrawIndexedPrimitive;
HRESULT WINAPI nDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex,
									UINT NumVertices, UINT StartIndex, UINT PrimitiveCount)
{	
	
	
	
	
	{	

		pDevice->SetRenderState( D3DRS_FOGENABLE, false );

	}	



	IDirect3DVertexBuffer9* pStreamData = NULL;

	UINT iOffsetInBytes,iStride; 

	pDevice->GetStreamSource(0,&pStreamData,&iOffsetInBytes,&iStride); 

	if (Chams) 
	{
		if (iStride == 44)
		{
             DWORD dwOldZEnable = D3DZB_TRUE;
             pDevice->SetTexture(0, Orange);
             pDevice->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable);
             pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
			 pDevice->DrawIndexedPrimitive(Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
             pDevice->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
             pDevice->SetTexture(0, Red);
}
	}

	
	
	
	
	return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimitiveCount);
			
	
}

/**************************************************************************************************/

/////////////////////
///SetStreamSource///
/////////////////////
typedef HRESULT(WINAPI* SetStreamSource_)(LPDIRECT3DDEVICE9 pDevice, UINT StreamNumber, IDirect3DVertexBuffer9 * pStreamData, UINT OffsetInBytes, UINT Stride);
SetStreamSource_ pSetStreamSource;
HRESULT WINAPI nSetStreamSource(LPDIRECT3DDEVICE9 pDevice, UINT StreamNumber, IDirect3DVertexBuffer9 * pStreamData, UINT OffsetInBytes, UINT Stride)
{	
	_asm NOP;
	HRESULT hRet = pSetStreamSource(pDevice, StreamNumber, pStreamData, OffsetInBytes, Stride);
if( StreamNumber == 0 ){iStride = Stride;}

	return hRet;
}

/**************************************************************************************************/

///////////
///Reset///
///////////
typedef HRESULT(WINAPI* Reset_)(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
Reset_ pReset;
HRESULT WINAPI nReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
{
	_asm NOP;
	HRESULT hRet = pReset(pDevice, pPresentationParameters);

	return hRet;
}

/**************************************************************************************************/


DWORD dwWait(LPVOID lpArgs)
{
	
	DWORD Base = NULL;

	for (;Base == NULL;Sleep(100))           
		Base = (DWORD)GetModuleHandle("crossfire.exe");  
	
	for(;pGameDevice == NULL; Sleep(10000))  
	{
		DWORD dwProtect;
		VirtualProtect((void*)(0x7D0840), 4, PAGE_EXECUTE_READWRITE, &dwProtect);
		memcpy(&pGameDevice, (void*)(0x7D0840), 4);
		VirtualProtect((void*)(0x7D0840), 4, dwProtect, NULL);
	}
			
		


	DWORD* pdwNewDevice  =(DWORD*)*(DWORD*)pGameDevice;
	pdwNewDevice = (DWORD*)pdwNewDevice[0];  //turn our pointer into an array for the vtable
	
	
	pReset = (Reset_)DetourFunction((PBYTE)pdwNewDevice[16],(PBYTE)nReset);
	pBeginScene = (BeginScene_)DetourFunction((PBYTE)pdwNewDevice[41],(PBYTE)nBeginScene);
	pEndScene = (EndScene_)DetourFunction((PBYTE)pdwNewDevice[42],(PBYTE)nEndScene);
	pDrawIndexedPrimitive = (DrawIndexedPrimitive_)DetourFunction((PBYTE)pdwNewDevice[82],(PBYTE)nDrawIndexedPrimitive);
	pSetStreamSource = (SetStreamSource_)DetourFunction((PBYTE)pdwNewDevice[100],(PBYTE)nSetStreamSource);
	
	return 0;
}

bool WINAPI DllMain(HMODULE hMod, DWORD dwReason, LPVOID lpReserved)
{
	if(dwReason == DLL_PROCESS_ATTACH)
	{
				
		CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)dwWait, NULL, NULL, NULL);
		
		return true;
	}
	
	return false;
}
It has errors, i dont know if it still works.

This isnt flawless, identify the errors and fix it. I dont want to make it a easy c/p..

Have fun. Hopefully you'll get the base idea.

Credits for Strife for the base.

Credits to fatboy for his D3D8 offsets tutorial.
I did this on the top of my head.
Wrong section bro.
#2 · 17y ago
SO
SoreBack
No one finds any use for this?

/cut

I know, but this is strictly for Combat ARms lol.

The strides and pointer and module name could be changed to be applicable to other games.
#3 · 17y ago
megaflcl
megaflcl
this will probably be of more use in one of the programming sections
#4 · 17y ago
Obama
Obama
Quote Originally Posted by SoreBack View Post
No one finds any use for this?

/cut

I know, but this is strictly for Combat ARms lol.

The strides and pointer and module name could be changed to be applicable to other games.
Honestly i dont no what the hell all of this is. Can you explain sorry.
#5 · 17y ago
SO
SoreBack
like anyone goes there >.>

Every post on this site barely has anything to do with Coding or any importance. Only the releases and glitches. You know you could easily make a undetected chams with what i just posted it just needs a little adjusting.

Btw, i did this in NotePad.
#6 · 17y ago
megaflcl
megaflcl
well odds are it will be moved there anyways =/
#7 · 17y ago
SO
SoreBack
Quote Originally Posted by SoreBack View Post
like anyone goes there >.>

Every post on this site barely has anything to do with Coding or any importance. Only the releases and glitches. You know you could easily make a undetected chams with what i just posted it just needs a little adjusting.

Btw, i did this in NotePad.
Re read it all.....
#8 · 17y ago
Remorse
Remorse
mmm i get some of this i think but looks more like for thegaysquads cham.
and yeah noone around here can probably make heads or tails of this.
#9 · 17y ago
SO
SoreBack
But the people who can will appreciate this.
#10 · 17y ago
Obama
Obama
Quote Originally Posted by SoreBack View Post
But the people who can will appreciate this.
We have none that can. If we did we wouldnt be waiting for hacks right now.
#11 · 17y ago
rwkeith
rwkeith
I am working onsomething after this upcoming patch. Its actually a cracked updater for free FPS CA Hacks. No joke and we all know FPS makes some pretty good stuff...
#12 · 17y ago
IW
Iwin
Quote Originally Posted by rwkeith View Post
I am working onsomething after this upcoming patch. Its actually a cracked updater for free FPS CA Hacks. No joke and we all know FPS makes some pretty good stuff...
why not just release free chams and shit?

i heard you were an experienced coder
#13 · 17y ago
SY
Synns
Why does it say crossfire.exe ?
#14 · 17y ago
rwkeith
rwkeith
Quote Originally Posted by Iwin View Post
why not just release free chams and shit?

i heard you were an experienced coder
I would if I had some help here >.>. I prefer to do something all the way too. If going to make something its going to have everything. Plus I wouldn't charge a dime. I'm better at cracking anyways.
#15 · edited 17y ago · 17y ago
Posts 1–15 of 18 · Page 1 of 2

Post a Reply

Similar Threads

  • Vtable hook sourceBy nitega in All Points Bulletin Reloaded Hacks
    26Last post 14y ago
  • crossfire wallhack source for hookBy GangsterCode in CrossFire Hack Coding / Programming / Source Code
    9Last post 15y ago
  • [CODE]VTable hookingBy Hell_Demon in C++/C Programming
    4Last post 15y ago
  • [Source] WH_KEYBOARD Hook HotkeysBy d.vel.oper in C++/C Programming
    1Last post 18y ago
  • Counter Strike Source Killa HookBy chrisisfat in CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    0Last post 17y ago

Tags for this Thread

#hook#sourcevtable