コード例 #1
0
        private void ReadRelocationEntry(IBinaryStreamReader reader, uint pageRva)
        {
            ushort rawValue = reader.ReadUInt16();
            var    type     = (RelocationType)(rawValue >> 12);
            int    offset   = rawValue & 0xFFF;

            Items.Add(new BaseRelocation(type, _peFile.GetReferenceToRva((uint)(pageRva + offset))));
        }
コード例 #2
0
        /// <inheritdoc />
        protected override IList <ExportedSymbol> GetExports()
        {
            var result = new ExportedSymbolCollection(this);

            if (!_peFile.TryCreateReaderAtRva(_addressTableRva, out var addressReader) ||
                !_peFile.TryCreateReaderAtRva(_namePointerRva, out var namePointerReader) ||
                !_peFile.TryCreateReaderAtRva(_ordinalTableRva, out var ordinalReader))
            {
                return(result);
            }

            var ordinalNameTable = ReadOrdinalNameTable(namePointerReader, ordinalReader);

            for (uint i = 0; i < _numberOfFunctions; i++)
            {
                uint rva = addressReader.ReadUInt32();
                ordinalNameTable.TryGetValue(i, out string name);
                result.Add(new ExportedSymbol(_peFile.GetReferenceToRva(rva), name));
            }

            return(result);
        }