Пример #1
0
        internal void Read(BinaryReader br)
        {
            msdos.signature = br.ReadUInt16();
            br.BaseStream.Seek(58, SeekOrigin.Current);
            msdos.peSignatureOffset = br.ReadUInt32();

            if (msdos.signature != MSDOS_HEADER.MAGIC_MZ)
            {
                throw new BadImageFormatException();
            }

            br.BaseStream.Seek(msdos.peSignatureOffset, SeekOrigin.Begin);
            headers.Read(br);
            sections = new SectionHeader[headers.FileHeader.NumberOfSections];
            for (int i = 0; i < sections.Length; i++)
            {
                sections[i] = new SectionHeader();
                sections[i].Read(br);
            }
        }
Пример #2
0
		internal void Read(BinaryReader br)
		{
			msdos.signature = br.ReadUInt16();
			br.BaseStream.Seek(58, SeekOrigin.Current);
			msdos.peSignatureOffset = br.ReadUInt32();

			if (msdos.signature != MSDOS_HEADER.MAGIC_MZ)
			{
				throw new BadImageFormatException();
			}

			br.BaseStream.Seek(msdos.peSignatureOffset, SeekOrigin.Begin);
			headers.Read(br);
			sections = new SectionHeader[headers.FileHeader.NumberOfSections];
			for (int i = 0; i < sections.Length; i++)
			{
				sections[i] = new SectionHeader();
				sections[i].Read(br);
			}
		}