Hola Lepuke.
Cita:
Empezado por Lepuke
¿ hay alguna forma de establecer el valor del byte buf en otro lado donde pueda ponerle el valor de 1024 desde una caja de texto ?
|
Código Delphi
[-]
procedure InflateExe(const aFileName: string; const NoBytes: LongWord);
var
buf: array of Byte;
i: Integer;
begin
with TFileStream.Create(aFileName, fmOpenReadWrite) do
try
SetLength(buf, NoBytes);
ZeroMemory(@buf[1], Length(buf));
Seek(0, soFromEnd);
Write(buf[0], Length(buf));
finally
Free;
end;
end;
Uso:
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
begin
InflateExe('test.exe', StrToInt(Edit1.Text));
end;
Saludos
