Esempio n. 1
0
        private void ReadMetadata()
        {
            MoveTo(metadata);
            if (ReadUInt32() != 1112167234)
            {
                throw new BadImageFormatException();
            }
            base.Advance(8);
            image.RuntimeVersion = ReadZeroTerminatedString(ReadInt32());
            base.Advance(2);
            ushort  num = ReadUInt16();
            Section sectionAtVirtualAddress = image.GetSectionAtVirtualAddress(metadata.VirtualAddress);

            if (sectionAtVirtualAddress == null)
            {
                throw new BadImageFormatException();
            }
            image.MetadataSection = sectionAtVirtualAddress;
            for (int i = 0; i < num; i++)
            {
                ReadMetadataStream(sectionAtVirtualAddress);
            }
            if (image.PdbHeap != null)
            {
                ReadPdbHeap();
            }
            if (image.TableHeap != null)
            {
                ReadTableHeap();
            }
        }
Esempio n. 2
0
        void ReadMetadata()
        {
            MoveTo(metadata);

            if (ReadUInt32() != 0x424a5342)
            {
                throw new BadImageFormatException();
            }

            // MajorVersion			2
            // MinorVersion			2
            // Reserved				4
            Advance(8);

            image.RuntimeVersion = ReadZeroTerminatedString(ReadInt32());

            // Flags		2
            Advance(2);

            var streams = ReadUInt16();

            var section = image.GetSectionAtVirtualAddress(metadata.VirtualAddress);

            if (section == null)
            {
                throw new BadImageFormatException();
            }

            image.MetadataSection = section;

            for (int i = 0; i < streams; i++)
            {
                ReadMetadataStream(section);
            }

            if (image.PdbHeap != null)
            {
                ReadPdbHeap();
            }

            if (image.TableHeap != null)
            {
                ReadTableHeap();
            }
        }