I'm no delphi wizard but I found this function on a board and I need it badly for C++, Is there somebody who knows Delphi and C++ well enough to convert it?
function GetModuleBase(hProcID: Cardinal; lpModName: PChar):Cardinal;
var
hSnap: Cardinal;
tm: TModuleEntry32;
begin
result := 0;
hSnap := CreateToolHelp32Snapshot(TH32CS_SNAPMODULE, hProcID);
if hSnap <> 0 then
begin
tm.dwSize := sizeof(TModuleEntry32);
if Module32First(hSnap, tm) = true then
begin
while Module32Next(hSnap, tm) = true do
begin
if lstrcmpi(tm.szModule, lpModName) = 0 then
begin
result := Cardinal(tm.modBaseAddr);
break;
end;
end;
end;
CloseHandle(hSnap);
end;
end;