The CBDisk component lets applications create a virtual disk backed by a contiguous block of data.
The CBDisk component is used to create a virtual disk whose contents are stored in one contiguous block of data. CBDisk doesn't implement any filesystem functionality, nor does it attempt to process virtual disks' contents in any way; its minimal API is focused wholly on the efficient transfer of raw disk data.
Therefore, a CBDisk-based application's only responsibility is to maintain a finite block of data for each virtual disk, reading from and writing to it as instructed by the component. This block of data functions as a virtual disk's storage space, and it can be located anywhere the application desires.
Newly-created virtual disks begin in a raw state, and must be formatted with a known filesystem (e.g., NTFS, FAT32, exFAT, etc.) using standard Windows formatting utilities. Once a virtual disk has been formatted, it can be used just like any other storage device. When the application is finished with a virtual disk, the block of data associated with it can be saved so that the virtual disk can be "re-created" at a later time.
The CBDisk component can be used in applications for Windows operating system.
Each CBDisk component instance controls a single virtual disk. Applications can use multiple instances of the CBDisk component if their use-case requires the creation of multiple virtual disks. The component's Tag property can be used to distinguish between instances during event handlers by storing some disk-specific information ("disk context") or UID.
Here's how to get up and running:
- If the system driver hasn't been installed yet, call the Install method to do so. This only needs to be done once.
- In production, the system driver can be installed (or updated) ahead-of-time by the application's installation script using the Installer DLL. Please refer to the Driver Installation in Windows topic for more information.
- Call the Initialize method to initialize the CBDisk component. This must be done each time the application starts (if the application is using multiple CBDisk component instances, only the first instance created should be used to call Initialize).
- Ensure that the component's event handlers have been implemented so that the driver can read and write raw disk data. Please refer to the events' documentation for more information.
- Create a virtual disk by calling the CreateStorage method.
- Create one or more Mounting Points for the virtual disk using the AddMountingPoint method. A mounting point can be a drive letter, a UNC path, or a directory on an existing NTFS-formatted drive.
- Call the MountMedia method to "insert storage media" into the virtual disk drive. (This "media" can be changed at any time later using the UnmountMedia and MountMedia methods.)
- Later, the application can unmount the "media" from the virtual disk using the UnmountMedia method. At this point, the application could call the MountMedia method again to "insert different storage media".
- To delete the virtual disk entirely, call the DeleteStorage method.
- To uninstall the system driver, call the Uninstall method. This should not be done as part of the driver upgrade process.
- In production, the system driver can be uninstalled by the application's uninstallation script using the Installer DLL. Please refer to the Driver Installation in Windows topic for more information.
The following is the full list of the properties of the component with short descriptions. Click on the links for further details.
|Active||Whether the component is active and handling OS requests.|
|MountingPoints||Collection of mounting points for the virtual drive.|
|ReadOnly||Whether the virtual drive should be mounted in read-only mode.|
|StorageCharacteristics||The characteristic flags to create the virtual drive with. (Windows only).|
|StorageGUID||The GUID to create the virtual drive with.|
|StoragePresent||Whether a virtual drive has been created.|
|StorageType||The type of virtual drive to create. (Windows only).|
|Tag||Stores application-defined data specific to this instance of the component.|
The following is the full list of the methods of the component with short descriptions. Click on the links for further details.
|AddMountingPoint||Adds a mounting point for the virtual drive.|
|Config||Sets or retrieves a configuration setting.|
|CreateStorage||Creates the virtual drive.|
|DeleteStorage||Deletes the virtual drive.|
|GetDriverStatus||Retrieves the status of the system driver.|
|GetModuleVersion||Retrieves the version of a given product module.|
|Initialize||Initializes the component.|
|Install||Installs (or upgrades) the product's system drivers and/or helper DLL. (Windows only).|
|IsIconRegistered||Checks whether the specified icon is registered.|
|MountMedia||Mounts media in the virtual drive, making it accessible for reading and writing.|
|RegisterIcon||Registers an icon that can be displayed as an overlay on the virtual drive in Windows Explorer.|
|RemoveMountingPoint||Removes a mounting point for the virtual drive.|
|ResetIcon||Resets the virtual drive's icon back to default by deselecting the active overlay icon.|
|SetIcon||Selects a registered overlay icon for display on the virtual drive in Windows Explorer.|
|ShutdownSystem||Shuts down or reboots the operating system.|
|Uninstall||Uninstalls the product's system drivers and/or helper DLL. (Windows only).|
|UnmountMedia||Unmounts media from the virtual drive.|
|UnregisterIcon||Unregisters an existing overlay icon.|
The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.
|DiskRead||Fires when the OS needs to read data from the virtual disk.|
|DiskWrite||Fires when the OS needs to write data to the virtual disk.|
|Ejected||Fires when the media and virtual drive have been ejected.|
|Error||Fires if an unhandled error occurs during an event.|
|GetDiskSize||Fires when the OS needs to retrieve the size of the virtual disk.|
The following is a list of configuration settings for the component with short descriptions. Click on the links for further details.
|AsyncDeleteStorageNotifications||Whether system broadcasts for virtual drive deletion are sent asynchronously.|
|LoggingEnabled||Whether extended logging is enabled.|
|SectorSize||The sector size to create the virtual drive with.|
|SupportSearchIndexer||Specifies whether the driver must take additional measures to support indexing by Windows Search.|
|VolumeGuidName||The GUID of the mounted volume.|