By:
unreal-pwner
This is my d3d8 base. It is undetected as of 4/29/2007.
I am releasing this, because someone has it, and I know he will give it out to people, or release this in his name. and I will not have my work bieng falsy released. Im sure you all can understand that. I just made this new hooking method the other day, its quite different. It doesnt touch Direct3DCreate8, or CreateDevice. It simply grabs the static pointer to BeginScene, EndScene, etc. Then you hook that address, and your good to go. props to rover for his vtable hooking info. The only problem that I have noticed with this method, is that you need to wait a few seconds AFTER the game is fully loaded, the device has been created, and BeginScene, EndScene, etc, have all been initialized. Another cool thing about this method of hooking, is that you can inject your d3d hack at ANY POINT in the game. So, its alot easier to test certain things. If you start playing legit, and get owned, just inject your d3d hack, in midgame. it'll work just fine.
The offsets are for America's Army. I dont know if the offsets are different for other d3d8 games. As i have not hacked any other d3d8 game aside from America's Army. If they are the same, please tell me, and i will edit this post.
Enjoy.
Download Link:
http://www.ucdownloads.com/downloads...=2047&act=down Code:
/*
D3D8 Base by uNrEaL.
© 2006-2007 uNrEaL
*/
#include < windows.h >
#include < detours.h >
#include < d3d8.h >
#include < d3dx8.h >
#include "base.h"
#pragma comment(lib, "d3dx8.lib")
static DWORD dwBeginScene = 0x6D9D9250;
static DWORD dwEndScene = 0x6D9D93A0;
static DWORD dwDrawIndexedPrimitive = 0x6D9D73A0;
static DWORD dwSetStreamSource = 0x6D9D6760;
static DWORD dwPresent = 0x6D9ECC50;
static DWORD dwReset = 0x6D9EE3B0;
/*
In BeginScene you would usually generate textures,
stuff like that.
*/
HRESULT WINAPI myBeginScene(LPDIRECT3DDEVICE8 pDevice)
{
_asm pushad;
// code goes here
_asm popad;
return pBeginScene(pDevice);
}
/*
In EndScene you could draw text on your screen.
You could also do this in Present.
*/
HRESULT WINAPI myEndScene(LPDIRECT3DDEVICE8 pDevice)
{
_asm pushad;
// code goes here
_asm popad;
return pEndScene(pDevice);
}
/*
In DrawIndexedPrimitive you would do your chams,
wallhack, wireframe, maphacks, stuff like that.
*/
HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount)
{
_asm pushad;
// code goes here
_asm popad;
return pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
}
/*
In SetStreamSource you would setup your stride logging.
This would be used later in DrawIndexedPrimitive
to only cham/wallhack/wireframe/maphack certain strides.
*/
HRESULT WINAPI mySetStreamSource(LPDIRECT3DDEVICE8 pDevice, UINT nStreamNumber, LPDIRECT3DVERTEXBUFFER8 pStreamData, UINT nStride)
{
_asm pushad;
// code goes here
_asm popad;
return pSetStreamSource(pDevice, nStreamNumber, pStreamData, nStride);
}
/*
In Present you can draw text, as mentioned above.
This function is called most often, so any
key events should be in this function.
*/
HRESULT WINAPI myPresent ( LPDIRECT3DDEVICE8 pDevice, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion )
{
_asm pushad;
// code goes here
_asm popad;
return pPresent( pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion );
}
/*
When you start drawing text on your screen,
you will need to reset the text device and such.
This is the function you would do this in.
This function MUST be hooked, otherwise if you
ALT+TAB out of game, or minimize it, or whatnot,
the device will fail, and your game will crash.
This function resets the device, so that you can continue
with no problems.
*/
HRESULT WINAPI myReset ( LPDIRECT3DDEVICE8 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
{
_asm pushad;
// code goes here
_asm popad;
return pReset(pDevice, pPresentationParameters);
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
DisableThreadLibraryCalls(hDll);
if ( dwReason == DLL_PROCESS_ATTACH )
{
pBeginScene = (oBeginScene)DetourFunction((PBYTE)dwBeginScene, (PBYTE)myBeginScene);
pEndScene = (oEndScene)DetourFunction((PBYTE)dwEndScene, (PBYTE)myEndScene);
pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunction((PBYTE)dwDrawIndexedPrimitive, (PBYTE)myDrawIndexedPrimitive);
pSetStreamSource = (oSetStreamSource)DetourFunction((PBYTE)dwSetStreamSource, (PBYTE)mySetStreamSource);
pPresent = (oPresent)DetourFunction((PBYTE)dwPresent, (PBYTE)myPresent);
pReset = (oReset)DetourFunction((PBYTE)dwReset, (PBYTE)myReset);
}
return TRUE;
}