unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, psapi;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
const
l = 512;
var
PIDArray: array[0..1023] of DWORD;
cb: DWORD;
I: integer;
ProcCount: integer;
hMod: HMODULE;
hProcess, h: THandle;
ModuleName: array[0..300] of char;
szName: array[0..l] of char;
begin
EnumProcesses(@PIDArray, sizeof(PIDArray), cb);
ProcCount := cb div sizeof(DWORD);
for I := 0 to ProcCount - 1 do
begin
hProcess := OpenProcess(PROCESS_QUERY_INFORMATION or
PROCESS_VM_READ,
false,
PIDArray[I]);
if (hProcess <> 0) then
begin
EnumProcessModules(hProcess, @hMod, sizeof(hMod), cb);
GetModuleFilenameEx(hProcess, hMod, ModuleName, sizeof(ModuleName));
memo1.lines.Add(ModuleName);
CloseHandle(hProcess);
end;
end;
end;
end.