示例#1
0
        public static bool AskForEntryPoint(out InjectionArguments args)
        {
            args = default;

            var ofd = new OpenFileDialog {
                Filter = PickFilenameConstants.DotNetAssemblyOrModuleFilter,
                Title  = "Select .NET assembly to inject",
            };

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }

            AssemblyDef asm;

            try {
                asm = AssemblyDef.Load(ofd.FileName);
            } catch (BadImageFormatException e) {
                MsgBox.Instance.Show("I couldn't load that binary. Are you sure it is a .NET assembly?\n" +
                                     "Exception message: " + e.Message);
                return(false);
            }

            var vm = new DLLEntryPointSelectionVM {
                Assembly = asm,
            };

            if (!vm.AllItems.Any())
            {
                MsgBox.Instance.Show("Couldn't find any suitable entry points in that assembly.\n" +
                                     "Make sure you have a method with the following signature: static int MethodName(string parameter)");
                return(false);
            }

            if (new DLLEntryPointSelection(vm).ShowDialog() != true)
            {
                return(false);
            }

            args = InjectionArguments.FromMethodDef(vm.SelectedMethod !, vm.Parameter);
            return(true);
        }
 public void Inject(int pid, InjectionArguments args, bool x86, RuntimeType runtimeType)
 => Inject(pid, args.Path, args.Type, args.Method, args.Argument, x86, runtimeType);
 public InjectRecentMenuItem(InjectRecentItems parent, InjectionArguments injectionArguments)
 {
     this.parent             = parent;
     this.injectionArguments = injectionArguments;
 }