reference:plugins:vfs_plugins:vfs_readfile

VFS_ReadFile(
     HANDLE:hVFSData,
     LPVFSFUNCDATA:lpFuncData,
     HANDLE:hFile,
     LPVOID:lpData,
     DWORD:dwSize,
     LPDWORD:lpdwReadSize
)
→ 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

lpData

[out] Pointer to a buffer to receive the data

dwSize

[in] Size of the buffer

lpdwReadSize

[out] Pointer to a DWORD to receive the amount of data read

Return value

The function must return TRUE if data was successfully read from the file, or FALSE on failure or end-of-file. You should set an appropriate error code on failure that Opus can retrieve via VFS_GetLastError - the error code should be set to 0 for an end-of-file condition.

Description

The VFS_ReadFile function is called to read data from an open file.

When this function is called you should read as much data as possible up to and including dwSize bytes from the file into the buffer provided. You should not block or wait for additional data to become available - only return as much data as you can (up to the provided buffer size). The amount of data returned must be placed in lpdwReadSize.