Register for your free account! | Forgot your password?

You last visited: Today at 17:53

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Soldier Front Base Hook

Discussion on Soldier Front Base Hook within the Soldier Front Hacks, Bots, Cheats & Exploits forum part of the Soldier Front category.

Reply
 
Old   #1
 
elite*gold: LOCKED
Join Date: Jun 2012
Posts: 530
Received Thanks: 166
Lightbulb Soldier Front Base Hook

This is a 'base' for Soldier Front 1 which hooks Endscene.

Feel free to copy and paste this and add bits, hopefully you can learn from it.

CVMTHookManager
Code:
class CVMTHookManager
{
public:
	CVMTHookManager( void )
	{
		memset( this, 0, sizeof( CVMTHookManager ) );
	}

	CVMTHookManager( PDWORD* ppdwClassBase )
	{
		bInitialize( ppdwClassBase );
	}

	bool UnhookVMT( PDWORD* ppdwClassBase )
	{
		*ppdwClassBase = m_pdwOldVMT;
		return true;
	}

	bool bInitialize( PDWORD* ppdwClassBase )
	{
		m_pdwOldVMT = *ppdwClassBase;
		m_dwVMTSize = dwGetVMTCount( *ppdwClassBase );
		m_pdwNewVMT = new DWORD[ m_dwVMTSize + 2 ];
		memcpy( m_pdwNewVMT, m_pdwOldVMT, sizeof( DWORD ) * m_dwVMTSize );
		*ppdwClassBase = m_pdwNewVMT;
		return true;
	}

	bool bInitialize( PDWORD** pppdwClassBase )
	{
		return bInitialize( *pppdwClassBase );
	}

	DWORD dwHookMethod( DWORD dwNewFunc, int iIndex )
	{
		if ( m_pdwNewVMT && m_pdwOldVMT && iIndex >= 0 && iIndex <= m_dwVMTSize )
		{
			m_pdwNewVMT[ iIndex ] = dwNewFunc;
			return m_pdwOldVMT[ iIndex ];
		}

		return NULL;
	}

	VOID dwUnHookMethod( int iIndex )
	{
		m_pdwNewVMT[ iIndex ] = m_pdwOldVMT[ iIndex ];
	}

private:
	DWORD dwGetVMTCount( PDWORD pdwVMT )
	{
		DWORD dwIndex;
		for ( dwIndex = 0; pdwVMT[ dwIndex ]; dwIndex++ )
		{
			if ( IsBadCodePtr( ( FARPROC ) pdwVMT[ dwIndex ] ) )
			{
				break;
			}
		}
		return dwIndex;
	}
	PDWORD	m_pdwNewVMT, m_pdwOldVMT;
	DWORD	m_dwVMTSize;
};

rgone.h
Code:
struct SFClass
{
	PDWORD PointerToClass; 

	SFClass( PDWORD Address )
	{
		PointerToClass = Address; 
	}

	BOOL IsClassAlive( )
	{
		BOOL Result;

		if(*PointerToClass != NULL)
		{
			Result = true;
		}
		else
		{
			Result = false;
		}

		return Result;
	}
};

struct GAME_SFDevice
{
	CHAR _UNKNOWN[0x08];
	LPDIRECT3DDEVICE9 pDevice;
};

struct SFDevice
{
	SFClass* GAMECLASS;
	CVMTHookManager* HookVMTManager;

	SFDevice( DWORD GameClass_Location )
	{
		GAMECLASS = new SFClass( (PDWORD)GameClass_Location );

	}

	~SFDevice( )
	{
		delete GAMECLASS;
	}

	LPDIRECT3DDEVICE9 Device( )
	{
		return ((GAME_SFDevice*)(*GAMECLASS->PointerToClass))->pDevice;
	}

	BOOL InitHook( )
	{
		if(!GAMECLASS->IsClassAlive( ))
			return FALSE;

		PDWORD* ppdwDevice = (PDWORD*)Device( );

		if(ppdwDevice == NULL)
			return FALSE;

		HookVMTManager = new CVMTHookManager( ppdwDevice );

		

		return TRUE;
	}

};

extern SFDevice* pSFDevice;

typedef LONG (WINAPI* tEndscene)(LPDIRECT3DDEVICE9);
extern tEndscene oEndscene;
LONG WINAPI hEndscene(LPDIRECT3DDEVICE9 pDevice);
rgone.cpp

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

SFDevice* pSFDevice;
DWORD WINAPI MyEntry( LPVOID );
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
	if(ul_reason_for_call == DLL_PROCESS_ATTACH)
	{
		CreateThread(0, 0, RGONE, 0, 0, 0);
	}

	return TRUE;
}

tEndscene oEndscene;

LONG WINAPI hEndscene(LPDIRECT3DDEVICE9 pDevice)
{

	return oEndscene(pDevice);
}

DWORD WINAPI RGONE( LPVOID )
{
	Sleep( 1000 );

	pSFDevice = new SFDevice( 0xEB5958 );

	if( !pSFDevice->InitHook( ) )
	{
		Beep(400, 400);
		return NULL;
	}

	oEndscene = (tEndscene) pSFDevice->HookVMTManager->dwHookMethod( (DWORD)hEndscene, 42 );

	return NULL;
}
Credits:
Shad0w_
cC
Einstein
Steam Trader is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Source] Soldier Front DFI Undetected Base
05/31/2012 - C/C++ - 4 Replies
PLEASE GIVE CREDITS! Okay today im gonna release my Source code in public. This is my first tutorial ^_^. ~Features: ~xhair~F1 ~XQZ WallHack~F2 ==main.h===



All times are GMT +1. The time now is 17:53.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.