title: c# multi-level pointers, memory reading
body: <p>I found a code that works perfectly for static addresses. </p>
  
  <p>However, how would I change this code so it works for pointers? I need to get value from this pointer:
  <code>0x1002CAA70 + 0x10 + 0x18 + 0x0 + 0x18</code>. </p>
  
  <p>It is for 64 bit application.</p>
  
  <pre><code>public class Program
  {
      private const int PROCESS_WM_READ = 0x0010;
  
      [DllImport("kernel32.dll")]
      public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
  
      [DllImport("kernel32.dll")]
      public static extern bool ReadProcessMemory(int hProcess,
      Int64 lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
  
      static void Main(string[] args)
      {
          Process process      = Process.GetProcessesByName("Tutorial-x86_64")[0];
          IntPtr processHandle = OpenProcess(PROCESS_WM_READ, false, process.Id);
  
          int bytesRead = 0;
          var buffer = new byte[4];
  
          ReadProcessMemory((int)processHandle, 0x0011D598, buffer, buffer.Length, ref bytesRead);
          Console.WriteLine(BitConverter.ToInt32(buffer, 0));
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/B7QjI.png" rel="nofollow noreferrer">image 1</a>
  <a href="https://i.stack.imgur.com/WHBsO.png" rel="nofollow noreferrer">image 2</a></p>