Ejemplo n.º 1
0
 public static Elf64_PHdr Load(ImageReader rdr)
 {
     var hdr = new Elf64_PHdr
     {
         p_type = (ProgramHeaderType)rdr.ReadUInt32(),
         p_flags = rdr.ReadUInt32(),
         p_offset = rdr.ReadUInt64(),
         p_vaddr = rdr.ReadUInt64(),
         p_paddr = rdr.ReadUInt64(),
         p_filesz = rdr.ReadUInt64(),
         p_pmemsz = rdr.ReadUInt64(),
         p_align = rdr.ReadUInt64(),
     };
     return hdr;
 }
Ejemplo n.º 2
0
        public static Elf64_PHdr Load(EndianImageReader rdr)
        {
            var hdr = new Elf64_PHdr
            {
                p_type   = (ProgramHeaderType)rdr.ReadUInt32(),
                p_flags  = rdr.ReadUInt32(),
                p_offset = rdr.ReadUInt64(),
                p_vaddr  = rdr.ReadUInt64(),
                p_paddr  = rdr.ReadUInt64(),
                p_filesz = rdr.ReadUInt64(),
                p_pmemsz = rdr.ReadUInt64(),
                p_align  = rdr.ReadUInt64(),
            };

            return(hdr);
        }
Ejemplo n.º 3
0
        public override int LoadSegments()
        {
            var rdr = CreateReader(Header64.e_phoff);

            for (int i = 0; i < Header64.e_phnum; ++i)
            {
                var sSeg = Elf64_PHdr.Load(rdr);
                Segments.Add(new ElfSegment
                {
                    p_type   = sSeg.p_type,
                    p_offset = sSeg.p_offset,
                    p_vaddr  = sSeg.p_vaddr,
                    p_paddr  = sSeg.p_paddr,
                    p_filesz = sSeg.p_filesz,
                    p_pmemsz = sSeg.p_pmemsz,
                    p_flags  = sSeg.p_flags,
                    p_align  = sSeg.p_align,
                });
            }
            return(Segments.Count);
        }