예제 #1
0
        public override RelocationResults Relocate(Program program, Address addrLoad)
        {
            var entryPoints = new List <ImageSymbol>();

            if (rsrcFork != null)
            {
                rsrcFork.Dump();
                rsrcFork.AddResourcesToImageMap(addrLoad, mem, segmentMap, entryPoints);
            }
            return(new RelocationResults(entryPoints, new SortedList <Address, ImageSymbol>()));
        }
예제 #2
0
        public override RelocationResults Relocate(Address addrLoad)
        {
            var entryPoints = new List <EntryPoint>();
            var relocations = new RelocationDictionary();

            if (rsrcFork != null)
            {
                rsrcFork.Dump();
                rsrcFork.AddResourcesToImageMap(addrLoad, imageMap, entryPoints);
            }
            return(new RelocationResults(entryPoints, relocations));
        }
예제 #3
0
                public ILoadedImage LoadImage(IServiceProvider?services, Address?addrLoad)
                {
                    addrLoad ??= Address.Ptr32(0x00100000);
                    var image      = this.GetBytes();
                    var rsrcFork   = new ResourceFork(Archive.Platform, image);
                    var bmem       = new ByteMemoryArea(addrLoad, image);
                    var segmentMap = new SegmentMap(addrLoad);
                    var program    = new Program(segmentMap, Archive.Architecture, Archive.Platform);

                    rsrcFork.AddResourcesToImageMap(addrLoad, bmem, program);

                    // The name is always 'rsrc', so go to the parent to fetch the "actual"
                    // file name.
                    program.Name     = this.Parent !.Name;
                    program.Location = this.Location;
                    return(program);
                }
예제 #4
0
        public override ILoadedImage Load(Address?addrLoad)
        {
            addrLoad ??= PreferredBaseAddress;
            BinHexDecoder      dec = new BinHexDecoder(new StringReader(Encoding.ASCII.GetString(RawImage)));
            IEnumerator <byte> stm = dec.GetBytes().GetEnumerator();
            BinHexHeader       hdr = LoadBinHexHeader(stm);

            byte[] dataBytes = LoadFork(hdr.DataForkLength, stm);
            byte[] rsrcBytes = LoadFork(hdr.ResourceForkLength, stm);

            var cfgSvc   = Services.RequireService <IConfigurationService>();
            var arch     = cfgSvc.GetArchitecture("m68k") !;
            var platform = (MacOSClassic)cfgSvc.GetEnvironment("macOs").Load(Services, arch);

            if (hdr.FileType == "PACT")
            {
                Cpt.CompactProArchive archive = new Cpt.CompactProArchive(base.ImageLocation, arch, platform);
                archive.Load(new MemoryStream(dataBytes));
                return(archive);
            }
            var     rsrcFork = new ResourceFork(platform, rsrcBytes);
            var     bmem     = new ByteMemoryArea(addrLoad, rsrcBytes);
            Program program;

            if (hdr.FileType == "MPST" || hdr.FileType == "APPL")
            {
                var segmentMap = new SegmentMap(addrLoad);
                program = new Program(segmentMap, arch, platform);
            }
            else
            {
                program = new Program(
                    new SegmentMap(bmem.BaseAddress,
                                   new ImageSegment("", bmem, AccessMode.ReadWriteExecute)),
                    arch,
                    platform);
            }
            rsrcFork.AddResourcesToImageMap(addrLoad, bmem, program);
            return(program);
        }