//lpFn: 文件名;
//能获得包括大于 4G 的文件大小
function GetFileBytes(lpFn: PChar): Int64;
var
hFile, dwSizeLow, dwSizeHigh: Longword;
begin
Result := -1;
hFile := CreateFile(lpFn, GENERIC_READ, FILE_SHARE_READ, nil, OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
try
if hFile <> INVALID_HANDLE_VALUE then
begin
dwSizeLow := GetFileSize(hFile, @dwSizeHigh);
Result := dwSizeHigh*4294967296 + dwSizeLow;
end;
finally
CloseHandle(hFile);
end;
end;