help me pls

Posts 1–7 of 7 · Page 1 of 1
help me pls
Swed swed = new Swed("MAT");
IntPtr moduleBase = swed.GetModuleBase("Mat.exe"); I see Problums it is System.IndexOutOfRangeException: 'Index was outside the bounds of the array.' how it fix
HMODULE GetModule(DWORD processId, const std::wstring& moduleName) {
HMODULE hModule = NULL;
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, processId);
if (hSnapshot) {
MODULEENTRY32 me;
me.dwSize = sizeof(me);
if (Module32First(hSnapshot, &me)) {
do {
if (me.th32ProcessID == processId && me.szModule == moduleName) {
hModule = me.hModule;
break;
}
} while (Module32Next(hSnapshot, &me));
}
CloseHandle(hSnapshot);
}
return hModule;
}
I encounter a problem that the program cannot find the game named MAT.exe What should
#pragma once


#include <stdio.h>
#include <tchar.h>
#include <Windows.h>
#include <iostream>
#include <TlHelp32.h>
#include <random>

using namespace std;


DWORD dwGetModuleBaseAddress(DWORD dwProcessID, LPCTSTR lpszModuleName)
{
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessID);
DWORD dwModuleBaseAddress = 0;
if (hSnapshot != INVALID_HANDLE_VALUE)
{
MODULEENTRY32 ModuleEntry32 = { 0 };
ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
if (Module32First(hSnapshot, &ModuleEntry32))
{
do
{
if (_tcscmp(ModuleEntry32.szModule, lpszModuleName) == 0)
{
dwModuleBaseAddress = (DWORD_PTR)ModuleEntry32.modBaseAddr;
break;
}
} while (Module32Next(hSnapshot, &ModuleEntry32));
}
CloseHandle(hSnapshot);
}
return dwModuleBaseAddress;
}



DWORD readPointerChain(HANDLE phandle, DWORD base, int* offsets, size_t numOffsets)
{
DWORD addr = base;
SIZE_T read;
for (size_t i = 0; i < numOffsets; i++)
{
BOOL success = ReadProcessMemory(phandle, (void*)addr, &addr, sizeof(addr), &read);
if (!success) { cout << " failed to read " << hex << addr; return 0; }
addr += offsets[i];

}
return addr;
}

int main()
{
HWND hwnd = FindWindow(NULL, _T("MAT"));
if (!hwnd) { printf("Start the game!\n"); cin.get(); return 1; }

DWORD pid;
GetWindowThreadProcessId(hwnd, &pid);
DWORD moduleBase = dwGetModuleBaseAddress(pid, _T("MAT"));

long base = moduleBase + 0x1FD660;

int offsets[] = { 0xC,0x14,0, 0x18 };

HANDLE phandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_VM_WRITE, 0, pid);
if (!phandle) { printf("Failed to open!\n"); cin.get(); return 1; }

DWORD addr = readPointerChain(phandle, base, offsets, sizeof(offsets) / sizeof(*offsets));
if (!addr) { cout << "Failed to follow path" << endl; cin.get(); return 1; }

DWORD val, read;
BOOL success = ReadProcessMemory(phandle, (void*)addr, &val, sizeof(val), &read);
cout << "val at " << hex << addr << " is " << dec << val << endl;

// http://www.cplusplus.com/reference/random/ⓘ
std::default_random_engine generator;
std::uniform_int_distribution<int> distribution(100, 1000);
int dice_roll = distribution(generator);
val = val + dice_roll;
WriteProcessMemory(phandle, (void*)addr, &val, sizeof(val), &read);

success = ReadProcessMemory(phandle, (void*)addr, &val, sizeof(val), &read);
cout << "val at " << hex << addr << " is now " << dec << val << endl;
cin.get();

return 0;
}
Maybe I can write one for you.
Which country are you from? Send me your Facebook
are you sure it's MAT and not MAT.exe ?
There aren't a lot of people in this forum, what's going on?
There aren't a lot of people in this forum, what's going on?
Quote Originally Posted by jabz123NN View Post
Swed swed = new Swed("MAT");
IntPtr moduleBase = swed.GetModuleBase("Mat.exe"); I see Problums it is System.IndexOutOfRangeException: 'Index was outside the bounds of the array.' how it fix
what cheat are ur wanna do ?
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?