title: C++ WriteProcessMemory() - how to get the right lpBaseAddress?
body: <p>I'm making an unofficial patch for a multiplayer game. The game supports only 6 screen resolutions by default, but I found a way to replace them by editing the EXE file with HEX editor. My C++ launcher will start one of 4 .EXE files (one with 16x9, second with 4x3, third with 16:10, etc.). Unfortunately the game generates a checksum and it doesn't allow players to join each other if they use different .EXE files. So I have to replace the generated checksum in RAM. I successfully wiresharked and found what I have to change, for example it's HEX: <code>dabfe599</code>.</p>
  
  <p>I use this code:</p>
  
  <pre><code>HWND hWnd;
  DWORD dwID;
  HANDLE hProcess;
  hWnd = FindWindow(NULL, "GameName");
  GetWindowThreadProcessId(hWnd, &amp;dwID);
  hProcess = OpenProcess(PROCESS_ALL_ACCESS, NULL, dwID);
  int value = 0000;
  WriteProcessMemory(hProcess, (LPVOID)0x0517A69A,
      (LPVOID)&amp;value, sizeof(&amp;value), NULL);
  WriteProcessMemory(hProcess, (LPVOID)0x0584B078,
      (LPVOID)&amp;value, sizeof(&amp;value), NULL);
  </code></pre>
  
  <p>And it works. Unfortunately: (LPVOID)0x0517A69A and (LPVOID)0x0584B078 are different every time I start the game. So I want to get the LPVOID by searching for the specified HEX (dabfe599) in hProcess. Does anybody know how can I do this?</p>