Directory Opus 9 supports batch-mode operations for VFS plugins. If you implement the batch interface via the VFS_BatchOperation function, Opus will call this function for any copy or delete operation involving your plugin, rather than using the filesystem-style functions described above.

BOOL VFS_BatchOperation( HANDLE hVFSData, LPVFSFUNCDATA lpFuncData,
    LPTSTR lpszPath, LPVFSBATCHDATA lpBatchData )

The hVFSData parameter is your namespace instance handle, and lpFuncData is not currently used. lpszPath specifies the current path in your namespace, and lpBatchData points to a VFSBATCHDATA structure that defines the operation parameters.

The fields of the VFSBATCHDATA structure are as follows:

if ( hAbortEvent && WaitForSingleObject( hAbortEvent, 0 ) == WAIT_OBJECT_0 )
{
    // aborted
}
BATCHF_COPY_PRESERVE_ATTRpreserve file attributes on add/extract
BATCHF_COPY_PRESERVE_DATEpreserve file timestamps on add/extract
BATCHF_COPY_PRESERVE_COMMENTSpreserve file comments on add/extract
BATCHF_COPY_PRESERVE_SECURITYpreserve file security information
BATCHF_COPY_ASK_REPLACEask before overwriting existing files
BATCHF_COPY_ASK_REPLACE_ROask before overwriting read-only files
BATCHF_COPY_RENAMEask user for new filenames (copy as)
BATCHF_COPY_DELETE_ORIGINALoperation is a 'move' - delete original files
BATCHF_DELETE_ASKask before beginning delete
BATCHF_DELETE_ASK_FILESask for each file before deleting
BATCHF_DELETE_ASK_FOLDERSask for each folder before deleting
BATCHF_DELETE_UNPROTECTautomatically unprotect files to delete
BATCHF_DELETE_ALLdelete all without prompting for each
BATCHF_DELETE_QUIETdon't prompt to begin deleting
BATCHF_DELETE_FORCEforce deletion
BATCHF_DELETE_SECUREsecure delete if possible
BATCHF_FILTERa filter is in force
BATCHF_FILTER_FOLDERSa filter is in force for folders
BATCHF_PROGRESS_SUBFOLDERSprogress bar knows about sub-folder contents

Most of these flags correspond to the options in the Opus Preferences (Copying/Deleting) and may not be relevant to your plugin. The 'ask' flags should be respected if possible - you can display confirmation dialogs using the Plugin Support API, which also contains functions to make respecting the 'filter' flags easy as well.

When Opus calls your VFS_BatchOperation function, you should examine the VFSBATCHDATA structure to determine if this is an operation you can process in batch mode. If it isn't (for example, you may support batch extraction but not deletion), you should return VFSBATCHRES_DODEFAULT. This indicates to Opus that batch mode is not available and Opus will then proceed to handle the operation in the usual way (via calls to VFS_CreateFile, VFS_ReadFile, etc.)

If, however, you can process the requested operation, you should then proceed to do so. Basically this is a matter of performing the requested actions, and returning result codes for each file. However, it is also the responsibility of the plugin to emulate Opus as much as possible while processing a batch operation. This may include displaying confirmation dialogs or dialogs asking for new filenames, displaying error messages, applying filters to files and folders and updating the progress bar. It is not required that you perform all these steps, however the user will enjoy a more seamless experience if you do.

The Plugin Support API (documented separately) provides several functions which can make these steps much easier for you. The functions specifically involved with batch mode operations that you may wish to use are:

ShowRequestDlggeneric message dialog helper function
ShowFunctionNewNameDlgdisplays a dialog allowing the user to specify a new filename
GetWildNewNameget a new filename from user-entered wildcard pattern
ShowFunctionErrorDlgdisplay an error message
ShowFunctionReplaceDlgdisplay 'replace existing file?' confirmation dialog
ShowFunctionInitialDeleteDlgdisplay initial confirmation dialog when deleting files
ShowFunctionDeleteDlgdisplay confirmation dialog when deleting a file or folder
FilterFunctionFileapply filters to files or folders
AddFunctionFileChangenotify Opus of a file change in your plugin's namespace
UpdateFunctionProgressBarupdate the progress bar for a batch mode operation
GetFunctionWindowretrieve window handle for a batch mode operation

For example, if the BATCHF_FILTER flag was set in the VFSBATCHDATA structure, you would call the FilterFunctionFile function to see if a file was to be filtered out.

See the Plugin Support API documentation for full information about these helper functions.

Your VFS_BatchOperation function should return a value indicating the result of the batch operation. See the reference section for a full description of the return codes.