This is my Form1 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 System.Diagnostics;
namespace ReadMemory
{
public partial class Form1 : Form
{
List<int> memoryAddresses = new List<int>();
public Form1()
{
InitializeComponent();
Process proc = Process.GetCurrentProcess();
IntPtr startOffset = proc.MainModule.BaseAddress;
IntPtr endOffset = IntPtr.Add(startOffset, proc.MainModule.ModuleMemorySize);
for (int i = 0; i < startOffset.ToInt64(); i++)
{
memoryAddresses.Add(startOffset[i]
}
}
private void modelsToolStripMenuItem_Click(object sender, EventArgs e)
{
}
}
}
I tried to scan all memory addresses from the start to the end and add them to a List. But i'm getting an error on the line:
memoryAddresses.Add(startOffset[i]
Error 3 Cannot apply indexing with [] to an expression of type 'System.IntPtr'
Second thing is doing in the loop: startOffset.ToInt64() is ok ? Or i should do ToInt32() ?