Reputation: 19
I want to get the process id for example of the process "notepad.exe".
I only found threads etc. for how to get process by PID. But I want to get the PID by process name (in this scenario "notepad.exe"). And this with my kernel driver.
Upvotes: -1
Views: 582
Reputation: 162297
There can be more than one process with a process image coming from a file notepad.exe
. You must enumerate all the running processes and retrieve the module name from that. It's described in the MSDN: https://learn.microsoft.com/en-us/windows/desktop/psapi/enumerating-all-processes
From the list of processes you then extract all the processes with a module name notepad.exe
and get the list of matching PIDs.
Upvotes: 1