How to create a virtual memory adress in C# ?

Beck Cristi 1 Reputation point
2021-10-25T07:44:46.503+00:00
        Hello, how do I create a memory region in C# ?

I mean, I want to build a C# program that create memory regions in an application, but I didn't find anything.

For example, 13FFF0000 13FFE0000 doesn't exist in this game memory, and all bytes have ?? ?? ?? ??, and I want to create those memory regions to patch them with new bytes.

How do I do that?

This is some of my code.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Memory;




namespace xFUT22
{

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        public Mem m = new Mem();
        private void form1_load(object sender, EventArgs e)
        {
            if (!backgroundWorker1.IsBusy)
                backgroundWorker1.RunWorkerAsync();
        }

        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            while (true)
            {

                int pID = m.GetProcIdFromName("FIFA22"); //Gaseste ID-ul jocului
                bool openProc = false; //verifica daca procesul e gasit
                if (pID > 0)
                {
                    openProc = m.OpenProcess(pID); //Porneste procesul, daca exista
                    procID.Invoke((MethodInvoker)delegate
                    {

                        procID.Text = pID.ToString();
                    });
                }



                if (openProc) // De aici incepe modificarea memoriei
                {

                    procID.Invoke((MethodInvoker)delegate
                    {

                        openLabel.Text = "OPEN";
                        openLabel.ForeColor = Color.Green;
                    });

 if (TF.Checked)


                    m.WriteMemory("0x143dd9ff9", "bytes", "41 18 0F 28 C7 48 8D 54 24 60 48 89 44 24 60 E8");

                else

                    m.WriteMemory("0x143dd9ff9", "bytes", "41 18 0F 28 C4 48 8D 54 24 60 48 89 44 24 60 E8");
Developer technologies C#
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.