Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

@PID and system processes?

May
13,026
174
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
 
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.
 
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.
 

Similar threads

Back
Top