Method PatchData
PatchData(PatchTargetKind, nint, ReadOnlySpan<byte>, Span<byte>)
Patches
patchTarget
to contain the data in data
, while creating a backup
of the data which was previously there in backup
.void PatchData(PatchTargetKind targetKind, nint patchTarget, ReadOnlySpan<byte> data, Span<byte> backup)
Parameters
targetKind
PatchTargetKind- The expected kind of data at
patchTarget
. patchTarget
nint- A pointer to the memory location to patch.
data
ReadOnlySpan<byte>- The data to write into
patchTarget
. backup
Span<byte>- A span to fill will the data which was already present, or an empty span.
Remarks
backup
may be an empty span. When it is, no backup is made.
targetKind
is to be used as nothing more than a hint. The system should check the existing mapping
to ensure that it is in fact correct (so that it would not remap an RW page to an RX page, or something similar).