Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi All running Processes And Loaded Modudles (https://www.delphipraxis.net/130820-all-running-processes-loaded-modudles.html)

mohfa 13. Mär 2009 17:56


All running Processes And Loaded Modudles
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hi , i want to Enumerate All running Processes and All Loaded Modules( All loaded modules not when i select a Process ID but all Loaded Modules in Memory )


Please see the Attachment


many thanks

mohfa 14. Mär 2009 14:12

Re: All running Processes And Loaded Modudles
 
Hi i did it with this Code :

Delphi-Quellcode:

procedure TForm1.GetProcessListr(var sl: TStrings);
var
  ProcHandle: THandle;
  mh: hmodule;
  procs: array[0..$FFF] of dword;
  count, cm: Cardinal;
  i: integer;
  ModName: array[0..max_path] of char; //??? ??????
begin
  sl.Clear;
  begin
    if not EnumProcesses(@procs, sizeof(procs), count) then
    begin
      exit;
    end;
    for i := 0 to count div 4 - 1 do
    begin
      ProcHandle := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ,
        false, procs[i]);
      if ProcHandle > 0 then
      begin
        EnumProcessModules(ProcHandle, @mh, 4, cm);
        GetModuleFileNameEx(ProcHandle, mh, ModName, sizeof(ModName));
        sl.Add(string(ModName));
        CloseHandle(ProcHandle);
      end;
    end;
  end;
end;


procedure TForm1.Button5Click(Sender: TObject);
var
  tmp: TStrings;
begin
  tmp :=listbox1.Items ;
  GetProcessListr(tmp);
end;
So the Result is :
?
\SystemRoot\System32\smss.exe
\??\C:\WINDOWS\system32\csrss.exe
\??\C:\WINDOWS\system32\winlogon.exe
.
.
.

So how to handle the System Processes Paths i mean how to get the Full path to smss.exe


many thanks Again .


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:10 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz