title: WriteProcessMemory with multiple Offsets C++
body: <p>I have struggled with a very annoying problem lately with writing to Process memory in c++... I can not write to process memory with multiple offsets! Even though there are thousands of pages explaining how you fix this problem, it still seems to not work for me. I have been searching around on google all day long, and found many examples of how to fix this problem, but it still seems to not work for me.</p>
  
  <p>So, let me first explain how I am writing to process memory myself, and you could possibly correct it afterwards.</p>
  
  <p>Let us say I have a base address of: 0x04AF3C94</p>
  
  <p>First offsets as: 0x1C</p>
  
  <p>Second offsets as: 0x20</p>
  
  <p>Third as: 0x568</p>
  
  <p>And fourth as: 0x134</p>
  
  <p>How I am doing this myself:</p>
  
  <pre><code>DWORD offset1 = 0x1C;
  DWORD offset2 = 0x20;
  DWORD offset3 = 0x568;
  DWORD offset4 = 0x134;
  
  DWORD base = 0x04AF3C94;
  DWORD pointer;
  DWORD pointer2;
  DWORD pointer3;
  DWORD pointer4;
  DWORD pointer5;
  ReadProcessMemory(handle, LPVOID(base), &amp;pointer, sizeof(pointer), 0);
  ReadProcessMemory(handle, LPVOID(pointer + offset1), &amp;pointer2, sizeof(pointer2), 0);
  ReadProcessMemory(handle, LPVOID(pointer2 + offset2), &amp;pointer3, sizeof(pointer3), 0);
  ReadProcessMemory(handle, LPVOID(pointer3 + offset3), &amp;pointer4, sizeof(pointer4), 0);
  ReadProcessMemory(handle, LPVOID(pointer4 + offset4), &amp;pointer5, sizeof(pointer4), 0);
  
  int value = 500;
  WriteProcessMemory(handle, LPVOID(pointer5), &amp;value, sizeof(value), 0);
  </code></pre>
  
  <p>As you can see, if I have 4 offsets such as in this example, I am adding every  offset one at a time to the base address, until I got one value that stores every offset added to the baseaddress.
  This apparently don't work, what should I do!?</p>