Inheritance: FileSegmentBuilder
Esempio n. 1
0
        private void InitializeBluePrint()
        {
            Segments.Add(Assembly.DosHeader);
            Segments.Add(Assembly.NtHeaders);
            Segments.Add(_sectionsTableBuilder);

            _textSectionBuilder = _sectionsTableBuilder.GetSectionBuilder(".text");
            _textSectionBuilder.Header.Attributes = ImageSectionAttributes.MemoryExecute |
                                                    ImageSectionAttributes.MemoryRead |
                                                    ImageSectionAttributes.ContentCode;
            _textSectionBuilder.Segments.Add(TextBuilder = new NetTextBuilder(Assembly.NetDirectory));

            if (Assembly.RootResourceDirectory != null)
            {
                _rsrcSectionBuilder = _sectionsTableBuilder.GetSectionBuilder(".rsrc");
                _rsrcSectionBuilder.Header.Attributes = ImageSectionAttributes.MemoryRead |
                                                        ImageSectionAttributes.ContentInitializedData;
            }

            if (Assembly.RelocationDirectory != null)
            {
                _relocSectionBuilder = _sectionsTableBuilder.GetSectionBuilder(".reloc");
                _relocSectionBuilder.Header.Attributes = ImageSectionAttributes.MemoryRead |
                                                         ImageSectionAttributes.MemoryDiscardable |
                                                         ImageSectionAttributes.ContentInitializedData;
            }
        }
Esempio n. 2
0
 public SectionBuilder GetSectionBuilder(string sectionName)
 {
     var section = _sectionBuilders.FirstOrDefault(x => x.Header.Name == sectionName);
     if (section == null)
     {
         _sectionBuilders.Add(section = new SectionBuilder(_builder, sectionName));
         _headerBuilder.Segments.Add(section.Header);
         _contentBuilder.Segments.Add(section);
     }
     return section;
 }