I?m trying to get the base adress of "engine.dll ", but for some reason my Method is unable to find the right dll, I always find dlls like "wow64.dll",wow64cpu.dll","ntdll.dll" and so on.
Would be nice if anyone would take a look at my Method and tell me if I?m doing something wrong.
*****Method
private static IntPtr GetModuleBaseAddress(string AppName, string ModuleName)
{
IntPtr BaseAddress = IntPtr.Zero;
Process[] myProcess = null;
ProcessModule myProcessModule = null;
myProcess = Process.GetProcessesByName(AppName);
if (myProcess.Length > 0)
{
ProcessModuleCollection myProcessModuleCollection = myProcess[0].Modules;
for (int i = 0; i < myProcessModuleCollection.Count; i++)
{
myProcessModule = myProcessModuleCollection[i];
if (myProcessModule.ModuleName.Contains(ModuleName))
{
BaseAddress = myProcessModule.BaseAddress;
break;
}
}
}
****Method end
Comment