Пример #1
0
        private void ParseSectionMap(Stream s)
        {
            //NOTE: We loose the ordering sections were specified in the file
            //here. That's OK for now, because we have a read-only structure.
            //If we ever need to use this code for round-tripping PE files,
            //then this needs to be modified to also track section order.

            s.AssumeNotNull();
            m_header.AssumeNotNull();

            m_sections =
                new RegionMap<SectionHeader>(
                    x => x.SectionRVA,
                    x => x.VirtualSize
                );

            for (int i = 0; i < m_header.NumberOfSections; ++i)
            {
                var section = new SectionHeader();
                section.Load(s);
                m_sections.Add(section);
            }
        }