Ejemplo n.º 1
0
 /// <summary>
 /// Establishes a disassembler instance for further tests.
 /// </summary>
 /// <param name="instrs"></param>
 private void Given_Instructions(params ushort[] instrs)
 {
     var w = new LeImageWriter();
     foreach (var instr in instrs)
     {
         w.WriteLeUInt16(instr);
     }
     var image = new MemoryArea(Address.Ptr32(0x00100000), w.ToArray());
     var arch = CreateArchitecture();
     this.dasm = CreateDisassembler(arch, image.CreateLeReader(0));
 }
Ejemplo n.º 2
0
        public void Omfldr_Library_Single_Record()
        {
            Given_Omf(LibraryHeader, 0xD, DW(0x10), W(1), B(0), Pad(6));
            Given_Omf(THEADR, 0x0C, S("ANSIINJECT"), B(42));
            Given_Omf(COMENT, 0x1B,
                      B(0x80), B(0xA0), B(0x01),
                      B(0x01),
                      S("ANSIINJECT"),
                      S("ANSICALL"),
                      W(1),
                      B(42));
            Given_Omf(COMENT, 0x08,
                      B(0xC0, 0xFE), DW(0x12345678), B(0), B(42));
            Given_Omf(MODEND, 0x02, B(0), B(42), Align(0x10));
            Given_Omf(LibraryEnd, 0x0, Align(0x10));

            var omf     = new OmfLoader(platform.Services, "foo.lib", writer.ToArray());
            var typelib = omf.Load(platform, new TypeLibrary());
            var module  = typelib.Modules["ANSICALL"];
            var svc     = module.ServicesByOrdinal[1];

            Assert.AreEqual("ANSIINJECT", svc.Name);
        }
Ejemplo n.º 3
0
 private void Given_ExeLoader()
 {
     this.exeLoader = new ExeImageLoader(null, "FOO.EXE", writer.ToArray());
     this.exeLoader.ReadCommonExeFields();
 }
Ejemplo n.º 4
0
 private void Given_ExeLoader()
 {
     this.exeLoader = new ExeImageLoader(null, ImageLocation.FromUri("file:FOO.EXE"), writer.ToArray());
     this.exeLoader.ReadCommonExeFields();
 }