Beispiel #1
0
        public static SubsectionDirectory Read(long lfaBase, BinaryReader r)
        {
            // Read directory section header
            var hdr = Misc.FromBinaryReader <SubsectionDirectoryHeader>(r);

            var sd = new SubsectionDirectory {
                Header = hdr
            };

            // Read entry headers
            var eheaders = new DirectoryEntryHeader[(int)hdr.DirectoryCount];

            for (int i = 0; i < hdr.DirectoryCount; i++)
            {
                eheaders[i] = Misc.FromBinaryReader <DirectoryEntryHeader>(r);
            }

            // Read directory entry contents
            sd.Sections = new SubsectionData[hdr.DirectoryCount];
            for (int i = 0; i < hdr.DirectoryCount; i++)
            {
                sd.Sections[i] = SubsectionData.Read(lfaBase, eheaders[i], r);
            }

            return(sd);
        }
        public static SubsectionDirectory Read(long lfaBase,BinaryReader r)
        {
            // Read directory section header
            var hdr = Misc.FromBinaryReader<SubsectionDirectoryHeader>(r);

            var sd = new SubsectionDirectory {
                Header=hdr
            };

            // Read entry headers
            var eheaders = new DirectoryEntryHeader[(int)hdr.DirectoryCount];
            for (int i = 0; i < hdr.DirectoryCount; i++)
                eheaders[i]=Misc.FromBinaryReader<DirectoryEntryHeader>(r);

            // Read directory entry contents
            sd.Sections = new SubsectionData[hdr.DirectoryCount];
            for(int i=0;i<hdr.DirectoryCount;i++)
                sd.Sections[i] = SubsectionData.Read(lfaBase, eheaders[i], r);

            return sd;
        }
Beispiel #3
0
        void DoRead()
        {
            /*
             * For more info, see codeviewNB09.pdf, point 7. "Symbol and Type Format for Microsoft Executables"
             * (pdf page 71)
             */

            cvData.lfaBase = r.BaseStream.Position;

            // Ensure that there's the right CodeView4 signature
            var signature = Encoding.ASCII.GetString(r.ReadBytes(4));

            if (signature != CodeViewSignature)
            {
                throw new InvalidDataException("Invalid CodeView Format: Signature '" + CodeViewSignature + "' expected, '" + signature + "' found at position " + cvData.lfaBase);
            }

            // Read 'Subsection Directory' address
            cvData.lfoDirectory = r.ReadUInt32();

            r.BaseStream.Position = cvData.lfaBase + cvData.lfoDirectory;

            cvData.SubsectionDirectory = SubsectionDirectory.Read(cvData.lfaBase, r);
        }