2

I use the JCL function JclSysInfo.RunningProcessesList to get the list of running processes. However, many of the returned processes consist only of the exe file names, while others contain the whole file path, for example:

dopus.exe
C:\Program Files\Listary\Listary.exe
C:\Program Files (x86)\Direct Folders\df.exe
Everything.exe
etc...

The code:

uses  
  ..., JclSysInfo;

procedure GetRunningProcesses;  
var  
  RunningProcesses: TStringList;  
begin  
  RunningProcesses := TStringList.Create;  
  try  
    if JclSysInfo.RunningProcessesList(RunningProcesses, True) then  
      CodeSite.Send('RunningProcesses', RunningProcesses);  
  finally  
    RunningProcesses.Free;  
  end;  
end;  

So how can I get the list of running processes where all processes have the full file path?

Ken White
  • 123,280
  • 14
  • 225
  • 444
user1580348
  • 5,721
  • 4
  • 43
  • 105
  • 3
    "Everyting" runs elevated. Do the same. – Sertac Akyuz Feb 18 '15 at 22:36
  • @SertacAkyuz Already tried that, same result. Copy the above example into a test program and try it for yourself. – user1580348 Feb 18 '15 at 23:25
  • 4
    I already did in the mean time. I get full path for "everything" when run elevated. Still not all processes have full path though. When compiled for 64bit, there are more with full path. Still not all. It's about access rights. JCL use `GetModuleFileNameEx` if it can open a handle. You may try using `QueryFullProcessImageName` instead when there's a handle. Vista and up. There's not much you can do when you can't open a handle. – Sertac Akyuz Feb 18 '15 at 23:38
  • 1
    `QueryFullProcessImageName()` also requires fewer access rights than `GetModuleFileNameEx()` does. – Remy Lebeau Feb 19 '15 at 01:17

0 Answers0