|
@@ -1204,6 +1204,8 @@ begin
|
|
with IInternalFuncParams(Params) do
|
|
with IInternalFuncParams(Params) do
|
|
begin
|
|
begin
|
|
Integer(F) := Get(0).AsInt;
|
|
Integer(F) := Get(0).AsInt;
|
|
|
|
+ if Integer(F) = 0 then
|
|
|
|
+ raise Exception.Create('Invalid file handle');
|
|
{$I-}
|
|
{$I-}
|
|
Readln(F^, S);
|
|
Readln(F^, S);
|
|
{$I+}
|
|
{$I+}
|
|
@@ -1231,11 +1233,13 @@ begin
|
|
with IInternalFuncParams(Params) do
|
|
with IInternalFuncParams(Params) do
|
|
begin
|
|
begin
|
|
Integer(F) := Get(0).AsInt;
|
|
Integer(F) := Get(0).AsInt;
|
|
|
|
+ if Integer(F) = 0 then
|
|
|
|
+ raise Exception.Create('Invalid file handle');
|
|
{$I-}
|
|
{$I-}
|
|
Reset(F^);
|
|
Reset(F^);
|
|
{$I+}
|
|
{$I+}
|
|
if IOResult <> 0 then
|
|
if IOResult <> 0 then
|
|
- FuncResult.Error('Failed to reset a file')
|
|
|
|
|
|
+ raise Exception.Create('Failed to reset a file')
|
|
else
|
|
else
|
|
ResPtr^ := NULL
|
|
ResPtr^ := NULL
|
|
end;
|
|
end;
|
|
@@ -1259,6 +1263,8 @@ begin
|
|
with IInternalFuncParams(Params) do
|
|
with IInternalFuncParams(Params) do
|
|
begin
|
|
begin
|
|
Integer(F) := Get(0).AsInt;
|
|
Integer(F) := Get(0).AsInt;
|
|
|
|
+ if Integer(F) = 0 then
|
|
|
|
+ raise Exception.Create('Invalid file handle');
|
|
{$I-}
|
|
{$I-}
|
|
IsEof := Eof(F^);
|
|
IsEof := Eof(F^);
|
|
{$I+}
|
|
{$I+}
|
|
@@ -1286,6 +1292,8 @@ begin
|
|
with IInternalFuncParams(Params) do
|
|
with IInternalFuncParams(Params) do
|
|
begin
|
|
begin
|
|
Integer(F) := Get(0).AsInt;
|
|
Integer(F) := Get(0).AsInt;
|
|
|
|
+ if Integer(F) = 0 then
|
|
|
|
+ raise Exception.Create('Invalid file handle');
|
|
{$I-}
|
|
{$I-}
|
|
Close(F^);
|
|
Close(F^);
|
|
{$I+}
|
|
{$I+}
|
|
@@ -1294,11 +1302,6 @@ begin
|
|
TPreprocessor(Ext).UncollectGarbage(Pointer(F));
|
|
TPreprocessor(Ext).UncollectGarbage(Pointer(F));
|
|
end;
|
|
end;
|
|
except
|
|
except
|
|
- on E: EAccessViolation do
|
|
|
|
- begin
|
|
|
|
- FuncResult.Error('Invalid file handle');
|
|
|
|
- Result.Error := ISPPFUNC_FAIL
|
|
|
|
- end;
|
|
|
|
on E: Exception do
|
|
on E: Exception do
|
|
begin
|
|
begin
|
|
FuncResult.Error(PChar(E.Message));
|
|
FuncResult.Error(PChar(E.Message));
|