title: Getting address of variable using baseaddress and offsets
body: <p>I am trying to get the address of a global variable from a target program. I can get the baseaddress of the target program using PsGetProcessSectionBaseAddress.</p>
  
  <p>Target Program Code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  MyType myObject;
  
  int main(){
      ...
  }
  </code></pre>
  
  <p>How do I get the offset of myObject (I can't figure how with offsetof because it requires a type for the variable to be inside of), and once I get the offset can I just add the offset to the baseaddress to get the address of the variable since it's global?</p>