예제 #1
0
        internal ELFProgramHeader(BinaryReader reader, ELFSizeFormat sizeFormat)
        {
            p_type = reader.ReadUInt32();

            if (sizeFormat == ELFSizeFormat.ELF32)
            {
                p_offset = reader.ReadUInt32();
                p_vaddr = reader.ReadUInt32();
                p_paddr = reader.ReadUInt32();
            }
            else if (sizeFormat == ELFSizeFormat.ELF64)
            {
                p_offset = reader.ReadUInt64();
                p_vaddr = reader.ReadUInt64();
                p_paddr = reader.ReadUInt64();
            }
            else
            {
                throw new InvalidDataException("Unknown ELF size format value");
            }

            p_filesz = reader.ReadUInt32();
            p_memsz = reader.ReadUInt32();
            p_flags = reader.ReadUInt32();
            p_align = reader.ReadUInt32();
        }
예제 #2
0
        internal ELFSectionHeader(BinaryReader reader, ELFSizeFormat sizeFormat)
        {
            sh_name = reader.ReadUInt32();
            sh_type = reader.ReadUInt32();

            if (sizeFormat == ELFSizeFormat.ELF32)
            {
                sh_flags = reader.ReadUInt32();
                sh_addr = reader.ReadUInt32();
                sh_offset = reader.ReadUInt32();
                sh_size = reader.ReadUInt32();
                sh_link = reader.ReadUInt32();
                sh_info = reader.ReadUInt32();
                sh_addralign = reader.ReadUInt32();
                sh_entsize = reader.ReadUInt32();
            }
            else if (sizeFormat == ELFSizeFormat.ELF64)
            {
                sh_flags = reader.ReadUInt64();
                sh_addr = reader.ReadUInt64();
                sh_offset = reader.ReadUInt64();
                sh_size = reader.ReadUInt64();
                sh_link = reader.ReadUInt32();
                sh_info = reader.ReadUInt32();
                sh_addralign = reader.ReadUInt64();
                sh_entsize = reader.ReadUInt64();
            }
            else
            {
                throw new InvalidDataException("Unknown ELF size format value");
            }
        }
예제 #3
0
 internal ELFSection(BinaryReader reader, ELFSizeFormat fmt)
 {
     _header = new ELFSectionHeader(reader, fmt);
 }