Example #1
0
 public static void WriteTo(this R2RImportSection.ImportSectionEntry theThis, TextWriter writer, DumpOptions options)
 {
     if (!options.Naked)
     {
         writer.Write($"+{theThis.StartOffset:X4}");
         writer.Write($" ({theThis.StartRVA:X4})");
         writer.Write($"  Section: 0x{theThis.Section:X8}");
         writer.Write($"  SignatureRVA: 0x{theThis.SignatureRVA:X8}");
         writer.Write("   ");
     }
     writer.Write(theThis.Signature);
     if (theThis.GCRefMap != null)
     {
         writer.Write(" -- ");
         theThis.GCRefMap.WriteTo(writer);
     }
 }
Example #2
0
        private FixupCell[] DecodeFixupCells(int offset)
        {
            List <FixupCell> cells  = new List <FixupCell>();
            NibbleReader     reader = new NibbleReader(Image, offset);

            // The following algorithm has been loosely ported from CoreCLR,
            // src\vm\ceeload.inl, BOOL Module::FixupDelayListAux
            uint curTableIndex = reader.ReadUInt();

            while (true)
            {
                uint fixupIndex = reader.ReadUInt(); // Accumulate the real rva from the delta encoded rva

                while (true)
                {
                    R2RImportSection importSection            = ImportSections[(int)curTableIndex];
                    R2RImportSection.ImportSectionEntry entry = importSection.Entries[(int)fixupIndex];
                    cells.Add(new FixupCell(cells.Count, curTableIndex, fixupIndex, entry.Signature));

                    uint delta = reader.ReadUInt();

                    // Delta of 0 means end of entries in this table
                    if (delta == 0)
                    {
                        break;
                    }

                    fixupIndex += delta;
                }

                uint tableIndex = reader.ReadUInt();

                if (tableIndex == 0)
                {
                    break;
                }

                curTableIndex = curTableIndex + tableIndex;
            } // Done with all entries in this table

            return(cells.ToArray());
        }
Example #3
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(SignatureString);

            sb.AppendLine($"Handle: 0x{MetadataTokens.GetToken(R2RReader.MetadataReader, MethodHandle):X8}");
            sb.AppendLine($"Rid: {MetadataTokens.GetRowNumber(R2RReader.MetadataReader, MethodHandle)}");
            sb.AppendLine($"EntryPointRuntimeFunctionId: {EntryPointRuntimeFunctionId}");
            sb.AppendLine($"Number of RuntimeFunctions: {RuntimeFunctions.Count}");
            if (Fixups != null)
            {
                sb.AppendLine($"Number of fixups: {Fixups.Count()}");
                foreach (FixupCell cell in Fixups)
                {
                    R2RImportSection importSection            = R2RReader.ImportSections[(int)cell.TableIndex];
                    R2RImportSection.ImportSectionEntry entry = importSection.Entries[(int)cell.CellOffset];
                    sb.AppendLine($"    TableIndex {cell.TableIndex}, Offset {cell.CellOffset:X4}: {entry.Signature}");
                }
            }

            return(sb.ToString());
        }