当前位置: 首页>>代码示例>>C#>>正文


C# LoadedImage.CreateImageMap方法代码示例

本文整理汇总了C#中Reko.Core.LoadedImage.CreateImageMap方法的典型用法代码示例。如果您正苦于以下问题:C# LoadedImage.CreateImageMap方法的具体用法?C# LoadedImage.CreateImageMap怎么用?C# LoadedImage.CreateImageMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reko.Core.LoadedImage的用法示例。


在下文中一共展示了LoadedImage.CreateImageMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

		public void Setup()
		{
            var image = new LoadedImage(Address.Ptr32(0x00100000), new byte[1024]);
            var arch = new FakeArchitecture();
            var program = new Program
            {
                Image = image,
                Architecture = arch,
                ImageMap = image.CreateImageMap(),
                Platform = new DefaultPlatform(null, arch),
            };
            store = program.TypeStore;
            factory = program.TypeFactory;
            globals = program.Globals;
			store.EnsureExpressionTypeVariable(factory, globals);

			StructureType s = new StructureType(null, 0);
			s.Fields.Add(0x00100000, PrimitiveType.Word32, null);

			TypeVariable tvGlobals = store.EnsureExpressionTypeVariable(factory, globals);
			EquivalenceClass eqGlobals = new EquivalenceClass(tvGlobals);
			eqGlobals.DataType = s;
			globals.TypeVariable.DataType = new Pointer(eqGlobals, 4);
			globals.DataType = globals.TypeVariable.DataType;

            tcr = new TypedConstantRewriter(program);
		}
开发者ID:gh0std4ncer,项目名称:reko,代码行数:27,代码来源:TypedConstantRewriterTests.cs

示例2: Load

        public override Program Load(Address addrLoad)
        {
            BinHexDecoder dec = new BinHexDecoder(new StringReader(Encoding.ASCII.GetString(RawImage)));
            IEnumerator<byte> stm = dec.GetBytes().GetEnumerator();
            BinHexHeader hdr = LoadBinHexHeader(stm);
            byte[] dataFork = LoadFork(hdr.DataForkLength, stm);
            byte[] rsrcFork = LoadFork(hdr.ResourceForkLength, stm);

            var arch = new M68kArchitecture();
            var platform = new MacOSClassic(Services, arch);
            if (hdr.FileType == "PACT")
            {
                Cpt.CompactProArchive archive = new Cpt.CompactProArchive();
                List<ArchiveDirectoryEntry> items = archive.Load(new MemoryStream(dataFork));
                IArchiveBrowserService abSvc = Services.GetService<IArchiveBrowserService>();
                if (abSvc != null)
                {
                    var selectedFile = abSvc.UserSelectFileFromArchive(items);
                    if (selectedFile != null)
                    {
                        var image = selectedFile.GetBytes();
                        this.rsrcFork = new ResourceFork(image, arch);
                        this.image = new LoadedImage(addrLoad, image);
                        this.imageMap = new ImageMap(addrLoad, image.Length);
                        return new Program(this.image, this.imageMap, arch, platform);
                    }
                }
            }

            var li = new LoadedImage(addrLoad, dataFork);
            return new Program(li, li.CreateImageMap(), arch, platform);
        }
开发者ID:melbcat,项目名称:reko,代码行数:32,代码来源:BinHexImageLoader.cs

示例3: Setup

		public void Setup()
		{
            mr = new MockRepository();
            form = new MainForm();
            sc = new ServiceContainer();
            loader = mr.StrictMock<ILoader>();
            dec = mr.StrictMock<IDecompiler>();
            sc = new ServiceContainer();
            uiSvc = new FakeShellUiService();
            host = mr.StrictMock<DecompilerHost>();
            memSvc = mr.StrictMock<ILowLevelViewService>();
            var image = new LoadedImage(Address.Ptr32(0x10000), new byte[1000]);
            var imageMap = image.CreateImageMap();
            var arch = mr.StrictMock<IProcessorArchitecture>();
            arch.Stub(a => a.CreateRegisterBitset()).Return(new BitSet(32));
            arch.Replay();
            var platform = mr.StrictMock<Platform>(null, arch);
            arch.BackToRecord();
            program = new Program(image, imageMap, arch, platform);
            project = new Project { Programs = { program } };

            browserSvc = mr.StrictMock<IProjectBrowserService>();

            sc.AddService<IDecompilerUIService>(uiSvc);
            sc.AddService(typeof(IDecompilerShellUiService), uiSvc);
            sc.AddService(typeof(IDecompilerService), new DecompilerService());
            sc.AddService(typeof(IWorkerDialogService), new FakeWorkerDialogService());
            sc.AddService(typeof(DecompilerEventListener), new FakeDecompilerEventListener());
            sc.AddService(typeof(IProjectBrowserService), browserSvc);
            sc.AddService(typeof(ILowLevelViewService), memSvc);
            sc.AddService<ILoader>(loader);

            i = new TestInitialPageInteractor(sc, dec);

		}
开发者ID:gh0std4ncer,项目名称:reko,代码行数:35,代码来源:InitialPageInteractorTests.cs

示例4: HSC_x86_FindCallsToProcedure

        public void HSC_x86_FindCallsToProcedure()
        {
#if OLD
            var image = new LoadedImage(Address.Ptr32(0x001000), new byte[] {
                0xE8, 0x0B, 0x00, 0x00,  0x00, 0xE8, 0x07, 0x00,
                0x00, 0x00, 0xC3, 0x00,  0x00, 0x00, 0x00, 0x00,
                0xC3, 0xC3                                      // 1010, 1011
            });
            prog = new Program
            {
                Image = image,
                ImageMap = image.CreateImageMap(),
                Architecture = new IntelArchitecture(ProcessorMode.Protected32),
            };
#else
            Given_Image32(0x001000, 
                "E8 0B 00 00 00 E8 07 00 " +
                "00 00 C3 00 00 00 00 00 " +
                "C3 C3 ");                                     // 1010, 1011
            Given_x86_32();
#endif
            Given_RewriterHost();
            mr.ReplayAll();

            Assert.AreEqual(18, prog.Image.Length);

            var hsc = new HeuristicScanner(prog, host, eventListener);
            var linAddrs = hsc.FindCallOpcodes(new Address[]{
                Address.Ptr32(0x1010),
                Address.Ptr32(0x1011)}).ToList();

            Assert.AreEqual(2, linAddrs.Count);
            Assert.IsTrue(linAddrs.Contains(Address.Ptr32(0x1000)));
            Assert.IsTrue(linAddrs.Contains(Address.Ptr32(0x1005)));
        }
开发者ID:gitter-badger,项目名称:reko,代码行数:35,代码来源:HeuristicScannerTests.cs

示例5: DecSvc_DecompilerProjectName

        public void DecSvc_DecompilerProjectName()
        {
            IDecompilerService svc = new DecompilerService();
            var loader = mr.StrictMock<ILoader>();
            var host = mr.StrictMock<DecompilerHost>();
            var arch = mr.StrictMock<IProcessorArchitecture>();
            var platform = mr.StrictMock<Platform>(sc, arch);
            var fileName = "foo\\bar\\baz.exe";
            var bytes = new byte[100];
            var image = new LoadedImage(Address.Ptr32(0x1000), bytes);
            var imageMap = image.CreateImageMap();
            var prog = new Program(image, imageMap, arch, platform);
            loader.Stub(l => l.LoadImageBytes(fileName, 0)).Return(bytes);
            loader.Stub(l => l.LoadExecutable(fileName, bytes, null)).Return(prog);
            loader.Replay();
            var dec = new DecompilerDriver(loader, host, sc);
            mr.ReplayAll();

            svc.Decompiler = dec;
            svc.Decompiler.Load(fileName);

            Assert.IsNotNull(svc.Decompiler.Project);
            Assert.AreEqual("baz.exe",  svc.ProjectName, "Should have project name available.");
            mr.VerifyAll();
        }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:25,代码来源:DecompilerServiceTests.cs

示例6: ProgramBuilder

 public ProgramBuilder(LoadedImage loadedImage)
 {
     Program = new Program
     {
         Image = loadedImage,
         ImageMap = loadedImage.CreateImageMap(),
         Architecture = new FakeArchitecture()
     };
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:9,代码来源:ProgramBuilder.cs

示例7: btnLoad_Click

 private void btnLoad_Click(object sender, EventArgs e)
 {
     var image = new LoadedImage(Address.Ptr32(0x12312300),new byte[0x1000]);
     var imageMap = image.CreateImageMap();
     var arch = new Reko.Arch.X86.X86ArchitectureFlat32();
     var program = new Core.Program(image, imageMap, arch, new DefaultPlatform(null, arch));
     var project = new Project { Programs = { program } };
     pbs.Load(project);
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:9,代码来源:ProjectBrowserDialog.cs

示例8: Setup

 public void Setup()
 {
     mr = new MockRepository();
     sc = new ServiceContainer();
     var image = new LoadedImage(Address.SegPtr(0xC00, 0), Enumerable.Range(0x0, 0x100).Select(b => (byte)b).ToArray());
     var imageMap = image.CreateImageMap();
     var arch = new Mocks.FakeArchitecture();
     this.program = new Program(image, imageMap, arch, new DefaultPlatform(sc, arch));
 }
开发者ID:nemerle,项目名称:reko,代码行数:9,代码来源:AddressSearchResultTests.cs

示例9: GetImage

 public Program GetImage()
 {
     var image = new LoadedImage(BaseAddress, Emitter.GetBytes());
     return new Program(
         image,
         image.CreateImageMap(),
         arch, 
         new DefaultPlatform(null, arch));
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:9,代码来源:M68kAssembler.cs

示例10: Given_ImageSeg

 internal void Given_ImageSeg(ushort seg, ushort offset, string sBytes)
 {
     var bytes = HexStringToBytes(sBytes);
     var imag = new LoadedImage(Address.SegPtr(seg, offset), bytes);
     prog = new Program
     {
         Image = imag,
         ImageMap = imag.CreateImageMap()
     };
 }
开发者ID:nemerle,项目名称:reko,代码行数:10,代码来源:HeuristicTestBase.cs

示例11: Given_Image32

 protected void Given_Image32(uint addr, string sBytes)
 {
     var bytes = HexStringToBytes(sBytes);
     var imag = new LoadedImage(Address.Ptr32(addr), bytes);
     prog = new Program
     {
         Image = imag,
         ImageMap = imag.CreateImageMap(),
     };
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:10,代码来源:HeuristicTestBase.cs

示例12: Load

 public override Program Load(Address addrLoad)
 {
     if (addrLoad == null)
         addrLoad = PreferredBaseAddress;
     var image = new LoadedImage(addrLoad, imageBytes);
     return new Program(
         image,
         image.CreateImageMap(),
         Architecture,
         Platform ?? new DefaultPlatform(Services, Architecture));
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:11,代码来源:NullImageLoader.cs

示例13: Load

 public override Program Load(Address addrLoad)
 {
     int iImageStart = (exe.e_cparHeader * 0x10);
     int cbImageSize = exe.e_cpImage * ExeImageLoader.CbPageSize - iImageStart;
     byte[] bytes = new byte[cbImageSize];
     int cbCopy = Math.Min(cbImageSize, RawImage.Length - iImageStart);
     Array.Copy(RawImage, iImageStart, bytes, 0, cbCopy);
     imgLoaded = new LoadedImage(addrLoad, bytes);
     imgLoadedMap = imgLoaded.CreateImageMap();
     return new Program(imgLoaded, imgLoadedMap, arch, platform);
 }
开发者ID:MavenRain,项目名称:reko,代码行数:11,代码来源:MsdosImageLoader.cs

示例14: BuildTest32

 private void BuildTest32(Address addrBase, params byte[] bytes)
 {
     arch = new M68kArchitecture();
     var image = new LoadedImage(addrBase, bytes);
     program = new Program(
         image,
         image.CreateImageMap(),
         arch,
         new DefaultPlatform(null, arch));
     RunTest(addrBase);
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:11,代码来源:Scanner.M68kTests.cs

示例15: Setup

 public void Setup()
 {
     this.sc = new ServiceContainer();
     this.mr = new MockRepository();
     var image = new LoadedImage(Address.SegPtr(0x0C00, 0), new byte[100]);
     this.program = new Program
     {
         Image = image,
         ImageMap = image.CreateImageMap()
     };
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:11,代码来源:Cmd_MarkProcedureTests.cs


注:本文中的Reko.Core.LoadedImage.CreateImageMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。