Hi,
I've an issue with TFileStream and CopyFrom method on IS6.3.3 - it always raise an exception with "Range check error". TFileStream.CopyFrom worked fine on IS5.6.1
I have test function like this:
function FileCopyWithTFileStream(ASrc, ADest: String): Boolean;
var
lSrc, lDest: TFileStream;
lSize: Longint;
begin
Result := True;
try
lSrc:= TFileStream.Create(ASrc, fmOpenRead or fmShareDenyNone);
try
lDest:= TFileStream.Create(ADest, fmCreate);
try
lSize := lSrc.Size;
lDest.CopyFrom(lSrc, lSize); // size can be any value, 0, 1, lSrc.Size, but always fails with "Range check error". This worked in 5.6.1
finally
lDest.Free;
end;
finally
lSrc.Free;
end;
except
Log('FileCopyWithTFileStream failed. Exception=' + GetExceptionMessage);
Result := False;
end;
end;
I could not find exact place in code where change was made, but it might be releated to fix (maybe not fixed similar issue in TStream.CopyFrom?):
6.3.2 (2024-06-28)
- Pascal Scripting change: Fixed support function TStream.Seek.
PS. I'm aware that there is a FileCopy support function, but for some reason it doesn't allow me to copy installer file to other location FileCopy(ExpandConstant('{srcexe}'), always returns False)
--
Regards,
Krystian Bigaj