reference:plugins:vfs_plugins:vfs_seekfile

VFS_SeekFile(
     HANDLE:hVFSData,
     LPVFSFUNCDATA:lpFuncData,
     HANDLE:hFile,
     __int64:iPos,
     DWORD:dwMethod,
     DWORD:dwFlags,
     unsigned __int64*:piNewPos
)
→ BOOL

Arguments

hVFSData

[in] The handle to the namespace instance data

lpFuncData

[in] unused

hFile

[in] File handle as returned by your VFS_CreateFile function

iPos

[in] Position to seek (either relative or absolute)

dwMethod

[in] Method of seeking in the file

FILE_BEGINiPos is relative to the start of the file
FILE_CURRENTiPos is relative to the current position
FILE_ENDiPos is relative to the end of the file

dwFlags

[in] Flags describing this seek operation

VFSSEEKF_RESUMEThe seek is occurring as part of a copy resume operation

piNewPos

[out] Pointer to an unsigned 64 bit value to receive the new file pointer or NULL

Return value

The function must return TRUE if seek was successful, or FALSE on failure. You should set an appropriate error code on failure that Opus can retrieve via VFS_GetLastError. If piNewPos is non-NULL you should return the new position of the file pointer in this parameter.

Description

The VFS_SeekFile function is called to set the file pointer within an open file.

It is valid for this function to be called with iPos set to 0 and dwMethod set to FILE_CURRENT. In this case you should simply return the current file position in piNewPos and return TRUE.

If your function does not support random seeking you should return an error of VFSERR_NOT_SUPPORTED when appropriate. You should still endeavor to support forward seeking if possible.