Вниз
Скачать: 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.013 c
1-58148
chips
2002-07-05 14:14
2002.07.18
stringgrid - свойства


6-58251
kool
2002-05-08 16:39
2002.07.18
как соединяется KaAzA


7-58331
Squire
2002-04-26 11:50
2002.07.18
Как отправить на печать несколько картинок одним заданием


14-58283
lak_b
2002-06-21 14:43
2002.07.18
Slang


3-57965
wHammer
2002-06-24 11:55
2002.07.18
Снова Paradox




   Наверх