title: C# Pointers to other application's memory
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4986047/how-to-access-structure-in-other-programs-memory">How to access structure in other program&#39;s memory?</a>  </p>
  </blockquote>
  
  
  
  <p>Hello.
  I want to access another application memory.
  I'm writing game hack (Don't worry, it's only for single-player mode).
  I have found pointer to player structure in game's memory.</p>
  
  <p>I don't want to use pInvoked ReadProcessMemory because I want to be able to read individual structure's field. I know address in game's memory where is array of player structs.</p>
  
  <p>Using pInvoked ReadProcessMemory is not very practical in this case.</p>
  
  <p>How can I use C#'s unsafe pointers to map other processes memory as struct?
  Or if it's not possibe to use direct pointers, what would be the way of using readPrcessMemory?</p>
  
  <p>I want in the end to be able to so sth like that.</p>
  
  <p>player is some kind of class representing struct in memory.
  Players is some kind Collection of players.</p>
  
  <pre><code>foreach(player guy in Players)
  { 
      DrawESP(guy.X, guy.Y, guy.Z);
  }
  </code></pre>