title: C# reading ALL of a process' memory
body: <p>Ello!</p>
  
  <p>Trying to read the memory of a running process, and it does actually work, somewhat. Issue here is I found out that my end address,
  <code>IntPtr endOffset = IntPtr.Add(startOffset, getProcess.MainModule.ModuleMemorySize);</code>, only gives me the amount of memory that is required to load the module.</p>
  
  <p>Thus giving me a lot of unread memory of the process that is allocated later on.
  The code I have written is not really interesting at all, but this is how I get my startaddress and endaddress, where clearly the endaddress is not including all of the later allocated memory.</p>
  
  <pre><code>        Process getProcess = Process.GetProcessesByName("processname")[0];
          IntPtr processHandle = OpenProcess(PROCESS_WM_READ, false, getProcess.Id);
          IntPtr startOffset = getProcess.MainModule.BaseAddress;
          IntPtr endOffset = IntPtr.Add(startOffset, getProcess.MainModule.ModuleMemorySize);
  </code></pre>
  
  <p>My "solution" atm is just to add a high decimal number to the end address, which naturally makes it read a lot of other memory that is not even of the process I want and of course slows the reading down a lot.</p>
  
  <p>So what I need your guys help with is how do I ensure that all of the process' memory is read? I know its most likely sorted out in chunks in the memory but I am not sure how I can pinpoint later start addresses and end addresses at where ever that is located in memory.</p>
  
  <p>Thank you!</p>