OldSchoolHack

Registrieren / Anmelden Deutsch

Brauche bei AntTweakBar Hilfe

icon Thema: [Help] Brauche bei AntTweakBar Hilfe

Anmeldungsdatum: Aug 2015

Beiträge: 2

Hallo OldSchoolHack Community,
bin noch C++ Anfänger und bräuchte Hilfe, um Um Links zu sehen, musst du dich registrieren als Menü für meinen GTA SA Hack zu "implementieren"...

Was ich gefunden habe, hilft mir nicht so, da es auch für ein anderes Spiel ist...
link: Um Links zu sehen, musst du dich registrieren

Ich habe ein Neues Projekt aufgemacht (dll) und diesen Code in D3D9_Test.exe injected, aber es erscheind kein Menü.

TEXT Code:
  1.  
  2. #include <windows.h>
  3. #include "common.h"
  4.  
  5. #define TW_NO_LIB_PRAGMA
  6. #include <AntTweakBar.h>
  7.  
  8. #include <d3d9.h>
  9.  
  10. #pragma comment(lib,"AntTweakBar.lib")
  11. #pragma comment(lib,"d3d9.lib")
  12.  
  13. HMODULE gInstance = NULL;
  14.  
  15. void UserOnInject();
  16.  
  17. BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved)
  18. {
  19. UNREFERENCED_PARAMETER(lpReserved);
  20. if(ulReason == DLL_PROCESS_ATTACH)
  21. {
  22. gInstance = hModule;
  23. DisableThreadLibraryCalls(hModule);
  24. }
  25. return TRUE;
  26. }
  27.  
  28. extern "C" __declspec(dllexport) void OnInject(DWORD address, LPDWORD bytes)
  29. {
  30. DWORD wrote = 0;
  31. WriteProcessMemory(GetCurrentProcess(), UlongToPtr(address), bytes, 6, &wrote);
  32.  
  33. UserOnInject();
  34. }
  35.  
  36. struct tGTASAD3D
  37. {
  38. IDirect3D9 * d3d;
  39. UINT adapter;
  40. D3DDEVTYPE deviceType;
  41. HWND focusWindow;
  42. DWORD behaviourFlags;
  43. D3DPRESENT_PARAMETERS * presentationParameters;
  44. IDirect3DDevice9 ** device;
  45. };
  46.  
  47. struct tGTASAWndProc
  48. {
  49. HWND hWnd;
  50. UINT message;
  51. WPARAM wParam;
  52. LPARAM lParam;
  53. };
  54.  
  55. tGTASAD3D GTASAD3D = {0};
  56. tGTASAWndProc GTASAWndProc = {0};
  57.  
  58. int numSec = 100;
  59. float color[] = { 1, 0, 0 };
  60. unsigned int bgColor = D3DCOLOR_ARGB(255, 40, 255, 200);
  61.  
  62. TwBar * mainBar1 = 0;
  63. TwBar * mainBar2 = 0;
  64.  
  65. bool bIsAntInitialized = false;
  66.  
  67. void UserOnCreateDevice();
  68. void UserOnEndScene();
  69. DWORD UserOnWndProc();
  70.  
  71. void TW_CALL Test1(void * clientData)
  72. {
  73. printf("Test1 called!\n");
  74. }
  75.  
  76. void TW_CALL Test2(void * clientData)
  77. {
  78. printf("Test2 called!\n");
  79. }
  80.  
  81. namespace CC_CreateDevice
  82. {
  83. DWORD codecave_CreateDevice_ReturnAddress = 0;
  84. DWORD codecave_CreateDevice_esp = 0;
  85.  
  86. void StealCreateDeviceParameters()
  87. {
  88. memcpy(&GTASAD3D, UlongToPtr(codecave_CreateDevice_esp), 28);
  89. }
  90.  
  91. void ProcessCreateDeviceParameters()
  92. {
  93. UserOnCreateDevice();
  94. }
  95. __declspec(naked) void codecave_CreateDevice()
  96. {
  97. __asm pop codecave_CreateDevice_ReturnAddress
  98. __asm mov codecave_CreateDevice_esp, esp
  99. __asm pushad
  100.  
  101. StealCreateDeviceParameters();
  102.  
  103. __asm popad
  104. __asm
  105. {
  106. CALL NEAR EAX
  107. MOV ECX,DWORD PTR SS:[EBP]
  108. }
  109.  
  110. __asm pushad
  111.  
  112. ProcessCreateDeviceParameters();
  113.  
  114. __asm popad
  115. __asm push codecave_CreateDevice_ReturnAddress
  116. __asm ret
  117. }
  118. }
  119.  
  120. namespace CC_EndScene
  121. {
  122. DWORD codecave_EndScene_ReturnAddress = 0;
  123.  
  124. void OnEndScene()
  125. {
  126. UserOnEndScene();
  127. }
  128. __declspec(naked) void codecave_EndScene()
  129. {
  130. __asm pop codecave_EndScene_ReturnAddress
  131. __asm pushad
  132.  
  133. OnEndScene();
  134.  
  135. __asm popad
  136. __asm
  137. {
  138. PUSH EAX
  139. CALL NEAR EDX
  140. MOV AL, 0x01
  141. }
  142.  
  143. __asm push codecave_EndScene_ReturnAddress
  144. __asm ret
  145. }
  146. }
  147.  
  148. namespace CC_WndProc
  149. {
  150. DWORD codecave_WndProc_ReturnAddress = 0;
  151. DWORD codecave_WndProc_esp = 0;
  152. DWORD codecave_WndProc_result = 0;
  153.  
  154. void OnWndProc()
  155. {
  156. memcpy(&GTASAWndProc, ((LPBYTE)ULongToPtr(codecave_WndProc_esp)) + 4, 16);
  157. codecave_WndProc_result = UserOnWndProc();
  158. }
  159. __declspec(naked) void codecave_WndProc()
  160. {
  161. __asm pop codecave_WndProc_ReturnAddress
  162. __asm mov codecave_WndProc_esp, esp
  163. __asm pushad
  164.  
  165. OnWndProc();
  166.  
  167. __asm cmp codecave_WndProc_result, 0
  168. __asm jne LABEL_1
  169. __asm popad
  170. __asm xor EAX, EAX
  171. __asm ret 0x10
  172.  
  173. LABEL_1:
  174.  
  175. __asm popad
  176.  
  177. __asm
  178. {
  179. CMP EAX, 0x496
  180. }
  181.  
  182. __asm push codecave_WndProc_ReturnAddress
  183. __asm ret
  184. }
  185. }
  186.  
  187. void UserOnInject()
  188. {
  189. edx::CreateConsole("GTASAFramework");
  190.  
  191. CreateMutexA(0, 0, "GTASA Launcher");
  192. CreateMutexA(0, 0, "Ready");
  193.  
  194. edx::CreateCodeCave(0xA62FE8, 5, CC_CreateDevice::codecave_CreateDevice);
  195. edx::CreateCodeCave(0xA5F05E, 5, CC_EndScene::codecave_EndScene);
  196. edx::CreateCodeCave(0x7324F4, 5, CC_WndProc::codecave_WndProc);
  197. }
  198.  
  199. void UserOnCreateDevice()
  200. {
  201. if(bIsAntInitialized == true)
  202. {
  203. TwTerminate();
  204. bIsAntInitialized = false;
  205. }
  206.  
  207. if(!TwInit(TW_DIRECT3D9, *GTASAD3D.device))
  208. {
  209. MessageBoxA(0, TwGetLastError(), "Cannot initialize AntTweakBar", MB_OK | MB_ICONERROR);
  210. }
  211. else
  212. {
  213. bIsAntInitialized = true;
  214.  
  215. mainBar1 = TwNewBar("GTA SA - Framework Bar 1");
  216. TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar in a DirectX9 application.' ");
  217. TwDefine(" TweakBar color='128 224 160' text=dark ");
  218. TwAddVarRW(mainBar1, "NumSec", TW_TYPE_INT32, &numSec, " label='Strip length' min=1 max=1000 keyIncr=s keyDecr=S help='Number of segments of the strip.' ");
  219. TwAddVarRW(mainBar1, "Color", TW_TYPE_COLOR3F, &color, " label='Strip color' ");
  220. TwAddVarRW(mainBar1, "BgColor", TW_TYPE_COLOR32, &bgColor, " label='Background color' ");
  221. TwAddVarRO(mainBar1, "Width", TW_TYPE_INT32, &GTASAD3D.presentationParameters->BackBufferWidth, " label='wnd width' help='Current graphics window width.' ");
  222. TwAddVarRO(mainBar1, "Height", TW_TYPE_INT32, &GTASAD3D.presentationParameters->BackBufferHeight, " label='wnd height' help='Current graphics window height.' ");
  223.  
  224. mainBar2 = TwNewBar("GTA SA - Framework Bar 2");
  225. TwAddButton(mainBar2, "buttonSnow", Test1, NULL, " label='Snow' ");
  226. TwAddButton(mainBar2, "buttonSun", Test2, NULL, " label='Sun' ");
  227. }
  228. }
  229.  
  230. void UserOnEndScene()
  231. {
  232. if(bIsAntInitialized)
  233. {
  234. TwDraw();
  235. }
  236. }
  237.  
  238. DWORD UserOnWndProc()
  239. {
  240. if(GTASAWndProc.message == WM_SETCURSOR)
  241. {
  242. return 0;
  243. }
  244. if(TwEventWin(GTASAWndProc.hWnd, GTASAWndProc.message, GTASAWndProc.wParam, GTASAWndProc.lParam))
  245. {
  246. return 0;
  247. }
  248. return 1;
  249. }
  250.  

Compilen funktioniert, wenn ich es aber in die D3D9 Test.exe injecte, crasht er sofort...

Wenn einer so Nett ist und mir Helfen könnte, wär ich sehr Dankbar!

Mfg

PS: Sorry für meinen Profilnamen XD