コード例 #1
0
        public void TextSectionIsReadableExecutableAndHasCode()
        {
            var textSections = SectionHeaders.Where(item => item.NameString == ".text\0\0\0").ToArray();

            if (textSections.Length < 1)
            {
                Assert.Inconclusive("Cannot run this test without .text section");
            }

            foreach (var sectionHeader in textSections)
            {
                Assert.That(
                    sectionHeader.Characteristics.HasFlag(SectionCharacteristics.ContainsCode),
                    ".text does not contain code (section flags)"
                    );
                Assert.That(sectionHeader.Characteristics.HasFlag(SectionCharacteristics.MemExecute), ".text is not executable (section flags)");
                Assert.That(sectionHeader.Characteristics.HasFlag(SectionCharacteristics.MemRead), ".text is not readable (section flags)");
            }
        }
コード例 #2
0
ファイル: PE.cs プロジェクト: MaxtorCoder/OpcodeDumper
 public uint GetPhysicalAddressEnd(string sectionName)
 {
     return(SectionHeaders.Where(i => i.NameString.Contains(sectionName)).Select(o => o.SizeOfRawData + o.PhysicalAddress).First());
 }