Einzelnen Beitrag anzeigen

mohfa

Registriert seit: 11. Feb 2007
97 Beiträge
 
Delphi 7 Enterprise
 
#2

Re: All running Processes And Loaded Modudles

  Alt 14. Mär 2009, 14:12
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 .
  Mit Zitat antworten Zitat