When launching a process through winapi calls (CreateProcessAsUserW
for instance), you get a process and thread handle. With this you could get the PID of the process and with that you could do a Process.GetProcessById
call. However, when the process has already terminated in the meantime this call will fail.
Is there a way to get a Process
object by handle instead?
I'm now using GetExitCodeProcess
to at least get some info, but I would rather return a Process
object with the relevant properties set.