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.
Ordinarily for a 64-bit application you can use OpenProcess()
to get a handle to the process with a particular PID and then pass the handle it returns to GetModuleFileNameEx()
to get its executable path. However, OpenProcess()
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 this question 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.)
Is there any way to do this?