private void ResolveNewMscrolibMethods(DebugModule mscorlib) { var assemblyLoadMethods = mscorlib.ResolveAllFunctionName("System.Reflection.Assembly", "Load"); if (assemblyLoadMethods != null) { foreach (var method in assemblyLoadMethods) { var methodParams = method.MetaData.GetParameters(); if (methodParams.Length == 1 && methodParams[0].Name == "rawAssembly") { _loadAssemblyMethod = method; _byteCorType = mscorlib.FindType("System.Byte").GetDebugType(); Logger.WriteLine("Assembly.Load(byte[] rawAssembly) - method address resolved."); } } } else { Logger.WriteLine("Could not find Assembly.Load() method in mscorlib. Something is wrong."); } }
private void UpdateInjectorFunction(DebugModule module) { var function = module.ResolveFunctionName(InjectorSettings.InjectClassName, InjectorSettings.InjectMethodName); if (function != null) { _injectorFunction = function; Logger.WriteLine("Injector function resolved. Waiting for a chance to perform a call..."); } else { Logger.WriteLine("The injecting module '{0}' was loaded, but method {1}.{2}() was not found in it", InjectorSettings.ModuleToInject, InjectorSettings.InjectClassName, InjectorSettings.InjectMethodName); Logger.WriteLine("Did you forget to update injector's configuration?"); } }
private void ResetOldMscrolibMethods() { _assemblyCodeInTargetProcess = null; // TODO: we should delete old code? _injectorFunction = null; _loadAssemblyMethod = null; _byteCorType = null; }