在Delphi中复制带偏移量的内存

我想复制带偏移的内存块,是否可能?

这是我到目前为止的代码

const
  SOURCE: array [0..5] of Byte = ($47,$49,$46,$38,$39,$61);
var
  Destination: Pointer;
begin
  // This is a full copy
  Move(SOURCE,Destination^,SizeOf(SOURCE));

  // If i want to copy from the third byte,is it possible?
  // I imagine the code should be,but it cannot be compiled.
  Move(Slice(SOURCE^,{Offset=}2)^,SizeOf(SOURCE) - 2);
end;

解决方法

你想要实现的目标并不完全清楚,但它看起来像
MoveMemory(pointer(NativeUInt(Destination) + 2),@SOURCE[0],SizeOf(SOURCE) - 2)

虽然我怀疑你真的想要

MoveMemory(pointer(NativeUInt(Destination) + 2),@SOURCE[2],SizeOf(SOURCE) - 2)

相关文章

 从网上看到《Delphi API HOOK完全说明》这篇文章,基本上都...
  从网上看到《Delphi API HOOK完全说明》这篇文章,基本上...
ffmpeg 是一套强大的开源的多媒体库 一般都是用 c/c+&#x...
32位CPU所含有的寄存器有:4个数据寄存器(EAX、EBX、ECX和ED...
1 mov dst, src dst是目的操作数,src是源操作数,指令实现的...