Код: Выделить всё
ProcessModuleCollection pc = Process.GetCurrentProcess().Modules;
foreach(ProcessModule pm in pc)
{
Console.WriteLine("The moduleName is " + pm.ModuleName);
Console.WriteLine("The " + pm.ModuleName + "'s base address is: " + pm.BaseAddress);
}
Код: Выделить всё
public class Loader : MarshalByRefObject
{
object CallInternal(string dll, string method, string[] parameters)
{
byte[] buffer = File.ReadAllBytes(dll);
Assembly a = Assembly.Load(buffer);
Type[] types = a.GetTypes();
MethodInfo m = null;
Type myType = null;
foreach (var type in types)
{
m = type.GetMethod(method);
if (m != null)
{
myType = type;
break;
}
}
if (m != null && myType != null)
{
var myInstance = Activator.CreateInstance(myType);
return m.Invoke(myInstance, new object[] { parameters });
}
else
{
return null;
}
}
public static object Call(string dll, string method, params string[] parameters)
{
AppDomain dom = AppDomain.CreateDomain("Temporal");
Loader ld = (Loader)dom.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(Loader).FullName);
object result = ld.CallInternal(dll, typename, method, parameters);
return result;
}
Подробнее здесь: https://stackoverflow.com/questions/665 ... rent-appdo