@PID and system processes?

#1
Why doesn't @PID work with a system process? TASKLIST can pair up PIDs and process names for system processes.

Code:
v:\> echo %@pid[serv-u.exe.exe]
0

v:\> echo %@word[0,%@execstr[tasklist | ffind /k /m /t"serv-u"]]
1804
 

rconn

Administrator
Staff member
May 14, 2008
10,755
97
#2
Because Microsoft doesn't want you to do that if you're not running an elevated session. (Works fine elevated.)

Specifically, the reason it doesn't work is because GetModuleFileNameEx() fails on system processes if you're not elevated. @PID needs to call GetModuleFileNameEx() so it can compare pathnames, not just a shortname.
 
#3
I see. I never knew @PID used paths. It makes sense that windows won't give you WM_READ for a system process.

It's funny, though, that ProcessExplorer, which doesn't require elevation, will show you the fully-qualified name in a balloon if you hover on an exe name or if you look at the properties of such a process. I wonder how it's done.