System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName("Tutorial-x86_64");
int base = processes[0].MainModule.BaseAddress.ToInt32();
Вы также можете получить EntryPoint
int base_adr = processes[0].MainModule.EntryPointAddress.ToInt32();
int height_offset = 0x0007E1BC; //some address example
int height_adr = (IntPtr)(base_adr + height_offset);
Вот еще одна функция.
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;
try
{
myProcessModuleCollection = myProcess[0].Modules;
}
catch { return IntPtr.Zero; /*Maybe would be ok show the exception after/instead return*/ }
for (int i = 0; i < myProcessModuleCollection.Count; i++)
{
myProcessModule = myProcessModuleCollection[i];
if (myProcessModule.ModuleName.Contains(ModuleName))
{
BaseAddress = myProcessModule.BaseAddress;
break;
}
}
}
return BaseAddress;
}