コード例 #1
0
ファイル: PdbReader.cs プロジェクト: liangran10000/dnlib-1
        ushort?ReadModules()
        {
            var stream = streams[STREAM_DBI].Content;

            stream.Position = 20;
            ushort symrecStream = stream.ReadUInt16();

            stream.Position += 2;
            uint gpmodiSize = ReadSizeField(stream);             // gpmodiSize
            uint otherSize  = 0;

            otherSize += ReadSizeField(stream); // secconSize
            otherSize += ReadSizeField(stream); // secmapSize
            otherSize += ReadSizeField(stream); // filinfSize
            otherSize += ReadSizeField(stream); // tsmapSize
            stream.ReadUInt32();                // mfcIndex
            uint dbghdrSize = ReadSizeField(stream);

            otherSize       += ReadSizeField(stream);       // ecinfoSize
            stream.Position += 8;

            modules = new List <DbiModule>();
            using (var moduleStream = stream.Create((FileOffset)stream.Position, gpmodiSize)) {
                while (moduleStream.Position < moduleStream.Length)
                {
                    var module = new DbiModule();
                    module.Read(moduleStream);
                    modules.Add(module);
                }
            }

            if (IsValidStreamIndex(symrecStream))
            {
                ReadGlobalSymbols(streams[symrecStream].Content);
            }

            if (dbghdrSize != 0)
            {
                stream.Position += gpmodiSize;
                stream.Position += otherSize;
                stream.Position += 12;
                return(stream.ReadUInt16());
            }
            return(null);
        }
コード例 #2
0
ファイル: PdbReader.cs プロジェクト: EmilZhou/dnlib
		ushort? ReadModules() {
			var stream = streams[STREAM_DBI].Content;
			stream.Position = 20;
			ushort symrecStream = stream.ReadUInt16();
			stream.Position += 2;
			uint gpmodiSize = ReadSizeField(stream); // gpmodiSize
			uint otherSize = 0;
			otherSize += ReadSizeField(stream); // secconSize
			otherSize += ReadSizeField(stream); // secmapSize
			otherSize += ReadSizeField(stream); // filinfSize
			otherSize += ReadSizeField(stream); // tsmapSize
			stream.ReadUInt32(); // mfcIndex
			uint dbghdrSize = ReadSizeField(stream);
			otherSize += ReadSizeField(stream); // ecinfoSize
			stream.Position += 8;

			modules = new List<DbiModule>();
			using (var moduleStream = stream.Create((FileOffset)stream.Position, gpmodiSize)) {
				while (moduleStream.Position < moduleStream.Length) {
					var module = new DbiModule();
					module.Read(moduleStream);
					modules.Add(module);
				}
			}

			if (IsValidStreamIndex(symrecStream))
				ReadGlobalSymbols(streams[symrecStream].Content);

			if (dbghdrSize != 0) {
				stream.Position += gpmodiSize;
				stream.Position += otherSize;
				stream.Position += 12;
				return stream.ReadUInt16();
			}
			return null;
		}