/// <summary> /// Reads a single <see cref="X64RuntimeFunction"/> from the provided input stream. /// </summary> /// <param name="context">The reader context.</param> /// <param name="reader">The input stream.</param> /// <returns>The read function entry.</returns> public static X64RuntimeFunction FromReader(PEReaderContext context, ref BinaryStreamReader reader) { uint begin = reader.ReadUInt32(); uint end = reader.ReadUInt32(); uint unwindInfoRva = reader.ReadUInt32(); X64UnwindInfo unwindInfo; if (context.File.TryCreateReaderAtRva(unwindInfoRva, out var unwindReader)) { unwindInfo = X64UnwindInfo.FromReader(context, ref unwindReader); } else { unwindInfo = context.BadImageAndReturn <X64UnwindInfo>($"Invalid UnwindInfo RVA {unwindInfoRva:X8}."); } return(new X64RuntimeFunction( context.File.GetReferenceToRva(begin), context.File.GetReferenceToRva(end), unwindInfo)); }
/// <summary> /// Creates a new instance of the <see cref="X64RuntimeFunction"/> class. /// </summary> /// <param name="begin">The reference to the beginning of the function. </param> /// <param name="end">The reference to the end of the function.</param> /// <param name="unwindInfo">The unwind information associated to the function.</param> public X64RuntimeFunction(ISegmentReference begin, ISegmentReference end, X64UnwindInfo unwindInfo) { Begin = begin; End = end; UnwindInfo = unwindInfo; }