Join Date: Jun 2011
Posts: 490
User-Rating:
|
Hey Leute, ich vesuche nun schon seit Stunden den Wert von Sv_cheats in C++ mit WriteProcessMemory auf 1 zu setzen. Mit der Cheat Engine klappt alles ohne Probleme, doch ich bekomms in C++ irgendwie nicht hin. Hier mal der Code : CPP Code: #include "stdafx.h" #include <windows.h> #include <iostream> #include <conio.h> #include <tlhelp32.h> #include <stdlib.h> #include <stdio.h> #include <string> #include <cstdlib> #include <sstream> #include <Windows.h> #pragma comment(lib, "Psapi.lib") using namespace std; int SetSvCheats = 1; int SetDrawModels = 2; int SvCheatsValue; int DrawModelsValue; DWORD GetModuleBaseExtern(const DWORD dwProcessId, const char *szModuleName) { #ifdef _GMBE_CHECK_PARAMS_ if (!dwProcessID) || (!szModuleName) return 0; #endif HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessId); if (!hSnap) return 0; MODULEENTRY32 me; me.dwSize = sizeof(MODULEENTRY32); DWORD dwReturn = 0; if (Module32First(hSnap, &me)) { while (Module32Next(hSnap, &me)) { if (lstrcmpi(me.szModule, szModuleName) == 0) { dwReturn = (DWORD)me.modBaseAddr; break; } } } CloseHandle(hSnap); return dwReturn; } int main(int argc, char *argv[]) { SetConsoleTitle( "Mantas Trigger - Exorbital gut" ); HWND hwnd = NULL; DWORD pid; HANDLE hProcess; DWORD clientbase; DWORD enginebase; cout << " Starte jetzt CS:S du Lappen." << endl; while(hwnd==NULL) { hwnd = FindWindow (NULL, "Counter-Strike Source"); cout << " Es ist ja immer noch nicht an ! " << endl; Sleep(3000); } GetWindowThreadProcessId (hwnd, &pid); hProcess = OpenProcess (PROCESS_ALL_ACCESS, 0, pid); cout << " Isch hab ihn gefunden ;) " << endl; cout << " _____ _____ _ " << endl; cout << " | __|___ _ _ ___ ___ __ | __|_ _ ___| |_ " << endl; cout << " |__ | . | | | _| _| -_| | __| | | _| '_|" << endl; cout << " |_____|___|___|_| |___|___| |__| |___|___|_,_|" << endl; cout << "" << endl; clientbase = GetModuleBaseExtern(pid, "client.dll"); enginebase = GetModuleBaseExtern(pid, "engine.dll"); cout << enginebase << endl; while (true) { if(GetKeyState(VK_F1)) { ReadProcessMemory (hProcess, (LPCVOID)(enginebase + 0x55F170), &SvCheatsValue, sizeof(SvCheatsValue), NULL); ReadProcessMemory (hProcess, (LPCVOID)(clientbase + 0x566A50), &DrawModelsValue, sizeof(DrawModelsValue), NULL); WriteProcessMemory (hProcess, (LPVOID)(SvCheatsValue), &SetSvCheats, sizeof(SetSvCheats), NULL); WriteProcessMemory (hProcess, (LPVOID)(DrawModelsValue), &SetDrawModels, sizeof(SetDrawModels), NULL); } } Sleep(3); }
__________________
|