@PID and system processes?

May 20, 2008
11,400
99
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
12,345
150
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
11,400
99
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.
 
Similar threads
Thread starter Title Forum Replies Date
vefatica @PID, ISAPP - don't see system processes Support 12
vefatica Help for @PID Support 2
vefatica Something wrong with @PID Support 10
vefatica New desktop, need Explorer PID Support 1
vefatica _STARPID & @PID[] after START /ELEVATED Support 10
Steve Pitts @PID weirdness Support 2
dcantor Missing help for @PIDCOMMAND[pid] Support 6
C old .vs. new system Support 0
Jay Sage Insufficient System Resources Support 1
dcantor How to? Can 32-bit TCC be run on a system with 64-bit TCMD and TCC installed? Support 6
M Problems with @REGBREAD on remote system Support 4
C "Failed to update the system registry. Please try using REGEDIT" Support 3
vefatica File system update after DEL? Support 4
Patulus TCHistoryLog: TCC: (Sys) The system cannot find the path specified Support 15
J Documentation New help system: "skip word list" Support 11
vefatica New help system Support 14
H Fixed ... MSVCR120.dll is missing from your system ... Support 2
Daniel P How to Purchase a Multi-System License for TCC? Support 2
Emilio III 1 System license (literally?) Support 3
Steve Pitts Insufficient system resources exist to complete the requested service Support 1
A How to? Can't change directory ("cd") into system hidden files Support 13
R WAD issue with filename completion with system and hidden files Support 8
D Individual vs multi-system licenses Support 1
S Your system (homepage) blocks my IP! Support 4
M And oddity re the 32-bit TCC on a 64-bit system... Support 4
Phileosophos How to? The help system redirects to the index page Support 4
C How to determine if system is 32 or 64 bit? Support 5
L File association: System cannot find the associated program Support 30
gschizas View uses Windows-1252 codepage instead of System codepage Support 4
O CALL SYSTEM from Fortran Support 4
daniel347x How to get Take Command to read in all current system environment variables that CMD.EXE sees? Support 13
R Delete command sets directory attributes to hidden & system Support 46
S Need help to execute TCC commands on another system Support 6
fpefpe Registry as file system Support 20
D System Error: A required privilege is not held by the client. Support 4
J 4NT Error when running 'system' from a program to execute a .BTM Support 3
Joe Caverly Create Windows Jobs and optionally attach processes to a job Support 17
L Peculiarities of how START launches processes Support 15
cgunhouse Increase in I/O on Hidden TCC Processes Support 11
cgunhouse Orphaned conhost.exe processes Support 8

Similar threads