Quantcast
Channel: VBForums - API
Viewing all articles
Browse latest Browse all 168

How do I convert ProcID into the name of the EXE file associated with that process?

$
0
0
I have enumed the processIDs using EnumProcesses. I now want to find the name of the EXE file associated with each processID. How do I do this? I was thinking of GetProcessImageFileName at first, but that doesn't allow a processID as input. It expects an hProcess (handle to a process) as input. Yes I could use OpenProcess to convert the processID into an hProcess, but that seems like an extra unnecessary step. I would think that in the vast collection of Windows API functions available, there'd be one I could use to get the EXE file name, with the only input being the processID, as this would seem like a fairly common thing that one would want to do (find the name of the EXE file associated with a processID). But I can't find such an API function. Is there one that I'm just overlooking? Or do I really need to waste those extra lines of code with the OpenProcess and CloseHandle functions, just to get the name of the EXE file?

Viewing all articles
Browse latest Browse all 168

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>