Вниз
Скачать: CL | DM;

DLL   Найти похожие ветки 

 
Alex ©   (2002-07-07 18:56) [0]

Как получить список загруженных DLL?


 
Eugene Lachinov ©   (2002-07-07 22:04) [1]

uses
PSApi, SysUtils, TlHelp32;

procedure GetModuleList(List : TStrings; ProcessID : THandle);
var
i : Integer;
hProcess, hSnapshot : THandle;
hModules : array of DWORD;
ME32 : TModuleEntry32;
cRequest, cModules : DWORD;
szModuleName : array[0..MAX_PATH] of Char;
begin
List.Clear;
if Win32Platform = VER_PLATFORM_WIN32_NT then begin
hProcess := OpenProcess(PROCESS_QUERY_INFORMATION or
PROCESS_VM_READ, False, ProcessID);
if hProcess <> 0 then try
cRequest := 96;
repeat
SetLength(hModules, cRequest div 4);
if EnumProcessModules(hProcess, Pointer(hModules), cRequest, cModules) then
Break;
if cModules < cRequest then Break else cRequest := cRequest shl 1
until False;
cModules := cModules div 4;
for i := 0 to cModules - 1 do
if GetModuleBaseName(hProcess, hModules[i], szModuleName, MAX_PATH) > 0 then
List.Add(szModuleName)
finally
CloseHandle(hProcess)
end
end else begin
hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, ProcessID);
if hSnapshot > 0 then try
ME32.dwSize := SizeOf(ME32);
if Module32First(hSnapshot, ME32) then repeat
List.Add(ME32.szModule);
until not Module32Next(hSnapshot, ME32)
finally
CloseHandle(hSnapshot)
end
end
end;

Пример использования:
GetModuleList(ListBox1.Items, GetCurrentProcessId)

Правда тут будут не только DLL :-)




Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.014 c
1-58115
Gonza
2002-07-07 21:49
2002.07.18
Запуск проги???


1-58162
newUser
2002-07-05 11:49
2002.07.18
Позиция курсора?


3-57972
bobr12
2002-06-26 13:02
2002.07.18
InterBase = ничего не понимаю


3-57932
Ocean
2002-06-21 13:17
2002.07.18
Запущен ли SQL-сервер?


1-58082
Wetnose
2002-07-08 08:15
2002.07.18
Delphi+Java




   Наверх