@PID and system processes?

May 20, 2008
10,624
81
Syracuse, NY, USA
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
11,926
133
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.
 
May 20, 2008
10,624
81
Syracuse, NY, USA
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.
 
Thread starter Similar threads Forum Replies Date
V Support 2
V Support 10
V Support 12
V Support 10
Steve Pitts Support 2