Join Date: Aug 2015
Posts: 2
|
Hallo OldSchoolHack Community, bin noch C++ Anfänger und bräuchte Hilfe, um Only registered and activated users can see links. 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: Only registered and activated users can see links.
Ich habe ein Neues Projekt aufgemacht (dll) und diesen Code in D3D9_Test.exe injected, aber es erscheind kein Menü.
TEXT Code: #include <windows.h> #include "common.h" #define TW_NO_LIB_PRAGMA #include <AntTweakBar.h> #include <d3d9.h> #pragma comment(lib,"AntTweakBar.lib") #pragma comment(lib,"d3d9.lib") HMODULE gInstance = NULL; void UserOnInject(); BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved) { UNREFERENCED_PARAMETER(lpReserved); if(ulReason == DLL_PROCESS_ATTACH) { gInstance = hModule; DisableThreadLibraryCalls(hModule); } return TRUE; } extern "C" __declspec(dllexport) void OnInject(DWORD address, LPDWORD bytes) { DWORD wrote = 0; WriteProcessMemory(GetCurrentProcess(), UlongToPtr(address), bytes, 6, &wrote); UserOnInject(); } struct tGTASAD3D { IDirect3D9 * d3d; UINT adapter; D3DDEVTYPE deviceType; HWND focusWindow; DWORD behaviourFlags; D3DPRESENT_PARAMETERS * presentationParameters; IDirect3DDevice9 ** device; }; struct tGTASAWndProc { HWND hWnd; UINT message; WPARAM wParam; LPARAM lParam; }; tGTASAD3D GTASAD3D = {0}; tGTASAWndProc GTASAWndProc = {0}; int numSec = 100; float color[] = { 1, 0, 0 }; unsigned int bgColor = D3DCOLOR_ARGB(255, 40, 255, 200); TwBar * mainBar1 = 0; TwBar * mainBar2 = 0; bool bIsAntInitialized = false; void UserOnCreateDevice(); void UserOnEndScene(); DWORD UserOnWndProc(); void TW_CALL Test1(void * clientData) { printf("Test1 called!\n"); } void TW_CALL Test2(void * clientData) { printf("Test2 called!\n"); } namespace CC_CreateDevice { DWORD codecave_CreateDevice_ReturnAddress = 0; DWORD codecave_CreateDevice_esp = 0; void StealCreateDeviceParameters() { memcpy(>ASAD3D, UlongToPtr(codecave_CreateDevice_esp), 28); } void ProcessCreateDeviceParameters() { UserOnCreateDevice(); } __declspec(naked) void codecave_CreateDevice() { __asm pop codecave_CreateDevice_ReturnAddress __asm mov codecave_CreateDevice_esp, esp __asm pushad StealCreateDeviceParameters(); __asm popad __asm { CALL NEAR EAX MOV ECX,DWORD PTR SS:[EBP] } __asm pushad ProcessCreateDeviceParameters(); __asm popad __asm push codecave_CreateDevice_ReturnAddress __asm ret } } namespace CC_EndScene { DWORD codecave_EndScene_ReturnAddress = 0; void OnEndScene() { UserOnEndScene(); } __declspec(naked) void codecave_EndScene() { __asm pop codecave_EndScene_ReturnAddress __asm pushad OnEndScene(); __asm popad __asm { PUSH EAX CALL NEAR EDX MOV AL, 0x01 } __asm push codecave_EndScene_ReturnAddress __asm ret } } namespace CC_WndProc { DWORD codecave_WndProc_ReturnAddress = 0; DWORD codecave_WndProc_esp = 0; DWORD codecave_WndProc_result = 0; void OnWndProc() { memcpy(>ASAWndProc, ((LPBYTE)ULongToPtr(codecave_WndProc_esp)) + 4, 16); codecave_WndProc_result = UserOnWndProc(); } __declspec(naked) void codecave_WndProc() { __asm pop codecave_WndProc_ReturnAddress __asm mov codecave_WndProc_esp, esp __asm pushad OnWndProc(); __asm cmp codecave_WndProc_result, 0 __asm jne LABEL_1 __asm popad __asm xor EAX, EAX __asm ret 0x10 LABEL_1: __asm popad __asm { CMP EAX, 0x496 } __asm push codecave_WndProc_ReturnAddress __asm ret } } void UserOnInject() { edx::CreateConsole("GTASAFramework"); CreateMutexA(0, 0, "GTASA Launcher"); CreateMutexA(0, 0, "Ready"); edx::CreateCodeCave(0xA62FE8, 5, CC_CreateDevice::codecave_CreateDevice); edx::CreateCodeCave(0xA5F05E, 5, CC_EndScene::codecave_EndScene); edx::CreateCodeCave(0x7324F4, 5, CC_WndProc::codecave_WndProc); } void UserOnCreateDevice() { if(bIsAntInitialized == true) { TwTerminate(); bIsAntInitialized = false; } if(!TwInit(TW_DIRECT3D9, *GTASAD3D.device)) { MessageBoxA(0, TwGetLastError(), "Cannot initialize AntTweakBar", MB_OK | MB_ICONERROR); } else { bIsAntInitialized = true; mainBar1 = TwNewBar("GTA SA - Framework Bar 1"); TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar in a DirectX9 application.' "); TwDefine(" TweakBar color='128 224 160' text=dark "); 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.' "); TwAddVarRW(mainBar1, "Color", TW_TYPE_COLOR3F, &color, " label='Strip color' "); TwAddVarRW(mainBar1, "BgColor", TW_TYPE_COLOR32, &bgColor, " label='Background color' "); TwAddVarRO(mainBar1, "Width", TW_TYPE_INT32, >ASAD3D.presentationParameters->BackBufferWidth, " label='wnd width' help='Current graphics window width.' "); TwAddVarRO(mainBar1, "Height", TW_TYPE_INT32, >ASAD3D.presentationParameters->BackBufferHeight, " label='wnd height' help='Current graphics window height.' "); mainBar2 = TwNewBar("GTA SA - Framework Bar 2"); TwAddButton(mainBar2, "buttonSnow", Test1, NULL, " label='Snow' "); TwAddButton(mainBar2, "buttonSun", Test2, NULL, " label='Sun' "); } } void UserOnEndScene() { if(bIsAntInitialized) { TwDraw(); } } DWORD UserOnWndProc() { if(GTASAWndProc.message == WM_SETCURSOR) { return 0; } if(TwEventWin(GTASAWndProc.hWnd, GTASAWndProc.message, GTASAWndProc.wParam, GTASAWndProc.lParam)) { return 0; } return 1; }
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
|