elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


  Mostrar Temas
Páginas: [1]
1  Programación / Programación C/C++ / (ayuda) copilar dll en: 4 Marzo 2015, 07:08 am
hola necesaria si alguien me podría hacer el favor de copilar una dll para mi e tratado y visto todos los vídeos pero no logro hacerlo desde ya agradezco su tiempo.

esto me dijieron que copile

Código
  1. //ghost recon phantoms hack by Nseven
  2. //credits: scrapdizle, ntKid, Citadell, s0beit, google
  3.  
  4. #include <Windows.h>
  5. #include <fstream>
  6. #include <vector>
  7. #include <d3d9.h>
  8. #include <d3dx9.h>
  9. #pragma comment (lib, "d3dx9.lib")
  10. #pragma comment (lib, "d3d9.lib")
  11. #include <detours.h>
  12. using namespace std;
  13.  
  14. //=====================================================================================
  15.  
  16. // settings
  17. DWORD aimkey = VK_SHIFT; //aimkey
  18. int aimfov = 25; //aim fov in %
  19. float aimheight = 1.2f; //adjust aim height, 0 = feet
  20. int aimsens = 3; //aimsensitivity (high aim sensitivity is for high mouse sensitivity)
  21.  
  22. //device
  23. LPDIRECT3DDEVICE9 Device;
  24.  
  25. //init once
  26. bool FirstInit = false;
  27.  
  28. //vertexshader
  29. //IDirect3DVertexShader9* vShader;
  30. //UINT vSize;
  31.  
  32. //models
  33. bool BODY;
  34. bool HEAD;
  35.  
  36. //viewport
  37. D3DVIEWPORT9 Viewport;
  38.  
  39. //
  40. UINT mStartRegister;
  41. UINT mVector4fCount;
  42.  
  43. //=====================================================================================
  44.  
  45. typedef HRESULT (WINAPI* tDrawIndexedPrimitive)(LPDIRECT3DDEVICE9 Device, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount);
  46. tDrawIndexedPrimitive oDrawIndexedPrimitive;
  47.  
  48. typedef HRESULT (WINAPI* tEndScene)(LPDIRECT3DDEVICE9 Device);
  49. tEndScene oEndScene;
  50.  
  51. typedef HRESULT (WINAPI* tReset) (LPDIRECT3DDEVICE9 Device, D3DPRESENT_PARAMETERS *pPresentationParameters);
  52. tReset oReset;
  53.  
  54. typedef HRESULT(__stdcall* tCreateQuery)(LPDIRECT3DDEVICE9 Device, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery);
  55. tCreateQuery oCreateQuery;
  56.  
  57. typedef HRESULT(__stdcall* tSetVertexShaderConstantF)(LPDIRECT3DDEVICE9 Device, UINT StartRegister, const float *pConstantData, UINT Vector4fCount);
  58. tSetVertexShaderConstantF oSetVertexShaderConstantF;
  59.  
  60. //=====================================================================================
  61.  
  62. LPDIRECT3DTEXTURE9    texRed, texYellow, texBlue;
  63. HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
  64. {
  65. if (FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL)))
  66. return E_FAIL;
  67.  
  68. WORD colour16 = ((WORD)((colour32 >> 28) & 0xF) << 12)
  69. | (WORD)(((colour32 >> 20) & 0xF) << 8)
  70. | (WORD)(((colour32 >> 12) & 0xF) << 4)
  71. | (WORD)(((colour32 >> 4) & 0xF) << 0);
  72.  
  73. D3DLOCKED_RECT d3dlr;
  74. (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
  75. WORD *pDst16 = (WORD*)d3dlr.pBits;
  76.  
  77. for (int xy = 0; xy < 8 * 8; xy++)
  78. *pDst16++ = colour16;
  79.  
  80. (*ppD3Dtex)->UnlockRect(0);
  81.  
  82. return S_OK;
  83. }
  84.  
  85. //=====================================================================================
  86.  
  87. void DrawPoint(LPDIRECT3DDEVICE9 Device, int baseX, int baseY, int baseW, int baseH, D3DCOLOR Cor)
  88. {
  89. D3DRECT BarRect = { baseX, baseY, baseX + baseW, baseY + baseH };
  90. Device->Clear(1, &BarRect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, Cor, 0, 0);
  91. }
  92.  
  93. void DrawCornerBox(LPDIRECT3DDEVICE9 Device, int x, int y, int w, int h, int borderPx, DWORD borderColor) //with x,y being the center of the box
  94. {
  95. DrawPoint(Device, x - (w / 2), (y - h + borderPx), w / 3, borderPx, borderColor); //bottom
  96. DrawPoint(Device, x - (w / 2) + w - w / 3, (y - h + borderPx), w / 3, borderPx, borderColor); //bottom
  97. DrawPoint(Device, x - (w / 2), (y - h + borderPx), borderPx, w / 3, borderColor); //left
  98. DrawPoint(Device, x - (w / 2), (y - h + borderPx) + h - w / 3, borderPx, w / 3, borderColor); //left
  99. DrawPoint(Device, x - (w / 2), y, w / 3, borderPx, borderColor); //top
  100. DrawPoint(Device, x - (w / 2) + w - w / 3, y, w / 3, borderPx, borderColor); //top
  101. DrawPoint(Device, (x + w - borderPx) - (w / 2), (y - h + borderPx), borderPx, w / 3, borderColor);//right
  102. DrawPoint(Device, (x + w - borderPx) - (w / 2), (y - h + borderPx) + h - w / 3, borderPx, w / 3, borderColor);//right
  103. }
  104.  
  105. //=====================================================================================
  106.  
  107. //   Name               Reg   Size
  108. //   ------------------ ----- ----
  109. //   g_mObjectToView    c0       3
  110. //   g_mProjection      c4       4
  111. //   gaf_UnpackPosInfos c118     1
  112.  
  113. struct ModelInfo_t
  114. {
  115. D3DXVECTOR3 Position2D;
  116. D3DXVECTOR3 Position3D;
  117. float CrosshairDistance;
  118. };
  119. vector<ModelInfo_t*>ModelInfo;
  120.  
  121. float GetDistance(float Xx, float Yy, float xX, float yY)
  122. {
  123. return sqrt((yY - Yy) * (yY - Yy) + (xX - Xx) * (xX - Xx));
  124. }
  125.  
  126. void Worldtoscreen(LPDIRECT3DDEVICE9 Device)
  127. {
  128. ModelInfo_t* pModel = new ModelInfo_t;
  129.  
  130. D3DXMATRIX g_mProjection, g_mObjectToView, BSMatrix;
  131. D3DXVECTOR3 VectorMiddle(0, 0, 0), ScreenMiddle(0, 0, (float)aimheight);
  132. pModel->Position3D = ScreenMiddle;
  133.  
  134. Device->GetVertexShaderConstantF(4, g_mProjection, 4);
  135. Device->GetVertexShaderConstantF(0, g_mObjectToView, 3);
  136.  
  137. D3DXMatrixIdentity(&BSMatrix);
  138. D3DXMatrixTranspose(&g_mObjectToView, &g_mObjectToView);
  139. D3DXMatrixTranspose(&g_mProjection, &g_mProjection);
  140.  
  141. //D3DXVec3Unproject(&VectorMiddle, &ScreenMiddle, &Viewport, &g_mProjection, &g_mObjectToView, &BSMatrix);
  142. D3DXVec3Project(&VectorMiddle, &pModel->Position3D, &Viewport, &g_mProjection, &g_mObjectToView, &BSMatrix);
  143.  
  144. pModel->Position2D.x = VectorMiddle.x;
  145. pModel->Position2D.y = VectorMiddle.y;
  146.  
  147. ModelInfo.push_back(pModel);
  148. }
  149.  
  150. //=====================================================================================
  151.  
  152. HRESULT __stdcall hkSetVertexShaderConstantF(LPDIRECT3DDEVICE9 Device, UINT StartRegister, const float *pConstantData, UINT Vector4fCount)
  153. {
  154. HRESULT hRet;
  155.  
  156. if (Device == nullptr)
  157. return oSetVertexShaderConstantF(Device, StartRegister, pConstantData, Vector4fCount);
  158.  
  159. if (pConstantData == NULL)
  160. return oSetVertexShaderConstantF(Device, StartRegister, pConstantData, Vector4fCount);
  161.  
  162. hRet = (HRESULT)oSetVertexShaderConstantF(Device, StartRegister, pConstantData, Vector4fCount);
  163.  
  164. if (SUCCEEDED(hRet))
  165. {
  166. mStartRegister = StartRegister;
  167. mVector4fCount = Vector4fCount;
  168. }
  169.  
  170. return hRet;
  171. }
  172.  
  173. //=====================================================================================
  174.  
  175. HRESULT WINAPI hkDrawIndexedPrimitive(LPDIRECT3DDEVICE9 Device, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
  176. {
  177. //HRESULT hRet;
  178.  
  179. if (FirstInit == FALSE)
  180. {
  181. GenerateTexture(Device, &texRed, D3DCOLOR_ARGB(255, 255, 0, 0));
  182. GenerateTexture(Device, &texYellow, D3DCOLOR_ARGB(255, 255, 255, 0));
  183. GenerateTexture(Device, &texBlue, D3DCOLOR_ARGB(255, 0, 0, 255));
  184.  
  185. FirstInit = TRUE;
  186. }
  187.  
  188. /*
  189. //get vSize
  190. hRet = Device->GetVertexShader(&vShader);
  191. if (SUCCEEDED(hRet) && vShader != NULL)
  192. {
  193. hRet = vShader->GetFunction(NULL, &vSize);
  194. if (SUCCEEDED(hRet) && vShader != NULL)
  195. {
  196. vShader->Release();
  197. vShader = NULL;
  198. }
  199. }
  200.  
  201. //model rec
  202. //body near //video settings
  203. if ((vSize == 3712) || //high
  204. (vSize == 3404) //med, low & very low
  205. ||
  206. //body far
  207. (vSize == 2524) || //med & high
  208. (vSize == 2488)) //low & very low
  209. BODY = true;
  210. else BODY = false;
  211.  
  212. //head near //video settings
  213. if ((vSize == 3592) || //high
  214. (vSize == 3308) //med, low & very low
  215. ||
  216. //head far
  217. (vSize == 3308) || //med & high
  218. (vSize == 3272) || //low & very low
  219. (vSize == 3672)) //main menu chara
  220. HEAD = true;
  221. else HEAD = false;
  222. */
  223.  
  224. //head
  225. if (mStartRegister == 128)
  226. HEAD = true;
  227. else HEAD = false;
  228.  
  229. //body
  230. if (mStartRegister == 192 || mStartRegister == 131)
  231. BODY = true;
  232. else BODY = false;
  233.  
  234. //worldtoscreen (head chams can f.up aim)
  235. if (HEAD)
  236. {
  237. Worldtoscreen(Device);
  238. }
  239.  
  240. //chams
  241. if (BODY)
  242. {
  243. Device->SetTexture(0, texRed);
  244. //Device->SetTexture(1, texRed);
  245. Device->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  246. oDrawIndexedPrimitive(Device, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
  247. Device->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  248. Device->SetTexture(0, texBlue);
  249. }
  250.  
  251. return oDrawIndexedPrimitive(Device, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
  252. }
  253.  
  254. //=====================================================================================
  255.  
  256. HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 Device)
  257. {
  258. //aimbot & esp
  259. Device->GetViewport(&Viewport);
  260. if (ModelInfo.size() != NULL)
  261. {
  262. UINT BestTarget = -1;
  263. DOUBLE fClosestPos = 99999;
  264.  
  265. for (size_t i = 0; i < ModelInfo.size(); i += 1)
  266. {
  267. //drawbox on targets (Esp)
  268. if (ModelInfo[i]->Position2D.x > 1 || ModelInfo[i]->Position2D.y > 1)
  269. {
  270. DrawCornerBox(Device, (int)ModelInfo[i]->Position2D.x, (int)ModelInfo[i]->Position2D.y+20, 20, 30, 1, D3DCOLOR_ARGB(255, 255, 255, 0));
  271. }
  272.  
  273. //get screen center
  274. float ScreenCenterX = Viewport.Width / 2.0f;
  275. float ScreenCenterY = Viewport.Height / 2.0f;
  276.  
  277. //aimfov
  278. float radiusx = aimfov * (ScreenCenterX / 100);
  279. float radiusy = aimfov * (ScreenCenterY / 100);
  280.  
  281. //get crosshairdistance
  282. ModelInfo[i]->CrosshairDistance = GetDistance(ModelInfo[i]->Position2D.x, ModelInfo[i]->Position2D.y, ScreenCenterX, ScreenCenterY);
  283.  
  284. //if in fov
  285. if (ModelInfo[i]->Position2D.x >= ScreenCenterX - radiusx && ModelInfo[i]->Position2D.x <= ScreenCenterX + radiusx && ModelInfo[i]->Position2D.y >= ScreenCenterY - radiusy && ModelInfo[i]->Position2D.y <= ScreenCenterY + radiusy)
  286.  
  287. //get closest/nearest target to crosshair
  288. if (ModelInfo[i]->CrosshairDistance < fClosestPos)
  289. {
  290. fClosestPos = ModelInfo[i]->CrosshairDistance;
  291. BestTarget = i;
  292. }
  293. }
  294.  
  295. //if nearest target to crosshair
  296. if (BestTarget != -1)
  297. {
  298. double DistX = ModelInfo[BestTarget]->Position2D.x - Viewport.Width / 2.0f;
  299. double DistY = ModelInfo[BestTarget]->Position2D.y - Viewport.Height / 2.0f;
  300.  
  301. //aimsmooth
  302. DistX /= aimsens;
  303. DistY /= aimsens;
  304.  
  305. //if aimkey is pressed
  306. if ((GetAsyncKeyState(aimkey) & 0x8000))
  307. mouse_event(MOUSEEVENTF_MOVE, (DWORD)DistX, (DWORD)DistY, NULL, NULL); //doaim, move mouse to x & y
  308. }
  309.  
  310. ModelInfo.clear();
  311. }
  312.  
  313. return oEndScene(Device);
  314. }
  315.  
  316. //=====================================================================================
  317.  
  318. HRESULT WINAPI hkReset(LPDIRECT3DDEVICE9 Device, D3DPRESENT_PARAMETERS *pPresentationParameters)
  319. {
  320. HRESULT hRet = oReset(Device, pPresentationParameters);
  321.  
  322. if (hRet == D3D_OK)
  323. {
  324.  
  325. }
  326.  
  327. if (SUCCEEDED(hRet))
  328. {
  329.  
  330. }
  331.  
  332. return hRet;
  333. }
  334.  
  335. //=====================================================================================
  336.  
  337. class CFakeQuery : public IDirect3DQuery9
  338. {
  339. public:
  340. HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj)
  341. {
  342. return D3D_OK;
  343. }
  344.  
  345. ULONG WINAPI AddRef()
  346. {
  347. m_ref++;
  348.  
  349. return m_ref;
  350. }
  351.  
  352. ULONG WINAPI Release()
  353. {
  354. return 1;
  355. }
  356.  
  357. HRESULT WINAPI GetDevice(IDirect3DDevice9 **ppDevice)
  358. {
  359. return D3D_OK;
  360. }
  361.  
  362. D3DQUERYTYPE WINAPI GetType()
  363. {
  364. return m_type;
  365. }
  366.  
  367. DWORD WINAPI GetDataSize()
  368. {
  369. return sizeof(DWORD);
  370. }
  371.  
  372. HRESULT    WINAPI Issue(DWORD dwIssueFlags)
  373. {
  374. return D3D_OK;
  375. }
  376.  
  377. HRESULT WINAPI GetData(void* pData, DWORD dwSize, DWORD dwGetDataFlags)
  378. {
  379. DWORD* pdwData = (DWORD*)pData;
  380.  
  381. *pdwData = 500; //500 pixels visible
  382.  
  383. return D3D_OK;
  384. }
  385.  
  386. int                m_ref;
  387. D3DQUERYTYPE    m_type;
  388. };
  389.  
  390. //=====================================================================================
  391.  
  392. HRESULT __stdcall hkCreateQuery(LPDIRECT3DDEVICE9 Device, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery)
  393. {
  394. if (Type == D3DQUERYTYPE_OCCLUSION)
  395. {
  396. *ppQuery = new CFakeQuery;
  397.  
  398. ((CFakeQuery*)*ppQuery)->m_type = Type;
  399.  
  400. return D3D_OK;
  401. }
  402.  
  403. return oCreateQuery(Device, Type, ppQuery);
  404. }
  405.  
  406. //=====================================================================================
  407.  
  408. LRESULT CALLBACK MsgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
  409. {
  410. return DefWindowProc(hwnd, uMsg, wParam, lParam);
  411. }
  412.  
  413. //=====================================================================================
  414.  
  415. DWORD* pVTable;
  416. void DX_Init(DWORD* table)
  417. {
  418. WNDCLASSEX wc = { sizeof(WNDCLASSEX),CS_CLASSDC,MsgProc,0L,0L,GetModuleHandle(NULL),NULL,NULL,NULL,NULL,"DX",NULL};
  419. RegisterClassEx(&wc);
  420. HWND hWnd = CreateWindow("DX",NULL,WS_OVERLAPPEDWINDOW,100,100,300,300,GetDesktopWindow(),NULL,wc.hInstance,NULL);
  421. LPDIRECT3D9 pD3D = Direct3DCreate9( D3D_SDK_VERSION );
  422. D3DPRESENT_PARAMETERS d3dpp;
  423. ZeroMemory( &d3dpp, sizeof(d3dpp) );
  424. d3dpp.Windowed = TRUE;
  425. d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
  426. d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
  427.  
  428. pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&Device);
  429. pVTable = (DWORD*)Device;
  430. pVTable = (DWORD*)pVTable[0];
  431.  
  432. DestroyWindow(hWnd);
  433. }
  434.  
  435. //=====================================================================================
  436.  
  437. HMODULE hmRendDx9Base = NULL;
  438. DWORD WINAPI DxHook(LPVOID)
  439. {
  440. DWORD VTable[3] = {0};
  441.  
  442. while(hmRendDx9Base == NULL)
  443. {
  444. hmRendDx9Base = GetModuleHandleA("d3d9.dll");
  445. Sleep(250);
  446. }
  447. CloseHandle(hmRendDx9Base);
  448.  
  449. DX_Init(VTable);
  450. oDrawIndexedPrimitive = (tDrawIndexedPrimitive)DetourFunction((BYTE*)pVTable[82], (BYTE*)hkDrawIndexedPrimitive);
  451. oEndScene = (tEndScene)DetourFunction((BYTE*)pVTable[42], (BYTE*)hkEndScene);
  452. oSetVertexShaderConstantF = (tSetVertexShaderConstantF)DetourFunction((BYTE*)pVTable[94], (BYTE*)hkSetVertexShaderConstantF);
  453. oCreateQuery = (tCreateQuery)DetourFunction((BYTE*)pVTable[118], (BYTE*)hkCreateQuery);
  454. //oReset = (tReset)DetourFunction((BYTE*)pVTable[16], (BYTE*)hkReset);
  455. return 0;
  456. }
  457.  
  458. //=====================================================================================
  459.  
  460. BOOL APIENTRY DllMain( HMODULE hModule, DWORD  ulReason, LPVOID lpReserved )
  461. {
  462. switch (ulReason)
  463. {
  464. case DLL_PROCESS_ATTACH:
  465. {
  466. DisableThreadLibraryCalls(hModule);
  467.  
  468. CreateThread(NULL, NULL, DxHook, NULL, NULL, NULL);
  469. }
  470. break;
  471. case DLL_PROCESS_DETACH:
  472. case DLL_THREAD_ATTACH:
  473. case DLL_THREAD_DETACH:
  474. break;
  475. }
  476. return TRUE;
  477. }

Mod: Usa etiquetas GeSHi para publicar codigo y publica en el subforo adecuado... modificado y movido
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines