public R2RImportSection(
            int index,
            R2RReader reader,
            int rva,
            int size,
            CorCompileImportFlags flags,
            byte 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        = (CorCompileImportType)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;
            }
        }
Example #2
0
        public R2RImportSection(
            int index,
            R2RReader reader,
            int rva,
            int size,
            CorCompileImportFlags flags,
            byte 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        = (CorCompileImportType)type;
            EntrySize   = entrySize;

            SignatureRVA = signatureRVA;
            Entries      = entries;

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

                for (int i = 0; i < Entries.Count; i++)
                {
                    GCRefMapDecoder decoder = new GCRefMapDecoder(reader, startOffset);
                    Entries[i].GCRefMap = decoder.ReadMap();
                    startOffset         = decoder.GetOffset();
                }

                AuxiliaryDataSize = startOffset - auxDataOffset;
            }
        }