Y por si tienes el C oxidado
Código Delphi
[-]
uses PsApi;
procedure EnumModules(List: TStringList);
var
hMods: array[0..1024] of HMODULE;
hProcess: THandle;
Needed: DWORD;
i: Integer;
ModName: Array[0..MAX_PATH] of Char;
begin
List.Clear;
hProcess:= OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ,
FALSE, GetCurrentProcessId);
if hProcess <> 0 then
begin
if EnumProcessModules(hProcess, @hMods, Sizeof(hMods), Needed) then
for i:= 0 to (Needed div Sizeof(HMODULE)) - 1 do
begin
FillChar(ModName,Sizeof(ModName),#0);
if GetModuleFileNameEx(hProcess, hMods[i], ModName, Sizeof(ModName) - 1) <> 0 then
List.Add(String(PChar(@ModName)));
end;
CloseHandle(hProcess);
end;
end;
Por ejemplo:
Código Delphi
[-]
var
Lista: TStringList;
begin
Lista:= TStringList.Create;
try
EnumModules(Lista);
ShowMessage(Lista.Text);
finally
Lista.Free;
end;
end;