Пример #1
0
        private void AddSection(SegmentMap segmentMap, uint size, uint flags, uint reserved1, uint reserved2, uint protection, Address addr, EndianImageReader bytes, string name)
        {
            AccessMode am = 0;

            if ((protection & VM_PROT_READ) != 0)
            {
                am |= AccessMode.Read;
            }
            if ((protection & VM_PROT_WRITE) != 0)
            {
                am |= AccessMode.Write;
            }
            if ((protection & VM_PROT_EXECUTE) != 0)
            {
                am |= AccessMode.Execute;
            }

            var mem          = new ByteMemoryArea(addr, bytes.ReadBytes((uint)size));
            var machoSection = new MachOSection(name, addr, (SectionFlags)flags, reserved1, reserved2);
            var imageSection = new ImageSegment(name, mem, am);

            ldr.imageSections.Add(machoSection, imageSection);

            this.ldr.sections.Add(machoSection);
            this.ldr.sectionsByName.Add(imageSection.Name, machoSection);
            if (imageSection.Size > 0)
            {
                segmentMap.AddSegment(imageSection);
            }
        }
Пример #2
0
 public MachOSymbol(string name, byte n_type, MachOSection msec, ushort n_desc, ulong n_value)
 {
     this.Name    = name;
     this.n_type  = n_type;
     this.msec    = msec;
     this.n_desc  = n_desc;
     this.n_value = n_value;
 }