Advertisement
Guest User

Main.cpp

a guest
Oct 27th, 2015
2,596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.24 KB | None | 0 0
  1. /*==============================================================*/
  2. // Source Credits ZrC-CyBâ„¢ Hacks || Copyright 2015
  3. // Creator & Edited By Y.L.A.S
  4. // Wallhack & Crosshair PointBlank Online || GameGuard XignCode3 OR Xtrap
  5. // Work Region Indonesia, Brazil, Thailand, Turkey, Global And Kaybo Server
  6. // Website : http://zero-cyberz-vip.net
  7. // Facebook : http://www.facebook.com/zero.cyberz.hacks
  8. // YouTube : http://www.youtube.com/channel/UCbug-ZLP4Yjo8KaXYLfLjtQ
  9. /*==============================================================*/
  10.  
  11. #include <windows.h>
  12. #include "Include.h"
  13. #include "cStride.h"
  14.  
  15. /*--------------------------------------------------------------*/
  16. #define PISSS           3.14159265
  17. #define GREEN           D3DCOLOR_ARGB(255, 000, 255, 000)
  18. HMODULE hGfxDx          = LoadLibrary("i3GfxDx.dll");
  19. LPTSTR PBi3Gfx          = "i3GfxDx.dll";
  20. DWORD DwStartGfx        = (DWORD)GetModuleHandleA(PBi3Gfx);
  21. LPDIRECT3DVERTEXBUFFER9 Stream_Data;
  22. D3DVIEWPORT9            g_ViewPort;
  23. LPDIRECT3DDEVICE9       npDevice, pGDevice;
  24. DWORD EndRender, ResultEndRender, g_pRenderContext, Resultg_pRenderContext;
  25.  
  26. int Cross     = 1; //True || On
  27. int Wallhack  = 1; //True || On
  28. int DontSmoke = 1; //True || On
  29. int DontFog   = 1; //True || On
  30. UINT Offset   = 0;
  31. UINT Stride   = 0;
  32.  
  33. /*-------------------------------------------------------------------------------------------------------------------*/
  34. typedef HRESULT (WINAPI* tEndScene)(LPDIRECT3DDEVICE9 pDevice);
  35. tEndScene oEndScene = NULL;
  36.  
  37. typedef HRESULT (WINAPI* tDrawIndexedPrimitive)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount);
  38. tDrawIndexedPrimitive oDrawIndexedPrimitive = NULL;
  39.  
  40. typedef HRESULT(WINAPI* tReset)(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
  41. tReset oReset = NULL;
  42.  
  43. /*---------------------------------------- Declaration D3DTLVERTEX ----------------------------------------------------*/
  44. struct D3DTLVERTEX
  45. {
  46.     float fX;
  47.     float fY;
  48.     float fZ;
  49.     float fRHW;
  50.     D3DCOLOR Color;
  51.     float fU;
  52.     float fV;
  53. };
  54.  
  55. D3DTLVERTEX CreateD3DTLVERTEX (float X, float Y, float Z, float RHW, D3DCOLOR color, float U, float V)
  56. {
  57.     D3DTLVERTEX v;
  58.     v.fX = X;
  59.     v.fY = Y;
  60.     v.fZ = Z;
  61.     v.fRHW = RHW;
  62.     v.Color = color;
  63.     v.fU = U;
  64.     v.fV = V;
  65.     return v;
  66. }
  67.  
  68. /*---------------------------------------- Declaration Circle ----------------------------------------------------*/
  69. void Circle( float x, float y, float rad, bool center, DWORD color ,LPDIRECT3DDEVICE9 pDevice)
  70. {
  71.     const int NUMPOINTS = 34;
  72.  
  73.     if(!center)
  74.     {
  75.         x -= rad;
  76.         y -= rad;
  77.     }
  78.  
  79.     D3DTLVERTEX Circle[NUMPOINTS + 1];
  80.     int i;
  81.     float X;
  82.     float Y;
  83.     float Theta;
  84.     float WedgeAngle;
  85.     WedgeAngle = (float)( (2*PISSS) / NUMPOINTS );
  86.     for( i=0; i<=NUMPOINTS; i++ )
  87.     {
  88.         Theta = i * WedgeAngle;
  89.         X = (float)( x + rad * cos(Theta) );
  90.         Y = (float)( y - rad * sin(Theta) );
  91.         Circle[i] = CreateD3DTLVERTEX( X, Y, 0.0f, 1.0f, color, 0.0f, 0.0f );
  92.     }
  93.     pDevice->SetFVF( D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1 );
  94.     pDevice->SetTexture( 0, NULL );
  95.     pDevice->DrawPrimitiveUP( D3DPT_LINESTRIP, NUMPOINTS, &Circle[0], sizeof(Circle[0]) );
  96. }
  97.  
  98. /*---------------------------------------- Declaration FillRGB ----------------------------------------------------*/
  99. void FillRGB( int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* pDevice )
  100. {
  101.     if( w < 0 )w = 1;
  102.     if( h < 0 )h = 1;
  103.     if( x < 0 )x = 1;
  104.     if( y < 0 )y = 1;
  105.     D3DRECT rec = { x, y, x + w, y + h };
  106.     pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );
  107. }
  108.  
  109. /*------------------------------------------- Declaration DrawCross ------------------------------------------------------*/
  110. void Crosshair(LPDIRECT3DDEVICE9 pDevice, D3DCOLOR Color)
  111. {
  112.     int x = ( GetSystemMetrics( 0 ) / 2);
  113.     int y = ( GetSystemMetrics( 1 ) / 2);
  114.     Circle (x,y,6,true,Color,pDevice);
  115.     FillRGB(x-10, y, 7, 1,Color,pDevice);
  116.     FillRGB(x+4, y, 7, 1,Color,pDevice);
  117.     FillRGB(x, y-10, 1, 7,Color,pDevice);
  118.     FillRGB(x, y+4, 1, 7,Color,pDevice);
  119. }
  120.  
  121. void DrawCrosshair(LPDIRECT3DDEVICE9 pDevice)
  122. {
  123.     if(Cross)
  124.     {
  125.         Crosshair(pDevice, GREEN);
  126.     }
  127. }
  128.  
  129. /*------------------------------------------- Declaration DrawEndScene ------------------------------------------------------*/
  130. HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice)
  131. {
  132.     pDevice->GetViewport(&g_ViewPort);
  133.     DrawCrosshair(pDevice);
  134.     return oEndScene(pDevice);
  135. }
  136.  
  137. /*------------------------------------------- Declaration DrawIndexPrim ------------------------------------------------------*/
  138. HRESULT WINAPI hkDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
  139. {
  140.  
  141. if(pDevice->GetStreamSource(0, &Stream_Data, &Offset, &Stride) == D3D_OK){
  142. Stream_Data->Release();
  143. }
  144.  
  145. /*--------------------------------- Declaration Wallhack --------------------------------------------*/
  146. if(Wallhack)
  147. {  
  148.     if(All_Stide)  
  149.     {            
  150.         pDevice->Clear(0, 0, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
  151.         oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
  152.     }
  153. }
  154.  
  155. /*--------------------------------- Declaration NoSmoke --------------------------------------------*/
  156. if(DontSmoke)
  157. {
  158.     if ((NumVertices == 192) || (NumVertices == 256))    
  159.     {
  160.         return D3D_OK;
  161.         return 0;
  162.     }
  163. }
  164.  
  165. /*--------------------------------- Declaration NoFog Map --------------------------------------------*/
  166. if(DontFog)                                            
  167. {
  168.     pDevice->SetRenderState(D3DRS_FOGENABLE, false);
  169. }
  170.  
  171.     return oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
  172. }
  173.  
  174. /*------------------------------------------- Declaration DrawReset ------------------------------------------------------*/
  175. HRESULT WINAPI hkReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
  176. {
  177.     if(oReset == D3D_OK)
  178.     {
  179.     }
  180.  
  181.     return oReset(pDevice, pPresentationParameters);
  182. }
  183.  
  184. /*------------------------------------------- Declaration Function ------------------------------------------------------*/
  185. void Hooked(PDWORD target, PDWORD newfunc)
  186. {
  187.     DWORD Jmpto=(DWORD)(newfunc)-(DWORD)target-5;
  188.     DWORD a;
  189.     VirtualProtect(target, 8, PAGE_EXECUTE_READWRITE, &a);
  190.     *(PBYTE)(target)=0xE9;
  191.     *(PDWORD)((DWORD)(target)+1)=Jmpto;
  192.     VirtualProtect(target, 8, a, &a);
  193. }
  194.  
  195. /*------------------------------------------- Declaration SearchAddress ------------------------------------------------------*/
  196. void SearchAddress(void)
  197. {
  198.     DWORD DwStartAddress = 0x400000;
  199.     do {
  200.         DwStartAddress = (DWORD)GetModuleHandle("PointBlank.exe");
  201.     }while(!DwStartAddress);
  202.     EndRender        = (DWORD)GetProcAddress(GetModuleHandleA(PBi3Gfx), "?EndRender@i3RenderContext@@QAEXXZ");
  203.     g_pRenderContext = (DWORD)GetProcAddress(GetModuleHandleA(PBi3Gfx), "?g_pRenderContext@@3PAVi3RenderContext@@A");
  204.     Resultg_pRenderContext = g_pRenderContext;
  205.     ReadProcessMemory(GetCurrentProcess(), (LPCVOID) (EndRender+0x2), &ResultEndRender, sizeof(ResultEndRender), NULL);
  206. }
  207.  
  208. /*------------------------------------------- Declaration HookEngine ------------------------------------------------------*/
  209. DWORD WINAPI HookEngine(void)
  210. {
  211.     if (hGfxDx > 0){
  212.         DWORD tmp1 = Resultg_pRenderContext;
  213.         DWORD tmp2 = 0;
  214.         Sleep(1);
  215.         while(!pGDevice){
  216.             if(IsBadReadPtr((PDWORD)tmp1,4)==NULL)tmp2 = *(PDWORD)((DWORD)(tmp1))+ResultEndRender;
  217.             Sleep(1);
  218.             if(IsBadReadPtr((PDWORD)tmp2,4)==NULL){
  219.                 DWORD OldProtect;
  220.                 VirtualProtect((void*)(tmp2), 4, PAGE_EXECUTE_READWRITE, &OldProtect);
  221.                 memcpy(&pGDevice, (void *)tmp2, 4);
  222.                 VirtualProtect((void*)(tmp2), 4, OldProtect, NULL);}
  223.         }
  224.         DWORD *g_pDevice = (DWORD*)pGDevice;
  225.         g_pDevice = (DWORD*)g_pDevice[0];
  226.         while(!npDevice)npDevice = (LPDIRECT3DDEVICE9)(DWORD*)g_pDevice;
  227.         *(PDWORD)&oEndScene = g_pDevice[42];
  228.         *(PDWORD)&oDrawIndexedPrimitive = g_pDevice[82];
  229.         *(PDWORD)&oReset    = g_pDevice[16];
  230.         Hooked((PDWORD)(g_pDevice[1] - 5), (PDWORD)(g_pDevice[4] - 5));
  231.         Hooked((PDWORD)(g_pDevice[2] - 5), (PDWORD)(g_pDevice[5] - 5));
  232.         Hooked((PDWORD)(g_pDevice[3] - 5), (PDWORD)(g_pDevice[6] - 5));
  233.         Hooked((PDWORD)(g_pDevice[4] - 5), (PDWORD)hkEndScene);
  234.         Hooked((PDWORD)(g_pDevice[5] - 5), (PDWORD)hkDrawIndexedPrimitive);
  235.         Hooked((PDWORD)(g_pDevice[6] - 5), (PDWORD)hkReset);
  236.         for(;;)
  237.         {
  238.             g_pDevice[42] = (DWORD)g_pDevice[1] - 5;
  239.             g_pDevice[82] = (DWORD)g_pDevice[2] - 5;
  240.             g_pDevice[16] = (DWORD)g_pDevice[3] - 5;
  241.         }
  242.         Sleep(100);
  243.     }
  244.     return (0);
  245. }
  246.  
  247. /*--------------------------------------- Declaration Caller AllThread --------------------------------------------------*/
  248. void ZrCCyBCallerThread(void)
  249. {
  250.     SearchAddress();
  251.     CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)HookEngine,NULL,NULL,NULL);
  252. }
  253.  
  254. /*------------------------------------------- Declaration Attach Dll ------------------------------------------------------*/
  255. BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved)
  256. {
  257.     if(dwReason == DLL_PROCESS_ATTACH){
  258.         DisableThreadLibraryCalls(hModule);
  259.         CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)ZrCCyBCallerThread,NULL,NULL,NULL);
  260.         Beep(1000, 100);
  261. }
  262. return TRUE;
  263. }
  264.  
  265. /*-------------------------------------------------------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement