当前位置: 首页>>代码示例>>C#>>正文


C# PE.Section类代码示例

本文整理汇总了C#中Mono.Cecil.PE.Section的典型用法代码示例。如果您正苦于以下问题:C# Section类的具体用法?C# Section怎么用?C# Section使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Section类属于Mono.Cecil.PE命名空间,在下文中一共展示了Section类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CodeReader

 public CodeReader(Section section, MetadataReader reader, Dictionary<uint, DumpedMethod> dumpedMethods = null)
     : base(section.Data)
 {
     this.code_section = section;
     this.reader = reader;
     this.dumpedMethods = dumpedMethods;
 }
开发者ID:bladecoding,项目名称:cecil,代码行数:7,代码来源:CodeReader.cs

示例2: MoveTo

		public void MoveTo (int rva)
		{
			if (!IsInSection (rva)) {
				code_section = reader.image.GetSectionAtVirtualAddress ((uint) rva);
				Reset (code_section.Data);
			}

			base.position = rva - (int) code_section.VirtualAddress;
		}
开发者ID:0xb1dd1e,项目名称:cecil,代码行数:9,代码来源:CodeReader.cs

示例3: BuildSections

        void BuildSections()
        {
            if (win32_resources != null || win32_resources_directory != null)
                sections++;

            text = CreateSection (".text", text_map.GetLength (), null);
            var previous = text;

            if (win32_resources != null) {
                rsrc = CreateSection (".rsrc", (uint) win32_resources.length, previous);

                PatchWin32Resources (win32_resources);
                previous = rsrc;
            } else if (win32_resources_directory != null) {
                rsrc = CreateSection(".rsrc", previous);

                WriteWin32ResourcesDirectory(win32_resources_directory);
                SetSectionSize(rsrc, (uint) win32_resources.length);
                previous = rsrc;
            }

            if (has_reloc)
                reloc = CreateSection (".reloc", 12u, previous);
        }
开发者ID:gluck,项目名称:cecil,代码行数:24,代码来源:ImageWriter.cs

示例4: MoveTo

        public void MoveTo(int rva)
        {
            if (!IsInSection (rva)) {
                var new_section = reader.image.GetSectionAtVirtualAddress ((uint) rva);
                if (new_section == null)
                    throw new ArgumentException ();
                code_section = new_section;
                Reset (code_section.Data);
            }

            base.position = rva - (int) code_section.VirtualAddress;
        }
开发者ID:bladecoding,项目名称:cecil,代码行数:12,代码来源:CodeReader.cs

示例5: MetadataStream

 public MetadataStream(Section section, uint start, uint size, string name)
     : base(section, start, size)
 {
     this.Name = name;
 }
开发者ID:hjlfmy,项目名称:cecil,代码行数:5,代码来源:MetadataStream.cs

示例6: ReadSections

        void ReadSections(ushort count)
        {
            var sections = new Section [count];

            for (int i = 0; i < count; i++) {
                var section = new Section ();

                // Name
                section.Name = ReadZeroTerminatedString (8);

                // VirtualSize		4
                Advance (4);

                // VirtualAddress	4
                section.VirtualAddress = ReadUInt32 ();
                // SizeOfRawData	4
                section.SizeOfRawData = ReadUInt32 ();
                // PointerToRawData	4
                section.PointerToRawData = ReadUInt32 ();

                // PointerToRelocations		4
                // PointerToLineNumbers		4
                // NumberOfRelocations		2
                // NumberOfLineNumbers		2
                // Characteristics			4
                Advance (16);

                sections [i] = section;

                ReadSectionData (section);
            }

            image.Sections = sections;
        }
开发者ID:rfcclub,项目名称:cecil,代码行数:34,代码来源:ImageReader.cs

示例7: ReadMetadataStream

        void ReadMetadataStream(Section section)
        {
            // Offset		4
            uint start = metadata.VirtualAddress - section.VirtualAddress + ReadUInt32 (); // relative to the section start

            // Size			4
            uint size = ReadUInt32 ();

            var name = ReadAlignedString (16);
            switch (name) {
            case "#~":
            case "#-":
                image.TableHeap = new TableHeap (section, start, size);
                break;
            case "#Strings":
                image.StringHeap = new StringHeap (section, start, size);
                break;
            case "#Blob":
                image.BlobHeap = new BlobHeap (section, start, size);
                break;
            case "#GUID":
                image.GuidHeap = new GuidHeap (section, start, size);
                break;
            case "#US":
                image.UserStringHeap = new UserStringHeap (section, start, size);
                break;
            }
        }
开发者ID:rfcclub,项目名称:cecil,代码行数:28,代码来源:ImageReader.cs

示例8: BlobHeap

 public BlobHeap(Section section, uint start, uint size)
     : base(section, start, size)
 {
 }
开发者ID:sillsdev,项目名称:mono-basic,代码行数:4,代码来源:BlobHeap.cs

示例9: WriteSection

        void WriteSection(Section section, uint characteristics)
        {
            var name = new byte [8];
            var sect_name = section.Name;
            for (int i = 0; i < sect_name.Length; i++)
                name [i] = (byte) sect_name [i];

            WriteBytes (name);
            WriteUInt32 (section.VirtualSize);
            WriteUInt32 (section.VirtualAddress);
            WriteUInt32 (section.SizeOfRawData);
            WriteUInt32 (section.PointerToRawData);
            WriteUInt32 (0);	// PointerToRelocations
            WriteUInt32 (0);	// PointerToLineNumbers
            WriteUInt16 (0);	// NumberOfRelocations
            WriteUInt16 (0);	// NumberOfLineNumbers
            WriteUInt32 (characteristics);
        }
开发者ID:buraksarica,项目名称:cecil,代码行数:18,代码来源:ImageWriter.cs

示例10: MoveToRVA

 void MoveToRVA(Section section, RVA rva)
 {
     BaseStream.Seek (section.PointerToRawData + rva - section.VirtualAddress, SeekOrigin.Begin);
 }
开发者ID:buraksarica,项目名称:cecil,代码行数:4,代码来源:ImageWriter.cs

示例11: BuildSections

        void BuildSections()
        {
            var has_win32_resources = win32_resources != null;
            if (has_win32_resources)
                sections++;

            text = CreateSection (".text", text_map.GetLength (), null);
            var previous = text;

            if (has_win32_resources) {
                rsrc = CreateSection (".rsrc", (uint) win32_resources.length, previous);

                PatchWin32Resources (win32_resources);
                previous = rsrc;
            }

            if (has_reloc)
                reloc = CreateSection (".reloc", 12u, previous);
        }
开发者ID:buraksarica,项目名称:cecil,代码行数:19,代码来源:ImageWriter.cs

示例12: ResizeSection

        internal void ResizeSection(Section section, uint newSize, bool update)
        {
            section.VirtualSize = newSize;
            section.SizeOfRawData = Align (newSize, file_alignment);
            byte[] newDat = new byte[section.SizeOfRawData];
            if (newDat.Length > section.Data.Length)
                Buffer.BlockCopy(section.Data, 0, newDat, 0, section.Data.Length);
            else
                Buffer.BlockCopy(section.Data, 0, newDat, 0, newDat.Length);
            section.Data = newDat;

            int sectIndex = sections.IndexOf(section);
            if (sectIndex != -1 && update)
                for (int i = sectIndex + 1; i < sections.Count; i++)
                {
                    sections[i].VirtualAddress = sections[i - 1].VirtualAddress + Align (sections[i - 1].VirtualSize, section_alignment);
                    sections[i].PointerToRawData = sections[i - 1].PointerToRawData + sections[i - 1].SizeOfRawData;
                }
        }
开发者ID:n017,项目名称:Confuser,代码行数:19,代码来源:ImageWriter.cs

示例13: CreateSection

 internal Section CreateSection(string name, uint size, uint characteristics, Section previous)
 {
     return new Section {
         Name = name,
         VirtualAddress = previous != null
             ? previous.VirtualAddress + Align (previous.VirtualSize, section_alignment)
             : text_rva,
         VirtualSize = size,
         PointerToRawData = previous != null
             ? previous.PointerToRawData + previous.SizeOfRawData
             : 0,
         SizeOfRawData = Align (size, file_alignment),
         Data = new byte[Align(size, file_alignment)],
         Characteristics = characteristics
     };
 }
开发者ID:n017,项目名称:Confuser,代码行数:16,代码来源:ImageWriter.cs

示例14: PatchResourceDirectoryTable

 static void PatchResourceDirectoryTable(ByteBuffer resources, Section old, Section @new)
 {
     resources.Advance(12);
     int num = resources.ReadUInt16() + resources.ReadUInt16();
     for (int i = 0; i < num; i++)
     {
         PatchResourceDirectoryEntry(resources, old, @new);
     }
 }
开发者ID:n017,项目名称:Confuser,代码行数:9,代码来源:Packer.cs

示例15: PatchResourceDirectoryEntry

 static void PatchResourceDirectoryEntry(ByteBuffer resources, Section old, Section @new)
 {
     resources.Advance(4);
     uint num = resources.ReadUInt32();
     int position = resources.Position;
     resources.Position = ((int)num) & 0x7fffffff;
     if ((num & 0x80000000) != 0)
     {
         PatchResourceDirectoryTable(resources, old, @new);
     }
     else
     {
         PatchResourceDataEntry(resources, old, @new);
     }
     resources.Position = position;
 }
开发者ID:n017,项目名称:Confuser,代码行数:16,代码来源:Packer.cs


注:本文中的Mono.Cecil.PE.Section类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。