reference:plugins:vfs_plugins:vfs_createfile

VFS_CreateFile(
     HANDLE:hVFSData,
     LPVFSFUNCDATA:lpFuncData,
     LPTSTR:lpszFile,
     DWORD:dwMode,
     DWORD:dwFlagsAndAttr,
     DWORD:dwFlags,
     LPFILETIME:lpFT
)
→ HANDLE

Arguments

hVFSData

[in] The handle to the namespace instance data

lpFuncData

[in] unused

lpszFile

[in] Null-terminated string representing the full pathname of the file to open or create

dwMode

[in] Indicates the type of access desired for the new file handle.

GENERIC_READAn existing file is being opened for reading
GENERIC_WRITEAn existing file is being opened or a new file is being created for writing

dwFlagsAndAttr

[in] Specifies the attributes to assign to a newly created file, and optional flags to control the behavior of the new file. This value is equivalent to the similar parameter in the Windows CreateFile function - see the Windows API SDK for information on these flags.

dwFlags

[in] Combines the Windows API "creation disposition" parameter with several Opus-specific flags.

VFSCREATEF_RESUMEFile is being opened to resume a transfer
VFSCREATEF_RECURSIVECOPYA recursive copy operation is in progress
VFSCREATEF_THUMBNAILOpus is opening the file in order to generate a thumbnail
VFSCREATEF_IGNOREIFSLOWIf reading the file will take a long time you should not open it and return failure instead
VFSCREATEF_BUFFEREDThe file is being buffered

lpFT

[in] Unless set to NULL, this points to a FILETIME structure specifying the creation timestamp that is to be used for the newly created file.

Return value

The function must return a HANDLE value that represents the file if the file was successfully opened or created. Directory Opus will pass this handle to the other file read/write API functions.

Description

The VFS_CreateFile function is called to open or create a file in your plugin's namespace.

You will only ever be called with GENERIC_WRITE if you do not specify the VFSCAPABILITY_READONLY capabilities flag. Directory Opus never opens a file for both read and write access - the dwMode parameter will always equal GENERIC_READ or GENERIC_WRITE.

As well as the flags listed above for dwFlags this parameter also contains the Windows CreateFile "creation disposition" parameter - CREATE_NEW, CREATE_ALWAYS, etc. You can retrieve the creation disposition value using the special mask value VFSCREATEF_MODEMASK. If creation disposition value is not specified you should assume "create new" for a write operation and "open existing" for a read operation.

In general, if your plugin does not support some of the concepts or features of this function you are free to ignore them - the only really important thing is that you return a HANDLE that can be passed to the VFS_ReadFile, VFS_WriteFile, VFS_SeekFile and VFS_CloseFile functions.