예제 #1
0
 internal Section(ElfFile file, UInt32 index, Elf.Elf32_Shdr section)
     : this(file, index)
 {
     this.sh_name      = section.sh_name;
     this.sh_type      = section.sh_type;
     this.sh_flags     = (Elf.SHF)section.sh_flags;
     this.sh_addr      = section.sh_addr;
     this.sh_offset    = section.sh_offset;
     this.sh_size      = section.sh_size;
     this.sh_link      = section.sh_link;
     this.sh_info      = section.sh_info;
     this.sh_addralign = section.sh_addralign;
     this.sh_entsize   = section.sh_entsize;
 }
예제 #2
0
        private Section[] ReadSections()
        {
            UInt64 offset = this.Header.Header.e_shoff;
            UInt16 count  = this.Header.Header.e_shnum;
            UInt32 size   = this.Header.Header.e_shentsize;

            Section[] result = new Section[count];
            for (UInt16 loop = 0; loop < count; loop++)
            {
                if (this.Header.Is64Bit)
                {
                    Elf.Elf64_Shdr section = this.Header.PtrToStructure <Elf.Elf64_Shdr>(offset);
                    result[loop] = new Section(this, loop, section);
                }
                else
                {
                    Elf.Elf32_Shdr section = this.Header.PtrToStructure <Elf.Elf32_Shdr>(offset);
                    result[loop] = new Section(this, loop, section);
                }
                offset += size;
            }
            return(result);
        }