I found this online if anyone can make a tut to make this code simple or explain it that would be good for this section



Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System****ntime.InteropServices;

namespace Basic_trainer
{
    public partial class Form1 : Form
    {
        Memory pReader =
new Memory();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            Process[] pArray = Process.GetProcessesByName("OPERATION7");
            if (pArray.Length == 0)
            {
                MessageBox.Show("Start the game first dumbass!");
                return;
            }
            pReader.ReadProcess = pArray[0];
            pReader.Open();
        }

        private void button1_Click(object sender, EventArgs e)
          
{
label1.Text = "spread on On";
byte[] EMP = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
int byteswritten;
pReader.Write((IntPtr)0x4D4462, EMP, out byteswritten);
}

        private void button2_Click(object sender, EventArgs e)
        {
            label1.Text = "spread Off";
byte[] EMP = {0x89, 0x9E, 0x30, 0x01, 0x00, 0x00};
int byteswritten;
pReader.Write((IntPtr)0x4D4462, EMP, out byteswritten);
}

        }
        }
   

class MemoryApi
{
// constants information can be found in <winnt.h>
[Flags]
public enum ProcessAccessType
{
PROCESS_TERMINATE = (0x0001),
PROCESS_CREATE_THREAD = (0x0002),
PROCESS_SET_SESSIONID = (0x0004),
PROCESS_VM_OPERATION = (0x0008),
PROCESS_VM_READ = (0x0010),
PROCESS_VM_WRITE = (0x0020),
PROCESS_DUP_HANDLE = (0x0040),
PROCESS_CREATE_PROCESS = (0x0080),
PROCESS_SET_QUOTA = (0x0100),
PROCESS_SET_INFORMATION = (0x0200),
PROCESS_QUERY_INFORMATION = (0x0400)
}

[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, Int32 bInheritHandle, UInt32 dwProcessId);
[DllImport("kernel32.dll")]
public static extern Int32 CloseHandle(IntPtr hObject);
[DllImport("kernel32.dll")]
public static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesRead);
[DllImport("kernel32.dll")]
public static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
}



public class Memory
{
public Memory()
{
}

public Process ReadProcess
{
get
{
return m_ReadProcess;
}
set
{
m_ReadProcess = value;
}
}
private Process m_ReadProcess = null;
private IntPtr m_hProcess = IntPtr.Zero;
public void Open()
{
MemoryApi.ProcessAccessType access;
access = MemoryApi.ProcessAccessType.PROCESS_VM_READ
| MemoryApi.ProcessAccessType.PROCESS_VM_WRITE
| MemoryApi.ProcessAccessType.PROCESS_VM_OPERATION;
m_hProcess = MemoryApi.OpenProcess((uint)access, 1, (uint)m_ReadProces*****);
}
public void CloseHandle()
{
int iRetValue;
iRetValue = MemoryApi.CloseHandle(m_hProcess);
if (iRetValue == 0)
throw new Exception("CloseHandle failed");
}
public byte[] Read(IntPtr MemoryAddress, uint bytesToRead, out int bytesRead)
{
byte[] buffer = new byte[bytesToRead];
IntPtr ptrBytesRead;
MemoryApi.ReadProcessMemory(m_hProcess, MemoryAddress, buffer, bytesToRead, out ptrBytesRead);
bytesRead = ptrBytesRead.ToInt32();
return buffer;
}
public void Write(IntPtr MemoryAddress, byte[] bytesToWrite, out int bytesWritten)
{
IntPtr ptrBytesWritten;
MemoryApi.WriteProcessMemory(m_hProcess, MemoryAddress, bytesToWrite, (uint)bytesToWrite.Length, out ptrBytesWritten);
bytesWritten = ptrBytesWritten.ToInt32();
}
}