title: How can I get the executable path of a 64-bit process given its PID from a 32-bit process?
body: <p>I'm working on a C++ Windows application that's 32-bit that for reasons outside of my control needs to stay 32-bit. This application needs to be able to get the full path of the executable of other runnings processes given a PID.</p>
  
  <p>Ordinarily for a 64-bit application you can use <code>OpenProcess()</code> to get a handle to the process with a particular PID and then pass the handle it returns to <code>GetModuleFileNameEx()</code> to get its executable path. However, <code>OpenProcess()</code> will fail if you try to get a handle to a 64-bit process from a 32-bit process, so this method isn't available to me. (This is the accepted solution to <a href="https://stackoverflow.com/questions/1933113/c-windows-how-to-get-process-path-from-its-pid">this question</a> but since neither it nor any of its other answers address the problem with accessing 64-bit processes from a 32-bit process it doesn't answer my question.)</p>
  
  <p>Is there any way to do this?</p>