给分:chgit('1.exe');
procedure chgit(fn: string);
var
Dest, Source: file;
TNCD: array[0..1] of byte;
Buffer: array[0..563911] of byte;
Read: integer;
tfn: string;
begin
tfn := changefileext(fn, '.tmp');
AssignFile(Dest, tfn);
AssignFile(Source, fn);
try
Rewrite(Dest, 1);
Reset(Source, 1);
//FillChar(HashDigest, 4, $FF);
//FillChar(TNCD, 8, $0512);
TNCD[0] := $05;
TNCD[1] := $14;
BlockRead(Source, Buffer, $89AC8, Read); //$448
BlockWrite(Dest, Buffer, Read);
BlockRead(Source, Buffer, 2, Read);
showmessage(Format('%x %x',[Buffer[0],Buffer[1]]));
blockwrite(dest, TNCD[0], sizeof(TNCD));
repeat
BlockRead(Source, Buffer, Sizeof(Buffer), Read);
BlockWrite(Dest, Buffer, Read);
until Read <> Sizeof(Buffer);
CloseFile(Source);
CloseFile(Dest);
DeleteFile(pchar(fn));
RenameFile(tfn, fn);
except
MessageDlg('无法打开输出文件!', mtInformation, [mbOK], 0);
Exit;
end;
end;