Google Translate
Arabic Korean Japanese Chinese Simplified
Russian Portuguese English French
German Spain Italian Dutch
0

Source Code Wallhack

Sabtu, 15 Oktober 2011
Share this Article on :
#include #include #include #include "detours.h" #pragma comment(lib,"detours.lib") #include #include #pragma comment(lib, "d3d9.lib") #pragma comment(lib, "d3dx9.lib") #define HOOK(func,addy) o##func = (t##func)DetourFunction((PBYTE)addy,(PBYTE)hk##func) #define UNHOOK(func,addy) o##func =
(t##func)DetourFunction((PBYTE)addy,(PBYTE)o##func) #define ES 0 #define DIP 1 #define RES 2
#define SSS 3 #define SVP 4  LPDIRECT3DDEVICE9 npDevice;  LPD3DXLINE g_pLine = NULL; D3DVIEWPORT9 g_ViewPort;  LPDIRECT3DVERTEXBUFFER9 Stream_Data; UINT Offset = 0; UINT Stride = 0; bool WallHack = true; bool chams = true; int m_stride;  LPDIRECT3DDEVICE9 g_pDevice = 0;  int b = 0;   LPDIRECT3DTEXTURE9 g_Blue = NULL; const BYTE Blue [60] = { 0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00 };  LPDIRECT3DTEXTURE9 g_Oren = NULL; const BYTE oren[ 58 ] = { 0x42, 0x4D, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0xFF, 0x00 };  LPDIRECT3DTEXTURE9 g_Muda = NULL; const BYTE muda[60] = { 0x42, 0x4D, 0x3C, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00 };  typedef HRESULT (WINAPI* tEndScene)(LPDIRECT3DDEVICE9 pDevice); tEndScene oEndScene = NULL;  typedef HRESULT (WINAPI* tSetViewport)(LPDIRECT3DDEVICE9 pDevice,CONST D3DVIEWPORT9* pViewport); tSetViewport oSetViewport;   typedef HRESULT (WINAPI* tSetStreamSource)(LPDIRECT3DDEVICE9 pDevice,UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride); tSetStreamSource oSetStreamSource;  typedef HRESULT (WINAPI* tDrawIndexedPrimitive)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount); tDrawIndexedPrimitive oDrawIndexedPrimitive = NULL;  typedef HRESULT(WINAPI* tReset)(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters); tReset oReset = NULL;      void ReFont(LPDIRECT3DDEVICE9 pDevice) { if (g_pDevice != pDevice) { g_pDevice = pDevice; } }   PBYTE HookVTableFunction( PDWORD* dwVTable, PBYTE dwHook, INT Index ) { DWORD dwOld = 0; PBYTE pOrig = ((PBYTE)(*dwVTable)[Index]); (*dwVTable)[Index] = (DWORD)dwHook; return pOrig; } HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice) {  while(!npDevice) { npDevice = pDevice; }  if(g_Oren == NULL) D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&oren, sizeof(oren), &g_Oren);  if(g_Blue == NULL) D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&Blue, sizeof(Blue), &g_Blue);  if(g_Muda == NULL) D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&muda, sizeof(muda), &g_Muda);   if(g_pLine == NULL) D3DXCreateLine(pDevice, &g_pLine);  pDevice->GetViewport(&g_ViewPort); if(g_Blue == NULL) D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&Blue, sizeof(Blue), &g_Blue); if(g_pLine != NULL){ } return oEndScene(pDevice); } //---------------------------------------------------------------------------------------------------------------------------------  HRESULT WINAPI hkSetViewport(LPDIRECT3DDEVICE9 pDevice,CONST D3DVIEWPORT9* pViewport) { return oSetViewport(pDevice,pViewport); }  HRESULT WINAPI hkDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) { if(pDevice->GetStreamSource(0, &Stream_Data, &Offset, &Stride) == D3D_OK) Stream_Data->Release();  if(WallHack) { if(m_stride==52) {  DWORD dwOldZEnable; pDevice-> GetRenderState (D3DRS_ZENABLE, & dwOldZEnable); pDevice-> SetRenderState (D3DRS_ZENABLE, D3DZB_FALSE);  oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); } }  if(chams) { if(m_stride==44) { DWORD dwOldZEnable; pDevice-> GetRenderState (D3DRS_ZENABLE, & dwOldZEnable); pDevice-> SetRenderState (D3DRS_ZENABLE, D3DZB_FALSE); pDevice->SetRenderState( D3DRS_FILLMODE,D3DFILL_SOLID ); pDevice->SetTexture( 0, g_Oren);  oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); pDevice-> SetRenderState (D3DRS_ZENABLE, dwOldZEnable); } }  return oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);  } HRESULT WINAPI hkReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters) { if( g_pLine ) g_pLine->OnLostDevice();  HRESULT iReturnValue = oReset(pDevice, pPresentationParameters);  if(iReturnValue == D3D_OK) {  if( g_pLine ) g_pLine->OnResetDevice(); } HRESULT hRet = oReset(pDevice, pPresentationParameters); return iReturnValue; }  HRESULT WINAPI hkSetStreamSource(LPDIRECT3DDEVICE9 pDevice,UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) { if(StreamNumber == 0){ m_stride = Stride; } return oSetStreamSource(pDevice, StreamNumber, pStreamData, OffsetInBytes, Stride); } LRESULT CALLBACK MsgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam){return DefWindowProc(hwnd, uMsg, wParam, lParam);} void DX_Init(DWORD* table) { WNDCLASSEX wc = {sizeof(WNDCLASSEX),CS_CLASSDC,MsgProc,0L,0L,GetModuleHandle(NULL),NULL,NULL,NULL,NULL,"DX",NULL}; RegisterClassEx(&wc); HWND hWnd = CreateWindow("DX",NULL,WS_OVERLAPPEDWINDOW,100,100,300,300,GetDesktopWindow(),NULL,wc.hInstance,NULL); LPDIRECT3D9 pD3D = Direct3DCreate9( D3D_SDK_VERSION ); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; LPDIRECT3DDEVICE9 pd3dDevice;   pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&pd3dDevice); DWORD* pVTable = (DWORD*)pd3dDevice; pVTable = (DWORD*)pVTable[0]; table[ES] = pVTable[42]; table[DIP] = pVTable[82]; table[RES] = pVTable[16]; table[SSS] = pVTable[100]; DestroyWindow(hWnd); } DWORD WINAPI VirtualMethodTableRepatchingLoopToCounterExtensionRepatching( LPVOID Param ) { while(1) { Sleep(100); HookVTableFunction((PDWORD*)npDevice, (PBYTE)hkDrawIndexedPrimitive, 82); HookVTableFunction((PDWORD*)npDevice, (PBYTE)hkEndScene, 42); HookVTableFunction((PDWORD*)npDevice, (PBYTE)hkReset, 16); HookVTableFunction((PDWORD*)npDevice, (PBYTE)hkSetStreamSource, 100); } return 1; }  bool hooked = false; DWORD WINAPI LoopFunction( LPVOID lpParam ) { if( hooked == false) { DWORD VTable[5] = {0};  while(GetModuleHandle("d3d9.dll")==NULL) { Sleep(250); } DX_Init(VTable); HOOK(EndScene,VTable[ES]);  while(!npDevice) { Sleep(50); } UNHOOK(EndScene, VTable[ES]); *(PDWORD)&oDrawIndexedPrimitive = VTable[DIP]; *(PDWORD)&oEndScene = VTable[ES]; *(PDWORD)&oReset = VTable[RES]; *(PDWORD)&oSetStreamSource = VTable[SSS]; *(PDWORD)&oSetViewport = VTable[SVP]; CreateThread(NULL,0,&VirtualMethodTableRepatchingLoopToCounterExtensionRepatching,NULL,0,NULL); hooked = true;  Sleep(200);  }  return 0; } BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved) { if(dwReason == DLL_PROCESS_ATTACH){ Beep(100,1000);  CreateThread(0, 0, LoopFunction, 0, 0, 0); } return TRUE; }


Artikel Terkait:

No Responses to "Source Code Wallhack"

Posting Komentar

Kahar Hacker

Visitor My BLog

free counters