Using the API

The sequence of API calls when using CBFS Disk is

  1. call SetRegistrationKey to set the license key and enable CBFS Disk. CBFS Disk doesn't work without the license key (either registered or evaluation). You can request the evaluation key via request form.
  2. Install the driver if it has not been installed yet. You don't need to call InstallDriver every time your application is started.
  3. Create a virtual disk device using CreateStorage method.
  4. Create one or more mounting points. Mounting point can be a UNC path (eg. "\\.\MyDisk") or a drive letter (eg. "Z:"). You can add several mounting points to one disk device using AddMountingPoint method.
  5. Now it's time to ensure, that the driver can read and write from / to the storage. You must implement handlers for OnFileRead, OnFileWrite and OnGetFileSize events.
  6. Call MountMedia method to "insert a disk" to the virtual device.
  7. The mounted disk image acts much like a regular hard drive, i.e. it is not formatted and you need to format it using system utilities (CBFS Disk doesn't have built-in functions that would implement a file system). You can format the disk to FAT or NTFS using system utilities. If you need a sophisticated file system with compression, encryption and other advanced features (and without royalties), take a look at CBFS Storage, which is a superset of CBFS Disk.
  8. When you finish your work with the disk, unmount it.
  9. You can change the "disks" without deleting and recreating a disk device using MountMedia and UnmountMedia methods.
  10. Delete the storage from the system using DeleteStorage method.
  11. To remove the driver from the system, call UninstallDriver method.