PDA

View Full Version : D3D mem hacks(how to)



Dxt-Cobra
02-10-2008, 04:22 PM
Heres how to do mem addies in a d3d.by Dxt-Cobra

DO NOT POST THIS ANYWERE ELSE!!!!

With a d3d the memory is already hooked.So there is all kinds of ways to do mem editing.

Heres some examples:

if you use Read and Write process memory you dont have to use findwindow(blah,blah);

Here is what you would do.

At the top of d3d8dev.cpp make a handle to somthing


HANDLE Wrrk; //<<< you can name this whatever i chose Wrrk for this example


Then find Initialize()

in there add this


Wrrk = GetCurrentProcess();


Call that in endscene too,to make sure we still have the current process.


#define Spawn_Addie1 0x00000000 //<<<<<<define your address up top somewere with the HANDLE

Wrrk = GetCurrentProcess();
ReadProcessMemory(Wrrk,(LPVOID*)(DWORD)Spawn_Addie 1,&v, sizeof(v), NULL);


now when you do ReadProcessMemory or WriteProcessMemory,we have our mem to read and write too.[/COLOR]


Now that method works and all but what other options is there?

Well here is method 2 of writing to memory.




#define Spawn_Addie1 0x00000000 //<<<<<<define your address up top somewere with the HANDLE


void Spawn()
{
long t=0;
unsigned long Protection;
VirtualProtect((void*)Spawn_Addie1, sizeof(t), PAGE_READWRITE, &Protection);
memcpy((void*)Spwan_Addie1, &t , sizeof(t));
VirtualProtect((void*)Spawn_Addie1, sizeof(t), Protection, 0);

VirtualProtect((void*)Spawn_Addie2, sizeof(t), PAGE_READWRITE, &Protection);
memcpy((void*)Spwan_Addie2, &t , sizeof(t));
VirtualProtect((void*)Spawn_Addie2, sizeof(t), Protection, 0);
}


That is how you do mem with memcpy,adn virtual protect.


To use this in hotkeys or menus


////up top bool your hack bool means true or false///

bool H_Spawn;


/////in End Scene/////Do the hotkey and hack

if( GetAsyncKeyState( VK_NUMPAD1)&1 )
H_Spawn = !H_Spawn; ////this tells it on or off

if (H_Spawn) ////if H_Spawn is true
{
Spawn(); /// hack
}

DutchHelFire
02-13-2008, 01:59 PM
How to add this into the menu??? like at chams it is:
"If (GetKeyPress)........................"
but how to to that with ur mem hacks??

EDIT----
Wrrk = GetCurrentProcess();
long v = 0;
WriteProcessMemory(Wrrk,(LPVOID*)(DWORD)Spawn_Addi e1,&v, sizeof(v), NULL);


Iunno i m not a coder but when i didnt do this i got 4 errors :eek:

Dxt-Cobra
02-13-2008, 08:07 PM
added ....

DutchHelFire
02-14-2008, 12:41 AM
ur method is for the Protect version right?

Hans211
02-14-2008, 12:17 PM
ur method is for the Protect version right?
Yes his code is correct, you have to define also the second address:

#define Spawn_Addie2 0x00000000 //<<<<<<define your address up top somewere with the HANDLE

DutchHelFire
02-14-2008, 01:30 PM
Yes his code is correct, you have to define also the second address:

#define Spawn_Addie2 0x00000000 //<<<<<<define your address up top somewere with the HANDLE

i ment his method for adding Mem hacks to the menu ;)

kingmetaru
02-14-2008, 10:40 PM
not easy to understand

Dxt-Credzis
02-16-2008, 04:08 PM
HANDLE Wrrk; //<<< you can name this whatever i chose Wrrk for this example


Then find Initialize()

in there add this


Wrrk = GetCurrentProcess();

------------------------------------------------------------------------------

Or the easy way



HANDLE Wrrk = GetCurrentProcess();

Xocitus
02-18-2008, 06:30 AM
Second Method is best... cause if you are in the Memory why would you still use WriteProccessMemory...

kingmetaru
02-19-2008, 08:22 AM
ya still use....

man2fight
03-03-2008, 10:48 AM
i have made it but if i start my menu (press insert) warrock chrashes

thimo
03-04-2008, 09:29 AM
HANDLE Wrrk; //<<< you can name this whatever i chose Wrrk for this example


Then find Initialize()

in there add this


Wrrk = GetCurrentProcess();

------------------------------------------------------------------------------

Or the easy way



HANDLE Wrrk = GetCurrentProcess();


ReadProcessMemory(GetCurrentProcess(),(LPVOID*)(DW ORD)Spawn_Addie1,&v, sizeof(v), NULL);

Is the easiest then...

man2fight
03-04-2008, 12:34 PM
but where do you set the value

DutchHelFire
03-14-2008, 05:00 PM
i m new to coding but i can read that in that coding it says READ
so make a WriteProcessMemory thingy and u can set ur value then ;)

seth26jan
03-30-2008, 06:17 AM
How would we apply this to C++ NOPs and pointer functions?

ZeaS
03-30-2008, 06:28 AM
How would we apply this to C++ NOPs and pointer functions?

i nop it like this: (kick = anti kick)


unsigned char Kick1On[6] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90};

unsigned char Kick1Off[6] = { /*your off hex.. */};

void KickOn(){unsigned long Protection;
VirtualProtect((void*)Kick_Addie, 6, PAGE_READWRITE, &Protection);
memcpy((void*)Kick_Addie, (const void*)Kick1On,6);
VirtualProtect((void*)Kick_Addie, 6, Protection, 0);
}

void KickOff(){unsigned long Protection;
VirtualProtect((void*)Kick_Addie, 6, PAGE_READWRITE, &Protection);
memcpy((void*)Kick_Addie, (const void*)Kick1Off,6);
VirtualProtect((void*)Kick_Addie, 6, Protection, 0);
}

seth26jan
03-30-2008, 06:30 AM
i nop it like this: (kick = anti kick)


unsigned char Kick1On[6] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90};

unsigned char Kick1Off[6] = { /*your off hex.. */};

void KickOn(){unsigned long Protection;
VirtualProtect((void*)Kick_Addie, 6, PAGE_READWRITE, &Protection);
memcpy((void*)Kick_Addie, (const void*)Kick1On,6);
VirtualProtect((void*)Kick_Addie, 6, Protection, 0);
}

void KickOff(){unsigned long Protection;
VirtualProtect((void*)Kick_Addie, 6, PAGE_READWRITE, &Protection);
memcpy((void*)Kick_Addie, (const void*)Kick1Off,6);
VirtualProtect((void*)Kick_Addie, 6, Protection, 0);
}

Also, how would you work with pointers, like with the player/server base and an offset?

ZeaS
03-30-2008, 06:36 AM
for pointers i dont use this way

i use this:


void WritePointerFloat(long addy, short offset, float value)
{
long maddy;
long saddy;
memory();
ReadProcessMemory(hProcess, (LPVOID*)(DWORD) addy, &maddy, sizeof(maddy), NULL);
saddy = maddy + offset;
WriteProcessMemory(hProcess, (LPVOID*)(DWORD) saddy, &value, sizeof(value), NULL);
}

i modify it a little but i use it like this to do pointers =\

Wrhackadmin
04-09-2008, 09:09 AM
http://img514.imageshack.us/img514/1620/immaginehm4.png

virus7799
04-09-2008, 10:49 AM
http://img514.imageshack.us/img514/1620/immaginehm4.png

Post your code and I may be able to help you.

Wrhackadmin
04-09-2008, 05:34 PM
Fixed Ty Ty Ty

Goldenfox
04-09-2008, 05:46 PM
thx dude!!!!!!!

virus7799
04-10-2008, 06:32 AM
/* Direct3D8 Device */

#include <windows.h>
#include "main.h"
#include "d3d8.h"
HANDLE Wrrk; //<<< you can name this whatever i chose Wrrk for this example
bool H_Spawn;

#define D3DHOOK_TEXTURES //comment this to disable texture hooking

HRESULT CD3DManager::Initialize()
{
/*
initialize Resources such as textures
(managed and unmanaged [D3DPOOL]),
vertex buffers, and other D3D rendering resources
...
m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture);
*/
Wrrk = GetCurrentProcess();
return S_OK;
}

HRESULT CD3DManager::PreReset()
{
/*
release all UNMANAGED [D3DPOOL_DEFAULT]
textures, vertex buffers, and other
volitile resources
...
_SAFE_RELEASE(m_pD3Dtexture);
*/
return S_OK;
}

HRESULT CD3DManager::PostReset()
{
/*
re-initialize all UNMANAGED [D3DPOOL_DEFAULT]
textures, vertex buffers, and other volitile
resources
...
m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture);
*/
return S_OK;
}

HRESULT CD3DManager::Release()
{
/*
Release all textures, vertex buffers, and
other resources
...
_SAFE_RELEASE(m_pD3Dtexture);
*/
return S_OK;
}

//-----------------------------------------------------------------------------

HRESULT APIENTRY hkIDirect3DDevice8::QueryInterface(REFIID riid, void** ppvObj)
{
return m_pD3Ddev->QueryInterface(riid, ppvObj);
}

ULONG APIENTRY hkIDirect3DDevice8::AddRef(void)
{
m_refCount++;
return m_pD3Ddev->AddRef();
}

ULONG APIENTRY hkIDirect3DDevice8::Release(void)
{
if( --m_refCount == 0 )
m_pManager->Release();

return m_pD3Ddev->Release();
}

HRESULT APIENTRY hkIDirect3DDevice8::TestCooperativeLevel(void)
{
return m_pD3Ddev->TestCooperativeLevel();
}

UINT APIENTRY hkIDirect3DDevice8::GetAvailableTextureMem(void)
{
return m_pD3Ddev->GetAvailableTextureMem();
}

HRESULT APIENTRY hkIDirect3DDevice8::ResourceManagerDiscardBytes(DW ORD Bytes)
{
return m_pD3Ddev->ResourceManagerDiscardBytes(Bytes);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetDirect3D(IDirect3D8** ppD3D8)
{
HRESULT hRet = m_pD3Ddev->GetDirect3D(ppD3D8);
if( SUCCEEDED(hRet) )
*ppD3D8 = m_pD3Dint;
return hRet;
}

HRESULT APIENTRY hkIDirect3DDevice8::GetDeviceCaps(D3DCAPS8* pCaps)
{
return m_pD3Ddev->GetDeviceCaps(pCaps);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetDisplayMode(D3DDISPLAYMODE* pMode)
{
return m_pD3Ddev->GetDisplayMode(pMode);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetCreationParameters(D3DDEVIC E_CREATION_PARAMETERS *pParameters)
{
return m_pD3Ddev->GetCreationParameters(pParameters);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetCursorProperties(UINT XHotSpot,UINT YHotSpot,IDirect3DSurface8* pCursorBitmap)
{
return m_pD3Ddev->SetCursorProperties(XHotSpot, YHotSpot, pCursorBitmap);
}

void APIENTRY hkIDirect3DDevice8::SetCursorPosition(int X,int Y,DWORD Flags)
{
m_pD3Ddev->SetCursorPosition(X, Y, Flags);
}

BOOL APIENTRY hkIDirect3DDevice8::ShowCursor(BOOL bShow)
{
return m_pD3Ddev->ShowCursor(bShow);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateAdditionalSwapChain(D3DP RESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain8** pSwapChain)
{
return m_pD3Ddev->CreateAdditionalSwapChain(pPresentationParameters, pSwapChain);
}

HRESULT APIENTRY hkIDirect3DDevice8::Reset(D3DPRESENT_PARAMETERS* pPresentationParameters)
{
m_pManager->PreReset();

HRESULT hRet = m_pD3Ddev->Reset(pPresentationParameters);

if( SUCCEEDED(hRet) )
{
m_PresentParam = *pPresentationParameters;
m_pManager->PostReset();
}

return hRet;
}

HRESULT APIENTRY hkIDirect3DDevice8::Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
{
return m_pD3Ddev->Present(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetBackBuffer(UINT BackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer)
{
return m_pD3Ddev->GetBackBuffer(BackBuffer, Type, ppBackBuffer);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetRasterStatus(D3DRASTER_STAT US* pRasterStatus)
{
return m_pD3Ddev->GetRasterStatus(pRasterStatus);
}

void APIENTRY hkIDirect3DDevice8::SetGammaRamp(DWORD Flags,CONST D3DGAMMARAMP* pRamp)
{
m_pD3Ddev->SetGammaRamp(Flags, pRamp);
}

void APIENTRY hkIDirect3DDevice8::GetGammaRamp(D3DGAMMARAMP* pRamp)
{
m_pD3Ddev->GetGammaRamp(pRamp);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture8** ppTexture)
{
HRESULT hRet = m_pD3Ddev->CreateTexture(Width, Height, Levels, Usage, Format, Pool, ppTexture);

#ifdef D3DHOOK_TEXTURES
if(hRet == D3D_OK) { *ppTexture = new hkIDirect3DTexture8(ppTexture, this, Width, Height, Format); }
#endif

return hRet;
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateVolumeTexture(UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture8** ppVolumeTexture)
{
return m_pD3Ddev->CreateVolumeTexture(Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateCubeTexture(UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture8** ppCubeTexture)
{
return m_pD3Ddev->CreateCubeTexture(EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer8** ppVertexBuffer)
{
return m_pD3Ddev->CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer8** ppIndexBuffer)
{
return m_pD3Ddev->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateRenderTarget(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,BOOL Lockable,IDirect3DSurface8** ppSurface)
{
return m_pD3Ddev->CreateRenderTarget(Width, Height, Format, MultiSample, Lockable, ppSurface);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateDepthStencilSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,IDirect3DSurface8** ppSurface)
{
return m_pD3Ddev->CreateDepthStencilSurface(Width, Height, Format, MultiSample, ppSurface);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateImageSurface(UINT Width,UINT Height,D3DFORMAT Format,IDirect3DSurface8** ppSurface)
{
return m_pD3Ddev->CreateImageSurface(Width, Height, Format, ppSurface);
}

HRESULT APIENTRY hkIDirect3DDevice8::CopyRects(IDirect3DSurface8* pSourceSurface,CONST RECT* pSourceRectsArray,UINT cRects,IDirect3DSurface8* pDestinationSurface,CONST POINT* pDestPointsArray)
{
return m_pD3Ddev->CopyRects(pSourceSurface, pSourceRectsArray, cRects, pDestinationSurface, pDestPointsArray);
}

HRESULT APIENTRY hkIDirect3DDevice8::UpdateTexture(IDirect3DBaseTex ture8* pSourceTexture,IDirect3DBaseTexture8* pDestinationTexture)
{
return m_pD3Ddev->UpdateTexture(pSourceTexture, pDestinationTexture);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetFrontBuffer(IDirect3DSurfac e8* pDestSurface)
{
return m_pD3Ddev->GetFrontBuffer(pDestSurface);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetRenderTarget(IDirect3DSurfa ce8* pRenderTarget,IDirect3DSurface8* pNewZStencil)
{
return m_pD3Ddev->SetRenderTarget(pRenderTarget, pNewZStencil);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetRenderTarget(IDirect3DSurfa ce8** ppRenderTarget)
{
return m_pD3Ddev->GetRenderTarget(ppRenderTarget);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetDepthStencilSurface(IDirect 3DSurface8** ppZStencilSurface)
{
return m_pD3Ddev->GetDepthStencilSurface(ppZStencilSurface);
}

HRESULT APIENTRY hkIDirect3DDevice8::BeginScene(void)
{
return m_pD3Ddev->BeginScene();
}

HRESULT APIENTRY hkIDirect3DDevice8::EndScene(void)
{
#define Spawn_Addie1 0x00000000 //<<<<<<define your address up top somewere with the HANDLE
#define Spawn_Addie2 0x00000000 //<<<<<<define your address up top somewere with the HANDLE
Wrrk = GetCurrentProcess();
void Spawn()
{
long t=0;
unsigned long Protection;
VirtualProtect((void*)Spawn_Addie1, sizeof(t), PAGE_READWRITE, &Protection);
memcpy((void*)Spwan_Addie1, &t , sizeof(t));
VirtualProtect((void*)Spawn_Addie1, sizeof(t), Protection, 0);

VirtualProtect((void*)Spawn_Addie2, sizeof(t), PAGE_READWRITE, &Protection);
memcpy((void*)Spwan_Addie2, &t , sizeof(t));
VirtualProtect((void*)Spawn_Addie2, sizeof(t), Protection, 0);
}
return m_pD3Ddev->EndScene();
}

HRESULT APIENTRY hkIDirect3DDevice8::Clear(DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil)
{
return m_pD3Ddev->Clear(Count, pRects, Flags, Color, Z, Stencil);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetTransform(D3DTRANSFORMSTATE TYPE State,CONST D3DMATRIX* pMatrix)
{
return m_pD3Ddev->SetTransform(State, pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetTransform(D3DTRANSFORMSTATE TYPE State,D3DMATRIX* pMatrix)
{
return m_pD3Ddev->GetTransform(State, pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice8::MultiplyTransform( D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix)
{
return m_pD3Ddev->MultiplyTransform(State,pMatrix);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetViewport( CONST D3DVIEWPORT8* pViewport)
{
return m_pD3Ddev->SetViewport(pViewport);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetViewport( D3DVIEWPORT8* pViewport)
{
return m_pD3Ddev->GetViewport(pViewport);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetMaterial( CONST D3DMATERIAL8* pMaterial)
{
return m_pD3Ddev->SetMaterial(pMaterial);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetMaterial( D3DMATERIAL8* pMaterial)
{
return m_pD3Ddev->GetMaterial(pMaterial);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetLight( DWORD Index,CONST D3DLIGHT8* pLight)
{
return m_pD3Ddev->SetLight(Index,pLight);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetLight( DWORD Index,D3DLIGHT8* pLight)
{
return m_pD3Ddev->GetLight(Index,pLight);
}

HRESULT APIENTRY hkIDirect3DDevice8::LightEnable( DWORD Index,BOOL Enable)
{
return m_pD3Ddev->LightEnable(Index,Enable);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetLightEnable( DWORD Index,BOOL* pEnable)
{
return m_pD3Ddev->GetLightEnable(Index,pEnable);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetClipPlane( DWORD Index,CONST float* pPlane)
{
return m_pD3Ddev->SetClipPlane(Index,pPlane);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetClipPlane( DWORD Index,float* pPlane)
{
return m_pD3Ddev->GetClipPlane(Index,pPlane);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetRenderState( D3DRENDERSTATETYPE State,DWORD Value)
{
return m_pD3Ddev->SetRenderState(State,Value);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetRenderState( D3DRENDERSTATETYPE State,DWORD* pValue)
{
return m_pD3Ddev->GetRenderState(State,pValue);
}

HRESULT APIENTRY hkIDirect3DDevice8::BeginStateBlock(void)
{
return m_pD3Ddev->BeginStateBlock();
}

HRESULT APIENTRY hkIDirect3DDevice8::EndStateBlock( DWORD* pToken)
{
return m_pD3Ddev->EndStateBlock(pToken);
}

HRESULT APIENTRY hkIDirect3DDevice8::ApplyStateBlock( DWORD Token)
{
return m_pD3Ddev->ApplyStateBlock(Token);
}

HRESULT APIENTRY hkIDirect3DDevice8::CaptureStateBlock( DWORD Token)
{
return m_pD3Ddev->CaptureStateBlock(Token);
}

HRESULT APIENTRY hkIDirect3DDevice8::DeleteStateBlock( DWORD Token)
{
return m_pD3Ddev->DeleteStateBlock(Token);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateStateBlock( D3DSTATEBLOCKTYPE Type,DWORD* pToken)
{
return m_pD3Ddev->CreateStateBlock(Type,pToken);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetClipStatus( CONST D3DCLIPSTATUS8* pClipStatus)
{
return m_pD3Ddev->SetClipStatus(pClipStatus);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetClipStatus( D3DCLIPSTATUS8* pClipStatus)
{
return m_pD3Ddev->GetClipStatus(pClipStatus);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetTexture( DWORD Stage,IDirect3DBaseTexture8** ppTexture)
{
return m_pD3Ddev->GetTexture(Stage,ppTexture);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetTexture(DWORD Stage,IDirect3DBaseTexture8* pTexture)
{
#ifdef D3DHOOK_TEXTURES
IDirect3DDevice8 *dev = NULL;
if(pTexture != NULL && ((hkIDirect3DTexture8*)(pTexture))->GetDevice(&dev) == D3D_OK)
{
if(dev == this)
return m_pD3Ddev->SetTexture(Stage, ((hkIDirect3DTexture8*)(pTexture))->m_D3Dtex);
}
#endif

return m_pD3Ddev->SetTexture(Stage,pTexture);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetTextureStageState( DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue)
{
return m_pD3Ddev->GetTextureStageState(Stage,Type,pValue);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetTextureStageState( DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value)
{
return m_pD3Ddev->SetTextureStageState(Stage,Type,Value);
}

HRESULT APIENTRY hkIDirect3DDevice8::ValidateDevice( DWORD* pNumPasses)
{
return m_pD3Ddev->ValidateDevice(pNumPasses);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetInfo( DWORD DevInfoID,void* pDevInfoStruct,DWORD DevInfoStructSize)
{
return m_pD3Ddev->GetInfo(DevInfoID,pDevInfoStruct,DevInfoStructSize );
}

HRESULT APIENTRY hkIDirect3DDevice8::SetPaletteEntries( UINT PaletteNumber,CONST PALETTEENTRY* pEntries)
{
return m_pD3Ddev->SetPaletteEntries(PaletteNumber,pEntries);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetPaletteEntries(UINT PaletteNumber,PALETTEENTRY* pEntries)
{
return m_pD3Ddev->GetPaletteEntries(PaletteNumber, pEntries);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetCurrentTexturePalette(UINT PaletteNumber)
{
return m_pD3Ddev->SetCurrentTexturePalette(PaletteNumber);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetCurrentTexturePalette(UINT *PaletteNumber)
{
return m_pD3Ddev->GetCurrentTexturePalette(PaletteNumber);
}

HRESULT APIENTRY hkIDirect3DDevice8::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount)
{
return m_pD3Ddev->DrawPrimitive(PrimitiveType, StartVertex, PrimitiveCount);
}

HRESULT APIENTRY hkIDirect3DDevice8::DrawIndexedPrimitive(D3DPRIMIT IVETYPE PrimitiveType,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{
return m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount);
}

HRESULT APIENTRY hkIDirect3DDevice8::DrawPrimitiveUP(D3DPRIMITIVETY PE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride)
{
return m_pD3Ddev->DrawPrimitiveUP(PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
}

HRESULT APIENTRY hkIDirect3DDevice8::DrawIndexedPrimitiveUP(D3DPRIM ITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride)
{
return m_pD3Ddev->DrawIndexedPrimitiveUP(PrimitiveType, MinVertexIndex, NumVertexIndices, PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
}

HRESULT APIENTRY hkIDirect3DDevice8::ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags)
{
return m_pD3Ddev->ProcessVertices(SrcStartIndex, DestIndex, VertexCount, pDestBuffer, Flags);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreateVertexShader(CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage)
{
return m_pD3Ddev->CreateVertexShader(pDeclaration, pFunction, pHandle, Usage);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetVertexShader(DWORD Handle)
{
return m_pD3Ddev->SetVertexShader(Handle);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetVertexShader(DWORD* pHandle)
{
return m_pD3Ddev->GetVertexShader(pHandle);
}

HRESULT APIENTRY hkIDirect3DDevice8::DeleteVertexShader(DWORD Handle)
{
return m_pD3Ddev->DeleteVertexShader(Handle);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetVertexShaderConstant(DWORD Register,CONST void* pConstantData,DWORD ConstantCount)
{
return m_pD3Ddev->SetVertexShaderConstant(Register, pConstantData, ConstantCount);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetVertexShaderConstant(DWORD Register,void* pConstantData,DWORD ConstantCount)
{
return m_pD3Ddev->GetVertexShaderConstant(Register, pConstantData, ConstantCount);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetVertexShaderDeclaration(DWO RD Handle,void* pData,DWORD* pSizeOfData)
{
return m_pD3Ddev->GetVertexShaderDeclaration(Handle, pData, pSizeOfData);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetVertexShaderFunction(DWORD Handle,void* pData,DWORD* pSizeOfData)
{
return m_pD3Ddev->GetVertexShaderFunction(Handle, pData, pSizeOfData);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer8* pStreamData,UINT Stride)
{
return m_pD3Ddev->SetStreamSource(StreamNumber, pStreamData, Stride);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer8** ppStreamData,UINT* pStride)
{
return m_pD3Ddev->GetStreamSource(StreamNumber, ppStreamData, pStride);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetIndices(IDirect3DIndexBuffe r8* pIndexData,UINT BaseVertexIndex)
{
return m_pD3Ddev->SetIndices(pIndexData, BaseVertexIndex);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetIndices(IDirect3DIndexBuffe r8** ppIndexData,UINT* pBaseVertexIndex)
{
return m_pD3Ddev->GetIndices(ppIndexData, pBaseVertexIndex);
}

HRESULT APIENTRY hkIDirect3DDevice8::CreatePixelShader(CONST DWORD* pFunction,DWORD* pHandle)
{
return m_pD3Ddev->CreatePixelShader(pFunction, pHandle);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetPixelShader(DWORD Handle)
{
return m_pD3Ddev->SetPixelShader(Handle);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetPixelShader(DWORD* pHandle)
{
return m_pD3Ddev->GetPixelShader(pHandle);
}

HRESULT APIENTRY hkIDirect3DDevice8::DeletePixelShader(DWORD Handle)
{
return m_pD3Ddev->DeletePixelShader(Handle);
}

HRESULT APIENTRY hkIDirect3DDevice8::SetPixelShaderConstant(DWORD Register,CONST void* pConstantData,DWORD ConstantCount)
{
return m_pD3Ddev->SetPixelShaderConstant(Register, pConstantData, ConstantCount);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetPixelShaderConstant(DWORD Register,void* pConstantData,DWORD ConstantCount)
{
return m_pD3Ddev->GetPixelShaderConstant(Register, pConstantData, ConstantCount);
}

HRESULT APIENTRY hkIDirect3DDevice8::GetPixelShaderFunction(DWORD Handle,void* pData,DWORD* pSizeOfData)
{
return m_pD3Ddev->GetPixelShaderFunction(Handle, pData, pSizeOfData);
}

HRESULT APIENTRY hkIDirect3DDevice8::DrawRectPatch(UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo)
{
return m_pD3Ddev->DrawRectPatch(Handle, pNumSegs, pRectPatchInfo);
}

HRESULT APIENTRY hkIDirect3DDevice8::DrawTriPatch(UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo)
{
return m_pD3Ddev->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo);
}

HRESULT APIENTRY hkIDirect3DDevice8::DeletePatch(UINT Handle)
{
return m_pD3Ddev->DeletePatch(Handle);
}

Where Add HotKey And How Fix The Up Problem?

First of all, your Spawn function does not go in End Scene. You would place it somewhere above Initialize().
So it looks like this:


/* Direct3D8 Device */

#include <windows.h>
#include "main.h"
#include "d3d8.h"
#define Spawn_Addie1 0x000000 //<<<<<<define your address up top somewere with the HANDLE
#define Spawn_Addie2 0x000000 //<<<<<<define your address up top somewere with the HANDLE
HANDLE Wrrk; //<<< you can name this whatever i chose Wrrk for this example
bool H_Spawn = false;

#define D3DHOOK_TEXTURES //comment this to disable texture hooking


void Spawn()
{
long t=0;
unsigned long Protection;
VirtualProtect((void*)Spawn_Addie1, sizeof(t), PAGE_READWRITE, &Protection);
memcpy((void*)Spawn_Addie1, &t , sizeof(t));
VirtualProtect((void*)Spawn_Addie1, sizeof(t), Protection, 0);

VirtualProtect((void*)Spawn_Addie2, sizeof(t), PAGE_READWRITE, &Protection);
memcpy((void*)Spawn_Addie2, &t , sizeof(t));
VirtualProtect((void*)Spawn_Addie2, sizeof(t), Protection, 0);
}


HRESULT CD3DManager::Initialize()
{
/*
initialize Resources such as textures
(managed and unmanaged [D3DPOOL]),
vertex buffers, and other D3D rendering resources
...
m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture);
*/
Wrrk = GetCurrentProcess();
return S_OK;
}

Then, you would place the hotkey in EndScene()
Here is Cobra's hotkey, which enables Instant Spawn When Numpad 1 is pressed.



if( GetAsyncKeyState( VK_NUMPAD1)&1 )
H_Spawn = !H_Spawn; ////this tells it on or off

if (H_Spawn) ////if H_Spawn is true
{
Spawn(); /// hack
}

Put the above code in EndScene and your hack should work fine.
Also, make sure you Bool your H_Spawn to false, like this:

bool H_Spawn = false;

Wrhackadmin
04-10-2008, 08:19 AM
ty you are the best

how i draw test when the hack is active and when is off?

zarut
04-10-2008, 08:58 AM
May i ask what version of sdk you use?

Wrhackadmin
04-10-2008, 09:09 AM
summer 2003

virus7799
04-10-2008, 01:01 PM
ty you are the best

how i draw test when the hack is active and when is off?

Follow cobra's Highlight text menu to draw the hacks.

Wolfe
04-18-2008, 09:48 PM
How would you freeze a value with this so stamina is always 100 or quick spawn is always 0?

jochem
06-04-2008, 11:06 AM
nice d3d tut =D
but nub question here whith what program u make d3ds?
i only got vb6 and vb8 ... u need c++ for d3ds? :D:****fag

olie122333
06-04-2008, 11:18 AM
How would you freeze a value with this so stamina is always 100 or quick spawn is always 0?

you wouldn't need to, the code is automatically called every time War Rock calls EndScene (if you coded your D3D right), which is called about 10x per second...

Wolfe
06-04-2008, 08:27 PM
wow i fixed this a LONG time ago......

Vindcare
07-30-2008, 01:41 PM
How do i code stamina?
I'm using this:

void WritePointer( void* pxAddress, void* pxBuffer )
{
unsigned long Protection;
VirtualProtect((void*)pxAddress, sizeof( pxBuffer ), PAGE_READWRITE, &Protection);
memcpy((void*)pxAddress, (const void*)pxBuffer, sizeof( pxBuffer ));
VirtualProtect((void*)pxAddress, sizeof( pxBuffer ), Protection, 0);
}

And in Endscene:

if( GetAsyncKeyState( VK_NUMPAD2)&1 )
H_Stamina = !H_Stamina; ////this tells it on or off

if (H_Stamina) ////if H_Spawn is true
{
WritePointer(PlayerPointer, StaminaOffset); /// hack
I defined both an got a error

G:\Documents and Settings\koks\Pulpit\D3D_Starterkit_v3_1_.0b(2)\D3 D_Starterkit_v3.0b\D3D8\old_workspace\d3d8dev.cpp( 304) : error C2664: 'WritePointer' : cannot convert parameter 1 from 'const int' to 'void *'

Vescovo
07-30-2008, 02:08 PM
How do i code stamina?
I'm using this:

void WritePointer( void* pxAddress, void* pxBuffer )
{
unsigned long Protection;
VirtualProtect((void*)pxAddress, sizeof( pxBuffer ), PAGE_READWRITE, &Protection);
memcpy((void*)pxAddress, (const void*)pxBuffer, sizeof( pxBuffer ));
VirtualProtect((void*)pxAddress, sizeof( pxBuffer ), Protection, 0);
}

And in Endscene:

if( GetAsyncKeyState( VK_NUMPAD2)&1 )
H_Stamina = !H_Stamina; ////this tells it on or off

if (H_Stamina) ////if H_Spawn is true
{
WritePointer(PlayerPointer, StaminaOffset); /// hack
I defined both an got a error

G:\Documents and Settings\koks\Pulpit\D3D_Starterkit_v3_1_.0b(2)\D3 D_Starterkit_v3.0b\D3D8\old_workspace\d3d8dev.cpp( 304) : error C2664: 'WritePointer' : cannot convert parameter 1 from 'const int' to 'void *'

Try learning the language and not copy/ paste coding.

Vindcare
07-30-2008, 03:56 PM
Fixed
(message to short)

dongthuc
03-02-2009, 12:33 AM
thanks for share

Sharkoon
04-02-2009, 09:17 AM
hey
how can i read a number/string from address? with readprocessmemory oder is there another method?