# Writing file system plugins for Double Commander

Description | Structures | Functions and Procedures | Types | Constants

## Description

This help file is about writing file system plugins for Double Commander.

### Functions and Procedures

`HANDLE __stdcall VfsOpen(char* Path);```
`void __stdcall VfsClose(HANDLE` `hInstance``);``` ``
`BOOL __stdcall VfsFindFirst(``HANDLE` `hInstance,` `char* Path,` `VFS_FIND_DATA*``FindData);```
`BOOL __stdcall VfsFindNext(``HANDLE` `hInstance,` `VFS_FIND_DATA* FindData``);``` ``
`void __stdcall VfsFindClose(````HANDLE` `hInstance,` `VFS_FIND_DATA* FindData````);```
`int __stdcall VfsMoveFile(``HANDLE hInstance, char* OldName, char* NewName, int CopyFlags``````);``` ``
`int __stdcall VfsDeleteFile(HANDLE hInstance, char* RemotePath);```
`int __stdcall VfsGetFile(``HANDLE hInstance, char* RemoteName, char* LocalName, int CopyFlags``);``` ``
`int __stdcall VfsPutFile(HANDLE hInstance, char* LocalName, char* RemoteName, int CopyFlags);```
`int __stdcall VfsExecuteFile(``HANDLE hInstance, HWND MainWin, char* RemoteName, char* Verb``);``` ``
`int __stdcall VfsCreateFolder(HANDLE hInstance, char* RemotePath);```
`int __stdcall VfsRemoveFolder(``HANDLE hInstance, char* RemotePath``);``` ``
`void __stdcall VfsNetworkGetSupportedProtocols(````char* Protocols, int MaxLen);```
`int __stdcall VfsNetworkGetConnection(``HANDLE hInstance,` `int Index,` `char*` `Connection, int MaxLen);``` ``
`int __stdcall` `VfsNetworkManageConnection(``HANDLE hInstance,` `HWND MainWin,` `char*` `Connection, int Action, int MaxLen);``` ``
`int __stdcall` `VfsNetworkOpenConnection(``HANDLE hInstance,` `char*` `Connection,` `char*``RootDir,``` `char*``RemotePath, int MaxLen);``` ``
`int __stdcall` `VfsNetworkCloseConnection(``HANDLE hInstance,` `char*` `Connection``);``` ``

### Constants

`VFS_NM_ACTION_ADD = 0;`
`VFS_NM_ACTION_EDIT = 1;`
`VFS_NM_ACTION_DELETE = 2;`
`VFS_RET_OK = 0;`
`VFS_RET_FAILED = 1;`
`VFS_RET_ABORTED = 2;`
`VFS_RET_NOT_SUPPORTED = 3;```
```VFS_RET_FILE_NOT_FOUND = 4;```
`VFS_RET_FILE_EXISTS = 5;`
`VFS_RET_READ_ERROR = 6;`
`VFS_RET_WRITE_ERROR = 7;`
`VFS_EXEC_OK = 0;`
`VFS_EXEC_ERROR = 1;`
`VFS_EXEC_YOURSELF = 2;`
`VFS_EXEC_SYMLINK = 3;`

## Description

### Functions and Procedures

`HANDLE __stdcall VfsOpen(char* Path);` ``
Initialize and open plugin file system. ###### Parameters Path Path that must be opened by plugin ###### Returns The function returns plugin instance handle if successful, `NULL` otherwise

`void __stdcall VfsClose(HANDLE` `hInstance``);``` ``
Finalize and close plugin file system. ###### Parameters Handle Plugin file system instance handle that have been returned by FsOpen

`BOOL __stdcall VfsMoveFile(``HANDLE hInstance, char* OldName, char* NewName, int CopyFlags``);` ``
VfsMoveFile is called to transfer (copy or move) a file within the plugin's file system. ###### Parameters `hInstance` Plugin file system instance handle `OldName` Name of the remote source file, with full path `NewName` Name of the remote destination file, with full path `CopyFlags``` Can be a combination of the VFS_COPYFLAGS_XXX flags ###### Returns The function returns `True` if successful, `False` otherwise

`BOOL __stdcall VfsGetFile(``HANDLE hInstance, char* RemoteName,char* LocalName,int CopyFlags``);` ``
VfsGetFile is called to transfer a file from the plugin's file system to the normal file system. ###### Parameters `hInstance` Plugin file system instance handle `RemoteName` Name of the file to be retrieved, with full path `LocalName` Local file name with full path `CopyFlags``` Can be a combination of the VFS_COPYFLAGS_XXX flags ###### Returns The function returns `True` if successful, `False` otherwise

`BOOL __stdcall VfsPutFile(``HANDLE hInstance, char* LocalName, char* RemoteName, int CopyFlags``);` ``
VfsPutFile is called to transfer a file from the normal file system to the plugin's file system. ###### Parameters `hInstance` Plugin file system instance handle `LocalName` Local file name with full path `RemoteName` Name of the remote file, with full path `CopyFlags``` Can be a combination of the VFS_COPYFLAGS_XXX flags ###### Returns The function returns `True` if successful, `False` otherwise

`BOOL __stdcall VfsDeleteFile(``HANDLE hInstance, char* RemotePath``);` ``
VfsDeleteFile is called to delete a file from the plugin's file system. ###### Parameters `hInstance` Plugin file system instance handle ```RemotePath``` Name of the file to be deleted, with full path ###### Returns The function returns `True` if successful, `False` otherwise

`int __stdcall VfsExecuteFile(HANDLE` `hInstance, HWND MainWin,` `char* RemoteName, char* Verb``);` ``
VfsExecuteFile is called to execute a file on the plugin's file system, or show its property sheet. ###### Parameters `hInstance` Plugin file system instance handle `MainWin` Parent window which can be used for showing a property sheet `RemoteName` Name of the file to be executed, with full path `Verb` Plugin file system instance handle that have been returned by VfsOpen ###### Returns The function returns `True` if successful, `False` otherwise

`int __stdcall VfsCreateFolder(HANDLE` `hInstance,` `char* RemoteName``);` ``
VfsCreateFolder is called to create a directory on the plugin's file system. ###### Parameters `hInstance` Plugin file system instance handle `RemoteName` Name of the directory to be created, with full path ###### Returns The function returns `True` if successful, `False` otherwise

`int __stdcall VfsRemoveFolder(HANDLE` `hInstance, char* RemoteName``);` ``
VfsRemoveFolder is called to remove a directory from the plugin's file system. ###### Parameters `hInstance` Plugin file system instance handle `RemoteName` Name of the directory to be removed, with full path ###### Returns The function returns `True` if successful, `False` otherwise

`void __stdcall VfsNetworkGetSupportedProtocols(char* Protocols, int MaxLen);` ``
VfsNetworkGetSupportedProtocols is called to retrieve protocols that supported by plugin. ###### Parameters Protocols Pointer to a buffer (allocated by the calling program) which can receive the semicolon separated protocol list, e.g. "http://;ftp://" MaxLen Maximum number of characters (including the final 0) which fit in the buffer.

```BOOL __stdcall VfsNetworkGetConnection(``int Index, char*` `Connection, int MaxLen);` ``````
VfsNetworkGetConnection is called to enumerate all connections that plugin has. Index is increased by 1 starting from 0 until the plugin returns `False`. ###### Parameters Index The index of the connection for which DC requests information. Starting with 0, the Index is increased until the plugin returns `False`. Connection Here the plugin has to return the name of the connection with index Index. You may return a maximum of maxlen characters, including the trailing 0. MaxLen The maximum number of characters, including the trailing 0, which may be returned in each of the connections. ###### Returns The function returns `True` if successful, `False` otherwise

```BOOL __stdcall` `VfsNetworkManageConnection(``HWND MainWin, char*` `Connection, int Action, int MaxLen);` ````````
VfsNetworkManageConnection is called from "Connection manager" dialog when user wants to add/edit/delete connection. ###### Parameters MainWin Parent window which can be used for showing a connection configuration dialog. Connection In: Connection name for edit/delete action Out: Connection name of new connection for add action Action Action type: `FS_NM_ACTION_ADD` or `FS_NM_ACTION_EDIT` or `FS_NM_ACTION_DELETE` MaxLen Maximum number of characters that you can return in Connection, including the final 0. ###### Returns The function returns `True` if successful, `False` otherwise

```BOOL __stdcall` `VfsNetworkOpenConnection(``char*` `Connection,` `char*``RootDir,``` `char*``RemotePath, int MaxLen);` ``````
VfsNetworkOpenConnection is called when the user wants to open a connection to the network. ###### Parameters Connection In: Connection name Out: Server address, e.g. "ftp://ftp.chg.ru" RootDir Here the plugin has to return the root directory of the opening connection, e.g. "/" RemotePath Here the plugin has to return the remote path of the opening connection, e.g. "/pub/Linux" MaxLen Maximum number of characters that you can return in Connection, RootDir and RemotePath, including the final 0. ###### Returns The function returns `True` if successful, `False` otherwise

```BOOL __stdcall` `VfsNetworkCloseConnection(``char*` `Connection``);` ``````
VfsNetworkOpenConnection is called when the user wants to close a connection to the network. ###### Parameters Connection Connection name ###### Returns The function returns `True` if successful, `False` otherwise

### Constants

``VFS_NM_ACTION_ADD = 0;``
Add connection action.

``VFS_NM_ACTION_EDIT = 1;``
Edit connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

```VFS_RET_OK` = 0;``
Delete connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

``VFS_NM_ACTION_DELETE = 2;``
Delete connection action.

Double Commander DFX plugin API