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
targetKindPatchTargetKind- The expected kind of data at
patchTarget. patchTargetnint- A pointer to the memory location to patch.
dataReadOnlySpan<byte>- The data to write into
patchTarget. backupSpan<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).