private void DoRewriteCore() { Project project = LoadProject(); project.Programs.Add(prog); scanner = new Scanner(prog, new Dictionary<Address, ProcedureSignature>(), new ImportResolver(project), new FakeDecompilerEventListener()); EntryPoint ep = new EntryPoint(baseAddress, prog.Architecture.CreateProcessorState()); scanner.EnqueueEntryPoint(ep); var program = project.Programs[0]; foreach (Procedure_v1 sp in program.UserProcedures.Values) { scanner.EnqueueUserProcedure(sp); } scanner.ScanImage(); }
private static void Rewrite(Program program, Assembler asm, string configFile) { var fakeDiagnosticsService = new FakeDiagnosticsService(); var fakeConfigService = new FakeDecompilerConfiguration(); var sc = new ServiceContainer(); sc.AddService(typeof(IDiagnosticsService), fakeDiagnosticsService); sc.AddService(typeof(IConfigurationService), fakeConfigService); sc.AddService<DecompilerEventListener>(new FakeDecompilerEventListener()); sc.AddService<DecompilerHost>(new FakeDecompilerHost()); var loader = new Loader(sc); var project = string.IsNullOrEmpty(configFile) ? new Project() : new ProjectLoader(sc, loader).LoadProject(FileUnitTester.MapTestPath(configFile)); var scan = new Scanner( program, new Dictionary<Address, ProcedureSignature>(), new ImportResolver(project), sc); scan.EnqueueEntryPoint(new EntryPoint(asm.StartAddress, program.Architecture.CreateProcessorState())); foreach (var f in project.Programs) { foreach (var sp in f.User.Procedures.Values) { scan.EnqueueUserProcedure(sp); } } scan.ScanImage(); }
private void DoRewriteCore() { var cfgSvc = MockRepository.GenerateStub<IConfigurationService>(); var env = MockRepository.GenerateStub<OperatingEnvironment>(); var tlSvc = MockRepository.GenerateStub<ITypeLibraryLoaderService>(); var eventListener = new FakeDecompilerEventListener(); cfgSvc.Stub(c => c.GetEnvironment("ms-dos")).Return(env); cfgSvc.Replay(); env.Stub(e => e.TypeLibraries).Return(new List<ITypeLibraryElement>()); env.Stub(e => e.CharacteristicsLibraries).Return(new List<ITypeLibraryElement>()); env.Replay(); tlSvc.Replay(); sc.AddService<DecompilerHost>(new FakeDecompilerHost()); sc.AddService<DecompilerEventListener>(eventListener); sc.AddService<IConfigurationService>(cfgSvc); sc.AddService<ITypeLibraryLoaderService>(tlSvc); Project project = LoadProject(); project.Programs.Add(this.program); scanner = new Scanner( this.program, new ImportResolver(project, this.program, eventListener), sc); ImageSymbol ep = new ImageSymbol(baseAddress); scanner.EnqueueImageSymbol(ep, true); var program = project.Programs[0]; foreach (Procedure_v1 sp in program.User.Procedures.Values) { scanner.EnqueueUserProcedure(sp); } scanner.ScanImage(); }
private void DoRewriteCore() { var cfgSvc = MockRepository.GenerateStub<IConfigurationService>(); var env = MockRepository.GenerateStub<OperatingEnvironment>(); var tlSvc = MockRepository.GenerateStub<ITypeLibraryLoaderService>(); cfgSvc.Stub(c => c.GetEnvironment("ms-dos")).Return(env); cfgSvc.Replay(); env.Stub(e => e.TypeLibraries).Return(new TypeLibraryElementCollection()); env.CharacteristicsLibraries = new TypeLibraryElementCollection(); env.Replay(); tlSvc.Replay(); sc.AddService<DecompilerHost>(new FakeDecompilerHost()); sc.AddService<DecompilerEventListener>(new FakeDecompilerEventListener()); sc.AddService<IConfigurationService>(cfgSvc); sc.AddService<ITypeLibraryLoaderService>(tlSvc); Project project = LoadProject(); project.Programs.Add(this.program); scanner = new Scanner(this.program, new Dictionary<Address, ProcedureSignature>(), new ImportResolver(project), sc); EntryPoint ep = new EntryPoint(baseAddress, this.program.Architecture.CreateProcessorState()); scanner.EnqueueEntryPoint(ep); var program = project.Programs[0]; foreach (Procedure_v1 sp in program.User.Procedures.Values) { scanner.EnqueueUserProcedure(sp); } scanner.ScanImage(); }