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


C# Core.LoadedImage类代码示例

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


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

示例1: Disassemble16

 private IntelInstruction Disassemble16(params byte[] bytes)
 {
     LoadedImage img = new LoadedImage(Address.SegPtr(0xC00, 0), bytes);
     ImageReader rdr = img.CreateLeReader(img.BaseAddress);
     var dasm = new X86Disassembler(rdr, PrimitiveType.Word16, PrimitiveType.Word16, false);
     return dasm.First();
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:7,代码来源:X86DisassemblerTests.cs

示例2: Disassemble64

 private IntelInstruction Disassemble64(params byte[] bytes)
 {
     var img = new LoadedImage(Address.Ptr64(0x10000), bytes);
     var rdr = img.CreateLeReader(img.BaseAddress);
     var dasm = new X86Disassembler(rdr, PrimitiveType.Word32, PrimitiveType.Word64, true);
     return dasm.First();
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:7,代码来源:X86DisassemblerTests.cs

示例3: RunTest

 private MachineInstruction RunTest(params byte[] bytes)
 {
     var image = new LoadedImage(Address.Ptr32(0x200), bytes);
     var rdr = new LeImageReader(image, 0);
     var dasm = new Disassembler(rdr);
     return dasm.First();
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:DisassemblerTests.cs

示例4: 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

示例5: 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

示例6: DisassembleWord

 private static SparcInstruction DisassembleWord(uint instr)
 {
     var bytes = new byte[4];
     new BeImageWriter(bytes).WriteBeUInt32(0, instr);
     var img = new LoadedImage(Address.Ptr32(0x00100000), bytes);
     return Disassemble(img);
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:SparcDisassemblerTests.cs

示例7: ValidateImage

 public void ValidateImage()
 {
     Program prog = new Program();
     LoadedImage rawImage = new LoadedImage(Address.SegPtr(0x0C00, 0), CreateMsdosHeader());
     ExeImageLoader exe = new ExeImageLoader(null, "foo.exe", rawImage.Bytes);
     Assert.IsTrue(PkLiteUnpacker.IsCorrectUnpacker(exe, rawImage.Bytes));
 }
开发者ID:nemerle,项目名称:reko,代码行数:7,代码来源:PkLiteUnpackerTests.cs

示例8: 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

示例9: 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

示例10: Disassemble32

 private X86Instruction Disassemble32(params byte[] bytes)
 {
     var img = new LoadedImage(Address.Ptr32(0x10000), bytes);
     var rdr = img.CreateLeReader(img.BaseAddress);
     var dasm = new X86Disassembler(ProcessorMode.Protected32, rdr, PrimitiveType.Word32, PrimitiveType.Word32, false);
     return dasm.First();
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:X86DisassemblerTests.cs

示例11: BuildTest

 private void BuildTest(params ushort[] words)
 {
     var bytes = words
         .SelectMany(u => new byte[] { (byte)u, (byte)(u >> 8), })
         .ToArray();
     image = new LoadedImage(Address.Ptr32(0x00100000), bytes);
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:ThumbRewriterTests.cs

示例12: BuildTest

 private void BuildTest(params string[] bitStrings)
 {
     var bytes = bitStrings.Select(bits => base.ParseBitPattern(bits))
         .SelectMany(u => new byte[] { (byte) u, (byte) (u >> 8), (byte) (u >> 16), (byte) (u >> 24) })
         .ToArray();
     image = new LoadedImage(Address.Ptr32(0x00100000), bytes);
 }
开发者ID:melbcat,项目名称:reko,代码行数:7,代码来源:ArmRewriterTests.cs

示例13: Program

 public Program(LoadedImage image, ImageMap imageMap, IProcessorArchitecture arch, Platform platform) : this()
 {
     this.Image = image;
     this.ImageMap = imageMap;
     this.Architecture = arch;
     this.Platform = platform;
 }
开发者ID:melbcat,项目名称:reko,代码行数:7,代码来源:Program.cs

示例14: 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

示例15: UShortFixup

		public void UShortFixup()
		{
			var bytes = new byte[] { 0x01, 0x02, 0x03 };
			var img = new LoadedImage(Address.SegPtr(0x0C00, 0), bytes);
			ushort newSeg = img.FixupLeUInt16(1, 0x4444);
			Assert.AreEqual(0x4746, newSeg);
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:ProgramImageTests.cs


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