Beispiel #1
0
        public ModHeaders(BinaryReader reader)
        {
            //read coff, pe, section headers
            _hdr = new OSHeaders(reader);

            //find and read COR20 header
            try
            {
                reader.BaseStream.Position = Rva2Offset(_hdr.PEHeader.DataDirs[14].Rva);
                _cor20 = new COR20Header(reader);
            }
            catch (Exception)
            {
                return;
            }

            //find and read md headers
            try
            {
                reader.BaseStream.Position = Rva2Offset(_cor20.MetaData.Rva);
                _md = new MetaDataHeaders(reader);
            }
            catch (Exception)
            {
                return;
            }

            try
            {
                reader.BaseStream.Position = _md.TableStreamHeader.Offset + _md.StorageSigAndHeader.Start;
                _mdth = new MetaDataTableHeader(reader);
            }
            catch (Exception)
            {
                return;
            }
        }
        public ModHeaders(BinaryReader reader)
        {
            //read coff, pe, section headers
            _hdr = new OSHeaders(reader);

            //find and read COR20 header
            try
            {
                reader.BaseStream.Position = Rva2Offset(_hdr.PEHeader.DataDirs[14].Rva);
                _cor20 = new COR20Header(reader);
            }
            catch(Exception)
            {
                return;
            }

            //find and read md headers
            try
            {
                reader.BaseStream.Position = Rva2Offset(_cor20.MetaData.Rva);
                _md = new MetaDataHeaders(reader);
            }
            catch(Exception)
            {
                return;
            }

            try
            {
                reader.BaseStream.Position = _md.TableStreamHeader.Offset + _md.StorageSigAndHeader.Start;
                _mdth = new MetaDataTableHeader(reader);
            }
            catch(Exception)
            {
                return;
            }
        }