예제 #1
0
        public ReadyToRunImportSection(
            int index,
            ReadyToRunReader reader,
            int rva,
            int size,
            ReadyToRunImportSectionFlags flags,
            ReadyToRunImportSectionType type,
            byte entrySize,
            int signatureRVA,
            List <ImportSectionEntry> entries,
            int auxDataRVA,
            int auxDataOffset,
            Machine machine,
            ushort majorVersion)
        {
            Index       = index;
            SectionRVA  = rva;
            SectionSize = size;
            Flags       = flags;
            Type        = type;
            EntrySize   = entrySize;

            SignatureRVA = signatureRVA;
            Entries      = entries;

            AuxiliaryDataRVA  = auxDataRVA;
            AuxiliaryDataSize = 0;
            if (AuxiliaryDataRVA != 0)
            {
                int endOffset = auxDataOffset + BitConverter.ToInt32(reader.Image, auxDataOffset);

                for (int i = 0; i < Entries.Count; i++)
                {
                    int entryStartOffset = auxDataOffset + BitConverter.ToInt32(reader.Image, auxDataOffset + sizeof(int) * (Entries[i].Index / GCRefMap.GCREFMAP_LOOKUP_STRIDE));
                    int remaining        = Entries[i].Index % GCRefMap.GCREFMAP_LOOKUP_STRIDE;
                    while (remaining != 0)
                    {
                        while ((reader.Image[entryStartOffset] & 0x80) != 0)
                        {
                            entryStartOffset++;
                        }

                        entryStartOffset++;
                        remaining--;
                    }

                    GCRefMapDecoder decoder = new GCRefMapDecoder(reader, entryStartOffset);
                    Entries[i].GCRefMap = decoder.ReadMap();
                    endOffset           = decoder.GetOffset();
                }

                AuxiliaryDataSize = endOffset - auxDataOffset;
            }
        }
예제 #2
0
        public ImportSectionNode(string name, ReadyToRunImportSectionType importType, ReadyToRunImportSectionFlags flags, byte entrySize, bool emitPrecode, bool emitGCRefMap)
        {
            _name         = name;
            _type         = importType;
            _flags        = flags;
            _entrySize    = entrySize;
            _emitPrecode  = emitPrecode;
            _emitGCRefMap = emitGCRefMap;

            _imports       = new ImportTable(_name + "_ImportBegin", _name + "_ImportEnd");
            _signatures    = new ArrayOfEmbeddedPointersNode <Signature>(_name + "_SigBegin", _name + "_SigEnd", new EmbeddedObjectNodeComparer(CompilerComparer.Instance));
            _signatureList = new List <Signature>();
            _gcRefMap      = _emitGCRefMap ? new GCRefMapNode(this) : null;
        }