uses psapi;
Function GetModuleBase(mName: String):Dword;
var
Mods: array [0..1024] of HMODULE;
ModInfo: TModuleInfo;
cbNeeded, i: Dword;
ModName: array[0..254] of char;
begin
if EnumProcessModules(hProcess, @Mods[0], SizeOf(Mods), cbNeeded) then
begin
for i := 0 to cbNeeded - 1 do
begin
if (Mods[i]<>0)and(GetModuleBaseName(hProcess, Mods[i], @ModName, SizeOf(ModName))>0) then
begin
GetModuleInformation(hProcess, Mods[i], @ModInfo, SizeOf(ModInfo));
if POS(LowerCase(mName),LowerCase(ModName))>0 then
begin
result := Mods[i];
Exit;
end;
end;
end;
end;
result := 0;
end;