Esempio n. 1
0
        protected void RunHexTest(string hexFile, string outputFile)
        {
            var svc           = new ServiceContainer();
            var cfg           = new FakeDecompilerConfiguration();
            var eventListener = new FakeDecompilerEventListener();

            svc.AddService <IConfigurationService>(cfg);
            svc.AddService <DecompilerEventListener>(eventListener);
            svc.AddService <IDecompiledFileService>(new FakeDecompiledFileService());
            ILoader ldr       = new Loader(svc);
            var     imgLoader = new DchexLoader(FileUnitTester.MapTestPath(hexFile), svc, null);
            var     program   = imgLoader.Load(null);
            var     project   = new Project {
                Programs = { program }
            };
            var ep             = ImageSymbol.Procedure(program.Architecture, program.ImageMap.BaseAddress);
            var importResolver = new ImportResolver(project, program, eventListener);
            var scan           = new Scanner(program, importResolver, svc);

            scan.EnqueueImageSymbol(ep, true);
            scan.ScanImage();

            var dfa = new DataFlowAnalysis(program, null, eventListener);

            dfa.AnalyzeProgram();
            RunTest(program, outputFile);
        }
Esempio n. 2
0
        protected void RunHexTest(string hexFile, string outputFile)
        {
            var svc = new ServiceContainer();
            var cfg = new FakeDecompilerConfiguration();
            svc.AddService<IConfigurationService>(cfg);
            ILoader ldr = new Loader(svc);
            var imgLoader = new DchexLoader(FileUnitTester.MapTestPath( hexFile), svc, null);
            var img = imgLoader.Load(null);
            var program = new Program(img.Image, img.Image.CreateImageMap(), img.Architecture, img.Platform);
            var project = new Project { Programs = { program } };
            var ep = new EntryPoint(program.Image.BaseAddress, program.Architecture.CreateProcessorState());
            var scan = new Scanner(program, new Dictionary<Address, ProcedureSignature>(), new ImportResolver(project), new FakeDecompilerEventListener());
            scan.EnqueueEntryPoint(ep);
            scan.ScanImage();

            var dfa = new DataFlowAnalysis(program, new FakeDecompilerEventListener());
            dfa.AnalyzeProgram();
            RunTest(program, outputFile);
        }
Esempio n. 3
0
        protected void RunHexTest(string hexFile, string outputFile)
        {
            var svc = new ServiceContainer();
            var cfg = new FakeDecompilerConfiguration();

            svc.AddService <IConfigurationService>(cfg);
            ILoader ldr       = new Loader(svc);
            var     imgLoader = new DchexLoader(FileUnitTester.MapTestPath(hexFile), svc, null);
            var     img       = imgLoader.Load(null);
            var     program   = new Program(img.Image, img.Image.CreateImageMap(), img.Architecture, img.Platform);
            var     project   = new Project {
                Programs = { program }
            };
            var ep   = new EntryPoint(program.Image.BaseAddress, program.Architecture.CreateProcessorState());
            var scan = new Scanner(program, new Dictionary <Address, ProcedureSignature>(), new ImportResolver(project), new FakeDecompilerEventListener());

            scan.EnqueueEntryPoint(ep);
            scan.ScanImage();

            var dfa = new DataFlowAnalysis(program, new FakeDecompilerEventListener());

            dfa.AnalyzeProgram();
            RunTest(program, outputFile);
        }
Esempio n. 4
0
        protected void RunHexTest(string hexFile, string outputFile)
        {
            var svc = new ServiceContainer();
            var cfg = new FakeDecompilerConfiguration();
            var eventListener = new FakeDecompilerEventListener();
            svc.AddService<IConfigurationService>(cfg);
            svc.AddService<DecompilerEventListener>(eventListener);
            svc.AddService<DecompilerHost>(new FakeDecompilerHost());
            ILoader ldr = new Loader(svc);
            var imgLoader = new DchexLoader(FileUnitTester.MapTestPath( hexFile), svc, null);
            var program = imgLoader.Load(null);
            var project = new Project { Programs = { program } };
            var ep = new ImageSymbol(program.ImageMap.BaseAddress);
            var importResolver = new ImportResolver(project, program, eventListener);
            var scan = new Scanner(program, importResolver, svc);
            scan.EnqueueImageSymbol(ep, true);
            scan.ScanImage();

            var dfa = new DataFlowAnalysis(program, null, eventListener);
            dfa.AnalyzeProgram();
            RunTest(program, outputFile);
        }