var MS : TMemoryStream; P0 : PByte; P1 : PByte;
begin MS := TMemoryStream.Create;
try MS.LoadFromFile( 'a.exe' );
P0 := PByte( MS.Memory );
P1 := P0; { 以下僅僅是個示例,實際上需要修改爲準確的偏移地址 UE中一行16個字節,第100行左右的地址就是100*16左右 欲得精確值,可觀看UE二進制編輯模式的左側,找到3333的地址 }
Inc( P1, 100 * 16 );
P1^ := $30
Inc( P1 );
P1^ := $30;
Inc( P1 );
P1^ := $30;
Inc( P1 );
P1^ := $30; { 上述幾行修改4個連續字節的動作,可以簡化爲一句 PCardinal( P1 )^ := $30303030; } // 修改第1000行左右的方法類似如上 MS.SaveToFile( 'a1.exe' );
finally MS.Free; end;end;