Skip to content

CodeCave problem,help #139

@alfredoi33i

Description

@alfredoi33i

**I will be very grateful for help.

The function runs, but the trainer closes with an "overflow exception" error**

https://i.ibb.co/7J9KsS1/Screenshot-4.png

`using System;
using System.Net;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MetroSet_UI.Forms;
using Memory;
using System.Threading;
using System.IO;
using System.Runtime.InteropServices;

namespace Dark_Souls_III
{
public partial class Form1 : MetroSetForm
{
Mem mem = new Mem();
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool VirtualFreeEx(
IntPtr hProcess,
UIntPtr lpAddress,
UIntPtr dwSize,
uint dwFreeType
);

    private bool IsProcOpen;
    private int ProcessID;
    public Form1()
    {
        InitializeComponent();
        MyTabs();
    }
    private void MyTabs()
    {
        Menu.SelectedTab = Page1;
    }

    private void exitbut_Click(object sender, EventArgs e)
    {
        DialogResult dr = MetroSetMessageBox.Show(this, "", "CLOSING THE TRAINER", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
        if (dr == DialogResult.Yes)
        {
            Application.ExitThread();
        }
        else
        {

        }
    }

    private void metroSetButton1_Click(object sender, EventArgs e)
    {
        WindowState = FormWindowState.Minimized;
    }

    private void BGworker_DoWork(object sender, DoWorkEventArgs e)
    {
        ProcessID = mem.GetProcIdFromName("DarkSoulsIII");
        if (ProcessID != 0)
        {
            IsProcOpen = mem.OpenProcess(ProcessID);
            Thread.Sleep(100);
            BGworker.ReportProgress(0);
        }
        else
        {
            label47.Invoke(new MethodInvoker(delegate
            {
                label47.Text = "NONE";
                label47.ForeColor = Color.Red;
            }));
            label50.Invoke(new MethodInvoker(delegate
            {
                label50.Text = "NONE";
                label50.ForeColor = Color.Red;
            }));
        }

    }

    private void Form1_Shown(object sender, EventArgs e)
    {
        BGworker.RunWorkerAsync();
    }

    private void BGworker_ProgressChanged(object sender, ProgressChangedEventArgs e)
    {
        if (IsProcOpen)
        {
            label47.Text = "DarkSoulsIII.exe";
            label47.ForeColor = Color.Lime;
            label50.Text = ProcessID.ToString();
            label50.ForeColor = Color.Lime;
            EllipseStatus.NormalColor = Color.Lime;
            EllipseStatus.HoverColor = Color.Lime;
            EllipseStatus.PressColor = Color.Lime;
            Unlimited_Items(metroSetSwitch3);

        }
    }

    private void BGworker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
    {
        BGworker.RunWorkerAsync();
    }

    #region game_function
    
    private void Unlimited_Items(MetroSet_UI.Controls.MetroSetSwitch metroSetSwitch3)
    {
        if (metroSetSwitch3.Switched)
        {
           byte[] freezebytesX = { 0x85, 0xED, 0x0F, 0x89, 0x03, 0x00, 0x00, 0x00, 0x48, 0x31, 0xED, 0x8B, 0xF0, 0x48, 0x8B, 0xCB };
            UIntPtr codecavebase =mem.CreateCodeCave("DarkSoulsIII.exe+0x58A417", freezebytesX, 5, 1000);
            UIntPtr codecaveAllocAddress = UIntPtr.Add(codecavebase, freezebytesX.Length);
            int newint = (int)(codecaveAllocAddress - 5);

        }
        else
        {
            mem.WriteMemory("DarkSoulsIII.exe+0x9DA2BB", "bytes", "48 8D 4C 24 38");

            
        }
    }`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions