Esempio n. 1
0
        private byte[] RelocateBytes(Address addrLoad)
        {
            var rel = new HunkRelocator(this.hunkFile);
            // Get sizes of all segments
            var sizes = rel.GetSegmentSizes();
            // Determine begin addrs for all segments
            uint base_addr = addrLoad.ToUInt32();
            var  addrs     = rel.GetSegmentRelocationAddresses(base_addr);
            //  Relocate and return data of segments
            var datas = rel.Relocate(addrs);

            if (datas == null)
            {
                throw new BadImageFormatException("Relocation failed.");
            }
            return(datas);
            //print "Relocate to base address",base_addr
            //print "Bases: "," ".join(map(lambda x:"%06x"%(x),addrs))
            //print "Sizes: "," ".join(map(lambda x:"%06x"%(x),sizes))
            //print "Data:  "," ".join(map(lambda x:"%06x"%(len(x)),datas))
            //print "Total: ","%06x"%(rel.get_total_size())
        }
Esempio n. 2
0
 private byte[] RelocateBytes(Address addrLoad)
 {
     var rel = new HunkRelocator(this.hunkFile);
     // Get sizes of all segments
     var sizes = rel.GetSegmentSizes();
     // Determine begin addrs for all segments
     uint base_addr = addrLoad.ToUInt32();
     var addrs = rel.GetSegmentRelocationAddresses(base_addr);
     //  Relocate and return data of segments
     var datas = rel.Relocate(addrs);
     if (datas == null)
         throw new BadImageFormatException("Relocation failed.");
     return datas;
     //print "Relocate to base address",base_addr
     //print "Bases: "," ".join(map(lambda x:"%06x"%(x),addrs))
     //print "Sizes: "," ".join(map(lambda x:"%06x"%(x),sizes))
     //print "Data:  "," ".join(map(lambda x:"%06x"%(len(x)),datas))
     //print "Total: ","%06x"%(rel.get_total_size())
 }