Advertisement
Guest User

ma'n.cpp

a guest
May 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.85 KB | None | 0 0
  1. #include "include.h"
  2. #include "Hook.h"
  3. #include "temalar.h"
  4. #include "detours.h"
  5. #include "esp.h"
  6. #pragma comment(lib, "detours.lib")
  7.  
  8. #pragma region External
  9.  
  10. extern LRESULT ImGui_ImplDX9_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
  11.  
  12. #pragma endregion
  13. #pragma region D3DStuff
  14.  
  15. DWORD *VTable;
  16. UINT Offset = 0;
  17. UINT Stride = 0;
  18. LPDIRECT3DVERTEXBUFFER9 Stream_Data;
  19. LPDIRECT3DDEVICE9 pDevice1, g_pDevice, r_pDevice;
  20. WNDPROC oriWndProc = NULL;
  21.  
  22. #pragma endregion
  23. #pragma region BoolandETC
  24.  
  25. bool isImGUiOK = false, testbool;
  26. float testslider;
  27. bool bShowMenu;
  28.  
  29. #pragma endregion
  30. HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice)
  31. {
  32.  
  33. return ((tEndScene)oEndScene)(pDevice);
  34. }
  35.  
  36. HRESULT WINAPI hkReset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
  37. {
  38. ImGui_ImplDX9_InvalidateDeviceObjects();
  39. return oReset(pDevice, pPresentationParameters);
  40. ImGui_ImplDX9_CreateDeviceObjects();
  41. return oReset(pDevice, pPresentationParameters);
  42. }
  43.  
  44.  
  45. HANDLE MEMORY = OpenProcess(PROCESS_ALL_ACCESS, 0, GetCurrentProcessId());
  46.  
  47.  
  48. bool testchk;
  49. int tabb = 1;
  50. void MenuRender()
  51. {
  52.  
  53.  
  54. if (!bShowMenu)
  55. return;
  56. static int pdx = 0;
  57. HANDLE hProcess;
  58.  
  59. hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, pdx);
  60.  
  61. pdx = pEx("Wolfteam.bin");
  62.  
  63. uintptr_t CShellBase = iGMBase(pdx, "csh");
  64. uintptr_t CShellSize = iGMBase(pdx, "csh", true);
  65. uintptr_t dwNameEspPtr = FindPatternEx(hProcess, CShellBase, CShellSize, "\x75\x31\x38\x00\x00\x00\x00\x00\x75\x29", "xxx?????xx");
  66.  
  67. DWORD nameesp = (dwNameEspPtr - CShellBase);
  68. ImGui_ImplDX9_NewFrame(); //ImGui Startup Point
  69. if (ImGui::Begin("test", 0, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_ShowBorders))
  70. {
  71. ImGui::Text("Coded by; #Coder");
  72. if (ImGui::Button("Visual", ImVec2(65, 40)))
  73. {
  74. tabb = 1;
  75. }
  76. ImGui::SameLine();
  77. if (ImGui::Button("Weapon", ImVec2(65, 40)))
  78. {
  79. tabb = 2;
  80. }
  81.  
  82. ImGui::BeginChild(1, ImVec2(500, 300), true);
  83.  
  84. switch (tabb)
  85. {
  86. case 1:
  87. {
  88. ImGui::Checkbox("deneme", &testchk);
  89. if (testchk)
  90. {
  91. DWORD ADRES = nameesp;
  92. DWORD VALUE = 2251829620;// name esp kapalı
  93. WriteProcessMemory(MEMORY, (LPVOID)ADRES, &VALUE, 4, NULL);
  94. }
  95. }
  96. break;
  97. case 2:
  98. {
  99. ImGui::Text("2");
  100. }
  101. break;
  102. default:
  103. break;
  104. }
  105. ImGui::EndChild();
  106. ImGui::End();
  107. }
  108. ImGui::Render(); //Calling ImGui to Render our Stuff*/
  109. }
  110.  
  111. HRESULT WINAPI hkPresent(LPDIRECT3DDEVICE9 pDevice, const RECT *a, const RECT *b, HWND c, const RGNDATA *d)
  112. {
  113. if (!isImGUiOK)
  114. {
  115. ImGuiIO& io = ImGui::GetIO();
  116. io.DeltaTime = 1.0f / 60.0f;
  117. D3DDEVICE_CREATION_PARAMETERS d3dcp{ 0 };
  118. pDevice->GetCreationParameters(&d3dcp);
  119. io.Fonts->AddFontDefault();
  120. ImGui_ImplDX9_Init(d3dcp.hFocusWindow, pDevice); // Render ImGui
  121. ColdHack();
  122. //isImGUiOK = true;
  123. }
  124.  
  125. if (GetAsyncKeyState(VK_INSERT) & 1)
  126. {
  127. bShowMenu = !bShowMenu;
  128. }
  129.  
  130. MenuRender();
  131.  
  132. //Do ur Memory editing here or make your own thread
  133.  
  134. ImGui::GetIO().MouseDrawCursor = bShowMenu;
  135.  
  136. return oPresent(pDevice, a, b, c, d);
  137. }
  138.  
  139. HRESULT WINAPI hkDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, int BaseVertexIndex, UINT MinIndex, UINT NumVertices, UINT StartIndex, UINT PrimCount)
  140. {
  141. if (!g_pDevice)
  142. {
  143. g_pDevice = pDevice;
  144. }
  145.  
  146. if (pDevice->GetStreamSource(0, &Stream_Data, &Offset, &Stride) == D3D_OK)
  147. Stream_Data->Release();
  148.  
  149.  
  150.  
  151. //Charm Hack Ready , code it yourself or google for source
  152.  
  153. return oDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimCount);
  154. }
  155.  
  156. LRESULT CALLBACK hWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  157. {
  158.  
  159. if (ImGui_ImplDX9_WndProcHandler(hwnd, uMsg, wParam, lParam) && GetKeyState(VK_INSERT) == 1)
  160. {
  161. return 1l;
  162. }
  163. return CallWindowProc(oriWndProc, hwnd, uMsg, wParam, lParam);
  164. }
  165. //Change Title
  166. DWORD __stdcall Thread(void * pParam)
  167. {
  168. UNREFERENCED_PARAMETER(pParam);
  169.  
  170. oriWndProc = (WNDPROC)SetWindowLongPtr(FindWindow(NULL, "WolfTeam"),GWL_WNDPROC, (LONG)(LONG_PTR)hWndProc);
  171.  
  172. return TRUE;
  173. }
  174.  
  175. DWORD WINAPI Hook(LPVOID lpAlgs)
  176. {
  177. DWORD dwD3D9 = 0;
  178. while (!dwD3D9) {
  179. Sleep(100);
  180. dwD3D9 = (DWORD)GetModuleHandle("d3d9.dll");
  181. }
  182. DWORD PPPDevice = FindPattern(dwD3D9, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx"); //C7 06 ? ? ? ? 89 86 ? ? ? ? 89 86
  183. memcpy(&VTable, (void *)(PPPDevice + 2), 4);
  184. DWORD dwVTable[5] = { 0 };
  185. CreateDevice(dwVTable);
  186. oReset = (tReset)DetourFunction((PBYTE)dwVTable[0], (PBYTE)&hkReset);
  187. oPresent = (tPresent)DetourFunction((PBYTE)dwVTable[1], (PBYTE)&hkPresent);
  188. oEndScene = (tEndScene)DetourFunction((PBYTE)dwVTable[2], (PBYTE)&hkEndScene);
  189. oDrawIndexedPrimitive = (tDrawIndexedPrimitive)DetourFunction((PBYTE)dwVTable[3], (PBYTE)&hkDrawIndexedPrimitive);
  190. return FALSE;
  191. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement