Eriandus
asked on
List of imported DLLs
Hello,
I'm injecting DLL into application and before I do that, I need to check whether I haven't already done it before. I saw that multiple applications like WinHex, ImpRec etc are able to list imported DLLs of process and output DLL filenames. It would be a perfect solution for me, so how can I get the list of imported DLLs if I know process id?
I would be really thankful for some Delphi source code examples ;)
Thanks in advance
I'm injecting DLL into application and before I do that, I need to check whether I haven't already done it before. I saw that multiple applications like WinHex, ImpRec etc are able to list imported DLLs of process and output DLL filenames. It would be a perfect solution for me, so how can I get the list of imported DLLs if I know process id?
I would be really thankful for some Delphi source code examples ;)
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks :)
this assumes that you have no more than 1024 libraries:
procedure TForm1.Button8Click(Sender : TObject);
var mods: array[0..1023] of DWORD;
need: Cardinal;
cnt: Integer;
file_name: array[0..MAX_PATH] of Char;
begin
FillChar(mods, 1024, 0);
need := 0;
EnumProcessModules(GetCurr entProcess , @mods[0], 1024, need);
for cnt := 0 to need - 1 do begin
GetModuleFileName(mods[cnt ], file_name, MAX_PATH);
Memo1.Lines.Add(file_name) ;
end;
end;
ziolko.
procedure TForm1.Button8Click(Sender
var mods: array[0..1023] of DWORD;
need: Cardinal;
cnt: Integer;
file_name: array[0..MAX_PATH] of Char;
begin
FillChar(mods, 1024, 0);
need := 0;
EnumProcessModules(GetCurr
for cnt := 0 to need - 1 do begin
GetModuleFileName(mods[cnt
Memo1.Lines.Add(file_name)
end;
end;
ziolko.
that was quick:)
ziolko.
ziolko.
ASKER
Open in new window