title: Error read addres with function ReadProcessMemory c#
body: <p>I have an error with reading the memory address of the game, where:
  my code is this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>public partial class MainWindow: Window
      {
          [DllImport ("kernel32.dll")]
          public static extern IntPtr OpenProcess (int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
  
          [DllImport ("kernel32.dll")]
          public static extern bool ReadProcessMemory (int hProcess, int lpBaseAddress, byte [] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
          const int PROCESS_WM_READ = 0x0010;
  
          public MainWindow ()
          {
              arguments dir = new arguments ();
              Process process = Process.GetProcessesByName (dir.proccessname) [0];
              IntPtr processHandle = OpenProcess (PROCESS_WM_READ, false, process.Id);
              int bytesRead = 0;
              byte [] buffer = new byte [4]; 
              ReadProcessMemory ((int) processHandle, dir.heal_Act, buffer, buffer.Length, ref bytesRead);
          }</code></pre>
  </div>
  </div>
  </p>
  
  <p>however, nothing reading appears:
  in cheat engine read me the values</p>
  
  <p><a href="https://i.stack.imgur.com/addfv.png" rel="nofollow noreferrer">Read address with Cheat Engine</a>
  Where in the image appears the reading of the memory address and finally the value contained with 4 bytes in size
  <a href="https://i.stack.imgur.com/EDcXT.png" rel="nofollow noreferrer">Read address with Cheat Engine</a>
  In addition, I do not know how the summation of the address is as shown in box 2 to obtain the contained value.
  they could help me to propose the reading with the indicated address, since zero appears.</p>