#include <stdio.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <fstream>
#include <time.h>
#include "color.h"
#include "addies.h"
#include "base.h"
#include "d3dmenu.h"
#include "Other.h"
#include "Detours.h"
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "D3DX9.LIB")
D3D9Menu *D3D9MENU = NULL;
LPDIRECT3DDEVICE9 pDevice = 0;
LPDIRECT3DTEXTURE9 White,Red,Green,Blue,Black,Purple,Grey,Yellow,Oran ge;
LPDIRECT3DVERTEXBUFFER9 StreamData;
UINT OffsetInBytes;
UINT m_Stride;
ID3DXFont* pFont;
bool Color = true;
bool Create;
char *MenuHIDESHOW[] = {"+", "~"};
char *MenuONOFF[] = {"|Off|", "|On|"};
int Slot = 0;
void RebuildMenu(void)
{
D3D9MENU->AddFolder("Server Hacks", MenuHIDESHOW, &Folders.TEST, 2);
if (Folders.TEST)
{
D3D9MENU->AddItem("Slot" , MenuONOFF , &Slot ,2 );
}
}
void Hacks ()
{
if(Slot==1)
{
"D"WORD Server = *(DWORD*)ADR_SERVERPOINTER;
if(Server !=0)
{
*(long*)(Server+OFS_SLOT5) = 1;
}
}
}
void HackThread()
{
for(;
{
Hacks();
}
Sleep(120);
}
HRESULT WINAPI myReset (LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
{
pFont->OnLostDevice();
HRESULT hRet = pReset(pDevice, pPresentationParameters);
pFont->OnResetDevice();
return hRet;
}
HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
{
if(FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL)))
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;
}
HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount)
{
if(pDevice->GetStreamSource(0,&StreamData,&OffsetInBytes,&m_S tride) == D3D_OK)
{
StreamData->Release();
}
DWORD dwOldZEnable = D3DZB_TRUE;
if(Color)
{
GenerateTexture(pDevice, &White, WHITE2);
GenerateTexture(pDevice, &Red, RED2);
GenerateTexture(pDevice, &Green, GREEN2);
GenerateTexture(pDevice, &Blue, BLUE2);GenerateTexture(pDevice, &Black, BLACK2);
GenerateTexture(pDevice, &Purple, PURPLE2);
GenerateTexture(pDevice, &Grey, GREY2);
GenerateTexture(pDevice, &Yellow, YELLOW2);
GenerateTexture(pDevice, &Orange, ORANGE2);
Color = false;
}
////////YOU D3D FUNKTIONS
return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}
PVOID D3Ddiscover(void *tbl, int size)
{
HWND hWnd;
void *pInterface=0 ;
D3DPRESENT_PARAMETERS d3dpp;
if ((hWnd=CreateWindowEx(NULL,WC_DIALOG,"",WS_OVERLAP PED,0,0,50,50,NULL,NULL,NULL,NULL))==NULL) return 0;
ShowWindow(hWnd, SW_HIDE);
LPDIRECT3D9 pD3D;
LPDIRECT3DDEVICE9 pD3Ddev;
if ((pD3D = Direct3DCreate9(D3D_SDK_VERSION))!=NULL)
{
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = hWnd;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
d3dpp.BackBufferWidth = d3dpp.BackBufferHeight = 600;
pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hW nd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&pD3 Ddev);
if (pD3Ddev)
{
pInterface = (PDWORD)*(DWORD *)pD3Ddev;
memcpy(tbl,(void *)pInterface,size);
pD3Ddev->Release();
}
pD3D->Release();
}
DestroyWindow(hWnd);
return pInterface;
}
HRESULT WINAPI myPresent ( LPDIRECT3DDEVICE9 pDevice, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
{
if( !Create )
{
D3DXCreateFont(pDevice, 20, 8, FW_NORMAL, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, (LPCSTR)"Trebuchet MS", &pFont);
Create = true;
}
if( pFont == NULL )
pFont->OnLostDevice();
else
{
if(D3D9MENU == NULL)
{
D3D9MENU = new D3D9Menu("Gangstas D3D V1.0");
}
else
{
if(D3D9MENU->Mmax==0) RebuildMenu();
if(D3D9MENU->Mmax==0) RebuildMenu();
D3D9MENU->MenuShow(12,10,pFont,pDevice);
D3D9MENU->MenuNav();
}
}
return pPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}
DWORD* FindDevice(DWORD Base)
{
for(long i= 0,n = 0; i < 0x128000; i++ )
{
if(*(BYTE *)(Base+i+0x00)==0xC7)n++;
if(*(BYTE *)(Base+i+0x01)==0x06)n++;
if(*(BYTE *)(Base+i+0x06)==0x89)n++;
if(*(BYTE *)(Base+i+0x07)==0x86)n++;
if(*(BYTE *)(Base+i+0x0C)==0x89)n++;
if(*(BYTE *)(Base+i+0x0D)==0x86)n++;
if(n == 6) return (DWORD*)
(
Base + i + 2);n = 0;
}
return(0);
}
bool bCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
{
for(;*szMask;++szMask,++pData,++bMask)
if(*szMask=='x' && *pData!=*bMask )
return false;
return (*szMask) == NULL;
}
DWORD FindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
{
for(DWORD i=0; i < dwLen; i++)
if( bCompare( (BYTE*)( dwAddress+i ),bMask,szMask) )
return (DWORD)(dwAddress+i);
return 0;
}
DWORD GetAddressPtr(int index)
{
DWORD* VTableStart = 0;
DWORD dwDevicePointer = FindPattern((DWORD)GetModuleHandle("d3d9.dll"), 0x1280000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x 00\x00\x89\x86", "xx????xx????xx");
memcpy(&VTableStart, (void*)(dwDevicePointer+2), 4);
return VTableStart[index];
}
int D3D(void)
{
HINSTANCE hD3D;
DWORD vTable[105];
DWORD dwPresent = GetAddressPtr(17);
DWORD dwReset = GetAddressPtr(16);
DWORD dwDrawIndexedPrimitive = GetAddressPtr(82);
hD3D=0;
do
{
hD3D = GetModuleHandle("d3d9.dll");
if (!hD3D) Sleep(10);
}
while(!hD3D);
if (D3Ddiscover((void *)&vTable[0],420)==0) return 0;
{
pPresent = (oPresent) E9Detours2((BYTE*)dwPresent,(BYTE*)myPresent,SIZEO F_MOVEAX_JMPEAX);
pReset = (oReset) E9Detours2((BYTE*)dwReset,(BYTE*)myReset,SIZEOF_MO VEAX_JMPEAX);
while(1)
{
if(memcmp((void *)vTable[82], (void *)"\x8B", 1) == 0 )
{
pDrawIndexedPrimitive = (oDrawIndexedPrimitive) B8Detours(dwDrawIndexedPrimitive, (DWORD)myDrawIndexedPrimitive, 12);
}
Sleep(10);
}
free((void *)vTable);
}
return 0;
}
BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
UnlinkModule(hDll);
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)D3D, 0, 0, 0);
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)HackThread, 0, 0, 0);
}
return TRUE;
}
"D" = Fehler
weis wer woran das liegt ? Bitte helfen






