Advertisement
Guest User

Untitled

a guest
Feb 8th, 2015
546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.78 KB | None | 0 0
  1. // dllmain.cpp : Definiert den Einstiegspunkt fьr die DLL-Anwendung.
  2. #include "stdafx.h"
  3. #include "arma.h"
  4. #include <stdio.h>
  5. #include <Subauth.h>
  6. #include <time.h> /* time */
  7. #include "detours.h"
  8. #pragma comment (lib, "detours.lib")
  9. #include <iostream>
  10. #include <string>
  11.  
  12. HRESULT __stdcall EndScene(LPDIRECT3DDEVICE9 pDevice);
  13. typedef HRESULT(__stdcall* EndScene_t)(LPDIRECT3DDEVICE9);
  14. typedef HRESULT (WINAPI* oEndScene) (LPDIRECT3DDEVICE9 pDev);
  15. typedef int (WINAPI *Present_t)(LPDIRECT3DDEVICE9 pDevice, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion);
  16. Present_t oPresent;
  17. EndScene_t pEndScene;
  18.  
  19. bool drawMenu = false;
  20.  
  21. LPD3DXFONT m_pFont;
  22. ID3DXLine* m_rectLine;
  23. DWORD dwModBase;
  24. char hurennigger[5012];
  25. D3DXVECTOR3 localPlayer; // pos
  26. DWORD* dwpVTableStart = NULL; // d3d9.dll device vtable
  27. bool Init = 0;
  28.  
  29. // W 2 S stuff
  30. D3DXVECTOR3 InvViewRight;
  31. D3DXVECTOR3 InvViewUp;
  32. D3DXVECTOR3 InvViewForward;
  33. D3DXVECTOR3 InvViewTranslation;
  34. D3DXVECTOR3 ViewPortMatrix;
  35. D3DXVECTOR3 ProjD1;
  36. D3DXVECTOR3 ProjD2;
  37. // end
  38.  
  39. // colors
  40. const D3DCOLOR txtPink = D3DCOLOR_ARGB(255, 255, 0, 255); // Alpha, Rot, Grьn, Blau
  41. const D3DCOLOR txtGreen = D3DCOLOR_ARGB(255, 20, 222, 20);
  42. const D3DCOLOR txtBlue = D3DCOLOR_ARGB(255, 20, 22, 222);
  43. const D3DCOLOR txtRed = D3DCOLOR_ARGB(255, 255, 0, 0);
  44. const D3DCOLOR txtGrey = D3DCOLOR_ARGB(255, 222, 222, 222);
  45. const D3DCOLOR txtDarkGrey = D3DCOLOR_ARGB(255, 142, 142, 182);
  46. // colors end
  47.  
  48. /* Menu options */
  49. float *distLimit = new float(1000);
  50. float *noRecoil = new float(0);
  51. float *noSpread = new float(0);
  52. float *noFatigue = new float(0);
  53. float *noFalldamage = new float(0);
  54. float *speedHack = new float(0);
  55. float *emptyVeh = new float(0);
  56. float *objects = new float(0);
  57. float *allObjects = new float(0);
  58. float *destruction = new float(0);
  59. float *playerTP = new float(0);
  60. float *unlockVehicles = new float(0);
  61. float *listItems = new float(0);
  62. float *bulletDamage = NULL;
  63.  
  64. struct itemEntry
  65. {
  66. char name[64];
  67. BYTE type;
  68. void* item;
  69. itemEntry* last;
  70. itemEntry* next;
  71. bool show;
  72. itemEntry(char * n, BYTE t,void *i)
  73. {
  74. strcpy_s(name,n);
  75. type = t;
  76. item = i;
  77. show = 1;
  78. next = NULL;
  79. }
  80. };
  81.  
  82. struct itemPicker
  83. {
  84. itemEntry* first;
  85. itemEntry* last;
  86. itemEntry* selected;
  87. itemPicker()
  88. {
  89. itemEntry *f = new itemEntry("...",0,0);
  90. selected = last = first = f;
  91. f->last = NULL;
  92. }
  93. void add(itemEntry* nm)
  94. {
  95. last->next = nm;
  96. nm->last = last;
  97. last = nm;
  98. }
  99. void update(char* t)
  100. {
  101.  
  102. }
  103. };
  104.  
  105. struct playerEntry
  106. {
  107. char name[32];
  108. int ID;
  109. playerEntry* last;
  110. playerEntry* next;
  111. playerEntry(char * n, int i)
  112. {
  113. strcpy_s(name,n);
  114. next = NULL;
  115. ID = i;
  116. }
  117. };
  118.  
  119. struct playerPicker
  120. {
  121. playerEntry* first;
  122. playerEntry* last;
  123. playerEntry* selected;
  124. playerPicker(playerEntry* f)
  125. {
  126. selected = last = first = f;
  127. f->last = NULL;
  128. }
  129. void add(playerEntry* nm)
  130. {
  131. last->next = nm;
  132. nm->last = last;
  133. last = nm;
  134. }
  135. };
  136.  
  137. struct menuentry
  138. {
  139. menuentry* next;
  140. menuentry* last;
  141. float *value;
  142. float step;
  143. float max;
  144. char name[32];
  145. menuentry(char * n,float* &d,float s, float m)
  146. {
  147. strcpy_s(name,n);
  148. next = NULL;
  149. value = d; step = s; max = m;
  150. }
  151. void right()
  152. {
  153. if(!((*value + step)>max))
  154. {
  155. *value = *value + step;
  156. }
  157. }
  158. void left()
  159. {
  160. if(!((*value - step)<0))
  161. {
  162. *value = *value - step;
  163. }
  164. }
  165. };
  166. menuentry* bd = NULL;
  167.  
  168. struct menu
  169. {
  170. menuentry* first;
  171. menuentry* last;
  172. menuentry* selected;
  173. playerPicker* picker;
  174. itemPicker* iPicker;
  175. menu(menuentry* f)
  176. {
  177. selected = last = first = f;
  178. f->last = NULL;
  179. picker = NULL;
  180. iPicker = NULL;
  181. }
  182.  
  183. void add(menuentry* nm)
  184. {
  185. last->next = nm;
  186. nm->last = last;
  187. last = nm;
  188. }
  189. };
  190.  
  191. menu *mainMenu;
  192. //
  193. typedef struct _PEB_LDR_DATA
  194. {
  195. ULONG Length;
  196. BOOLEAN Initialized;
  197. PVOID SsHandle;
  198. LIST_ENTRY InLoadOrderModuleList;
  199. LIST_ENTRY InMemoryOrderModuleList;
  200. LIST_ENTRY InInitializationOrderModuleList;
  201. } PEB_LDR_DATA, *PPEB_LDR_DATA;
  202.  
  203. typedef struct _LDR_MODULE {
  204.  
  205. LIST_ENTRY InLoadOrderModuleList;
  206. LIST_ENTRY InMemoryOrderModuleList;
  207. LIST_ENTRY InInitializationOrderModuleList;
  208. PVOID BaseAddress;
  209. PVOID EntryPoint;
  210. ULONG SizeOfImage;
  211. UNICODE_STRING FullDllName;
  212. UNICODE_STRING BaseDllName;
  213. ULONG Flags;
  214. SHORT LoadCount;
  215. SHORT TlsIndex;
  216. LIST_ENTRY HashTableEntry;
  217. ULONG TimeDateStamp;
  218.  
  219. } LDR_MODULE, *PLDR_MODULE;
  220.  
  221. inline float Vectorl3(D3DVECTOR v) {
  222. return (sqrt(v.x * v.x + v.y * v.y + v.z * v.z));
  223. }
  224.  
  225. inline float Vectorl2(D3DXVECTOR2 v) {
  226. return (sqrt(v.x * v.x + v.y * v.y));
  227. }
  228.  
  229. VOID* DetourCreate(BYTE *src, const BYTE *dst, const int len)
  230. {
  231. BYTE *jmp = (BYTE*)malloc(len+5);
  232. DWORD dwBack;
  233.  
  234. VirtualProtect(src, len, PAGE_EXECUTE_READWRITE, &dwBack);
  235. memcpy(jmp, src, len);
  236. jmp += len;
  237. jmp[0] = 0xE9;
  238. *(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
  239. src[0] = 0xE9;
  240. *(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
  241. for (int i=5; i<len; i++) src[i]=0x90;
  242. VirtualProtect(src, len, dwBack, &dwBack);
  243. return (jmp-len);
  244. }
  245.  
  246. bool bDataCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
  247. {
  248. for(;*szMask;++szMask,++pData,++bMask)
  249. if(*szMask=='x' && *pData!=*bMask )
  250. return false;
  251. return (*szMask) == NULL;
  252. }
  253. DWORD dwFindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
  254. {
  255. for(DWORD i=0; i < dwLen; i++)
  256. if( bDataCompare( (BYTE*)( dwAddress+i ),bMask,szMask) )
  257. return (DWORD)(dwAddress+i);
  258.  
  259. return 0;
  260. }
  261.  
  262. DWORD D3D9VTable()
  263. {
  264. DWORD dwObjBase = (DWORD)LoadLibraryA("D3D9.DLL");
  265. while ( dwObjBase++ < dwObjBase + 0x127850 )
  266. {
  267. if ( (*(WORD*)(dwObjBase + 0x00)) == 0x06C7 && (*(WORD*)(dwObjBase + 0x06)) == 0x8689 && (*(WORD*)(dwObjBase + 0x0C)) == 0x8689 )
  268. {
  269. dwObjBase += 2;
  270. break;
  271. }
  272. }
  273. return ( dwObjBase );
  274. }
  275.  
  276. void DrawRect (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color)
  277. {
  278. D3DRECT rect = {X, Y, X+L, Y+H};
  279. Device_t->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0); // bei Google gibt’s nдheres
  280. }
  281.  
  282. void DrawLine(ID3DXLine* pLine,float x1, float y1,float x2, float y2, D3DCOLOR color)
  283. {
  284. D3DXVECTOR2 Vector2[2];
  285. Vector2[0].x = x1;
  286. Vector2[0].y = y1;
  287. Vector2[1].x = x2;
  288. Vector2[1].y = y2;
  289. pLine->Draw(Vector2,2,color);
  290. }
  291.  
  292. void DrawFont (int X, int Y, D3DCOLOR Color, char *format, ...)
  293. {
  294. char buffer[256];
  295. va_list args; // deswegen: #include <cstdio>
  296. va_start (args, format);
  297. vsprintf (buffer,format, args);
  298. RECT FontRect = { X, Y, X + 120, Y + 16 };
  299. m_pFont->DrawText( NULL, buffer, -1, &FontRect, DT_NOCLIP , Color ); // Zeichnen
  300. va_end (args);
  301. }
  302.  
  303. void UpdateView()
  304. {
  305. const D3DCOLOR txtPink = D3DCOLOR_ARGB(255, 255, 0, 255); // Alpha, Rot, Grьn, Blau
  306. DWORD *dwTransformations = (DWORD*)0xDD32F4;
  307. DWORD *dwTransData = (DWORD*)(*dwTransformations + 0x90);
  308. InvViewRight = *(D3DXVECTOR3*)(*dwTransData+0x4);
  309. InvViewUp = *(D3DXVECTOR3*)(*dwTransData+0x10);
  310. InvViewForward = *(D3DXVECTOR3*)(*dwTransData+0x1C);
  311. InvViewTranslation = *(D3DXVECTOR3*)(*dwTransData+0x28);
  312. ViewPortMatrix = *(D3DXVECTOR3*)(*dwTransData+0x54);
  313. ProjD1 = *(D3DXVECTOR3*)(*dwTransData+0xCC);
  314. ProjD2 = *(D3DXVECTOR3*)(*dwTransData+0xD8);
  315. }
  316.  
  317. D3DXVECTOR3 WorldToScreen(D3DXVECTOR3 in)
  318. {
  319. D3DXVECTOR3 out, temp;
  320.  
  321. D3DXVec3Subtract(&temp, &in, &InvViewTranslation);
  322. float x = D3DXVec3Dot(&temp, &InvViewRight);
  323. float y = D3DXVec3Dot(&temp, &InvViewUp);
  324. float z = D3DXVec3Dot(&temp, &InvViewForward);
  325.  
  326. out.x = ViewPortMatrix.x * (1 + (x / ProjD1.x / z));
  327. out.y = ViewPortMatrix.y * (1 - (y / ProjD2.y / z));
  328. out.z = z;
  329.  
  330. return out;
  331. }
  332.  
  333. /*
  334. HRESULT __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice)
  335. {
  336. if(m_pFont==NULL)
  337. {
  338. D3DXCreateFont(pDevice, 14, 0, 400, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Verdana"), &m_pFont);
  339. }
  340. DrawFont(3,3,txtPink,"DistFilter: (%d)",DistLimit);
  341. WorldPointer pWorld = *(WorldPointer*)0xDA8208;
  342. if(pWorld.world->cameraOn->unit)
  343. {
  344. if(pWorld.world->cameraOn->unit->entityVisualState)
  345. localPlayer = pWorld.world->cameraOn->unit->entityVisualState->coordinates;
  346. EntityTablePointer* ObjectPtr = (pWorld.world->entityTablePointer);
  347. if(!IsBadReadPtr(ObjectPtr,0x8))
  348. {
  349. DWORD* entTable = *(DWORD**)ObjectPtr;
  350. if(!IsBadReadPtr(entTable,4))
  351. {
  352. for(int i = 0; i<pWorld.world->entityTablePointer->objectTableSize; i++)
  353. {
  354. EntityTable *eTable = *(EntityTable**)((entTable+(13*i)));
  355. if(eTable)
  356. {
  357. Entity *e = eTable->e;
  358. if(e)
  359. {
  360. if(strcmp(e->cfgVehicle->objectType->string,"soldier")==0)
  361. {
  362. bool human = 0;
  363. if(!IsBadReadPtr(eTable->unitInfo,0x34))
  364. {
  365. if(!IsBadReadPtr(eTable->unitInfo->unit,0x1178))
  366. if(eTable->unitInfo->unit->playerID > 1)human = 1;
  367. }
  368. EntityVisualState *vis = e->entityVisualState;
  369. if(vis)
  370. {
  371. UpdateView();
  372. D3DXVECTOR3 pos = WorldToScreen(vis->coordinates);
  373. if(pos.z > 0.01)
  374. DrawFont(pos.x,pos.y,human ? txtPink : txtRed,"%s (%s) %f m",e->cfgVehicle->entityName->string, e->cfgVehicle->objectType->string, (int)(Vectorl(localPlayer - vis->coordinates)));
  375. }
  376. }
  377. }
  378. }
  379. }
  380. }
  381. }
  382. }
  383. /*
  384. if(pWorld.world->cameraOn->unit)
  385. {
  386. if(pWorld.world->cameraOn->unit->entityVisualState)
  387. {
  388. D3DVECTOR pos = pWorld.world->cameraOn->unit->entityVisualState->coordinates;
  389. DrawFont(3,3,txtPink,"local pos: %f %f %f",pos.x,pos.y,pos.z);
  390. }
  391. }
  392.  
  393.  
  394. return pEndScene(pDevice);
  395. }
  396. */
  397.  
  398. void UnlinkModule (char *szModule)
  399. {
  400. DWORD dwPEB = 0, dwOffset = 0;
  401. PLIST_ENTRY pUserModuleHead, pUserModule;
  402. PPEB_LDR_DATA pLdrData;
  403. PLDR_MODULE pLdrModule;
  404. PUNICODE_STRING lpModule;
  405. char szModuleName[512];
  406. int i = 0, n = 0;
  407.  
  408. _asm
  409. {
  410. pushad
  411. mov eax, fs: [48]
  412. mov dwPEB, eax
  413. popad
  414. }
  415.  
  416. pLdrData= ( PPEB_LDR_DATA )(PDWORD)(*(PDWORD)(dwPEB + 12));
  417.  
  418. for (; i < 3; i++)
  419. {
  420. switch (i)
  421. {
  422. case 0:
  423. pUserModuleHead = pUserModule = ( PLIST_ENTRY ) ( &( pLdrData->InLoadOrderModuleList ) );
  424. dwOffset = 0;
  425. break;
  426.  
  427. case 1:
  428. pUserModuleHead = pUserModule = ( PLIST_ENTRY ) ( &( pLdrData->InMemoryOrderModuleList ) );
  429. dwOffset = 8;
  430. break;
  431. case 2:
  432. pUserModuleHead = pUserModule = (PLIST_ENTRY) (&(pLdrData->InInitializationOrderModuleList));
  433. dwOffset = 16;
  434. break;
  435. }
  436.  
  437. while (pUserModule->Flink != pUserModuleHead)
  438. {
  439. pUserModule = pUserModule->Flink;
  440. lpModule = (PUNICODE_STRING)(((DWORD)(pUserModule)) + (36-dwOffset));
  441.  
  442. for (n = 0; n < (lpModule->Length)/2 && n < 512; n++)
  443. szModuleName[n] = (CHAR)(* ((lpModule->Buffer)+(n)));
  444.  
  445. szModuleName[n] = '\0';
  446. if (strstr (szModuleName, szModule))
  447. {
  448. pUserModule->Blink->Flink = pUserModule->Flink;
  449. pUserModule->Flink->Blink = pUserModule->Blink;
  450. }
  451. }
  452. }
  453. }
  454.  
  455. void HideModule( HINSTANCE hModule )
  456. {
  457. DWORD dwPEB_LDR_DATA = 0;
  458.  
  459. _asm
  460. {
  461. pushad;
  462. pushfd;
  463. mov eax, fs:[30h] // PEB
  464. mov eax, [eax+0Ch] // PEB->ProcessModuleInfo
  465. mov dwPEB_LDR_DATA, eax // Save ProcessModuleInfo
  466.  
  467. InLoadOrderModuleList:
  468. mov esi, [eax+0Ch] // ProcessModuleInfo->InLoadOrderModuleList[FORWARD]
  469. mov edx, [eax+10h] // ProcessModuleInfo->InLoadOrderModuleList[BACKWARD]
  470.  
  471. LoopInLoadOrderModuleList:
  472. lodsd // Load First Module
  473. mov esi, eax // ESI points to Next Module
  474. mov ecx, [eax+18h] // LDR_MODULE->BaseAddress
  475. cmp ecx, hModule // Is it Our Module ?
  476. jne SkipA // If Not, Next Please (@f jumps to nearest Unamed Lable @@:)
  477. mov ebx, [eax] // [FORWARD] Module
  478. mov ecx, [eax+4] // [BACKWARD] Module
  479. mov [ecx], ebx // Previous Module's [FORWARD] Notation, Points to us, Replace it with, Module++
  480. mov [ebx+4], ecx // Next Modules, [BACKWARD] Notation, Points to us, Replace it with, Module--
  481. jmp InMemoryOrderModuleList // Hidden, so Move onto Next Set
  482. SkipA:
  483. cmp edx, esi // Reached End of Modules ?
  484. jne LoopInLoadOrderModuleList // If Not, Re Loop
  485.  
  486. InMemoryOrderModuleList:
  487. mov eax, dwPEB_LDR_DATA // PEB->ProcessModuleInfo
  488. mov esi, [eax+14h] // ProcessModuleInfo->InMemoryOrderModuleList[START]
  489. mov edx, [eax+18h] // ProcessModuleInfo->InMemoryOrderModuleList[FINISH]
  490.  
  491. LoopInMemoryOrderModuleList:
  492. lodsd
  493. mov esi, eax
  494. mov ecx, [eax+10h]
  495. cmp ecx, hModule
  496. jne SkipB
  497. mov ebx, [eax]
  498. mov ecx, [eax+4]
  499. mov [ecx], ebx
  500. mov [ebx+4], ecx
  501. jmp InInitializationOrderModuleList
  502. SkipB:
  503. cmp edx, esi
  504. jne LoopInMemoryOrderModuleList
  505.  
  506. InInitializationOrderModuleList:
  507. mov eax, dwPEB_LDR_DATA // PEB->ProcessModuleInfo
  508. mov esi, [eax+1Ch] // ProcessModuleInfo->InInitializationOrderModuleList[START]
  509. mov edx, [eax+20h] // ProcessModuleInfo->InInitializationOrderModuleList[FINISH]
  510.  
  511. LoopInInitializationOrderModuleList:
  512. lodsd
  513. mov esi, eax
  514. mov ecx, [eax+08h]
  515. cmp ecx, hModule
  516. jne SkipC
  517. mov ebx, [eax]
  518. mov ecx, [eax+4]
  519. mov [ecx], ebx
  520. mov [ebx+4], ecx
  521. jmp Finished
  522. SkipC:
  523. cmp edx, esi
  524. jne LoopInInitializationOrderModuleList
  525.  
  526. Finished:
  527. popfd;
  528. popad;
  529. }
  530. }
  531.  
  532. void DrawMenu(LPDIRECT3DDEVICE9 pDevice)
  533. {
  534. if(mainMenu)
  535. {
  536. if(mainMenu->first)
  537. {
  538. menuentry* looper = mainMenu->first;
  539. int i = 0;
  540. do
  541. {
  542. if(i)
  543. looper = looper->next;
  544. if(looper->value)
  545. DrawFont(3,(i*13)+3,(looper == mainMenu->selected) ? txtPink : txtBlue,"%s: (%d)",looper->name,(int)*looper->value);
  546. i++;
  547. }
  548. while(looper->next);
  549. }
  550. if(mainMenu->picker)
  551. {
  552. if(mainMenu->picker->first)
  553. {
  554. playerEntry* looper = mainMenu->picker->first;
  555. int i = 0;
  556. do
  557. {
  558. looper = looper->next;
  559. if(looper->ID>1)
  560. {
  561. DrawFont(153,(i*13)+3,(looper == mainMenu->picker->selected) ? txtPink : txtBlue,looper->name);
  562. i++;
  563. }
  564. }
  565. while(looper->next);
  566. }
  567. }
  568. else if(mainMenu->iPicker)
  569. {
  570. if(mainMenu->iPicker->first)
  571. {
  572. itemEntry* looper = mainMenu->iPicker->first;
  573. int i = 0;
  574. while(looper)
  575. {
  576. if(looper->show)
  577. {
  578. DrawFont(153,(i*13)+3,(looper == mainMenu->iPicker->selected) ? txtPink : txtBlue,"%s %x",looper->name,looper->item);
  579. i++;
  580. }
  581. looper = looper->next;
  582. }
  583. }
  584. }
  585. }
  586. }
  587.  
  588. char* getCombi(EntryArray *entry)
  589. {
  590. while(true)
  591. {
  592. if((DWORD)entry>1)
  593. {
  594. if(!IsBadReadPtr(entry->firstEntry,4))
  595. {
  596. varEntry* en = entry->firstEntry;
  597. if(en->vTable == 12644640)
  598. {
  599. if(strcmp(en->name->string,"characterid")==0)
  600. return(en->value->value->string);//DrawFont(250,3+(i*13),txtGreen,"variable: %s n: %f",en->name->string,);
  601. }
  602. else
  603. {
  604. return 0;
  605. }
  606. }
  607. }
  608. entry += 1;
  609. }
  610. }
  611.  
  612. void SlaveLoop(EntityList* table, int size)
  613. {
  614. for(int i = 0; i<size; i++)
  615. {
  616. if((DWORD*)(table+i))
  617. {
  618. Entity *e = *(Entity**)(table+i);
  619. if(e->entityVisualState)
  620. {
  621. if(e->cfgVehicle)
  622. {
  623. if(!IsBadReadPtr(e->cfgVehicle,0x220))
  624. {
  625. float dist = (Vectorl3(localPlayer - e->entityVisualState->coordinates));
  626. if(dist<*distLimit)
  627. {
  628. D3DXVECTOR3 pos = WorldToScreen(e->entityVisualState->coordinates);
  629. if(pos.z > 0.01)
  630. {
  631. if(*allObjects==0)
  632. {
  633. if(strcmp(e->cfgVehicle->entityName->string,"VaultStorageLocked")==0)
  634. {
  635. char *combi = NULL;
  636. DWORD vTable = *(DWORD*)(e);
  637. DWORD func = *(DWORD*)(vTable+0x104);
  638. VarTable* table;
  639. __asm
  640. {
  641. mov ECX, e
  642. call func
  643. mov table, EAX
  644. }
  645. EntryArray *entry = table->eArray;
  646. combi = getCombi(entry);
  647. DrawFont(pos.x,pos.y,txtGreen,"Safe (%s) %dm",combi,(int)dist);
  648. }
  649. else if(strcmp(e->cfgVehicle->entityName->string,"CinderWallDoorLocked_DZ")==0 || strcmp(e->cfgVehicle->entityName->string,"CinderWallDoorSmallLocked_DZ")==0 || strcmp(e->cfgVehicle->entityName->string,"Land_DZE_GarageWoodDoorLocked")==0 || strcmp(e->cfgVehicle->entityName->string,"Land_DZE_LargeWoodDoorLocked")==0 || strcmp(e->cfgVehicle->entityName->string,"Land_DZE_WoodDoorLocked")==0)
  650. {
  651. char *combi = NULL;
  652. DWORD vTable = *(DWORD*)(e);
  653. DWORD func = *(DWORD*)(vTable+0x104);
  654. VarTable* table;
  655. __asm
  656. {
  657. mov ECX, e
  658. call func
  659. mov table, EAX
  660. }
  661. EntryArray *entry = table->eArray;
  662. combi = getCombi(entry);
  663. DrawFont(pos.x,pos.y,txtGreen,"door (%s) %dm",combi,(int)dist);
  664. }
  665. if(strcmp(e->cfgVehicle->entityName->string,"LockboxStorageLocked")==0)
  666. {
  667. char *combi = NULL;
  668. DWORD vTable = *(DWORD*)(e);
  669. DWORD func = *(DWORD*)(vTable+0x104);
  670. VarTable* table;
  671. __asm
  672. {
  673. mov ECX, e
  674. call func
  675. mov table, EAX
  676. }
  677. EntryArray *entry = table->eArray;
  678. combi = getCombi(entry);
  679. DrawFont(pos.x,pos.y,txtGreen,"Lockbox (%s) %dm",combi,(int)dist);
  680. }
  681. else if(strcmp(e->cfgVehicle->entityName->string,"VaultStorage")==0)
  682. DrawFont(pos.x,pos.y,txtGreen,"Safe(open) %dm",(int)dist);
  683. else if(strcmp(e->cfgVehicle->entityName->string,"LockboxStorage")==0)
  684. DrawFont(pos.x,pos.y,txtGreen,"Lockbox(open) %dm",(int)dist);
  685. else if(strstr(e->cfgVehicle->entityName->string,"TentStorage"))
  686. DrawFont(pos.x,pos.y,txtGreen,"Tent %dm",(int)dist);
  687. else if(strstr(e->cfgVehicle->entityName->string,"StorageShed") || strstr(e->cfgVehicle->entityName->string,"WoodShack"))
  688. DrawFont(pos.x,pos.y,txtGreen,"Shed %dm",(int)dist);
  689. else if(strcmp(e->cfgVehicle->entityName->string,"WoodCrate_DZ")==0)
  690. DrawFont(pos.x,pos.y,txtGreen,"Crate %dm",(int)dist);
  691. else if(strstr(e->cfgVehicle->entityName->string,"Grave"))
  692. DrawFont(pos.x,pos.y,txtGrey,"Grave %dm",(int)dist);
  693. else if(strcmp(e->cfgVehicle->entityName->string,"GunRack_DZ")==0)
  694. DrawFont(pos.x,pos.y,txtGreen,"Gunrack %dm",(int)dist);
  695. else if(strcmp(e->cfgVehicle->entityName->string,"Plastic_Pole_EP1_DZ")==0)
  696. DrawFont(pos.x,pos.y,txtGreen,"Pole %dm",(int)dist);
  697. }
  698. else
  699. {
  700. DrawFont(pos.x,pos.y,txtGreen,e->cfgVehicle->entityName->string);
  701. }
  702. }
  703. }
  704. }
  705. }
  706. }
  707. }
  708. }
  709. }
  710.  
  711. void MasterLoop(EntitiesDistributed* table)
  712. {
  713. __try
  714. {
  715. if(table->table1)SlaveLoop(table->table1,table->table1Size);
  716. if(table->table2)SlaveLoop(table->table2,table->table2Size);
  717. if(table->table3)SlaveLoop(table->table3,table->table3Size);
  718. if(table->table4)SlaveLoop(table->table4,table->table4Size);
  719. }
  720. __except(EXCEPTION_EXECUTE_HANDLER)
  721. {
  722.  
  723. }
  724. }
  725.  
  726. int WINAPI HookedPresent(LPDIRECT3DDEVICE9 pDevice, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion)
  727. {
  728. if(m_pFont==NULL)
  729. {
  730. D3DXCreateFont(pDevice, 14, 0, 400, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Verdana"), &m_pFont);
  731. }
  732. if(!Init)
  733. {
  734. mainMenu = new menu(new menuentry("Distance",distLimit,1000,15000));
  735. mainMenu->add(new menuentry("No Recoil",noRecoil,1,1));
  736. mainMenu->add(new menuentry("No Spread",noSpread,1,1));
  737. mainMenu->add(new menuentry("No Fatigue",noFatigue,1,1));
  738. mainMenu->add(new menuentry("Show empty Vehicles",emptyVeh,1,1));
  739. mainMenu->add(new menuentry("Show Storages",objects,1,1));
  740. mainMenu->add(new menuentry("Show all objects",allObjects,1,1));
  741. mainMenu->add(new menuentry("No Falldamage",noFalldamage,1,1));
  742. mainMenu->add(new menuentry("Fly",speedHack,1,1));
  743. mainMenu->add(new menuentry("Item List",listItems,1,1));
  744. mainMenu->add(new menuentry("Unlock Vehicles",unlockVehicles,1,1));
  745. mainMenu->add(new menuentry("Teleport to Marker",destruction,1,1));
  746. mainMenu->add(new menuentry("Teleport to Player",playerTP,1,1));
  747. //mainMenu->add(new menuentry("Vehicle locked",vehicleLocked,1,3));
  748. bd = new menuentry("Bulletdamage",bulletDamage,10,50000);
  749. mainMenu->add(bd);
  750. Init = 1;//menuvalue* v1 = selected->current = selected->first = new menuvalue();
  751. if(!m_rectLine)D3DXCreateLine(pDevice,&m_rectLine);
  752. }
  753.  
  754. if (GetAsyncKeyState(VK_HOME))
  755. drawMenu = !drawMenu;
  756.  
  757. if (drawMenu)
  758. DrawMenu(pDevice);
  759.  
  760. WorldPointer pWorld = *(WorldPointer*)0xDA8208;
  761. NetworkManager pNetworkmanager = *(NetworkManager*)0xD99F08;
  762. if(pWorld.world->cameraOn->unit)
  763. {
  764. if(*playerTP&&mainMenu->picker==NULL)
  765. {
  766. mainMenu->picker = new playerPicker(new playerEntry("YOURSELF",0));
  767. if(pNetworkmanager.scoreboard)
  768. {
  769. if(pNetworkmanager.scoreboard->scoreboardTable)
  770. {
  771. for(int i = 0;i < pNetworkmanager.scoreboard->scoreboardTableCount; i++)
  772. {
  773. mainMenu->picker->add(new playerEntry((char*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2),*(DWORD*)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1)));
  774. }
  775. }
  776. }
  777. }
  778. if(*listItems&&mainMenu->iPicker==NULL)
  779. {
  780. mainMenu->iPicker = new itemPicker();
  781. MagTable *mt = (MagTable*)0xDA81F0;
  782. for(int i = 0;i<mt->count;i++)
  783. {
  784. MagazineType *m = *(MagazineType**)((DWORD)mt->mag+i*4);
  785. //char nigger[64];
  786. //sprintf_s(nigger,"%x",m);
  787. if(m->magazineName)
  788. mainMenu->iPicker->add(new itemEntry(m->magazineName->string,0,m));
  789. }
  790. }
  791. else if(mainMenu->iPicker&&*listItems==0)
  792. {
  793. mainMenu->iPicker = NULL;
  794. }
  795. else if(mainMenu->picker&&*playerTP==0)
  796. {
  797. mainMenu->picker = NULL;
  798. }
  799. if(*destruction)
  800. {
  801. *destruction = 0;
  802. pWorld.world->cameraOn->unit->entityVisualState->coordinates = pWorld.world->cameraOn->unit->markerPos;
  803. }
  804. /*
  805. Entity* e = (Entity*)pWorld.world->cameraOn->unit;
  806. DWORD vTable = *(DWORD*)(e);
  807. DWORD func = *(DWORD*)(vTable+0x104);
  808. VarTable* table;
  809. __asm
  810. {
  811. mov ECX, e
  812. call func
  813. mov table, EAX
  814. }
  815. EntryArray *entry = table->eArray;
  816. int i = 0;
  817. DrawFont(250,500,txtGreen,"varTable: %x",table);
  818. while(true)
  819. {
  820. i++;
  821. if((DWORD)entry>1)
  822. {
  823. if(!IsBadReadPtr(entry->firstEntry,4))
  824. {
  825. varEntry* en = entry->firstEntry;
  826. if(en->vTable == 12644640)
  827. {
  828. DrawFont(250,3+(i*13),txtGreen,"variable: %s n: %x",en->name->string,en);
  829. }
  830. else
  831. {
  832. break;
  833. }
  834. }
  835. }
  836. entry += 1;
  837. }
  838. */
  839.  
  840.  
  841. //DrawFont(250,250,txtGreen,"%s",entry->name->string);
  842. if(pWorld.world->cameraOn->unit->playerID>0)
  843. {
  844. if(!pWorld.world->cameraOn->unit->isDead)
  845. {
  846. /*
  847. if(pNetworkmanager.scoreboard)
  848. if(pNetworkmanager.scoreboard->scoreboardTable)
  849. {
  850. for(int i = 0;i < pNetworkmanager.scoreboard->scoreboardTableCount; i++)
  851. {
  852. DrawFont(200,3+(i*13),txtPink,"%s %d",(wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2),*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1)); // (wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+0x2A)+0x2)
  853. }
  854. }
  855. */
  856. if(*noRecoil&&pWorld.world->cameraOn->unit->customRecoilCoef)
  857. pWorld.world->cameraOn->unit->customRecoilCoef = 0;
  858. if(*noFatigue&&pWorld.world->cameraOn->unit->fatigue)
  859. pWorld.world->cameraOn->unit->fatigue = 0;
  860. if(*noFalldamage&&pWorld.world->cameraOn->unit->damagePartCount)
  861. pWorld.world->cameraOn->unit->damagePartCount = 0;
  862. if(*noSpread&&(DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9))
  863. {
  864. if(((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x4))
  865. {
  866. if((*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x4)+0xB))
  867. {
  868. *(float**)(*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x4)+0xB) = 0; // spread
  869. }
  870. }
  871. if(((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x1))
  872. {
  873. if(*(DWORD**)(*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x1)+0x2)+0x80)
  874. {
  875. if(bd)
  876. bd->value = (float*)(*(DWORD**)(*(DWORD**)(*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x1)+0x2)+0x80)+0x50);
  877. }
  878. }
  879. }
  880. }
  881. //float* bulletdmg = (float*)(*(DWORD**)(*(DWORD**)(*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x1)+0x2)+0x80)+0x50);
  882. //pWorld.world->cameraOn->unit->customRecoilCoef = 0;
  883. //pWorld.world->cameraOn->unit->fatigue = 0;
  884. /*
  885. Weapon *w = (Weapon*)(pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9)+0x1);
  886. if(w)
  887. {
  888. DrawFont(3,42,txtPink,"weapon %x", w);
  889. //w->weaponModeType->dispersion = 0;
  890. if(w->magazine)
  891. {
  892. //w->magazine->magazineType->ammunition->directDamage = 12;
  893. DrawFont(3,29,txtPink,"damage %f speed %f",w->magazine->magazineType->ammunition->directDamage,w->magazine->magazineType->ammunition->typicalSpeed);
  894. }
  895. else
  896. {
  897. DrawFont(3,29,txtPink,"Magazine is null");
  898. }
  899. }
  900. else
  901. {
  902. DrawFont(3,42,txtPink,"no weapon");
  903. }
  904. */
  905. }
  906. if(pWorld.world->cameraOn->unit->entityVisualState)
  907. localPlayer = pWorld.world->cameraOn->unit->entityVisualState->coordinates;
  908. EntityTablePointer* ObjectPtr = (pWorld.world->entityTablePointer);
  909. if(!IsBadReadPtr(ObjectPtr,0x8))
  910. {
  911. DWORD* entTable = *(DWORD**)ObjectPtr;
  912. if(!IsBadReadPtr(entTable,4))
  913. {
  914. UpdateView();
  915. for(int i = 0; i<pWorld.world->entityTablePointer->objectTableSize; i++)
  916. {
  917. EntityTable *eTable = *(EntityTable**)((entTable+(13*i)));
  918. if(eTable)
  919. {
  920. Entity *e = eTable->e;
  921. if(e)
  922. {
  923. if(strcmp(e->cfgVehicle->objectType->string,"soldier")==0)
  924. {
  925. if(e != (Entity*)pWorld.world->cameraOn->unit)
  926. {
  927. bool human = 0;
  928. Unit* u = (Unit*)e;
  929. if(u->playerID>1)
  930. human = 1;
  931. EntityVisualState *vis = e->entityVisualState;
  932. if(vis)
  933. {
  934. int dist = (int)(Vectorl3(localPlayer - vis->coordinates));
  935. if(dist<*distLimit)
  936. {
  937. if(!u->isDead)
  938. {
  939. if(human)
  940. {
  941. char* name = "null";
  942. D3DXVECTOR3 pos = WorldToScreen(vis->coordinates);
  943. if(pos.z > 0.01)
  944. {
  945. if(pNetworkmanager.scoreboard)
  946. {
  947. if(pNetworkmanager.scoreboard->scoreboardTable)
  948. {
  949. for(int i = 0;i < pNetworkmanager.scoreboard->scoreboardTableCount; i++)
  950. {
  951. if(*(DWORD*)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1) == u->playerID)
  952. {
  953. //DrawFont(200,3+(i*13),txtPink,"%s %d",(char*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2),*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1)); // (wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+0x2A)+0x2)
  954. name = (char*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2);
  955. break;//DrawFont(200,3+(i*13),txtPink,"%s %d",(wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2),*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1)); // (wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+0x2A)+0x2)
  956. }
  957. }
  958. }
  959. }
  960. if(dist<500)
  961. {
  962. D3DXVECTOR3 headpos = WorldToScreen(vis->headCoordinates);
  963. D3DXVECTOR3 bodypos = WorldToScreen(vis->torsoCoordinates);
  964. //D3DXVECTOR2 headpos2D(headpos.x,headpos.y);
  965. //D3DXVECTOR2 boxdir = (headpos - pos);
  966. //float blength = Vectorl2(boxdir);
  967. //D3DXVECTOR2 box90(-boxdir.y, boxdir.x);
  968. //D3DXVECTOR2 norm90;
  969. //D3DXVec2Normalize(&norm90,&box90);
  970. //D3DXVECTOR3 lefttop = headpos2D + (norm90 * 0,2);
  971. //D3DXVECTOR3 righttop = headpos2D - (norm90 * 0,2);
  972. DrawLine(m_rectLine,headpos.x,headpos.y,bodypos.x,bodypos.y,txtRed);
  973. DrawLine(m_rectLine,bodypos.x,bodypos.y,pos.x,pos.y,txtRed);
  974. //DrawLine(m_rectLine,lefttop.x,lefttop.y,righttop.x,righttop.y,txtRed);
  975. }
  976. D3DCOLOR txtCustom = D3DCOLOR_ARGB(255-(int)((float)((float)dist/(float)*distLimit)*255), 255, 0, 0);
  977. wchar_t dispName[256];
  978. //swprintf(dispName,L"%s %dm %d",name, dist,u->playerID);
  979. DrawFont(pos.x,pos.y,txtCustom,"%s %dm",name, dist);
  980. }
  981. }
  982. }
  983. else
  984. {
  985. D3DXVECTOR3 pos = WorldToScreen(vis->coordinates);
  986. if(pos.z > 0.01)
  987. {
  988. DrawFont(pos.x,pos.y,txtDarkGrey,"%s (dead) %dm",e->cfgVehicle->entityName->string, dist);
  989. }
  990. }
  991. }
  992. }
  993. }
  994. }
  995. else if(strcmp(e->cfgVehicle->objectType->string,"helicopter")==0 || strcmp(e->cfgVehicle->objectType->string,"car")==0 || strcmp(e->cfgVehicle->objectType->string,"airplane")==0 || strcmp(e->cfgVehicle->objectType->string,"motorcycle")==0 || strcmp(e->cfgVehicle->objectType->string,"parachute")==0)
  996. {
  997. Vehicle* v = (Vehicle*)e;
  998. /*
  999. DWORD desob = NULL;
  1000. DWORD delVeh = 0x450430;
  1001. if(*destruction)
  1002. {
  1003. __asm
  1004. {
  1005. push v
  1006. call delVeh
  1007. mov desob, EAX
  1008. }
  1009.  
  1010. if(desob)
  1011. {
  1012. DWORD vTable = *(DWORD*)desob;
  1013. DWORD Adress = *(DWORD*)(vTable + 0x28);
  1014. __asm
  1015. {
  1016. mov ECX, desob
  1017. call Adress
  1018. }
  1019. }
  1020.  
  1021. }
  1022. */
  1023. if(*unlockVehicles)
  1024. {
  1025. Unit *u = (Unit*)v;
  1026. u->vehicleLocked = 1;
  1027. }
  1028. if((Unit*)v != pWorld.world->cameraOn->unit)
  1029. {
  1030. if(v->driver)
  1031. {
  1032. if(v->driver->playerID)
  1033. {
  1034. EntityVisualState *vis = e->entityVisualState;
  1035. if(vis)
  1036. {
  1037. int dist = (int)(Vectorl3(localPlayer - vis->coordinates));
  1038. if(dist<*distLimit)
  1039. {
  1040. Unit* e = (Unit*)v;
  1041. char* name = "null";
  1042. if(pNetworkmanager.scoreboard)
  1043. {
  1044. if(pNetworkmanager.scoreboard->scoreboardTable)
  1045. {
  1046. for(int i = 0;i < pNetworkmanager.scoreboard->scoreboardTableCount; i++)
  1047. {
  1048. if(*(DWORD*)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1) == v->driver->playerID)
  1049. {
  1050. //DrawFont(200,3+(i*13),txtPink,"%s %d",(char*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2),*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1)); // (wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+0x2A)+0x2)
  1051. name = (char*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2);
  1052. break;//DrawFont(200,3+(i*13),txtPink,"%s %d",(wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46)+0x2A)+0x2),*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+(i * 0x46) + 0x1)); // (wchar_t*)(*(DWORD**)((DWORD*)pNetworkmanager.scoreboard->scoreboardTable+0x2A)+0x2)
  1053. }
  1054. }
  1055. }
  1056. }
  1057. D3DXVECTOR3 pos = WorldToScreen(vis->coordinates);
  1058. if(pos.z > 0.01)
  1059. {
  1060. DrawFont(pos.x,pos.y,txtPink,"%s %dm (%d) [%s]",e->cfgVehicle->entityName->string, dist,e->vehicleLocked, name);
  1061. }
  1062. }
  1063. }
  1064. }
  1065. }
  1066. else if(*emptyVeh)
  1067. {
  1068. EntityVisualState *vis = e->entityVisualState;
  1069. if(vis)
  1070. {
  1071. int dist = (int)(Vectorl3(localPlayer - vis->coordinates));
  1072. if(dist<*distLimit)
  1073. {
  1074. Unit* e = (Unit*)v;
  1075. D3DXVECTOR3 pos = WorldToScreen(vis->coordinates);
  1076. if(pos.z > 0.01)
  1077. {
  1078. DrawFont(pos.x,pos.y,txtGrey,"%s %dm (%x)",e->cfgVehicle->entityName->string, dist,e->vehicleLocked);
  1079. }
  1080. }
  1081. }
  1082. }
  1083. }
  1084. }
  1085. }
  1086. }
  1087. }
  1088. }
  1089. }
  1090. if(*objects)
  1091. {
  1092. MasterLoop(pWorld.world->table1);
  1093. MasterLoop(pWorld.world->table2);
  1094. MasterLoop(pWorld.world->table3);
  1095. }
  1096. }
  1097. /*
  1098. if(pWorld.world->cameraOn->unit)
  1099. {
  1100. if(pWorld.world->cameraOn->unit->entityVisualState)
  1101. {
  1102. D3DVECTOR pos = pWorld.world->cameraOn->unit->entityVisualState->coordinates;
  1103. DrawFont(3,3,txtPink,"local pos: %f %f %f",pos.x,pos.y,pos.z);
  1104. }
  1105. }
  1106. */
  1107.  
  1108.  
  1109. oPresent(pDevice, pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion);
  1110. return 0;
  1111. }
  1112.  
  1113. template <typename T> T HookVTableFunction(DWORD* dwpTable, int index, DWORD dwNewFunc)
  1114. {
  1115. DWORD dwProt = 0;
  1116. VirtualProtect(&dwpTable[index],4,PAGE_EXECUTE_READWRITE,&dwProt);
  1117. T oFunc = (T)dwpTable[index];
  1118. dwpTable[index] = dwNewFunc;
  1119. VirtualProtect(&dwpTable[index],4,dwProt,0);
  1120. return oFunc;
  1121. }
  1122.  
  1123. DWORD WINAPI HookThread(LPVOID lpParameter)
  1124. {
  1125. HMODULE hModule = GetModuleHandleA("d3d9.dll");
  1126. DWORD dwDeviceVMTPtr(0), *dwpDeviceVMT = NULL;
  1127. dwDeviceVMTPtr = *(DWORD*)(*(DWORD*)(*(DWORD*)0xDA8208+0x4)+0x188c);
  1128. memcpy(&dwpDeviceVMT, (LPVOID)dwDeviceVMTPtr, 4);
  1129. oPresent = HookVTableFunction<Present_t>(dwpDeviceVMT, 17, (DWORD)&HookedPresent);
  1130. while (true)
  1131. {
  1132. HookVTableFunction<Present_t>(dwpDeviceVMT, 17, (DWORD)&HookedPresent);
  1133. Sleep(1000);
  1134. }
  1135. }
  1136.  
  1137. DWORD WINAPI SpeedThread(LPVOID lpParameter)
  1138. {
  1139. while(true)
  1140. {
  1141. if(*speedHack)
  1142. {
  1143. WorldPointer pWorld = *(WorldPointer*)0xDA8208;
  1144. if(pWorld.world->cameraOn->unit)
  1145. {
  1146. pWorld.world->cameraOn->unit->landcontact = 1;
  1147. EntityVisualState* vis = pWorld.world->cameraOn->unit->entityVisualState;
  1148. vis->velocity.x = 0;
  1149. vis->velocity.y = 0;
  1150. vis->velocity.z = 0;
  1151. if(GetAsyncKeyState(0x57))
  1152. {
  1153. vis->coordinates.x += vis->direction.x*(1-(fabs(vis->pitch)));
  1154. vis->coordinates.z += vis->direction.z*(1-(fabs(vis->pitch)));
  1155. vis->coordinates.y += vis->pitch;
  1156. }
  1157. }
  1158. }
  1159. Sleep(10);
  1160. }
  1161. }
  1162.  
  1163. DWORD WINAPI KeyThread(LPVOID lpParameter)
  1164. {
  1165. while(true)
  1166. {
  1167. if(GetAsyncKeyState(VK_DOWN))
  1168. {
  1169. if(!mainMenu->picker&&!mainMenu->iPicker)
  1170. {
  1171. if(mainMenu->selected->next)
  1172. mainMenu->selected = mainMenu->selected->next;
  1173. else
  1174. mainMenu->selected = mainMenu->first;
  1175. }
  1176. else if(!mainMenu->iPicker)
  1177. {
  1178. if(mainMenu->picker->selected->next)
  1179. mainMenu->picker->selected = mainMenu->picker->selected->next;
  1180. else
  1181. mainMenu->picker->selected = mainMenu->picker->first;
  1182. }
  1183. else
  1184. {
  1185. if(mainMenu->iPicker->selected->next)
  1186. mainMenu->iPicker->selected = mainMenu->iPicker->selected->next;
  1187. else
  1188. mainMenu->iPicker->selected = mainMenu->iPicker->first;
  1189. }
  1190. }
  1191. if(GetAsyncKeyState(VK_UP))
  1192. {
  1193. if(!mainMenu->picker&&!mainMenu->iPicker)
  1194. {
  1195. if(mainMenu->selected->last)
  1196. mainMenu->selected = mainMenu->selected->last;
  1197. else
  1198. mainMenu->selected = mainMenu->last;
  1199. }
  1200. else if(!mainMenu->iPicker)
  1201. {
  1202. if(mainMenu->picker->selected->last)
  1203. mainMenu->picker->selected = mainMenu->picker->selected->last;
  1204. else
  1205. mainMenu->picker->selected = mainMenu->picker->last;
  1206. }
  1207. else
  1208. {
  1209. if(mainMenu->iPicker->selected->last)
  1210. mainMenu->iPicker->selected = mainMenu->iPicker->selected->last;
  1211. else
  1212. mainMenu->iPicker->selected = mainMenu->iPicker->last;
  1213. }
  1214. }
  1215. if(GetAsyncKeyState(VK_RIGHT))
  1216. {
  1217. mainMenu->selected->right();
  1218. }
  1219. if(GetAsyncKeyState(VK_LEFT))
  1220. {
  1221. mainMenu->selected->left();
  1222. }
  1223. if(GetAsyncKeyState(VK_PRIOR))
  1224. {
  1225. WorldPointer pWorld = *(WorldPointer*)0xDA8208;
  1226. //Weapon *w = (Weapon*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9);
  1227. //pWorld.world->cameraOn->unit->weaponTable->weaponModeType->dispersion
  1228. DWORD* dispersion = (DWORD*)(*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x4)+0xB);
  1229. DWORD* garbage1 = (DWORD*)(*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x1)+0x3);
  1230. DWORD* garbage2 = (DWORD*)(*(DWORD**)((DWORD*)pWorld.world->cameraOn->unit->weaponTable+(pWorld.world->cameraOn->unit->weaponID * 0x9) + 0x1)+0x9);
  1231. //pWorld.world->cameraOn->unit->weaponTable->magazine->magazineType->ammunition->directDamage
  1232. *garbage1 = (30^0xBABAC8B6) << 1;
  1233. *garbage2 = (30^0xBABAC8B6) - *garbage1;
  1234. *dispersion = 0;
  1235. //w->magazine->ammo1 = 0xDD5D6454;
  1236. //w->magazine->ammo2 = 0xDD5D6454;
  1237. //w->weaponModeType->dispersion = 0;
  1238. //w->magazine->magazineType->ammunition->directDamage = 22;
  1239. }
  1240. if(GetAsyncKeyState(VK_INSERT))
  1241. {
  1242. WorldPointer pWorld = *(WorldPointer*)0xDA8208;
  1243. if(strcmp(pWorld.world->cameraOn->unit->cfgVehicle->objectType->string,"soldier")!=0)
  1244. {
  1245. srand (time(NULL));
  1246. Vehicle* v = (Vehicle*)pWorld.world->cameraOn->unit;
  1247. for(int i=0;i<v->damagePartsCount;i++)
  1248. {
  1249. float* part = (float*)(v->damageParts + i);
  1250. *part = (float)((float)(rand()%100)/1000);
  1251. }
  1252. v->coordinates->fuelLevel = v->cfgVehicle->fuelTankCap;
  1253. }
  1254. }
  1255. if(GetAsyncKeyState(VK_RETURN))
  1256. {
  1257. std::cout << "Enter";
  1258. WorldPointer pWorld = *(WorldPointer*)0xDA8208;
  1259. if(mainMenu->picker)
  1260. {
  1261. if(*playerTP)
  1262. {
  1263. Unit* unitTP = NULL;
  1264. EntityTablePointer* ObjectPtr = (pWorld.world->entityTablePointer);
  1265. if(!IsBadReadPtr(ObjectPtr,0x8))
  1266. {
  1267. DWORD* entTable = *(DWORD**)ObjectPtr;
  1268. if(!IsBadReadPtr(entTable,4))
  1269. {
  1270. UpdateView();
  1271. for(int i = 0; i<pWorld.world->entityTablePointer->objectTableSize; i++)
  1272. {
  1273. EntityTable *eTable = *(EntityTable**)((entTable+(13*i)));
  1274. if(eTable)
  1275. {
  1276. Entity *e = eTable->e;
  1277. if(e)
  1278. {
  1279. if(strcmp(e->cfgVehicle->objectType->string,"soldier")==0)
  1280. {
  1281. if(e != (Entity*)pWorld.world->cameraOn->unit)
  1282. {
  1283. Unit *u = (Unit*)e;
  1284. if(u->playerID == mainMenu->picker->selected->ID)
  1285. {
  1286. unitTP = u;
  1287. }
  1288. }
  1289. }
  1290. }
  1291. }
  1292. }
  1293. }
  1294. }
  1295. if(unitTP!=NULL)
  1296. {
  1297. if(pWorld.world->cameraOn&&pWorld.world->cameraOn->unit)
  1298. {
  1299. pWorld.world->cameraOn->unit->entityVisualState->coordinates = unitTP->entityVisualState->coordinates - unitTP->entityVisualState->direction*3;
  1300. pWorld.world->cameraOn->unit->entityVisualState->direction = unitTP->entityVisualState->direction;
  1301. }
  1302. }
  1303. }
  1304. }
  1305. else if(mainMenu->iPicker)
  1306. {
  1307. if(*listItems)
  1308. {
  1309. if(pWorld.world->cameraOn->unit)
  1310. {
  1311. if(mainMenu->iPicker)
  1312. {
  1313. if(mainMenu->iPicker->selected->item)
  1314. {
  1315. if(pWorld.world->cameraOn->unit->inventoryMagTableSize<pWorld.world->cameraOn->unit->inventoryMagTableMaxSize)
  1316. {
  1317. DWORD off_D83398 = 0xD83398;
  1318. DWORD initMag = 0x71E326;
  1319. MagazineType *item = (MagazineType*)mainMenu->iPicker->selected->item;
  1320. Magazine *mag = NULL;
  1321. DWORD test = 0;
  1322. __asm
  1323. {
  1324. mov ecx, [off_D83398]
  1325. mov eax, [ecx]
  1326. mov eax, [eax]
  1327. mov test, eax
  1328. push 30h
  1329. call dword ptr [eax+4]
  1330. push item
  1331. mov ecx, eax
  1332. call initMag
  1333. mov mag, eax
  1334. }
  1335.  
  1336. //pWorld.world->cameraOn->unit->inventoryMagTableMaxSize++;
  1337. mag->ammo1 = (item->magazineCapacity ^ 0xBABAC8B6) << 1;
  1338. mag->ammo2 = (item->magazineCapacity ^ 0xBABAC8B6) - mag->ammo1;
  1339. mag->references = 2;
  1340. DWORD *newmag = (DWORD*)((DWORD)pWorld.world->cameraOn->unit->inventoryMagTable+pWorld.world->cameraOn->unit->inventoryMagTableSize*4);
  1341. pWorld.world->cameraOn->unit->inventoryMagTableSize++;
  1342. *newmag = (DWORD)mag;
  1343. }
  1344. }
  1345. }
  1346. }
  1347. }
  1348. }
  1349. }
  1350. Sleep(200);
  1351. }
  1352. }
  1353.  
  1354. BOOL APIENTRY DllMain( HMODULE hModule,
  1355. DWORD ul_reason_for_call,
  1356. LPVOID lpReserved
  1357. )
  1358. {
  1359. switch (ul_reason_for_call)
  1360. {
  1361. case DLL_PROCESS_ATTACH:
  1362. {
  1363. DisableThreadLibraryCalls(hModule);
  1364. HideModule(hModule);
  1365. UnlinkModule ("Fraps.dll");
  1366.  
  1367. CreateMutex(0, false, "wwdUWdhhnawhf6");
  1368.  
  1369. dwModBase = (DWORD)GetModuleHandle("ArmA2OA.exe");
  1370. CreateThread(0, 0, HookThread, 0, 0, 0);
  1371. CreateThread(0, 0, KeyThread, 0, 0, 0);
  1372. CreateThread(0, 0, SpeedThread, 0, 0, 0);
  1373. }
  1374. case DLL_THREAD_ATTACH:
  1375. case DLL_THREAD_DETACH:
  1376. case DLL_PROCESS_DETACH:
  1377. break;
  1378. }
  1379. return TRUE;
  1380. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement