Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.46 KB | None | 0 0
  1. #include <d3d9.h>
  2. #include <d3dx9.h>
  3. #include "Quelle.h"
  4. #include "color.h"
  5. #include "detour.h"
  6. #include "int.h"
  7. #include "Hacks.h"
  8. #include "d3dmenu.h"
  9.  
  10.  
  11. #pragma comment(lib, "d3d9.lib")
  12. #pragma comment(lib, "d3dx9.lib")
  13.  
  14. D3D9Menu *pMenu = NULL;
  15. CD3DFont* pFont; // Farben halt
  16.  
  17.  
  18. bool Color = true;
  19. bool Create;
  20.  
  21.  
  22.  
  23. LPDIRECT3DTEXTURE9 Red, Yellow, Green, Blue, Purple, Pink, Orange, White, Black;
  24. DWORD org_scp;
  25. DWORD retES;
  26. DWORD jump_DrawIndexedPrimitive;
  27. void MemoryHacks();
  28.  
  29. __declspec(naked) DWORD APIENTRY pPresent(LPDIRECT3DDEVICE9 pDevice, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion)
  30. {
  31. __asm
  32. {
  33. MOV EDI, EDI
  34. PUSH EBP
  35. MOV EBP, ESP
  36. jmp retES
  37. }
  38. }
  39.  
  40. __declspec(naked) DWORD APIENTRY pDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex, UINT NumVertices, UINT StartIndex, UINT PrimitiveCount)
  41. {
  42. __asm
  43. {
  44. MOV EDI, EDI
  45. PUSH EBP
  46. MOV EBP, ESP
  47. jmp jump_DrawIndexedPrimitive
  48. }
  49. }
  50.  
  51. __declspec(naked) DWORD APIENTRY D3DXCreateFont(DWORD A, DWORD B, DWORD C, DWORD D, DWORD E, DWORD F, DWORD G, DWORD H, DWORD I, DWORD J, DWORD K, DWORD L)
  52. {
  53. __asm
  54. {
  55. MOV EDI, EDI
  56. PUSH EBP
  57. MOV EBP, ESP
  58. jmp org_scp
  59. }
  60. }
  61.  
  62. HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
  63. {
  64. if (FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL)))
  65. return E_FAIL;
  66.  
  67. WORD colour16 = ((WORD)((colour32 >> 28) & 0xF) << 12)
  68. | (WORD)(((colour32 >> 20) & 0xF) << 8)
  69. | (WORD)(((colour32 >> 12) & 0xF) << 4)
  70. | (WORD)(((colour32 >> 4) & 0xF) << 0);
  71.  
  72. D3DLOCKED_RECT d3dlr;
  73. (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
  74. WORD *pDst16 = (WORD*)d3dlr.pBits;
  75.  
  76. for (int xy = 0; xy < 8 * 8; xy++)
  77. *pDst16++ = colour16;
  78.  
  79. (*ppD3Dtex)->UnlockRect(0);
  80.  
  81. return S_OK;
  82. }
  83.  
  84.  
  85. void RebuildMenu(void)
  86. {
  87. pMenu->AddFolder("[DIRECT3D]", Moptfolder, &folder[1], 2);
  88. if (folder[1])
  89. {
  90. pMenu->AddItem("Wallhack", Moptonoff, &CH_Item[0], 2);
  91. pMenu->AddItem("SeeGhost", Moptonoff, &CH_Item[1], 2);
  92. pMenu->AddItem("Wireframe", Moptonoff, &CH_Item[2], 2);
  93. pMenu->AddItem("Glasswall", Moptonoff, &CH_Item[3], 2);
  94. pMenu->AddItem("Chams", Moptonoff, &CH_Item[14], 2);
  95. pMenu->AddItem("Crosshair", Crosshair, &CH_Item[4], 6);
  96.  
  97. }
  98. pMenu->AddFolder("[PLAYER]", Moptfolder, &folder[2], 2);
  99. if (folder[2])
  100. {
  101. pMenu->AddItem("Superkill", Superkill, &CH_Item[13], 2);//17
  102. pMenu->AddItem("Invisible", Moptonoff, &CH_Item[15], 2);
  103. pMenu->AddItem("Spectator", SpectateT, &CH_Item[5], 2);
  104.  
  105. }
  106. pMenu->AddFolder("[MEMORY]", Moptfolder, &folder[3], 2);
  107. if (folder[3])
  108. {
  109. pMenu->AddItem("Unli Bag", Moptonoff, &CH_Item[17], 2);
  110. pMenu->AddItem("No Recoil", Moptonoff, &CH_Item[7], 2);
  111. pMenu->AddItem("No Spread", Moptonoff, &CH_Item[8], 2);
  112. pMenu->AddItem("Fast Reload", AutoOn, &CH_Item[9], 2);
  113. pMenu->AddItem("Fast Change", AutoOn, &CH_Item[10], 2);
  114. pMenu->AddItem("NoBugDamage", AutoOn, &CH_Item[11], 1);
  115. pMenu->AddItem("NoFallDamage", AutoOn, &CH_Item[12], 1);
  116. }
  117. pMenu->AddFolder("[MISC]", Moptfolder, &folder[5], 2);
  118. if (folder[5])
  119. {
  120. pMenu->AddItem("Exit Game", Moptonoff, &CH_Item[16], 2);
  121.  
  122. }
  123. pMenu->AddFolder("[CREDITS]", Moptfolder, &folder[4], 2);
  124. if (folder[4])
  125. {
  126. pMenu->AddItem("@EnhanceDevelopment", Creditsss, &credits, 1);
  127. pMenu->AddItem("@MemoryThePast", Creditsss, &credits, 1);
  128. pMenu->AddItem("@RazerXJosh", Creditsss, &credits, 1);
  129. pMenu->AddItem("@hackX10", Creditsss, &credits, 1);
  130. pMenu->AddItem("@zNova", Creditsss, &credits, 1);
  131. pMenu->AddItem("@hackX10", Creditsss, &credits, 1);
  132. pMenu->AddItem("@DivineAwe", Creditsss, &credits, 1);
  133. }
  134.  
  135.  
  136. }
  137.  
  138.  
  139. HRESULT APIENTRY my_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex, UINT NumVertices, UINT StartIndex, UINT PrimitiveCount)
  140. {
  141.  
  142. UINT UselessData;
  143. LPDIRECT3DVERTEXBUFFER9 StreamData;
  144. UINT CurrentStride,Offset;
  145.  
  146. if (pDevice->GetStreamSource(0, &StreamData, &Offset, &CurrentStride) == D3D_OK)
  147. StreamData->Release();
  148.  
  149. pDevice->GetStreamSource(NULL, &StreamData, &UselessData, &CurrentStride);
  150. if (CH_Item[0] == 1)//WALLHACK
  151. {
  152. if (CurrentStride != 0) {
  153. if (CurrentStride == 32) {
  154. pDevice->SetRenderState(D3DRS_ZENABLE, false);
  155. }
  156. else if (CurrentStride == 44) {
  157. pDevice->SetRenderState(D3DRS_ZENABLE, false);
  158. }
  159. else if (CurrentStride == 40) {
  160. pDevice->SetRenderState(D3DRS_ZENABLE, false);
  161. }
  162. else {
  163. ;
  164. }
  165. }
  166. }
  167.  
  168. if (CH_Item[1] == 1)//SEEGHOST
  169. {
  170. if (CurrentStride == 44 || CurrentStride == 40)
  171. {
  172. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  173. pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_NEVER);
  174. pDevice->SetRenderState(D3DRS_LIGHTING, false);
  175. pDevice->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_ARGB(255, 255, 255, 255));
  176. pDevice->SetRenderState(D3DRS_FOGENABLE, false);
  177. }
  178. }
  179. if (CH_Item[2] == 1 && (CurrentStride == 40 || CurrentStride == 44))//WIREFRAME
  180. {
  181. pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
  182. }
  183.  
  184. if (CH_Item[14] == 1 && (CurrentStride == 40 || CurrentStride == 32 || CurrentStride == 44))
  185. {
  186.  
  187. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  188. pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_NEVER);
  189. pDevice->SetTexture(0, Yellow);
  190. pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimitiveCount);
  191. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  192. pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
  193. pDevice->SetTexture(0, Red);
  194. }
  195.  
  196. return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimitiveCount);
  197. }
  198.  
  199.  
  200. HRESULT APIENTRY my_Present(LPDIRECT3DDEVICE9 pDevice, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion)
  201. {
  202.  
  203. if (CH_Item[4] == 1)
  204. {
  205. Cross(pDevice, RED);
  206. }
  207. else if (CH_Item[4] == 1)
  208. {
  209. Cross(pDevice, BLUE);
  210. }
  211. else if (CH_Item[4] == 1)
  212. {
  213. Cross(pDevice, GREEN);
  214. }
  215. else if (CH_Item[4] == 1)
  216. {
  217. Cross(pDevice, BLACK);
  218. }
  219. else if (CH_Item[4] == 1)
  220. {
  221. Cross(pDevice, PURPLE);
  222. }
  223. if (CH_Item[16] == 1)
  224. {
  225. ExitProcess(0);
  226. }
  227. if (!msg)
  228. {
  229. ShowMessage("Simple Menu Hack\n-Juesril");
  230. msg = true;
  231. }
  232.  
  233. if (CH_Item[15] == 1)
  234. {
  235. MakeInvisible();
  236. }
  237. else
  238. {
  239. MakeVisible();
  240. }
  241. Spectator();
  242.  
  243. GenerateTexture(pDevice, &Red, D3DCOLOR_ARGB(255, 255, 0, 0));
  244. GenerateTexture(pDevice, &Yellow, D3DCOLOR_ARGB(255, 255, 255, 0));
  245. GenerateTexture(pDevice, &Green, D3DCOLOR_ARGB(255, 0, 255, 0));
  246. GenerateTexture(pDevice, &Blue, D3DCOLOR_ARGB(255, 0, 0, 255));
  247. GenerateTexture(pDevice, &Purple, D3DCOLOR_ARGB(255, 102, 0, 153));
  248. GenerateTexture(pDevice, &Pink, D3DCOLOR_ARGB(255, 255, 20, 147));
  249. GenerateTexture(pDevice, &Orange, D3DCOLOR_ARGB(255, 255, 165, 0));
  250. GenerateTexture(pDevice, &Black, D3DCOLOR_ARGB(255, 0, 0, 0));
  251. GenerateTexture(pDevice, &White, D3DCOLOR_ARGB(255, 255, 255, 255));
  252.  
  253. if (CH_Item[11] == 0 )
  254. {
  255. CH_Item[9] = 1;
  256. CH_Item[10] = 1;
  257. CH_Item[11] = 1;
  258. CH_Item[12] = 1;
  259.  
  260. }
  261.  
  262.  
  263. pFont = new CD3DFont("Arial", 8, D3DFONT_BOLD);
  264. pFont->InitDeviceObjects(pDevice);
  265. pFont->RestoreDeviceObjects();
  266.  
  267.  
  268. if (pMenu == NULL)
  269. {
  270.  
  271. pMenu = new D3D9Menu("JuesrilHax[BETA]");//menü name
  272. }
  273. else {
  274. pMenu->MenuShow(12, 10, pFont, pDevice);
  275. if (pMenu->Mmax == 0) RebuildMenu();
  276. pMenu->MenuNav();
  277.  
  278. }
  279. delete pFont;
  280. return pPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
  281. }
  282.  
  283.  
  284. DWORD APIENTRY MyD3DXCreateFont(DWORD A, DWORD B, DWORD C, DWORD D, DWORD E, DWORD F, DWORD G, DWORD H, DWORD I, DWORD J, DWORD K, DWORD L)
  285. {
  286.  
  287. DWORD thisa = *(DWORD*)A;
  288. /*=====Present Hook=====*/
  289. DWORD oldflagES;
  290. DWORD ESAddress = thisa + 68;
  291. DWORD ESHook = *(DWORD*)ESAddress;
  292. retES = ESHook + 5;
  293. /*=====Present Hook=====*/
  294. VirtualProtect((LPVOID)ESHook, 5, PAGE_EXECUTE_READWRITE, &oldflagES);
  295. *(PBYTE)ESHook = 0xE9;
  296. *(PULONG)(ESHook + 1) = (DWORD)my_Present - (ESHook + 5);
  297. /*=====DrawIndexedPrimitive Hook=====*/
  298. DWORD OLD_DrawIndexedPrimitive;
  299. DWORD DIPAddress = thisa + 328;
  300. DWORD MID_DrawIndexedPrimitive = *(DWORD*)DIPAddress;
  301. jump_DrawIndexedPrimitive = MID_DrawIndexedPrimitive + 5;
  302. /*=====DrawIndexedPrimitive Hook=====*/
  303. VirtualProtect((LPVOID)MID_DrawIndexedPrimitive, 5, PAGE_EXECUTE_READWRITE, &OLD_DrawIndexedPrimitive);
  304. *(PBYTE)MID_DrawIndexedPrimitive = 0xE9;
  305. *(PULONG)(MID_DrawIndexedPrimitive + 1) = (DWORD)my_DrawIndexedPrimitive - (MID_DrawIndexedPrimitive + 5);
  306. *(PULONG)(org_scp - 5) = 0x0000008b;
  307. *(PULONG)(org_scp - 4) = 0xEC8B55FF;
  308.  
  309. return D3DXCreateFont(A, B, C, D, E, F, G, H, I, J, K, L);
  310. }
  311.  
  312. UINT APIENTRY StartD3D(LPVOID param)
  313. {
  314. DWORD OLD_Font;
  315. HMODULE user32 = LoadLibraryA("d3dx9_29.dll");
  316. PVOID Address_Font = (PVOID)GetProcAddress(user32, "D3DXCreateFontA");
  317. VirtualProtect(Address_Font, 5, PAGE_EXECUTE_READWRITE, &OLD_Font);
  318. org_scp = (DWORD)Address_Font + 0x5;
  319. *(PULONG)Address_Font = 0xE9;
  320. *(PULONG)((DWORD)Address_Font + 0x1) = (DWORD)MyD3DXCreateFont - ((DWORD)Address_Font + 0x5);
  321. CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)MemoryHacks, NULL, NULL, NULL);
  322. return true;
  323. }
  324.  
  325.  
  326.  
  327. BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
  328. {
  329. if (dwReason == DLL_PROCESS_ATTACH)
  330. {
  331. HideModule(hDll);
  332. EraseHeaders(hDll);
  333.  
  334. CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)StartD3D, NULL, NULL, NULL);
  335. }
  336. return TRUE;
  337. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement