title: C++ Read Memory Address / Pointer & Offset
body: <p>So, I have injected a DLL into a process (a game) so that I can read from the process memory.</p>
  
  <p>I want to get the current game time, and I've found the static base address &amp; offset of it using Cheat Engine :</p>
  
  <p>"game.exe"+0158069C</p>
  
  <p>Offset : 14</p>
  
  <p>And this is the code I've tried to get the float value (current game timer) :</p>
  
  <pre><code>//Offsets
  #define BASETIME 0x158069C
  #define OFFSET 0x14
  
  void CurrentTime() {
  
      float *time;
      DWORD *BaseAddress = (DWORD*)GetModuleHandle(NULL);
      DWORD *BaseTimeAddress = (DWORD*)(BaseAddress + BASETIME);
      time = (float*)(BaseTimeAddress + OFFSET);
  
      if (BaseTimeAddress &amp;&amp; time) //Check the addresses, not values.
      {
          std::cout &lt;&lt; "Base Address : " &lt;&lt; BaseAddress &lt;&lt; endl; // Correct
          std::cout &lt;&lt; "Base Time Address &amp;: " &lt;&lt; &amp;BaseTimeAddress &lt;&lt; endl; // Not correct
          std::cout &lt;&lt; "Base Time Address : " &lt;&lt; BaseTimeAddress &lt;&lt; endl; // Not correct
          std::cout &lt;&lt; "Time Value : " &lt;&lt; *time &lt;&lt; endl; // Not correct
      }
  }
  </code></pre>
  
  <p>The cout of the Base Address is correct (I can check it with Cheat Engine), but after that everything is wrong, can you help me ? I'm stuck with this and I've tried many things ... :/</p>
  
  <p>Thank you in advance,</p>