Thread: help me pls

Results 1 to 6 of 6
  1. #1
    jabz123NN's Avatar
    Join Date
    Jun 2024
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0

    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

  2. #2
    xuanshiqi's Avatar
    Join Date
    May 2024
    Gender
    female
    Posts
    3
    Reputation
    10
    Thanks
    0
    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;
    }

  3. #3
    jabz123NN's Avatar
    Join Date
    Jun 2024
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0

    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;

    // https://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;
    }

  4. #4
    xuanshiqi's Avatar
    Join Date
    May 2024
    Gender
    female
    Posts
    3
    Reputation
    10
    Thanks
    0

    Smile Maybe I can write one for you.

    Which country are you from? Send me your Facebook

  5. #5
    IsoMonster's Avatar
    Join Date
    Jun 2024
    Gender
    male
    Posts
    14
    Reputation
    10
    Thanks
    0
    are you sure it's MAT and not MAT.exe ?

  6. #6
    xuanshiqi's Avatar
    Join Date
    May 2024
    Gender
    female
    Posts
    3
    Reputation
    10
    Thanks
    0

    Smile 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?

Similar Threads

  1. [Help Request] Can SomeOne Help Me Pls ?
    By yousefghaly in forum Visual Basic Programming
    Replies: 3
    Last Post: 09-15-2012, 04:32 PM
  2. [Help Request] Help meh! pls!
    By blazejgd in forum Combat Arms Help
    Replies: 1
    Last Post: 07-30-2012, 09:02 PM
  3. [Help Request] NEED A LITTLE HELP AGAIN ... PLS...
    By wackx26 in forum CrossFire PH Help
    Replies: 5
    Last Post: 06-10-2012, 10:11 AM
  4. [Help Request] Help me pls
    By Cheetos007 in forum Call of Duty Modern Warfare 3 Help
    Replies: 1
    Last Post: 12-15-2011, 10:48 AM
  5. [Help Request] Help Binding pls
    By ~Inujasha in forum Vindictus Help
    Replies: 4
    Last Post: 11-19-2011, 11:05 AM