为什么我会从此代码中收到无效的类型转换错误?

Why am I getting an Invalid typecast error from this code?

function FileSize64(var F : File): Int64;
var
  ph :_stat;
  pl:longword;
begin
  pl := fstat(TFileRec(f).Handle, ph);
  if (pl = $ffffffff) and (GetLastError <> 0) then
    CreateIOException(GetLastError, 'FileSize64', f, false);
  FileSize64 := Int64(ph) shl 32 + pl;
end;

我遇到一个错误:

E2089 Invalid typecast

检查这个解决方案:

  uses
    Posix.SysStat;

  function FileSize64(var F: File): Int64;
  var
    ph :_stat;
  begin
    if fstat(TFileRec(F).Handle, ph) <> 0 then
      RaiseLastOSError;
    result := ph.st_size;
  end;

提示:在下一个问题中,请告知使用列表中引用了哪些单位。