title: WriteProcessMemory C++
body: <p>Just pasted what was necessary, the memory addresses aren't being written to even though my logging shows that WriteProcessMemory() was successful. Also, I've double checked that i have the correct memory addresses as well. Thank You for help.</p>
  
  <pre><code>char* offsets[][3] = {
      { "0x3E264", "0", "char[1]" },
      { "0x45848", "Auto-Mine", "char[10]" },
      { "0x458C0", "Auto-Build", "char[10]" },
      //to be continued...
  };
  
  HANDLE scHandle = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_OPERATION, FALSE, ID);
  if (scHandle == NULL) {
      log &lt;&lt; "ERROR: OpenProcess() returned " &lt;&lt; GetLastError() &lt;&lt; endl;
      return false;
  }
  DWORD bytesOut;
  for (int a = 0; a &lt; 9; a++) {
      if (WriteProcessMemory(scHandle, (LPVOID)(wDetectorBaseAddress + (int)strtol(offsets[a][0], NULL, 0)), offsets[a][1], strlen(offsets[a][1]) + 1, &amp;bytesOut))
      {
          log &lt;&lt; "WriteProcessMemory() to address " &lt;&lt; wDetectorBaseAddress &lt;&lt; " + " &lt;&lt; (int)strtol(offsets[a][0], NULL, 0) &lt;&lt; " = " &lt;&lt; wDetectorBaseAddress + (int)strtol(offsets[a][0], NULL, 0) &lt;&lt; " with '" &lt;&lt; offsets[a][1] &lt;&lt; "'; " &lt;&lt; bytesOut &lt;&lt; " bytes were written" &lt;&lt; endl;
      }
      else
      {
          log &lt;&lt; "ERROR: WriteProcessMemory() returned " &lt;&lt; GetLastError() &lt;&lt; endl;
          return false;
      }
  }
  CloseHandle(scHandle);
  </code></pre>