public virtual object process_file(string scan_file) { object delta; object end; object fobj; object path; object result; object start; //path = scan_file.get_path(); //fobj = scan_file.get_fobj(); var hunkBytes = File.ReadAllBytes(scan_file); var sc = new ServiceContainer(); sc.AddService <IConfigurationService>(new StubConfigurationService()); var loader = new HunkLoader(sc, scan_file, hunkBytes); Address addr = null; if (args["--base-address"] == null || !Address.TryParse32((string)args["--base-address"].Value, out addr)) { addr = Address.Ptr32(0); } result = loader.Load(addr); // ignore non hunk files return(this.handle_file(scan_file, loader.HunkFile)); }
public void Hunk_LoadFile() { var bytes = File.ReadAllBytes( FileUnitTester.MapTestPath("../../subjects/Hunk-m68k/FIBO")); var ldr = new HunkLoader(sc, "FIBO", bytes); ldr.Load(Address.Ptr32(0x10000)); }
public void Hunk_LoadFile() { var bytes = File.ReadAllBytes( FileUnitTester.MapTestPath("../UnitTests/Arch/M68k/images/FIBO")); var ldr = new HunkLoader(null, "FIBO", bytes); ldr.Load(Address.Ptr32(0x10000)); }
public void Hunk_LoadEmpty() { var bytes = mh.MakeBytes( HunkType.HUNK_HEADER, "", 0, 0, 0, 0); var ldr = new HunkLoader(sc, "foo.bar", bytes); var ldImg = ldr.Load(Address.Ptr32(0x00010000)); Assert.AreEqual(1, ldImg.SegmentMap.Segments.Count); Assert.AreEqual(Address.Ptr32(0x00010000), ldImg.SegmentMap.Segments.Values[0].Address); }
public void Hunk_LoadCode() { var bytes = mh.MakeBytes( HunkType.HUNK_HEADER, "CODE", "", 1, 0, 0, 0x40, HunkType.HUNK_CODE, 1, (ushort)0x4E75, (ushort)0, HunkType.HUNK_END); var ldr = new HunkLoader(sc, "foo.bar", bytes); var program = ldr.Load(Address.Ptr32(0x00010000)); var rlImg = ldr.Relocate(program, Address.Ptr32(0x00010000)); Assert.AreEqual(1, rlImg.EntryPoints.Count); Assert.AreEqual(0x00010000ul, rlImg.EntryPoints[0].Address.ToLinear()); }