Table of Contents

Struct PatchContext

Namespace
AsmResolver.Patching
Assembly
AsmResolver.dll

Provides members describing the context in which a patch may be situated in.

public readonly struct PatchContext
Inherited Members

Constructors

PatchContext(ISegment, ulong, ulong, BinaryStreamWriter)

Creates a new instance of the PatchContext structure.

public PatchContext(ISegment segment, ulong imageBase, ulong writerBase, BinaryStreamWriter writer)

Parameters

segment ISegment

The segment to be patched.

imageBase ulong

The image base to assume while patching.

writerBase ulong

The offset the writer actually started writing the segment at.

writer BinaryStreamWriter

The object responsible for writing the patches.

Properties

ImageBase

Gets the image base that is assumed while patching.

public ulong ImageBase { get; }

Property Value

ulong

Segment

Gets the segment to be patched.

public ISegment Segment { get; }

Property Value

ISegment

Writer

Gets the object responsible for writing the patches.

public BinaryStreamWriter Writer { get; }

Property Value

BinaryStreamWriter

WriterBase

Gets the actual offset the writer started writing the segment at.

public ulong WriterBase { get; }

Property Value

ulong

Remarks

This property is in most cases equivalent to Segment.Offset. However, callers may be calling Write(BinaryStreamWriter) with a BinaryStreamWriter that is not writing the entire enclosing file (e.g., when calling WriteIntoArray(ISegment)). Implementations of IPatch should therefore always prefer WriterBase over Segment.Offset when adjusting the current offset of Writer.