Example #1
0
        public static void InitializeSections(NewPE PE)
        {
            // <--- Text Section --->
            {
                PE_SECTION_HEADER TextSectionHeader = new PE_SECTION_HEADER()
                {
                    Name = new char[] { '.', 't', 'e', 'x', 't' },
                    Characteristics = 0x60000020
                };

                PE.Sections.AddFirst(TextSectionHeader);
            }

            // <--- IData Section --->
            {
                PE_SECTION_HEADER IDataSectionHeader = new PE_SECTION_HEADER()
                {
                    Name = new char[] { '.', 'i', 'd', 'a', 't', 'a' },
                    Characteristics = 0x40000040
                };

                PE.Sections.AddLast(IDataSectionHeader);
            }

            // <--- Data Section --->
            {
                PE_SECTION_HEADER DataSectionHeader = new PE_SECTION_HEADER()
                {
                    Name = new char[] { '.', 'd', 'a', 't', 'a' },
                    Characteristics = 0xC0000040
                };

                PE.Sections.AddLast(DataSectionHeader);
            }

#if TLS
            // <--- TLS Section --->
            {
                PE_SECTION_HEADER TLSSectionHeader = new PE_SECTION_HEADER()
                {
                    Name = new char[] { '.', 'b', 's', 's' },
                    Characteristics = 0xC0000040
                };

                PE.Sections.AddLast(TLSSectionHeader);
            }
#endif
        }
Example #2
0
 private static void ReplaceSectionByName(string Name, PE_SECTION_HEADER NewSection, NewPE PE)
 {
     PE_SECTION_HEADER oldSection = GetSectionByName(Name, PE);
     PE.Sections.Find(oldSection).Value = NewSection;
 }