All pastes #896525 Raw Edit

CroZBr

public text v1 · immutable
·published 2008-02-08 19:08 UTC
rendered paste body
Function FindModule(Module: string):TProcess;
var ML,PL: Integer;
    Proc: TProcess;
    Mods: TModules;
begin
  try
    Proc := ListProcess;
    for PL := low(proc) to high(proc) do
    if (Proc[PL].szExeFile <> 'System') and (Proc[PL].szExeFile <> '[System Process]') then begin
     Mods := ListModules(Proc[PL].th32ProcessID);
      for ML := low(MODS) to high(MODS) do
       if pos(Module, lowercase(MODS[ML].szModule))>0 then begin
        Setlength(result, length(result)+1);
        result[high(result)] := PROC[PL];
        break;
      end;
    end;
  Except
   Exit;
  end;
end;