title: How do I give RPM/WPM permissions to a Handle without OPENPROCESS?
body: <p>I want to Read and Write Process memory. With this program I have to type in the PID every time. I want this to be automated so I used FindWindow to get the window of "Dummy" and return a handle. But that handle doesn't have RPM/WPM permissions. Any ideas what to do?</p>
  
  <pre><code>DWORD PID = 0;
  int Read = 0;
  uintptr_t pRead;
  bool flag;
  cout &lt;&lt; "Enter PID of Process: " &lt;&lt; endl;
  cin &gt;&gt; PID;
  cout &lt;&lt; "Enter Address to Read " &lt;&lt; endl;
  cin &gt;&gt; hex &gt;&gt; pRead;
  
  HANDLE fProcess = FindWindow(NULL, "Dummy");
  
  HANDLE hProcess = OpenProcess(PROCESS_VM_READ, false, PID);
  if (hProcess == NULL)
  {
      cout &lt;&lt; "Something went wrong. Getting last Error." &lt;&lt; GetLastError() &lt;&lt; endl;
      system("PAUSE");
      CloseHandle(hProcess);
      return (EXIT_FAILURE);
  }
  
  flag = ReadProcessMemory(fProcess, (LPCVOID)pRead, &amp;Read, sizeof(Read), NULL);
  </code></pre>