示例#1
0
        public void Read(ReaderContext ctxt, BlobReader reader)
        {
            if (reader.RemainingBytes < Size)
                throw new PEException("missing DOSHeader");

            var actualPrefix = reader.ReadBytes((uint)prefix.Length);
            if (!EqualBytes(actualPrefix, prefix))
                throw new PEException("invalid DOSHeader.Prefix");

            LfaNew.Read(reader);
            if (LfaNew.Offset < Size)
                throw new PEException("invalid DOSHeader.LfaNew");

            var actualSuffix = reader.ReadBytes((uint)suffix.Length);
            if (!EqualBytes(actualSuffix, suffix))
                throw new PEException("invalid DOSHeader.Suffix");

            Final = reader.ReadUInt32();

            if (ctxt.Tracer != null)
                LfaNew.Append(ctxt, "DOSHeader.LfaNew");
        }