コード例 #1
0
ファイル: PortableExecutable.cs プロジェクト: zyonet/Pscx
        public PortableExecutableInfo(string path)
        {
            this.imagePath = path;

            using (Stream stream = OpenImage())
            {
                using (BinaryParser br = new BinaryParser(stream))
                {
                    dosHeader = DosHeader.Parse(br);

                    br.SkipTo(dosHeader.CoffHeaderOffset);

                    coffHeader = br.ReadRecord <CoffHeader>();
                    peHeader   = PEHeader.Parse(br);

                    sections = new List <PESection>();
                    for (int i = 0; i < coffHeader.NumberOfSections; i++)
                    {
                        sections.Add(br.ReadRecord <PESection>());
                    }
                }
            }
        }