CBVaultDrive Component

Properties   Methods   Events   Config Settings   Errors  

The CBVaultDrive component lets applications create a vault, manipulate its contents, and mount it as a virtual drive.

Syntax

cbfsstorage.CBVaultDrive

Remarks

The CBVaultDrive component provides a superset of the functionality offered by the CBVAULT component. In addition to allowing applications to create and interact with a vault directly, the CBVaultDrive component can mount a vault as a virtual drive, allowing its contents to be accessed by the system and third-party applications.

Unlike the CBVAULT component, which can be used as-is, the CBVaultDrive component requires additional deployment steps; please refer to the Windows-specific deployment topics deployment topics for more information. For more information about using CBFS Storage's many features, please refer to the extensive General Information topics.

Getting Started

Each CBVaultDrive component instance controls a single vault-based virtual drive. Applications can use multiple instances of the CBVaultDrive component if their use-case requires that multiple vaults be mounted simultaneously.

Here's how to get up and running:

  1. Ensure that the required Prerequisites have been satisfied. On Windows, for example, this involves installing the system driver, which can be done using the Install method.
  2. Call the Initialize method to initialize the CBVaultDrive component. This must be done each time the application starts (if the application is using multiple CBVaultDrive component instances, only the first instance created should be used to call Initialize).
  3. If the application is using custom compression, custom encryption, or callback mode, ensure that the appropriate event handlers have been implemented. Please refer to the linked topics for more information.
  4. Call the OpenVault method to create/open a vault and mount it as a virtual drive.
  5. Create one or more Mounting Points for the virtual drive using the AddMountingPoint method.
  6. At this point, the system and other processes will be able to access the vault's contents via the virtual drive.
  7. Later, the application can close the vault and unmount the associated virtual drive by calling the CloseVault method.

Property List


The following is the full list of the properties of the component with short descriptions. Click on the links for further details.

AccessDeniedProcessCountThe number of records in the AccessDeniedProcess arrays.
AccessDeniedProcessDesiredAccessThe kind of access granted or denied.
AccessDeniedProcessIncludeChildrenWhether child processes are affected.
AccessDeniedProcessIdThe Id of the target process.
AccessDeniedProcessNameThe filename of the target process's executable.
AccessGrantedProcessCountThe number of records in the AccessGrantedProcess arrays.
AccessGrantedProcessDesiredAccessThe kind of access granted or denied.
AccessGrantedProcessIncludeChildrenWhether child processes are affected.
AccessGrantedProcessIdThe Id of the target process.
AccessGrantedProcessNameThe filename of the target process's executable.
ActiveWhether a vault has been opened and mounted as a virtual drive.
AutoCompactAtThis property specifies the free space percentage threshold a vault must reach to be eligible for automatic compaction.
CallbackModeThis property specifies whether the component should operate in callback mode.
CaseSensitiveThis property specifies whether the component should open a vault in case-sensitive mode.
DefaultFileAccessPasswordThis property specifies the default encryption password to use when opening files and alternate streams.
DefaultFileCompressionThis property specifies the default compression mode to use when creating files and alternate streams.
DefaultFileCreatePasswordThis property specifies the default encryption password to use when creating new files and alternate streams.
DefaultFileEncryptionThis property specifies the default encryption mode to use when creating files and alternate streams.
FileSystemNameThe name of the virtual filesystem.
IsCorruptedThis property specifies whether the vault is corrupted.
LastWriteTimeThis property specifies the last modification time of the vault.
LogoThis property specifies an application-defined text-based logo stored in the second page of a vault.
MountingPointCountThe number of records in the MountingPoint arrays.
MountingPointAuthenticationIdThe Authentication ID used when creating the mounting point, if applicable.
MountingPointFlagsThe flags used to create the mounting point.
MountingPointNameThe mounting point name.
OpenFilesCountThe number of records in the OpenFile arrays.
OpenFileNameThe name of the open file.
OpenFileProcessIdThe Id of the process that opened the file.
OpenFileProcessNameThe name of the process that opened the file.
PageSizeThis property specifies the vault's page size.
PathSeparatorThis property specifies the path separator character to use when returning vault paths.
PossibleFreeSpaceThis property specifies the maximum amount of free space the vault could possibly have available.
PossibleSizeThis property specifies the maximum size the vault could possibly be.
ProcessRestrictionsEnabledWhether process access restrictions are enabled.
ReadOnlyThis property specifies whether the component should open a vault in read-only mode.
ReportPossibleSizeHow the component should report the virtual drive's size and free space to the OS.
SerializeEventsWhether events should be fired on a single worker thread, or many.
StorageCharacteristicsThe characteristic flags to create the virtual drive with (Windows only).
StorageGUIDThe GUID to create the virtual drive with.
StorageTypeThe type of virtual drive to create (Windows only).
TagThis property stores application-defined data specific to a particular instance of the component.
TimeoutHow long vault events may execute before timing out (Windows only).
UnmountOnTerminationWhether the virtual drive should be unmounted if the application terminates (Windows only).
UseAccessTimeThis property specifies whether the component should keep track of last access times for vault items.
UseSystemCacheThis property specifies whether the operating system's cache is used.
VaultEncryptionThis property specifies the whole-vault encryption mode.
VaultFileThis property specifies the vault to create or open.
VaultFreeSpaceThis property reflects the actual amount of free space the vault has available.
VaultPasswordThis property specifies the whole-vault encryption password.
VaultSizeThis property specifies the actual size of the vault.
VaultSizeMaxThis property specifies the maximum size a vault can be.
VaultSizeMinThis property specifies the minimum size a vault can be.
VaultStateThis property specifies information about the state of the vault.

Method List


The following is the full list of the methods of the component with short descriptions. Click on the links for further details.

AddDeniedProcessAdds a rule that prevents a process from accessing the virtual drive.
AddGrantedProcessAdds a rule that allows a process to access the virtual drive.
AddMountingPointAdds a mounting point for the virtual drive.
CacheFilePasswordThis method caches an encryption password to use the next time a file or alternate stream is accessed or removes the cached password.
CheckAndRepairThis method checks a vault's consistency and repairs it as necessary.
CheckFilePasswordThis method verifies whether a particular file password is correct.
CheckVaultPasswordThis method verifies whether a particular vault password is correct.
CloseOpenedFilesSnapshotCloses the previously-created opened files snapshot.
CloseVaultCloses the vault.
CompactVaultThis method compacts the vault.
ConfigSets or retrieves a configuration setting.
ConvertToDrivePathConverts a vault-local vault item path to a virtual drive file path (Windows only).
ConvertToVaultPathConverts a virtual drive file path to a vault-local vault item path (Windows only).
CreateDirectoryThis method creates a new directory in the vault.
CreateLinkThis method creates a symbolic link to another file in the vault.
CreateOpenedFilesSnapshotCreates a snapshot of information about files that are currently open.
DeleteFileThis method deletes a vault item.
DeleteFileTagThis method deletes a file tag.
EjectVolumeEjects a removable storage volume formatted with the CBFS Storage filesystem (Windows only).
FileExistsThis method checks whether a vault item exists.
FileMatchesMaskThis method checks whether a particular file or directory name matches the specified mask.
FileTagExistsThis method checks whether a file tag exists.
FileTimeToNanosecondsThis method returns the subsecond part of the time expressed in nanoseconds.
FileTimeToUnixTimeThis method converts FileTime to Unix time format.
FindCloseThis method closes a search operation and releases any associated resources.
FindFirstThis method searches for the first vault item that matches the specified name and attributes.
FindFirstByQueryThis method searches for the first file or directory whose file tags match the specified query.
FindNextThis method searches for the next vault item that matches an ongoing search operation.
ForceUnmountForcefully unmounts the virtual drive associated with the specified vault (Windows only).
FormatVolumeFormats a storage volume or partition with the CBFS Storage filesystem (Windows only).
GetDriverStatusRetrieves the status of the system driver.
GetFileAttributesThis method retrieves the attributes of a vault item.
GetFileCompressionThis method retrieves the compression mode of a file or alternate stream.
GetFileCreationTimeThis method retrieves the creation time of a vault item.
GetFileEncryptionThis method retrieves the encryption mode of a file or alternate stream.
GetFileLastAccessTimeThis method retrieves the last access time of a vault item.
GetFileModificationTimeThis method retrieves the modification time of a vault item.
GetFileSizeThis method retrieves the size of a file or alternate stream.
GetFileTagThis method retrieves the binary data held by a raw file tag attached to the specified vault item.
GetFileTagAsAnsiStringThis method retrieves the value of an AnsiString-typed file tag attached to the specified vault item.
GetFileTagAsBooleanThis method retrieves the value of a Boolean-typed file tag attached to the specified vault item.
GetFileTagAsDateTimeThis method retrieves the value of a DateTime-typed file tag attached to the specified vault item.
GetFileTagAsNumberThis method retrieves the value of a Number-typed file tag attached to the specified vault item.
GetFileTagAsStringThis method retrieves the value of a String-typed file tag attached to the specified vault item.
GetFileTagDataTypeThis method retrieves the data type of a typed file tag attached to a specific vault item.
GetFileTagSizeThis method retrieves the size of a raw file tag attached to the specified vault item.
GetModuleVersionRetrieves the version of a given product module.
GetOriginatorProcessIdRetrieves the Id of the process (PID) that initiated the operation.
GetOriginatorProcessNameRetrieves the name of the process that initiated the operation.
GetOriginatorThreadIdRetrieves the Id of the thread that initiated the operation (Windows only).
GetOriginatorTokenRetrieves the security token associated with the process that initiated the operation (Windows only).
GetSearchResultAttributesThis method retrieves the attributes of a vault item found during a search operation.
GetSearchResultCreationTimeThis method retrieves the creation time of a vault item found during a search operation.
GetSearchResultFullNameThis method retrieves the fully qualified name of a vault item found during a search operation.
GetSearchResultLastAccessTimeThis method retrieves the last access time of a vault item found during a search operation.
GetSearchResultLinkDestinationThis method retrieves the destination of a symbolic link found during a search operation.
GetSearchResultMetadataSizeThis method retrieves the size of the metadata associated with a vault item found during a search operation.
GetSearchResultModificationTimeThis method retrieves the modification time of a vault item found during a search operation.
GetSearchResultNameThis method retrieves the name of a vault item found during a search operation.
GetSearchResultSizeThis method retrieves the size of a vault item found during a search operation.
InitializeThis method initializes the component.
InstallInstalls (or upgrades) the product's system drivers and/or the helper DLL (Windows only).
IsDirectoryEmptyThis method checks whether a directory is empty.
IsIconRegisteredChecks whether the specified icon is registered (Windows only).
IsValidVaultThis method checks whether a local file is a CBFS Storage vault.
IsValidVaultVolumeChecks whether a storage partition or volume is formatted with the CBFS Storage filesystem (Windows only).
MoveFileThis method renames or moves a vault item.
OpenFileThis method opens a new or existing file or alternate stream in the vault.
OpenFileExThis method opens a new or existing file or alternate stream in the vault.
OpenRootDataThis method opens the vault's root data stream.
OpenVaultThis method opens a new or existing vault.
OpenVolumeOpens a storage volume or partition formatted with the CBFS Storage filesystem as a vault (Windows only).
RegisterIconRegisters an icon that can be displayed as an overlay on the virtual drive in Windows Explorer (Windows only).
RemoveDeniedProcessRemoves a rule that prevents a process from accessing the virtual drive.
RemoveGrantedProcessRemoves a rule that allows a process to access the virtual drive.
RemoveMountingPointRemoves a mounting point for the virtual drive.
ResetIconResets the virtual drive's icon back to default by deselecting the active overlay icon (Windows only).
ResolveLinkThis method retrieves the destination of a symbolic link.
SetFileAttributesThis method sets the attributes of a vault item.
SetFileCompressionThis method compresses or decompresses a file or alternate stream.
SetFileCreationTimeThis method sets the creation time of a vault item.
SetFileEncryptionThis method encrypts, decrypts, or changes the encryption password of a file or alternate stream.
SetFileLastAccessTimeThis method sets the last access time of a vault item.
SetFileModificationTimeThis method sets the modification time of a vault item.
SetFileSizeThis method sets the size of a file or alternate stream.
SetFileTagThis method attaches a raw file tag with binary data to the specified vault item.
SetFileTagAsAnsiStringThis method attaches an AnsiString-typed file tag to the specified vault item.
SetFileTagAsBooleanThis method attaches a Boolean-typed file tag to the specified vault item.
SetFileTagAsDateTimeThis method attaches a DateTime-typed file tag to the specified vault item.
SetFileTagAsNumberThis method attaches a Number-typed file tag to the specified vault item.
SetFileTagAsStringThis method attaches a String-typed file tag to the specified vault item.
SetIconSelects a registered overlay icon for display on the virtual drive in Windows Explorer (Windows only).
ShutdownSystemShuts down or reboots the operating system.
UninstallUninstalls the product's system drivers and/or helper DLL (Windows only).
UnixTimeToFileTimeThis method converts the date/time in Unix format to the Windows FileTime format.
UnregisterIconUnregisters an existing overlay icon (Windows only).
UpdateVaultEncryptionThis method encrypts, decrypts, or changes the encryption password of the vault.

Event List


The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.

DataCompressThis event fires to compress a block of data using a custom compression algorithm.
DataDecompressThis event fires to decompress a block of data using a custom compression algorithm.
DataDecryptThis event fires to decrypt a block of data using a custom encryption implementation.
DataEncryptThis event fires to encrypt a block of data using a custom encryption implementation.
EjectedFires when the media and virtual drive have been ejected (Windows only).
ErrorThis event fires if an unhandled error occurs during an event.
FileAccessFires when the OS wants to create or open a file or directory.
FileAfterCopyThis event fires after the file has been copied during file export/import operations.
FileBeforeCopyThis event fires before the file is copied during file export/import operations.
FilePasswordNeededThis event fires if a password is needed to open an encrypted file.
HashCalculateThis event fires to calculate a password hash using a custom hashing implementation.
KeyDeriveThis event fires to derive an encryption key using a custom key derivation implementation.
ProgressThis event fires to indicate the progress of long-running vault operations.
VaultCloseThis event fires to close a callback mode vault.
VaultDeleteThis event fires to delete a callback mode vault.
VaultFlushThis event fires to flush a callback mode vault's data out to storage.
VaultGetParentSizeThis event fires to determine how much free space is available for growing a callback mode vault.
VaultGetSizeThis event fires to determine the size of a callback mode vault.
VaultOpenThis event fires to open a new or existing callback mode vault.
VaultReadThis event fires to read data from a callback mode vault.
VaultSetSizeThis event fires to resize a callback mode vault.
VaultWriteThis event fires to write data to a callback mode vault.
WorkerThreadCreationFires just after a new worker thread is created.
WorkerThreadTerminationFires just before a worker thread is terminated.

Config Settings


The following is a list of config settings for the component with short descriptions. Click on the links for further details.

AllowMoveStreamsBetweenFilesWhether alternate streams may be moved from one file to another.
AsyncDeleteStorageNotificationsWhether system broadcasts for virtual drive deletion are sent asynchronously.
AutoCompactDelayHow long a vault must remain idle before starting automatic compaction.
DefaultFileCompressionLevelThe default compression level to use when creating files and alternate streams.
FireFileAccessEventWhether FileAccess event is fired.
LoggingEnabledWhether extended logging is enabled.
MaxNonPagedNameLengthThe maximum number of name characters to store directly within a vault item.
MaxWorkerThreadCountThe maximum number of worker threads to use to fire events.
MinWorkerThreadCountThe minimum number of worker threads to use to fire events.
PageCacheSizeThe size of the in-memory vault page cache.
PartSizeThe part size used by a multipart vault.
SupportSearchIndexerSpecifies whether the driver must take additional measures to support indexing by Windows Search.
VolumeGuidNameThe GUID of the mounted volume.
WorkerInitialStackSizeThe initial stack size to create worker threads with.

AccessDeniedProcessCount Property (CBVaultDrive Component)

The number of records in the AccessDeniedProcess arrays.

Syntax

func (obj *CBVaultDrive) AccessDeniedProcessCount() (int32, error)

Default Value

0

Remarks

This property controls the size of the following arrays:

The array indices start at 0 and end at AccessDeniedProcessCount - 1.

This property is read-only.

Data Type

int32

AccessDeniedProcessDesiredAccess Property (CBVaultDrive Component)

The kind of access granted or denied.

Syntax

func (obj *CBVaultDrive) AccessDeniedProcessDesiredAccess(AccessDeniedProcessIndex int32) (int32, error)

Default Value

0

Remarks

The kind of access granted or denied.

This property specifies what kind of access is granted or denied by the rule. Possible values are:

STG_DACCESS_READ0x00000001Grant/deny read access.

STG_DACCESS_WRITE0x00000002Grant/deny write access.

STG_DACCESS_READWRITE0x00000003Grant/deny read and write access.

The AccessDeniedProcessIndex parameter specifies the index of the item in the array. The size of the array is controlled by the AccessDeniedProcessCount property.

This property is read-only.

Data Type

int32

AccessDeniedProcessIncludeChildren Property (CBVaultDrive Component)

Whether child processes are affected.

Syntax

func (obj *CBVaultDrive) AccessDeniedProcessIncludeChildren(AccessDeniedProcessIndex int32) (bool, error)

Default Value

false

Remarks

Whether child processes are affected.

This property indicates whether the rule applies to children of the target process.

The AccessDeniedProcessIndex parameter specifies the index of the item in the array. The size of the array is controlled by the AccessDeniedProcessCount property.

This property is read-only.

Data Type

bool

AccessDeniedProcessId Property (CBVaultDrive Component)

The Id of the target process.

Syntax

func (obj *CBVaultDrive) AccessDeniedProcessId(AccessDeniedProcessIndex int32) (int32, error)

Default Value

0

Remarks

The Id of the target process.

This property reflects the target process's Id (PID). Will be 0 if the target process was specified by AccessDeniedProcessProcessName, or -1 if the rule applies to all processes.

The AccessDeniedProcessIndex parameter specifies the index of the item in the array. The size of the array is controlled by the AccessDeniedProcessCount property.

This property is read-only.

Data Type

int32

AccessDeniedProcessName Property (CBVaultDrive Component)

The filename of the target process's executable.

Syntax

func (obj *CBVaultDrive) AccessDeniedProcessName(AccessDeniedProcessIndex int32) (string, error)

Default Value

""

Remarks

The filename of the target process's executable.

This property reflects the full filename of the target process's executable. Will be empty if the target process was specified by AccessDeniedProcessProcessId (or if the rule applies to all processes, in which case AccessDeniedProcessProcessId will be -1).

The AccessDeniedProcessIndex parameter specifies the index of the item in the array. The size of the array is controlled by the AccessDeniedProcessCount property.

This property is read-only.

Data Type

string

AccessGrantedProcessCount Property (CBVaultDrive Component)

The number of records in the AccessGrantedProcess arrays.

Syntax

func (obj *CBVaultDrive) AccessGrantedProcessCount() (int32, error)

Default Value

0

Remarks

This property controls the size of the following arrays:

The array indices start at 0 and end at AccessGrantedProcessCount - 1.

This property is read-only.

Data Type

int32

AccessGrantedProcessDesiredAccess Property (CBVaultDrive Component)

The kind of access granted or denied.

Syntax

func (obj *CBVaultDrive) AccessGrantedProcessDesiredAccess(AccessGrantedProcessIndex int32) (int32, error)

Default Value

0

Remarks

The kind of access granted or denied.

This property specifies what kind of access is granted or denied by the rule. Possible values are:

STG_DACCESS_READ0x00000001Grant/deny read access.

STG_DACCESS_WRITE0x00000002Grant/deny write access.

STG_DACCESS_READWRITE0x00000003Grant/deny read and write access.

The AccessGrantedProcessIndex parameter specifies the index of the item in the array. The size of the array is controlled by the AccessGrantedProcessCount property.

This property is read-only.

Data Type

int32

AccessGrantedProcessIncludeChildren Property (CBVaultDrive Component)

Whether child processes are affected.

Syntax

func (obj *CBVaultDrive) AccessGrantedProcessIncludeChildren(AccessGrantedProcessIndex int32) (bool, error)

Default Value

false

Remarks

Whether child processes are affected.

This property indicates whether the rule applies to children of the target process.

The AccessGrantedProcessIndex parameter specifies the index of the item in the array. The size of the array is controlled by the AccessGrantedProcessCount property.

This property is read-only.

Data Type

bool

AccessGrantedProcessId Property (CBVaultDrive Component)

The Id of the target process.

Syntax

func (obj *CBVaultDrive) AccessGrantedProcessId(AccessGrantedProcessIndex int32) (int32, error)

Default Value

0

Remarks

The Id of the target process.

This property reflects the target process's Id (PID). Will be 0 if the target process was specified by AccessGrantedProcessProcessName, or -1 if the rule applies to all processes.

The AccessGrantedProcessIndex parameter specifies the index of the item in the array. The size of the array is controlled by the AccessGrantedProcessCount property.

This property is read-only.

Data Type

int32

AccessGrantedProcessName Property (CBVaultDrive Component)

The filename of the target process's executable.

Syntax

func (obj *CBVaultDrive) AccessGrantedProcessName(AccessGrantedProcessIndex int32) (string, error)

Default Value

""

Remarks

The filename of the target process's executable.

This property reflects the full filename of the target process's executable. Will be empty if the target process was specified by AccessGrantedProcessProcessId (or if the rule applies to all processes, in which case AccessGrantedProcessProcessId will be -1).

The AccessGrantedProcessIndex parameter specifies the index of the item in the array. The size of the array is controlled by the AccessGrantedProcessCount property.

This property is read-only.

Data Type

string

Active Property (CBVaultDrive Component)

Whether a vault has been opened and mounted as a virtual drive.

Syntax

func (obj *CBVaultDrive) Active() (bool, error)

Default Value

false

Remarks

This property reflects whether the component has opened a vault and mounted a virtual drive for it; it will be true once the OpenVault or OpenVolume method has been called successfully.

This property is read-only.

Data Type

bool

AutoCompactAt Property (CBVaultDrive Component)

This property specifies the free space percentage threshold a vault must reach to be eligible for automatic compaction.

Syntax

func (obj *CBVaultDrive) AutoCompactAt() (int32, error)
func (obj *CBVaultDrive) SetAutoCompactAt(value int32) error

Default Value

25

Remarks

This property specifies the percentage of free space a vault must have, at minimum, for it to be eligible for automatic vault compaction. An eligible vault may be compacted automatically in the background at any time. Please refer to the CompactVault method for more information about the compacting process.

To guard against excessive automatic compaction operations, applications can set the AutoCompactDelay configuration setting to a nonzero value. Alternatively, this property can be set to 0 to disable automatic compaction completely.

A vault opened in ReadOnly mode will never be compacted, regardless of this property's value.

Note: This property cannot be changed within events.

Data Type

int32

CallbackMode Property (CBVaultDrive Component)

This property specifies whether the component should operate in callback mode.

Syntax

func (obj *CBVaultDrive) CallbackMode() (bool, error)
func (obj *CBVaultDrive) SetCallbackMode(value bool) error

Default Value

false

Remarks

This property specifies whether the component should operate in callback mode, causing all vault access to be performed through the following events. Please refer to the Callback Mode topic for more information.

When this property is enabled, the following events must all be implemented for the component to function correctly:

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

bool

CaseSensitive Property (CBVaultDrive Component)

This property specifies whether the component should open a vault in case-sensitive mode.

Syntax

func (obj *CBVaultDrive) CaseSensitive() (bool, error)
func (obj *CBVaultDrive) SetCaseSensitive(value bool) error

Default Value

false

Remarks

This property specifies whether the component should open a vault in case-sensitive mode. Enabling this property causes all file, directory, symbolic link, alternate stream, and file tag names to be treated as case sensitive.

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

bool

DefaultFileAccessPassword Property (CBVaultDrive Component)

This property specifies the default encryption password to use when opening files and alternate streams.

Syntax

func (obj *CBVaultDrive) DefaultFileAccessPassword() (string, error)
func (obj *CBVaultDrive) SetDefaultFileAccessPassword(value string) error

Default Value

""

Remarks

This property specifies the default encryption password that the component should use when opening files and alternate streams.

Please refer to the Encryption topic for more information.

As an alternative to using this property, applications may call the CacheFilePassword method (before a file is opened) to specify a one-time-use password or may specify file encryption passwords dynamically using the FilePasswordNeeded event.

Data Type

string

DefaultFileCompression Property (CBVaultDrive Component)

This property specifies the default compression mode to use when creating files and alternate streams.

Syntax

func (obj *CBVaultDrive) DefaultFileCompression() (int32, error)
func (obj *CBVaultDrive) SetDefaultFileCompression(value int32) error

Default Value

0

Remarks

This property specifies the default compression mode that the component should use when creating files and alternate streams. Valid values are as follows:

VAULT_CM_NONE0Do not use compression.

VAULT_CM_DEFAULT1Use default compression (zlib).

VAULT_CM_CUSTOM2Use event-based custom compression.

This compression level is not used.

VAULT_CM_ZLIB3Use zlib compression.

Valid compression levels are 1-9.

VAULT_CM_RLE4Use RLE compression.

This compression level is not used.

Applications that use custom compression must implement the DataCompress and DataDecompress events. Please refer to the Compression topic for more information.

Applications can also specify a default compression level using the DefaultFileCompressionLevel configuration setting, if desired.

Data Type

int32

DefaultFileCreatePassword Property (CBVaultDrive Component)

This property specifies the default encryption password to use when creating new files and alternate streams.

Syntax

func (obj *CBVaultDrive) DefaultFileCreatePassword() (string, error)
func (obj *CBVaultDrive) SetDefaultFileCreatePassword(value string) error

Default Value

""

Remarks

This property specifies the default encryption password that the component should use when creating new files and alternate streams.

Please refer to the Encryption topic for more information.

Data Type

string

DefaultFileEncryption Property (CBVaultDrive Component)

This property specifies the default encryption mode to use when creating files and alternate streams.

Syntax

func (obj *CBVaultDrive) DefaultFileEncryption() (int32, error)
func (obj *CBVaultDrive) SetDefaultFileEncryption(value int32) error

Default Value

0

Remarks

This property specifies the default encryption mode that the component should use when creating files and alternate streams. Valid values are as follows:

VAULT_EM_NONE0x0Do not use encryption.

VAULT_EM_DEFAULT0x1Use default encryption (VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA256).

VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA2560x2Use AES256 encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

VAULT_EM_CUSTOM256_PBKDF2_HMAC_SHA2560x3Use event-based custom 256-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_PBKDF2_HMAC_SHA2560x4Use event-based custom 512-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_PBKDF2_HMAC_SHA2560x5Use event-based custom 1024-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_CUSTOM_KEY_DERIVE0x23Use event-based custom 256-bit encryption with custom key derivation.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_CUSTOM_KEY_DERIVE0x24Use event-based custom 512-bit encryption with custom key derivation.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_CUSTOM_KEY_DERIVE0x25Use event-based custom 1024-bit encryption with custom key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_DIRECT_KEY0x43Use event-based custom 256-bit encryption with no key derivation.

A 256-bit (32-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM512_DIRECT_KEY0x44Use event-based custom 512-bit encryption with no key derivation.

A 512-bit (64-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM1024_DIRECT_KEY0x45Use event-based custom 1024-bit encryption with no key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_UNKNOWN0xFFUnidentified or unknown encryption.

Applications that use custom encryption must implement at least the DataEncrypt and DataDecrypt events. Certain custom encryption modes may require that the HashCalculate or KeyDerive event be implemented as well. Please refer to the Encryption topic for more information.

Applications that set this property to a value other than VAULT_EM_NONE (the default) should also specify a default encryption password using the DefaultFileCreatePassword property.

Data Type

int32

FileSystemName Property (CBVaultDrive Component)

The name of the virtual filesystem.

Syntax

func (obj *CBVaultDrive) FileSystemName() (string, error)
func (obj *CBVaultDrive) SetFileSystemName(value string) error

Default Value

"FAT32"

Remarks

This property specifies the name of the virtual filesystem. Windows, and some other applications, use this name to identify the filesystem.

In general, the filesystem name can be any reasonable string up to 10 characters in length. However, some versions of Windows and some third-party programs may behave differently when they encounter an unknown filesystem name (i.e., anything other than FAT, FAT32, exFAT, NTFS, etc.). Applications should keep this restriction in mind when choosing a filesystem name.

This property is set to FAT32 by default, which may cause some applications to fail when attempting to copy large (>4GB) files to and from the virtual drive. It is recommended that applications set this property to exFAT if such issues occur.

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

string

IsCorrupted Property (CBVaultDrive Component)

This property specifies whether the vault is corrupted.

Syntax

func (obj *CBVaultDrive) IsCorrupted() (bool, error)

Default Value

false

Remarks

This property reflects whether the currently open vault is corrupted, as indicated by the presence of the VAULT_ST_CORRUPTED flag in the VaultState property.

The VAULT_ST_CORRUPTED flag is set automatically anytime the component detects that a vault's integrity has been compromised. Calling the CheckAndRepair method for a corrupted vault will clear the flag.

This property is read-only.

Data Type

bool

LastWriteTime Property (CBVaultDrive Component)

This property specifies the last modification time of the vault.

Syntax

func (obj *CBVaultDrive) LastWriteTime() (time.Time, error)

Default Value

0

Remarks

This property reflects the vault's last modification time, specified in UTC.

This property is read-only.

Data Type

time.Time

Logo Property (CBVaultDrive Component)

This property specifies an application-defined text-based logo stored in the second page of a vault.

Syntax

func (obj *CBVaultDrive) Logo() (string, error)
func (obj *CBVaultDrive) SetLogo(value string) error

Default Value

"CBFS Vault"

Remarks

This property is used to control a vault's logo, which is a UTF-16LE string stored in the second page of a vault. A vault's logo is visible to anyone who inspects its raw data and thus can be used to provide information about the vault itself.

Vault logos can be up to 127 characters long (not including the null terminator).

Note: This property cannot be changed within events.

Data Type

string

MountingPointCount Property (CBVaultDrive Component)

The number of records in the MountingPoint arrays.

Syntax

func (obj *CBVaultDrive) MountingPointCount() (int32, error)

Default Value

0

Remarks

This property controls the size of the following arrays:

The array indices start at 0 and end at MountingPointCount - 1.

This property is read-only.

Data Type

int32

MountingPointAuthenticationId Property (CBVaultDrive Component)

The Authentication ID used when creating the mounting point, if applicable.

Syntax

func (obj *CBVaultDrive) MountingPointAuthenticationId(MountingPointIndex int32) (int64, error)

Default Value

0

Remarks

The Authentication ID used when creating the mounting point, if applicable.

If the STGMP_LOCAL flag is included in the MountingPointFlags value, this property reflects the Authentication ID of the user session in which the mounting point was added. Will be 0 if the mounting point was added in the current user session or globally.

The MountingPointIndex parameter specifies the index of the item in the array. The size of the array is controlled by the MountingPointCount property.

This property is read-only.

Data Type

int64

MountingPointFlags Property (CBVaultDrive Component)

The flags used to create the mounting point.

Syntax

func (obj *CBVaultDrive) MountingPointFlags(MountingPointIndex int32) (int32, error)

Default Value

0

Remarks

The flags used to create the mounting point.

This property reflects the flags used to create the mounting point. It is a combination of zero or more of the following:

STGMP_SIMPLE0x00010000Create a simple mounting point.

Simple mounting points may be local or global; and when local, can be made visible in either the current user session or another one.

This flag cannot be combined with STGMP_MOUNT_MANAGER or STGMP_NETWORK, and is implied if neither of those flags are present.

STGMP_MOUNT_MANAGER0x00020000Create a mounting point that appears to the system as a physical device.

When the StorageType property is set to STGT_DISK_PNP, mounting points created using the system mount manager appear as physical devices in the Disk Management snap-in of the Microsoft Management Console (mmc.exe).

This flag is a necessary prerequisite for creating a folder mounting point, which makes a drive accessible via an otherwise empty directory on another NTFS volume.

This flag cannot be combined with STGMP_SIMPLE, STGMP_NETWORK, or STGMP_LOCAL.

Only one mounting point of this type can be added to a virtual drive.

STGMP_NETWORK0x00040000Create a network mounting point.

Network mounting points can be further configured using the various STGMP_NETWORK_* flags described below. Applications that plan to make use of network mounting points must be sure to install the Helper DLL before doing so, otherwise Windows Explorer will not correctly recognize the "network" drive.

This flag cannot be combined with STGMP_SIMPLE or STGMP_MOUNT_MANAGER.

STGMP_LOCAL0x10000000Specifies that a local mounting point should be created.

This flag specifies that a local mounting point should be created rather than a global one. When this flag is set, applications must also pass an appropriate value for the AddMountingPoint method's AuthenticationId parameter.

Passing 0 for AuthenticationId will make the mounting point visible in the current user session. To make the mounting point visible in a different user session instead, pass the target session's Authentication ID.

This flag is valid when combined with STGMP_SIMPLE or STGMP_NETWORK; it cannot be combined with STGMP_MOUNT_MANAGER. Please note that a mounting point can be made available to other computers as a network share, and network shares are always globally visible on the local machine, even if this flag is set.

STGMP_NETWORK_ALLOW_MAP_AS_DRIVE0x00000001Indicates that users may assign a drive letter to the share (e.g., using the 'Map network drive...' context menu item in Windows Explorer).

STGMP_NETWORK_HIDDEN_SHARE0x00000002Indicates that the share should be skipped during enumeration.

Such shares are only accessible when their name is already known to the accessor.

STGMP_NETWORK_READ_ACCESS0x00000004Makes a read-only share available for the mounting point.

When this flag is specified, the <Server Name> part of the MountingPoint parameter value must be empty. Please refer to the Mounting Points topic for more information. This flag makes the component use the Windows API's NetShareAdd function. As per MSDN, "Only members of the Administrators, System Operators, or Power Users local group can add file shares with a call to the NetShareAdd function."

This flag cannot be used together with STGMP_NETWORK_CLAIM_SERVER_NAME.

STGMP_NETWORK_WRITE_ACCESS0x00000008Makes a read/write share available for the mounting point.

When this flag is specified, the <Server Name> part of the MountingPoint parameter value must be empty. Please refer to the Mounting Points topic for more information. This flag makes the component use the Windows API's NetShareAdd function. As per MSDN, "Only members of the Administrators, System Operators, or Power Users local group can add file shares with a call to the NetShareAdd function."

This flag cannot be used together with STGMP_NETWORK_CLAIM_SERVER_NAME.

STGMP_NETWORK_CLAIM_SERVER_NAME0x00000010Specifies that the server name is unique.

When this flag is specified, the driver handles IOCTL_REDIR_QUERY_PATH[_EX] requests by instructing the OS to direct all requests going to the <Server Name> part of the MountingPoint parameter's value to the driver instead.

This flag should be used when the <Server Name> is unique within the local system (e.g., when the application's name is used). Using this flag allows the system to avoid delays caused by certain network requests made by various processes.

This flag is also required for "net view" command to be able to show the share in the list.

This flag cannot be used together with STGMP_NETWORK_READ_ACCESS or STGMP_NETWORK_WRITE_ACCESS.

STGMP_DRIVE_LETTER_NOTIFY_ASYNC0x20000000Causes the method to return immediately without waiting for mounting notifications to be sent to the system.

STGMP_AUTOCREATE_DRIVE_LETTER0x40000000Tells the component that it should assign the drive letter automatically.

When this flag is specified, the component will automatically assign a drive letter from the list of available letters. The assigned letter is added to the end of the list of mounting points, and can be retrieved from there.

Do not include a drive letter in the MountingPoint parameter's value when specifying this flag.

The MountingPointIndex parameter specifies the index of the item in the array. The size of the array is controlled by the MountingPointCount property.

This property is read-only.

Data Type

int32

MountingPointName Property (CBVaultDrive Component)

The mounting point name.

Syntax

func (obj *CBVaultDrive) MountingPointName(MountingPointIndex int32) (string, error)

Default Value

""

Remarks

The mounting point name.

This property reflects the name of the mounting point (i.e., the value passed to the AddMountingPoint method's MountingPoint parameter).

The MountingPointIndex parameter specifies the index of the item in the array. The size of the array is controlled by the MountingPointCount property.

This property is read-only.

Data Type

string

OpenFilesCount Property (CBVaultDrive Component)

The number of records in the OpenFile arrays.

Syntax

func (obj *CBVaultDrive) OpenFilesCount() (int32, error)

Default Value

0

Remarks

This property controls the size of the following arrays:

The array indices start at 0 and end at OpenFilesCount - 1.

This property is read-only.

Data Type

int32

OpenFileName Property (CBVaultDrive Component)

The name of the open file.

Syntax

func (obj *CBVaultDrive) OpenFileName(OpenFileIndex int32) (string, error)

Default Value

""

Remarks

The name of the open file.

This property reflects the name of the open file.

The OpenFileIndex parameter specifies the index of the item in the array. The size of the array is controlled by the OpenFilesCount property.

This property is read-only.

Data Type

string

OpenFileProcessId Property (CBVaultDrive Component)

The Id of the process that opened the file.

Syntax

func (obj *CBVaultDrive) OpenFileProcessId(OpenFileIndex int32) (int32, error)

Default Value

0

Remarks

The Id of the process that opened the file.

This property reflects the Id of the process (PID) that opened the file.

The OpenFileIndex parameter specifies the index of the item in the array. The size of the array is controlled by the OpenFilesCount property.

This property is read-only.

Data Type

int32

OpenFileProcessName Property (CBVaultDrive Component)

The name of the process that opened the file.

Syntax

func (obj *CBVaultDrive) OpenFileProcessName(OpenFileIndex int32) (string, error)

Default Value

""

Remarks

The name of the process that opened the file.

This property reflects the name of the process that opened the file.

The OpenFileIndex parameter specifies the index of the item in the array. The size of the array is controlled by the OpenFilesCount property.

This property is read-only.

Data Type

string

PageSize Property (CBVaultDrive Component)

This property specifies the vault's page size.

Syntax

func (obj *CBVaultDrive) PageSize() (int32, error)
func (obj *CBVaultDrive) SetPageSize(value int32) error

Default Value

4096

Remarks

This property controls the page size used when creating new vaults and reflects the page size of the currently open vault. Valid values are 256 through 65536 bytes (inclusive).

A vault's page size is permanent, it cannot be changed after the vault is created. Please refer to the Vaults topic for more information.

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

int32

PathSeparator Property (CBVaultDrive Component)

This property specifies the path separator character to use when returning vault paths.

Syntax

func (obj *CBVaultDrive) PathSeparator() (int32, error)
func (obj *CBVaultDrive) SetPathSeparator(value int32) error

Default Value

92

Remarks

This property specifies the path separator character that the component APIs should use when returning a vault path. Valid values are as follows:

VAULT_PSC_BACKSLASH92Backslash ('\').

This character is the Windows path separator.

VAULT_PSC_SLASH47Forward slash ('/').

This character is the Unix-style path separator.

Note: This property is just a convenience; applications are free to use either of the above characters as path separators when passing path strings to the component's APIs.

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

int32

PossibleFreeSpace Property (CBVaultDrive Component)

This property specifies the maximum amount of free space the vault could possibly have available.

Syntax

func (obj *CBVaultDrive) PossibleFreeSpace() (int64, error)

Default Value

0

Remarks

This property reflects the maximum amount of free space, in bytes, that the vault could possibly have available. That is, it is the amount of free space that would be available if the vault automatically grew to its maximum PossibleSize right now, without any additional data being written to it. Therefore:

In both cases, parent_free_space is the amount of free space available for the vault to use for automatic growth. For a file-based vault, this is the total amount of free space on the disk where the vault's storage file (i.e., VaultFile) resides, as reported by the OS. For a Callback Mode vault, this is whatever value the application provides through the VaultGetParentSize event.

Please refer to the Vault Size topic for more information.

This property is read-only.

Data Type

int64

PossibleSize Property (CBVaultDrive Component)

This property specifies the maximum size the vault could possibly be.

Syntax

func (obj *CBVaultDrive) PossibleSize() (int64, error)

Default Value

0

Remarks

This property reflects the maximum size, in bytes, that the vault could possibly be. That is, it is the size that the vault would be if it automatically grew as much as possible right now, without any additional data being written to it. Therefore:

In the former case, parent_free_space is the amount of free space available for the vault to use for automatic growth. For a file-based vault, this is the total amount of free space on the disk where the vault's storage file (i.e., VaultFile) resides, as reported by the OS. For a Callback Mode vault, this is whatever value the application provides through the VaultGetParentSize event.

Please refer to the VaultSize topic for more information.

This property is read-only.

Data Type

int64

ProcessRestrictionsEnabled Property (CBVaultDrive Component)

Whether process access restrictions are enabled.

Syntax

func (obj *CBVaultDrive) ProcessRestrictionsEnabled() (bool, error)
func (obj *CBVaultDrive) SetProcessRestrictionsEnabled(value bool) error

Default Value

false

Remarks

This property controls whether the component should enforce per-process access restrictions; by default, it is disabled. When enabled, the AddGrantedProcess and AddDeniedProcess methods can be used to add process-specific access rules for the component to enforce across the entire virtual drive.

When an application enables this propery, it should use the AddGrantedProcess method to add at least one pocess as allowed; otherwise, the data will be inaccessible.

The current process access rules are reflected by the AccessGrantedProcess* and AccessDeniedProcess* properties.

Note: The methods and properties related to process access lists are not intended to be used from multiple threads at once. Applications that wish to use said methods and properties from multiple threads are responsible for employing proper thread synchronization techniques to ensure that manipulation and enumeration of process access information occurs in a thread-safe manner.

Data Type

bool

ReadOnly Property (CBVaultDrive Component)

This property specifies whether the component should open a vault in read-only mode.

Syntax

func (obj *CBVaultDrive) ReadOnly() (bool, error)
func (obj *CBVaultDrive) SetReadOnly(value bool) error

Default Value

false

Remarks

This property specifies whether the component should open a vault in read-only mode. When a vault is opened in read-only mode, the following restrictions apply:

  • No new vault items (e.g., files, directories, symbolic links, and alternate streams) may be created.
  • No existing vault items may be modified, renamed, moved, or deleted. This includes updating access times.
  • The vault cannot be resized or compacted (automatically or explicitly).
  • Vault corruption cannot be repaired using CheckAndRepair.

Note: This list may not necessarily be exhaustive.

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

bool

ReportPossibleSize Property (CBVaultDrive Component)

How the component should report the virtual drive's size and free space to the OS.

Syntax

func (obj *CBVaultDrive) ReportPossibleSize() (bool, error)
func (obj *CBVaultDrive) SetReportPossibleSize(value bool) error

Default Value

true

Remarks

This property controls which pair of values the component should use when reporting the virtual drive's size and free space to the OS.

When this property is enabled (default), the component will use the values of the PossibleSize and PossibleFreeSpace properties. When this property is disabled, the component will use the values of the VaultSize and PossibleSize properties.

To ensure correct operation, it is recommended that applications keep this property enabled, unless a vault's size has been fixed by setting the VaultSizeMin and VaultSizeMax properties equal to each other.

Please refer to the documentation of the properties mentioned above, as well as the Vault Size topic, for more information.

Note: This property cannot be changed within events.

Data Type

bool

SerializeEvents Property (CBVaultDrive Component)

Whether events should be fired on a single worker thread, or many.

Syntax

func (obj *CBVaultDrive) SerializeEvents() (int32, error)
func (obj *CBVaultDrive) SetSerializeEvents(value int32) error

Default Value

0

Remarks

This property specifies whether the component should fire all events serially on a single worker thread, or concurrently on multiple worker threads. The possible values are:

0 (seOnMultipleThreads) The component fires events in the context of multiple worker threads. The MinWorkerThreadCount and MaxWorkerThreadCount configuration settings control how many worker threads are used for this.
1 (seOnOneWorkerThread) The component fires events in the context of one background worker thread.

Please refer to the Threading and Concurrency topic for more information.

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

int32

StorageCharacteristics Property (CBVaultDrive Component)

The characteristic flags to create the virtual drive with (Windows only).

Syntax

func (obj *CBVaultDrive) StorageCharacteristics() (int32, error)
func (obj *CBVaultDrive) SetStorageCharacteristics(value int32) error

Default Value

16

Remarks

The system, as well as other applications, use these flags to optimize their use of the virtual drive. This property should be set by OR'ing together zero or more of the following flags:

STGC_FLOPPY_DISKETTE0x00000001The storage is a floppy disk device.

This flag is not supported when StorageType is set to STGT_DISK_PNP.

STGC_READONLY_DEVICE0x00000002The storage is a read-only device.

STGC_WRITE_ONCE_MEDIA0x00000008The storage device's media can only be written to once.

This flag is not supported when StorageType is set to STGT_DISK_PNP.

STGC_REMOVABLE_MEDIA0x00000010The storage device's media is removable.

Users may remove the storage media from the virtual drive at any time. (Note that this flag does not indicate that the virtual drive itself is removable.)

STGC_AUTOCREATE_DRIVE_LETTER0x00002000The system should automatically create a drive letter for the storage device.

Deprecated: Include the STGMP_AUTOCREATE_DRIVE_LETTER flag in the value passed for the AddMountingPoint method's Flags parameter instead.

When this flag is present, the StorageGUID property must be set. This flag only works when StorageType is set to STGT_DISK_PNP.

STGC_SHOW_IN_EJECTION_TRAY0x00004000The storage device should be shown in the 'Safely Remove Hardware and Eject Media' menu in the system notification area (system tray).

This flag only works when StorageType is set to STGT_DISK_PNP.

STGC_ALLOW_EJECTION0x00008000The storage device can be ejected.

Users may eject the virtual drive at any time. When the virtual drive is ejected, it is destroyed.

This flag only works when StorageType is set to STGT_DISK_PNP.

STGC_RESERVED_10x00010000Reserved, do not use.

STGC_RESERVED_20x00020000Reserved, do not use.

Note: This property cannot be changed after a virtual drive is created, and it cannot be changed within events.

Data Type

int32

StorageGUID Property (CBVaultDrive Component)

The GUID to create the virtual drive with.

Syntax

func (obj *CBVaultDrive) StorageGUID() (string, error)
func (obj *CBVaultDrive) SetStorageGUID(value string) error

Default Value

""

Remarks

When the StorageType property is set to STGT_DISK_PNP, this property is used to specify a GUID for the virtual drive, and must be set to GUID-formatted string (e.g., {676D0357-A23A-49c3-B433-65AAD72DD282}). Otherwise, this property may be left empty; in the latter case, the driver will generate a unique value when a drive is mounted.

Some software uses a drive's GUID for the purpose of setting and maintaining certain configuration parameters. Therefore, applications are expected to use the same GUID when repeatedly creating a virtual drive that represents the same data.

Note: This property cannot be changed after a virtual drive is created, and it cannot be changed within events.

Data Type

string

StorageType Property (CBVaultDrive Component)

The type of virtual drive to create (Windows only).

Syntax

func (obj *CBVaultDrive) StorageType() (int32, error)
func (obj *CBVaultDrive) SetStorageType(value int32) error

Default Value

0

Remarks

This property specifies what type of virtual drive should be created. Windows Explorer uses this information to display the appropriate icon and apply the appropriate security settings for the virtual drive. Other applications may also make use of this information in various ways.

Possible values are:

STGT_DISK0x00000000Create a regular disk device.

STGT_CDROM0x00000001Create a CD-ROM or DVD device.

STGT_DISK_PNP0x00000003Create a plug-and-play storage device.

Important: The CBFS Storage system driver must be installed in PnP mode for this option to function properly.

Note: This property cannot be changed after a virtual drive is created, and it cannot be changed within events.

Plug-and-play Virtual Drives

Virtual drives created as plug-and-play (STGT_DISK_PNP) require that a "physical device" be visible in the Disk Manager snap-in of the Microsoft Management Console (mmc.exe). This can be accomplished by calling the AddMountingPoint method and including the STGMP_MOUNT_MANAGER flag in the value passed for its Flags parameter.

In addition to supporting the STGC_REMOVABLE_MEDIA StorageCharacteristics flag, which specifies whether a virtual drive's media is removable or non-removable, plug-and-play virtual drives also support the STGC_ALLOW_EJECTION flag, which specifies whether a virtual drive itself is removable or non-removable.

Data Type

int32

Tag Property (CBVaultDrive Component)

This property stores application-defined data specific to a particular instance of the component.

Syntax

func (obj *CBVaultDrive) Tag() (int64, error)
func (obj *CBVaultDrive) SetTag(value int64) error

Default Value

0

Remarks

This property can be used to store data specific to a particular instance of the component.

Data Type

int64

Timeout Property (CBVaultDrive Component)

How long vault events may execute before timing out (Windows only).

Syntax

func (obj *CBVaultDrive) Timeout() (int32, error)
func (obj *CBVaultDrive) SetTimeout(value int32) error

Default Value

0

Remarks

When an application is operating in Callback Mode, this property specifies how long the Vault* events may execute before timing out.

When this property is set to a non-zero value, and a Vault* event executes long enough for its timeout to expire, the driver cancels the underlying request by reporting an error to the OS. The tardy event still runs to completion, but any results it returns once finished are ignored since the underlying request has already been handled.

Setting this property to 0 disables event timeouts, which allows Vault* events to take as long as necessary to execute.

Note: This property cannot be changed within events.

Data Type

int32

UnmountOnTermination Property (CBVaultDrive Component)

Whether the virtual drive should be unmounted if the application terminates (Windows only).

Syntax

func (obj *CBVaultDrive) UnmountOnTermination() (bool, error)
func (obj *CBVaultDrive) SetUnmountOnTermination(value bool) error

Default Value

true

Remarks

This property specifies whether the CBFS Storage driver should automatically unmount the virtual drive (closing all handles and other resources associated with it) if the application terminates.

If this property is disabled, applications may need to call the ForceUnmount method after a crash (if there was a file-based vault open and mounted as a virtual drive when the crash occurred).

Note: This property cannot be disabled on non-Windows platforms.

Data Type

bool

UseAccessTime Property (CBVaultDrive Component)

This property specifies whether the component should keep track of last access times for vault items.

Syntax

func (obj *CBVaultDrive) UseAccessTime() (bool, error)
func (obj *CBVaultDrive) SetUseAccessTime(value bool) error

Default Value

false

Remarks

This property specifies whether the component should update the last access time for vault items (e.g., files, directories, symbolic links, and alternate streams) every time they are accessed.

Note: Keeping track of access times will slow down operations.

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

bool

UseSystemCache Property (CBVaultDrive Component)

This property specifies whether the operating system's cache is used.

Syntax

func (obj *CBVaultDrive) UseSystemCache() (bool, error)
func (obj *CBVaultDrive) SetUseSystemCache(value bool) error

Default Value

true

Remarks

This property specifies whether the operating system's cache should be used. Use of the OS cache affects the speed of various vault operations; however, the exact effects depend on the type of operation as well as the data sizes involved.

For the CBVAULT component, disabling this property will cause a vault's storage file (specified by the VaultFile property) to be opened with FILE_FLAG_NO_BUFFERING (on Windows) or F_NOCACHE (on Linux/macOS). This also applies for the CBVaultDrive component on Linux and macOS.

For the CBVaultDrive component on Windows, a vault's storage file is always opened with FILE_FLAG_NO_BUFFERING regardless of how this property is set. Disabling this property prevents the system cache from being used to cache files on the virtual drive. This may be necessary in certain situations to prevent BSODs. Please refer to Microsoft's File Caching article for more information about the system file cache.

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

bool

VaultEncryption Property (CBVaultDrive Component)

This property specifies the whole-vault encryption mode.

Syntax

func (obj *CBVaultDrive) VaultEncryption() (int32, error)
func (obj *CBVaultDrive) SetVaultEncryption(value int32) error

Default Value

0

Remarks

This property controls the whole-vault encryption mode used when creating new vaults and reflects the whole-vault encryption mode of the currently open vault. Valid values are as follows:

VAULT_EM_NONE0x0Do not use encryption.

VAULT_EM_DEFAULT0x1Use default encryption (VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA256).

VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA2560x2Use AES256 encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

VAULT_EM_CUSTOM256_PBKDF2_HMAC_SHA2560x3Use event-based custom 256-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_PBKDF2_HMAC_SHA2560x4Use event-based custom 512-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_PBKDF2_HMAC_SHA2560x5Use event-based custom 1024-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_CUSTOM_KEY_DERIVE0x23Use event-based custom 256-bit encryption with custom key derivation.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_CUSTOM_KEY_DERIVE0x24Use event-based custom 512-bit encryption with custom key derivation.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_CUSTOM_KEY_DERIVE0x25Use event-based custom 1024-bit encryption with custom key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_DIRECT_KEY0x43Use event-based custom 256-bit encryption with no key derivation.

A 256-bit (32-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM512_DIRECT_KEY0x44Use event-based custom 512-bit encryption with no key derivation.

A 512-bit (64-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM1024_DIRECT_KEY0x45Use event-based custom 1024-bit encryption with no key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_UNKNOWN0xFFUnidentified or unknown encryption.

Applications that use custom encryption must implement at least the DataEncrypt and DataDecrypt events. Certain custom encryption modes may require that the HashCalculate or KeyDerive event be implemented as well. Please refer to the Encryption topic for more information.

To create a new vault with whole-vault encryption enabled, the VaultPassword property must be set as well.

When an existing vault is opened, the component updates VaultEncryption automatically based on the detected whole-vault encryption mode. If the vault is encrypted, the component will attempt to access it using the password specified by VaultPassword. If VaultPassword is incorrect, the attempt will fail and the vault will not be opened.

The VaultEncryption and VaultPassword properties cannot be used to change an open vault's whole-vault encryption mode or password; use the UpdateVaultEncryption method.

Please refer to the Encryption topic for more information.

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

int32

VaultFile Property (CBVaultDrive Component)

This property specifies the vault to create or open.

Syntax

func (obj *CBVaultDrive) VaultFile() (string, error)
func (obj *CBVaultDrive) SetVaultFile(value string) error

Default Value

""

Remarks

This property specifies the vault to create or open when the OpenVault method is called.

When the CallbackMode property is disabled (default), this property specifies the vault storage file to create or open. It must be set to a fully qualified file path formatted according to OS conventions.

When the CallbackMode property is enabled, this property is only used to populate the Vault parameter of the VaultOpen, VaultGetParentSize, and VaultDelete events; and can be set to any application-defined value. Please refer to the Callback Mode topic for more information.

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

string

VaultFreeSpace Property (CBVaultDrive Component)

This property reflects the actual amount of free space the vault has available.

Syntax

func (obj *CBVaultDrive) VaultFreeSpace() (int64, error)

Default Value

0

Remarks

This property reflects the actual amount of free space, in bytes, that the vault currently has available. A vault's actual free space is based on its actual size, which is reflected by the VaultSize property.

Applications can also determine the maximum amount of free space the vault could possibly have by querying the PossibleFreeSpace property; please refer to its documentation, as well as the Vault Size topic, for more information.

This property is read-only.

Data Type

int64

VaultPassword Property (CBVaultDrive Component)

This property specifies the whole-vault encryption password.

Syntax

func (obj *CBVaultDrive) VaultPassword() (string, error)
func (obj *CBVaultDrive) SetVaultPassword(value string) error

Default Value

""

Remarks

This property specifies the whole-vault encryption password to use when creating new vaults and opening existing vaults.

To create a new vault with whole-vault encryption enabled, the VaultEncryption property must be set as well.

When an existing vault is opened, the component updates VaultEncryption automatically based on the detected whole-vault encryption mode. If the vault is encrypted, the component will attempt to access it using the password specified by VaultPassword. If VaultPassword is incorrect, the attempt will fail and the vault will not be opened.

The VaultEncryption and VaultPassword properties cannot be used to change an open vault's whole-vault encryption mode or password; use the UpdateVaultEncryption method.

Please refer to the Encryption topic for more information.

Note: This property cannot be changed when Active is true, and it cannot be changed within events.

Data Type

string

VaultSize Property (CBVaultDrive Component)

This property specifies the actual size of the vault.

Syntax

func (obj *CBVaultDrive) VaultSize() (int64, error)
func (obj *CBVaultDrive) SetVaultSize(value int64) error

Default Value

0

Remarks

This property specifies the actual size of the vault, in bytes.

Applications may use this property to explicitly resize a vault, keeping in mind the following:

  • A vault cannot shrink more than its available free space allows (i.e., not by more than VaultFreeSpace bytes).
  • A vault cannot shrink beyond VaultSizeMin bytes.
  • If VaultSizeMax is not 0 (unlimited), a vault cannot grow beyond VaultSizeMax bytes.
  • If a vault grows enough to reach or exceed its AutoCompactAt threshold, it will automatically shrink again when the next automatic compaction occurs.

Applications can determine the maximum size a vault could possibly be by querying the PossibleSize property. Please refer to the Vault Size topic for more information.

Note: This property can be changed only when Active is true, and it cannot be changed within events.

Data Type

int64

VaultSizeMax Property (CBVaultDrive Component)

This property specifies the maximum size a vault can be.

Syntax

func (obj *CBVaultDrive) VaultSizeMax() (int64, error)
func (obj *CBVaultDrive) SetVaultSizeMax(value int64) error

Default Value

0

Remarks

This property specifies the maximum size, in bytes, that a vault can be. This property must be set to 0 (unlimited), or a number greater than or equal to 8 * PageSize or VaultSizeMin (whichever is greater).

The limit imposed by this property, if any, applies to both explicit growth of a vault via the VaultSize property, and implicit growth of a vault due to storage load. Please refer to the Vault Size topic for more information.

Note: This property cannot be changed within events.

Data Type

int64

VaultSizeMin Property (CBVaultDrive Component)

This property specifies the minimum size a vault can be.

Syntax

func (obj *CBVaultDrive) VaultSizeMin() (int64, error)
func (obj *CBVaultDrive) SetVaultSizeMin(value int64) error

Default Value

0

Remarks

This property specifies the minimum size, in bytes, that a vault can be. This property's value must be less than or equal to VaultSizeMax, unless VaultSizeMax is set to 0 (unlimited).

The limit imposed by this property applies to both explicit shrinking of a vault via the VaultSize property or the CompactVault method, and implicit shrinking of a vault via automatic compaction. Please refer to the Vault Size topic for more information.

Note: This property cannot be changed within events.

Data Type

int64

VaultState Property (CBVaultDrive Component)

This property specifies information about the state of the vault.

Syntax

func (obj *CBVaultDrive) VaultState() (int32, error)

Default Value

0

Remarks

This property reflects the current state of the vault; its value consists of one or more of the following flags, ORed together:

VAULT_ST_FIXED_SIZE0x00000001The vault is a fixed size.

VAULT_ST_READ_ONLY0x00000002The vault was opened in read-only mode.

Please refer to the ReadOnly property for more information.

VAULT_ST_CORRUPTED0x00000004The vault is corrupted.

Applications can use the CheckAndRepair method to try to repair vault corruption. Please refer to the Vault Corruption topic for more information.

VAULT_ST_TRANSACTIONS_USED0x00000008The vault was opened in journaling mode.

Please refer to the UseJournaling property for more information.

VAULT_ST_ACCESS_TIME_USED0x00000010Last access times are being tracked.

Please refer to the UseAccessTime property for more information.

VAULT_ST_ENCRYPTED0x00000020The vault is encrypted with whole-vault encryption.

Please refer to the Encryption topic for more information.

VAULT_ST_VALID_PASSWORD_SET0x00000040The correct whole-vault encryption password has been provided.

Please refer to the Encryption topic for more information.

VAULT_ST_PHYSICAL_VOLUME0x00000080The vault is backed by a storage volume or partition formatted with the CBFS Storage filesystem.

This flag only applies when using the CBVaultDrive component.

VAULT_ST_PARTED0x00000100The vault's contents are split across multiple files on disk.

Please refer to the Multipart Vaults topic for more information.

This property is read-only.

Data Type

int32

AddDeniedProcess Method (CBVaultDrive Component)

Adds a rule that prevents a process from accessing the virtual drive.

Syntax

func (obj *CBVaultDrive) AddDeniedProcess(ProcessFileName string, ProcessId int32, ChildProcesses bool, DesiredAccess int32) error

Remarks

When the ProcessRestrictionsEnabled property is enabled, this method can be used to add an access rule that denies the process specified by ProcessFileName or ProcessId the access right specified by DesiredAccess.

Processes that are already running can be specified by passing their process Id (PID) for the ProcessId parameter (in which case ProcessFileName should be empty). Processes that have not yet started can be specified by passing the full filename of the process's executable file for ProcessFileName (in which case ProcessId should be set to 0). If ProcessName is empty, and ProcessId is -1, the new rule will apply to all processes. When adding a PID-based rule, you need to be aware of the PID Reuse behavior of Windows.

ChildProcesses controls whether the rule also applies to children of the target process.

DesiredAccess specifies the access right to deny; valid values are:

STG_DACCESS_READ0x00000001Grant/deny read access.

STG_DACCESS_WRITE0x00000002Grant/deny write access.

STG_DACCESS_READWRITE0x00000003Grant/deny read and write access.

To remove the process access rule later, pass the same ProcessFileName and ProcessId values to the RemoveDeniedProcess method.

Note: This method can be called only when Active is true, and it cannot be called within events.

The methods and properties related to process access lists are not intended to be used from multiple threads at once. Applications that wish to use said methods and properties from multiple threads are responsible for employing proper thread synchronization techniques to ensure that manipulation and enumeration of process access information occurs in a thread-safe manner.

AddGrantedProcess Method (CBVaultDrive Component)

Adds a rule that allows a process to access the virtual drive.

Syntax

func (obj *CBVaultDrive) AddGrantedProcess(ProcessFileName string, ProcessId int32, ChildProcesses bool, DesiredAccess int32) error

Remarks

When the ProcessRestrictionsEnabled property is enabled, this method can be used to add an access rule that grants the process specified by ProcessFileName or ProcessId the access right specified by DesiredAccess.

Processes that are already running can be specified by passing their process Id (PID) for the ProcessId parameter (in which case ProcessFileName should be empty). Processes that have not yet started can be specified by passing the full filename of the process's executable file for ProcessFileName (in which case ProcessId should be set to 0). If ProcessName is empty, and ProcessId is -1, the new rule will apply to all processes. When adding a PID-based rule, you need to be aware of the PID Reuse behavior of Windows.

ChildProcesses controls whether the rule also applies to children of the target process.

DesiredAccess specifies the access right to grant; valid values are:

STG_DACCESS_READ0x00000001Grant/deny read access.

STG_DACCESS_WRITE0x00000002Grant/deny write access.

STG_DACCESS_READWRITE0x00000003Grant/deny read and write access.

To remove the process access rule later, pass the same ProcessFileName and ProcessId values to the RemoveGrantedProcess method.

Note: This method can be called only when Active is true, and it cannot be called within events.

The methods and properties related to process access lists are not intended to be used from multiple threads at once. Applications that wish to use said methods and properties from multiple threads are responsible for employing proper thread synchronization techniques to ensure that manipulation and enumeration of process access information occurs in a thread-safe manner.

AddMountingPoint Method (CBVaultDrive Component)

Adds a mounting point for the virtual drive.

Syntax

func (obj *CBVaultDrive) AddMountingPoint(MountingPoint string, Flags int32, AuthenticationId int64) error

Remarks

This method adds a new mounting point for the virtual drive (which must have already been created using OpenVault). Virtual drives may have as many mounting points as desired.

MountingPoint should be set to the name/path of the mounting point. The format of this value varies based what type of mounting point the application wishes to create; please refer to the Mounting Points topic for more information.

The Flags parameter is used to specify properties for the mounting point, and should be set by OR'ing together zero or more of the following flags:

Windows:

STGMP_SIMPLE0x00010000Create a simple mounting point.

Simple mounting points may be local or global; and when local, can be made visible in either the current user session or another one.

This flag cannot be combined with STGMP_MOUNT_MANAGER or STGMP_NETWORK, and is implied if neither of those flags are present.

STGMP_MOUNT_MANAGER0x00020000Create a mounting point that appears to the system as a physical device.

When the StorageType property is set to STGT_DISK_PNP, mounting points created using the system mount manager appear as physical devices in the Disk Management snap-in of the Microsoft Management Console (mmc.exe).

This flag is a necessary prerequisite for creating a folder mounting point, which makes a drive accessible via an otherwise empty directory on another NTFS volume.

This flag cannot be combined with STGMP_SIMPLE, STGMP_NETWORK, or STGMP_LOCAL.

Only one mounting point of this type can be added to a virtual drive.

STGMP_NETWORK0x00040000Create a network mounting point.

Network mounting points can be further configured using the various STGMP_NETWORK_* flags described below. Applications that plan to make use of network mounting points must be sure to install the Helper DLL before doing so, otherwise Windows Explorer will not correctly recognize the "network" drive.

This flag cannot be combined with STGMP_SIMPLE or STGMP_MOUNT_MANAGER.

STGMP_LOCAL0x10000000Specifies that a local mounting point should be created.

This flag specifies that a local mounting point should be created rather than a global one. When this flag is set, applications must also pass an appropriate value for the AddMountingPoint method's AuthenticationId parameter.

Passing 0 for AuthenticationId will make the mounting point visible in the current user session. To make the mounting point visible in a different user session instead, pass the target session's Authentication ID.

This flag is valid when combined with STGMP_SIMPLE or STGMP_NETWORK; it cannot be combined with STGMP_MOUNT_MANAGER. Please note that a mounting point can be made available to other computers as a network share, and network shares are always globally visible on the local machine, even if this flag is set.

STGMP_NETWORK_ALLOW_MAP_AS_DRIVE0x00000001Indicates that users may assign a drive letter to the share (e.g., using the 'Map network drive...' context menu item in Windows Explorer).

STGMP_NETWORK_HIDDEN_SHARE0x00000002Indicates that the share should be skipped during enumeration.

Such shares are only accessible when their name is already known to the accessor.

STGMP_NETWORK_READ_ACCESS0x00000004Makes a read-only share available for the mounting point.

When this flag is specified, the <Server Name> part of the MountingPoint parameter value must be empty. Please refer to the Mounting Points topic for more information. This flag makes the component use the Windows API's NetShareAdd function. As per MSDN, "Only members of the Administrators, System Operators, or Power Users local group can add file shares with a call to the NetShareAdd function."

This flag cannot be used together with STGMP_NETWORK_CLAIM_SERVER_NAME.

STGMP_NETWORK_WRITE_ACCESS0x00000008Makes a read/write share available for the mounting point.

When this flag is specified, the <Server Name> part of the MountingPoint parameter value must be empty. Please refer to the Mounting Points topic for more information. This flag makes the component use the Windows API's NetShareAdd function. As per MSDN, "Only members of the Administrators, System Operators, or Power Users local group can add file shares with a call to the NetShareAdd function."

This flag cannot be used together with STGMP_NETWORK_CLAIM_SERVER_NAME.

STGMP_NETWORK_CLAIM_SERVER_NAME0x00000010Specifies that the server name is unique.

When this flag is specified, the driver handles IOCTL_REDIR_QUERY_PATH[_EX] requests by instructing the OS to direct all requests going to the <Server Name> part of the MountingPoint parameter's value to the driver instead.

This flag should be used when the <Server Name> is unique within the local system (e.g., when the application's name is used). Using this flag allows the system to avoid delays caused by certain network requests made by various processes.

This flag is also required for "net view" command to be able to show the share in the list.

This flag cannot be used together with STGMP_NETWORK_READ_ACCESS or STGMP_NETWORK_WRITE_ACCESS.

STGMP_DRIVE_LETTER_NOTIFY_ASYNC0x20000000Causes the method to return immediately without waiting for mounting notifications to be sent to the system.

STGMP_AUTOCREATE_DRIVE_LETTER0x40000000Tells the component that it should assign the drive letter automatically.

When this flag is specified, the component will automatically assign a drive letter from the list of available letters. The assigned letter is added to the end of the list of mounting points, and can be retrieved from there.

Do not include a drive letter in the MountingPoint parameter's value when specifying this flag.

If no flags are specified, the STGMP_SIMPLE flag is assumed.

Linux and macOS:

STGMP_LOCAL_FUSE0x10000000Creates a mounting point, accessible only for current user.

If this flag is not passed, the "-oallow_other" option of FUSE is used.

STGMP_SYMLINK_DEBUG0x40000000Prints debug messages to stderr

The messages generated by the component are printed.

STGMP_SYMLINK_SYSTEM_DEBUG0x20000000Prints debug messages generated by the FUSE library to stderr

STGMP_NETWORK_MACOS0x00040000Create a network mounting point (macOS only).

If this flag is not passed, the "-olocal" option of macFUSE is used.

For more information about the "-olocal" option of macFUSE, please refer to the macFUSE FAQ.

Windows:

If the STGMP_LOCAL flag is set, the AuthenticationId parameter should be set to the Authentication ID of the user session the mounting point should visible in; or to 0 to make the mounting point visible in the current user session. If the aforementioned flag is not set and AuthenticationId is 0, the mounting point will be global (i.e., visible in all user sessions). When AuthenticationId is set to a non-zero value, STGMP_LOCAL is implied. Please refer to the Mounting Points topic for more information.

Linux, macOS: The AuthenticationId parameter is ignored.

Note: This method cannot be called within events.

The methods and properties related to mounting points are not intended to be used from multiple threads at once. Applications that wish to use said methods and properties from multiple threads are responsible for employing proper thread synchronization techniques to ensure that manipulation and enumeration of mounting points occurs in a thread-safe manner.

Virtual Drives and Mounting Points

When applications call the OpenVault (CBVaultDrive) or CreateVault method, the specified vault is opened and used to create and mount a virtual drive. This virtual drive is created without a drive letter.

To add a drive letter for the virtual drive, applications have to call the AddMountingPoint method. Once a drive letter is assigned, the virtual drive will be visible to the system and other applications, allowing them to start accessing its files and directories.

CacheFilePassword Method (CBVaultDrive Component)

This method caches an encryption password to use the next time a file or alternate stream is accessed or removes the cached password.

Syntax

func (obj *CBVaultDrive) CacheFilePassword(FileName string, Password string, TTLInCache int32, RemoveFromCache bool) error

Remarks

This method temporarily caches an encryption password so that it can be used the next time the file or alternate stream specified by FileName is accessed.

The value passed for FileName must be a vault-local absolute path.

The Password parameter specifies the password to cache. It must match the one last used to encrypt the specified file or the alternate stream; otherwise, this method returns an error.

The specified password is automatically removed from the cache as soon as one of the following things occur:

  • The password is used to access the file or alternate stream and the value of the TTLInCache parameter is 0.
  • The password for the file or alternate stream is changed.
  • The vault is closed.
  • The timeout expires.

To remove the previously cached password from the cache, set the RemoveFromCache parameter to true. When it is set so, the value of the Password parameter is ignored.

The TTLInCache parameter specifies time to seconds that the component keeps the password in the internal cache to reduce the number of requests for a password. The value of 0 tells the component to discard the password after the first use.

As an alternative to using this method, applications can provide a default file encryption password using the DefaultFileAccessPassword property or provide such passwords dynamically using the FilePasswordNeeded event.

Note: This method can be called only when Active is true.

CheckAndRepair Method (CBVaultDrive Component)

This method checks a vault's consistency and repairs it as necessary.

Syntax

func (obj *CBVaultDrive) CheckAndRepair(Flags int32) error

Remarks

This method checks the consistency of a vault and attempts to repair it as necessary.

Applications should call this method if a vault has become corrupted (i.e., if the IsCorrupted property is true, or if a vault operation fails with a "Vault Corrupted" error). Be sure to make a vault backup before calling this method, because its repair efforts may cause data loss in cases of severe corruption. Please refer to the Vault Corruption topic for more information.

The Flags parameter is used to specify additional options, and it should be set by ORing together zero or more of the following flags:

VAULT_CR_CHECK_ONLY0x00000001Check only, do not attempt any repairs.

VAULT_CR_CHECK_ALL_PAGES0x00000002Check all vault pages, including empty ones.

When this flag is not present, only the vault pages that are marked as occupied are checked.

Note: This method cannot be called when Active is true, and it cannot be called within events.

CheckFilePassword Method (CBVaultDrive Component)

This method verifies whether a particular file password is correct.

Syntax

func (obj *CBVaultDrive) CheckFilePassword(FileName string, Password string) (bool, error)

Remarks

This method verifies whether the specified Password matches the one used to encrypt the file or alternate stream specified by FileName. If the password is correct, this method returns true; otherwise, it returns false.

The value passed for FileName must be a vault-local absolute path.

Please refer to the Encryption topic for more information.

Note: This method can be called only when Active is true.

CheckVaultPassword Method (CBVaultDrive Component)

This method verifies whether a particular vault password is correct.

Syntax

func (obj *CBVaultDrive) CheckVaultPassword(Password string) (bool, error)

Remarks

This method verifies whether the specified Password matches the one used to encrypt the vault. If the password is correct, this method returns true; otherwise, it returns false.

Please refer to the Encryption topic for more information.

Note: This method can be called only when Active is true.

CloseOpenedFilesSnapshot Method (CBVaultDrive Component)

Closes the previously-created opened files snapshot.

Syntax

func (obj *CBVaultDrive) CloseOpenedFilesSnapshot() error

Remarks

This method closes the opened files snapshot previously created by CreateOpenedFilesSnapshot, releasing the memory associated with it. Please refer to that method's documentation for more information.

Note: This method cannot be called within events.

The methods and properties related to open files snapshots are not intended to be used from multiple threads at once. Applications that wish to use said methods and properties from multiple threads are responsible for employing proper thread synchronization techniques to ensure that creation, use, and cleanup of open files snapshots occurs in a thread-safe manner.

CloseVault Method (CBVaultDrive Component)

Closes the vault.

Syntax

func (obj *CBVaultDrive) CloseVault(Force bool) error

Remarks

This method closes the currently-open vault.

For CBVaultDrive, the Force parameter specifies whether to forcefully close any file or directory handles open currently. If Force is false, this method will fail if any handles are currently open.

Note: This method can be called only when Active is true.

CompactVault Method (CBVaultDrive Component)

This method compacts the vault.

Syntax

func (obj *CBVaultDrive) CompactVault() (bool, error)

Remarks

This method triggers vault compaction, which is a process that shrinks a vault's overall size by truncating its free space. If the compacting operation completes successfully, this method returns true; otherwise, it returns false.

Compaction involves physically moving a vault's occupied pages to the beginning of the vault, and then truncating the unoccupied pages from the end of the vault. The runtime of a compacting operation depends on a number of factors, and it is possible for it to be interrupted by other vault operations.

Compaction occurs automatically when the vault's free space percentage exceeds the threshold specified by the AutoCompactAt property. Applications can also use the AutoCompactDelay configuration setting to add a delay to the automatic compaction trigger.

Note: A vault opened in ReadOnly mode cannot be compacted, either automatically or explicitly.

Note: This method can be called only when Active is true, and it cannot be called within events.

Config Method (CBVaultDrive Component)

Sets or retrieves a configuration setting.

Syntax

func (obj *CBVaultDrive) Config(ConfigurationString string) (string, error)

Remarks

Config is a generic method available in every component. It is used to set and retrieve configuration settings for the component.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.

ConvertToDrivePath Method (CBVaultDrive Component)

Converts a vault-local vault item path to a virtual drive file path (Windows only).

Syntax

func (obj *CBVaultDrive) ConvertToDrivePath(VaultFilePath string) (string, error)

Remarks

This method returns a virtual drive file path that corresponds to the vault item (file, directory, or symbolic link) specified by VaultFilePath.

The value passed for VaultFilePath must be a vault-local absolute path.

The value returned by this method is a fully-qualified file path formatted according to OS conventions, suitable for passing to system file APIs and/or external applications.

Note: This method can be called only when Active is true.

ConvertToVaultPath Method (CBVaultDrive Component)

Converts a virtual drive file path to a vault-local vault item path (Windows only).

Syntax

func (obj *CBVaultDrive) ConvertToVaultPath(VirtualFilePath string) (string, error)

Remarks

This method returns the vault-local absolute path of the vault item (file, directory, or symbolic link) that corresponds to the virtual drive file path specified by VirtualFilePath.

The value passed for VirtualFilePath must be a fully-qualified file path formatted according to OS conventions.

The value returned by this method can be used to access the corresponding vault item using the component APIs.

Note: This method can be called only when Active is true.

CreateDirectory Method (CBVaultDrive Component)

This method creates a new directory in the vault.

Syntax

func (obj *CBVaultDrive) CreateDirectory(Directory string, CreateParents bool) error

Remarks

This method creates a new directory in the vault at the path specified by Directory.

The value passed for Directory must be a vault-local absolute path.

The CreateParents parameter specifies whether nonexistent parent directories in the specified path should be created as well. If this parameter is false, and one or more parent directories are missing, this method returns an error.

Note: This method can be called only when Active is true, and it cannot be called within events.

CreateLink Method (CBVaultDrive Component)

This method creates a symbolic link to another file in the vault.

Syntax

func (obj *CBVaultDrive) CreateLink(LinkName string, DestinationName string) error

Remarks

This method creates a new symbolic link named LinkName that points to the file specified by DestinationName.

The value passed for LinkName must be a vault-local absolute path. The value passed for DestinationName must also be a vault-local path, but it may be absolute or relative to LinkName.

Note: This method can be called only when Active is true, and it cannot be called within events.

CreateOpenedFilesSnapshot Method (CBVaultDrive Component)

Creates a snapshot of information about files that are currently open.

Syntax

func (obj *CBVaultDrive) CreateOpenedFilesSnapshot() error

Remarks

This method creates a snapshot of information about all files and directories in the virtual filesystem that are currently open. This information is then used to populate the OpenFile* properties.

Note that there will always be at least one item in the OpenFile* properties since the virtual volume itself is always inherently open.

When the application is finished working with the opened files snapshot, it must close it by calling the CloseOpenedFilesSnapshot method in order to release the associated memory. If this method is called again before an existing snapshot is closed, the component will attempt to close it before creating a new one.

Note: This method can be called only when Active is true, and it cannot be called within events.

The methods and properties related to open files snapshots are not intended to be used from multiple threads at once. Applications that wish to use said methods and properties from multiple threads are responsible for employing proper thread synchronization techniques to ensure that creation, use, and cleanup of open files snapshots occurs in a thread-safe manner.

DeleteFile Method (CBVaultDrive Component)

This method deletes a vault item.

Syntax

func (obj *CBVaultDrive) DeleteFile(FileName string) error

Remarks

This method deletes the vault item (file, directory, symbolic link, or alternate stream) specified by FileName from the vault.

The value passed for FileName must be a vault-local absolute path.

Please note the following:

  • When a file is deleted, any alternate streams it contains are deleted as well.
  • Directories must be empty to be deleted; otherwise, this method returns an error. Use the IsDirectoryEmpty method to check whether a directory is empty.
  • Deleting a symbolic link only deletes the link itself, not the file it points to.

Note: This method can be called only when Active is true, and it cannot be called within events.

DeleteFileTag Method (CBVaultDrive Component)

This method deletes a file tag.

Syntax

func (obj *CBVaultDrive) DeleteFileTag(FileName string, TagId int32, TagName string) error

Remarks

This method deletes the file tag identified by TagId or TagName from the file, directory, or alternate stream specified by FileName.

The value passed for FileName must be a vault-local absolute path.

To delete a raw file tag, pass its Id for TagId and pass an empty string for TagName. To delete a typed file tag, pass its name for TagName and pass 0 for TagId. If values are provided for both TagId and TagName, this method returns an error.

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true, and it cannot be called within events.

EjectVolume Method (CBVaultDrive Component)

Ejects a removable storage volume formatted with the CBFS Storage filesystem (Windows only).

Syntax

func (obj *CBVaultDrive) EjectVolume(Force bool) error

Remarks

If the currently-open vault resides on a removable storage volume formatted with the CBFS Storage filesystem (i.e., if the vault was opened using the OpenVolume method), this method can be used to eject it. If this method is successful, the vault is closed, and the volume is made available for removal (similar to how the "Eject" functionality provided by Windows Explorer works).

The Force parameter specifies whether the removable storage volume should be forcefully ejected. If Force is false, this method will fail if the vault is currently in use by the system or other applications.

Note: This method can be called only when Active is true, and it cannot be called within events.

FileExists Method (CBVaultDrive Component)

This method checks whether a vault item exists.

Syntax

func (obj *CBVaultDrive) FileExists(FileName string) (bool, error)

Remarks

This method checks whether a vault item (file, directory, symbolic link, or alternate stream) with the specified FileName exists in the vault. If the specified vault item exists, this method returns true; otherwise, it returns false.

The value passed for FileName must be a vault-local absolute path.

Note: This method can be called only when Active is true.

FileMatchesMask Method (CBVaultDrive Component)

This method checks whether a particular file or directory name matches the specified mask.

Syntax

func (obj *CBVaultDrive) FileMatchesMask(Mask string, FileName string, CaseSensitive bool) (bool, error)

Remarks

This method checks whether the file or directory name specified by FileName matches Mask; if it does, this method returns true. The CaseSensitive parameter controls whether a case-sensitive match should be performed.

Note: This method does not handle so-called DOS_* wildcards (DOS_STAR, DOS_QM, DOS_DOT). The explanation about the characters can be found in the MSDN article. If you have a mask that includes one of those characters on Windows, you can use the RtlIsNameInExpression function of Windows API.

Note: As the explanation states, "When you do a case-insensitive search and do not provide a translation table, the name is converted to uppercase."

FileTagExists Method (CBVaultDrive Component)

This method checks whether a file tag exists.

Syntax

func (obj *CBVaultDrive) FileTagExists(FileName string, TagId int32, TagName string) (bool, error)

Remarks

This method checks whether a file tag with the specified TagId or TagName is attached to the file, directory, or alternate stream specified by FileName. If the specified file tag exists, this method returns true; otherwise, it returns false.

The value passed for FileName must be a vault-local absolute path.

To check for a raw file tag, pass its Id for TagId and pass an empty string for TagName. To check for a typed file tag, pass its name for TagName and pass 0 for TagId. If values are provided for both TagId and TagName, this method returns an error.

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true.

FileTimeToNanoseconds Method (CBVaultDrive Component)

This method returns the subsecond part of the time expressed in nanoseconds.

Syntax

func (obj *CBVaultDrive) FileTimeToNanoseconds(FileTime time.Time) (int32, error)

Remarks

Use this method to obtain the subsecond part of the FileTime value, expressed in nanoseconds.

FileTimeToUnixTime Method (CBVaultDrive Component)

This method converts FileTime to Unix time format.

Syntax

func (obj *CBVaultDrive) FileTimeToUnixTime(FileTime time.Time) (int64, error)

Remarks

Use this method to convert the FileTime value to Unix time format. The subsecond part of the value is not preserved; to obtain it, use the FileTimeToNanoseconds method.

FindClose Method (CBVaultDrive Component)

This method closes a search operation and releases any associated resources.

Syntax

func (obj *CBVaultDrive) FindClose(SearchId int64) error

Remarks

This method closes the search operation identified by SearchId, releasing any previously allocated resources associated with it.

The value passed for SearchId must be a search operation Id returned by FindFirst or FindFirstByQuery.

Note: This method can be called only when Active is true.

FindFirst Method (CBVaultDrive Component)

This method searches for the first vault item that matches the specified name and attributes.

Syntax

func (obj *CBVaultDrive) FindFirst(FileMask string, Attributes int32, Flags int32) (int64, error)

Remarks

This method initiates a search operation based on the specified FileMask, Attributes, and Flags. If there are any matching vault items (files, directories, symbolic links, or alternate streams), then a search operation Id is returned. If there are no matching vault items, then -1 is returned.

To obtain information about a search result, pass the returned search handle to the following methods:

To retrieve the next search result, pass the returned search handle to the FindNext method. When an application is finished with (or wants to abandon) a search operation, it must pass the associated search handle to the FindClose method to release the resources associated with it.

Because each search operation is identified by the search handle associated with it, applications may initiate additional search operations at any time and may process each operation's search results in any manner it desires (e.g., sequentially, round robin).

The FileMask parameter specifies both the directory path to search within and the filename mask to match against (e.g., \directory\to\search\*.txt). Or, when searching a file's alternate streams, it specifies the file path and stream name mask (e.g., \path\to\file:*). Only the mask may contain wildcards. The path must be specified in vault-local absolute format. Also note that files without an extension will match *, but not *.*.

The Attributes parameter specifies the attributes to match against; items will match only if they have one or more of the specified attributes. The value passed for this parameter should be constructed by ORing together zero or more of the following values. Passing 0 will allow any file in a directory (or, any alternate stream in a file) to match; it is equivalent to VAULT_FATTR_FILE | VAULT_FATTR_DATA_STREAM.

VAULT_FATTR_FILE0x00000001The entry is a file.

VAULT_FATTR_DIRECTORY0x00000002The entry is a directory.

VAULT_FATTR_DATA_STREAM0x00000004The entry is an alternate data stream.

VAULT_FATTR_COMPRESSED0x00000008The file or stream is compressed.

VAULT_FATTR_ENCRYPTED0x00000010The file or stream is encrypted.

VAULT_FATTR_SYMLINK0x00000020The entry is a symbolic link.

VAULT_FATTR_READONLY0x00000040The file is read-only.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_ARCHIVE0x00000080The file requires archiving.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_HIDDEN0x00000100The file is hidden.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_SYSTEM0x00000200The file is a system file.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_TEMPORARY0x00000400The file is temporary.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_DELETE_ON_CLOSE0x00000800The file should be deleted when the last handle to the file is closed.

This attribute is currently not supported by CBFS Storage.

VAULT_FATTR_RESERVED_00x00001000Reserved.

VAULT_FATTR_RESERVED_10x00002000Reserved.

VAULT_FATTR_RESERVED_20x00004000Reserved.

VAULT_FATTR_RESERVED_30x00008000Reserved.

VAULT_FATTR_NO_USER_CHANGE0x0000F03FA mask that includes all attributes that cannot be changed.

Applications cannot use the SetFileAttributes method to directly change any of the following attributes: FILE, DIRECTORY, DATA_STREAM, COMPRESSED, ENCRYPTED, SYMLINK, RESERVED_0, RESERVED_1, RESERVED_2, or RESERVED_3.

VAULT_FATTR_USER_DEFINED0x7FF00000A mask for application-defined attributes.

Applications can use the SetFileAttributes method to set custom attributes, as long as their values are covered by this mask.

VAULT_FATTR_ANY_FILE0x7FFFFFFFA mask that includes any and all attributes.

The Flags parameter controls search behavior. Among other things, it can be used to request that only specific pieces of information be returned, which can greatly improve performance. The value passed for this parameter should be constructed by ORing together zero or more of the following values:

VAULT_FF_NEED_NAME0x00000001Include entry names (without paths) when returning search results.

VAULT_FF_NEED_FULL_NAME0x00000002Include fully qualified entry names when returning search results.

VAULT_FF_NEED_ATTRIBUTES0x00000004Include entry attributes when returning search results.

VAULT_FF_NEED_SIZE0x00000008Include entry sizes when returning search results.

VAULT_FF_NEED_METADATA_SIZE0x00000010Include entry metadata sizes when returning search results.

VAULT_FF_NEED_TIMES0x00000020Include entry times when returning search results.

VAULT_FF_NEED_LINK_DEST0x00000040Include symbolic link destinations when returning search results.

VAULT_FF_EMULATE_FAT0x00001000Inserts . and .. pseudo-entries into search results for all directories except the root one.

VAULT_FF_RECURSIVE0x00002000Search recursively in all subdirectories.

VAULT_FF_CASE_INSENSITIVE0x00004000Forces case-insensitive search, even if the vault is case-sensitive.

If Flags is 0, the component uses 0x0000006F (i.e., all VAULT_FF_NEED_* flags except VAULT_FF_NEED_METADATA).

Note: This method can be called only when Active is true, and it cannot be called within events.

FindFirstByQuery Method (CBVaultDrive Component)

This method searches for the first file or directory whose file tags match the specified query.

Syntax

func (obj *CBVaultDrive) FindFirstByQuery(Directory string, Query string, Flags int32) (int64, error)

Remarks

This method initiates a search operation within the specified Directory for files and subdirectories whose typed file tags match the specified Query. If there are any matching files or directories, then a search operation Id is returned. If there are no matching files or directories, then -1 is returned.

To obtain information about a search result, pass the returned search handle to the following methods:

To retrieve the next search result, pass the returned search handle to the FindNext method. When an application is finished with (or wants to abandon) a search operation, it must pass the associated search handle to the FindClose method to release the resources associated with it.

Because each search operation is identified by the search handle associated with it, applications may initiate additional search operations at any time and may process each operation's search results in any manner it desires (e.g., sequentially, round robin).

The value passed for Directory must be a vault-local absolute path.

The value passed for Query must be a search query constructed using the CBFS Storage Query Language; please refer to that topic for more information.

The Flags parameter controls search behavior. Among other things, it can be used to request that only specific pieces of information be returned, which can greatly improve performance. The value passed for this parameter should be constructed by ORing together zero or more of the following values:

VAULT_FF_NEED_NAME0x00000001Include entry names (without paths) when returning search results.

VAULT_FF_NEED_FULL_NAME0x00000002Include fully qualified entry names when returning search results.

VAULT_FF_NEED_ATTRIBUTES0x00000004Include entry attributes when returning search results.

VAULT_FF_NEED_SIZE0x00000008Include entry sizes when returning search results.

VAULT_FF_NEED_METADATA_SIZE0x00000010Include entry metadata sizes when returning search results.

VAULT_FF_NEED_TIMES0x00000020Include entry times when returning search results.

VAULT_FF_NEED_LINK_DEST0x00000040Include symbolic link destinations when returning search results.

VAULT_FF_EMULATE_FAT0x00001000Inserts . and .. pseudo-entries into search results for all directories except the root one.

VAULT_FF_RECURSIVE0x00002000Search recursively in all subdirectories.

VAULT_FF_CASE_INSENSITIVE0x00004000Forces case-insensitive search, even if the vault is case-sensitive.

If Flags is 0, the component uses 0x0000006F (i.e., all VAULT_FF_NEED_* flags except VAULT_FF_NEED_METADATA).

Note: This method can be called only when Active is true, and it cannot be called within events.

FindNext Method (CBVaultDrive Component)

This method searches for the next vault item that matches an ongoing search operation.

Syntax

func (obj *CBVaultDrive) FindNext(SearchId int64) (bool, error)

Remarks

This method searches for the next vault item (file, directory, symbolic link, or alternate stream) that matches the ongoing search operation identified by SearchId. If a matching vault item is found, this method returns true; otherwise, it returns false.

The value passed for SearchId must be a search operation Id returned by FindFirst or FindFirstByQuery. Please refer to the methods' documentation for more information about search operations.

Note: This method can be called only when Active is true, and it cannot be called within events.

ForceUnmount Method (CBVaultDrive Component)

Forcefully unmounts the virtual drive associated with the specified vault (Windows only).

Syntax

func (obj *CBVaultDrive) ForceUnmount(VaultFile string) error

Remarks

This method instructs the CBFS Storage driver to forcefully unmount the virtual drive associated with the vault storage file specified by VaultFile. Typically, this is only necessary if an application crashes without first unmounting the virtual drive(s) that it created.

Please note that only the processes which have access to a vault storage file may forcefully unmount a virtual drive associated with it.

The value passed for VaultFile must be a fully-qualified file path formatted according to OS conventions.

Note: This method cannot be called within events.

FormatVolume Method (CBVaultDrive Component)

Formats a storage volume or partition with the CBFS Storage filesystem (Windows only).

Syntax

func (obj *CBVaultDrive) FormatVolume(VolumeName string, Flags int32) error

Remarks

This method formats the storage volume or partition specified by VolumeName with the CBFS Storage filesystem, allowing it to be opened as a vault using the OpenVolume method.

The VolumeName parameter specifies the fully-qualified name of a storage volume or partition. DOS names, such as X:, are also valid.

The Flags parameter is used to control formatting options, and should be set by OR'ing together zero or more of the following flags:

VAULT_FMF_FAST_FORMAT0x00000001Perform a fast format; only initialize the pages necessary for storing the filesystem structure.

When this flag is not set, all pages of the new vault are initialized.

Note that formatting a large storage partition or volume can take a significant amount of time, and this method will block until the formatting process is complete.

Note: This method cannot be called when Active is true, and it cannot be called within events.

GetDriverStatus Method (CBVaultDrive Component)

Retrieves the status of the system driver.

Syntax

func (obj *CBVaultDrive) GetDriverStatus(ProductGUID string, Module int32) (int32, error)

Remarks

This method retrieves the status of the system driver module specified by Module. This status can then be used to verify whether it has been properly installed and is ready for use.

The value returned by the method corresponds to the dwCurrentState field of the SERVICE_STATUS structure from the Windows API. It will be one of the following:

MODULE_STATUS_NOT_PRESENT0x00000000The specified module is not present on the system.

MODULE_STATUS_STOPPED0x00000001The specified module is in the Stopped state.

MODULE_STATUS_RUNNING0x00000004The specified module is loaded and running.

ProductGUID is used to distinguish between driver installations performed by different applications. Such information is necessary to guard against unexpected situations such as, e.g., the driver being uninstalled by one application despite other applications still needing it.

The GUID must be specified in so-called "Registry Format" (e.g., "{1FAD0EF2-9A03-4B87-B4BC-645B7035ED90}") with curly braces included.

To ensure proper operation, it is critical that each individual application have its own unique ProductGUID value, and that applications (and their installation scripts) use that value when calling any of the following methods:

The Module parameter specifies which driver module to query the status of. Possible values are:

MODULE_DRIVER_PNP_BUS0x00000001PnP Bus Driver (.sys file).

This module must be installed if the application wishes to make use of Plug-and-Play (PnP) storage features component in Windows. PnP storage devices are those visible as disks in the Device Manager, and the system treats such storage devices differently from other purely virtual devices.

The virtual disk driver must be re-installed anytime this module is added or removed.

MODULE_DRIVER_BLOCK0x00000002Virtual disk driver (.sys file).

The product's virtual disk driver module, which provides core functionality; it must be installed for the component to function correctly.

MODULE_DRIVER_FS0x00000004Filesystem driver (.sys file).

The product's filesystem driver module, which provides core functionality; it must be installed for the component to function correctly.

MODULE_HELPER_DLL0x00010000Shell Helper DLL (CBVaultDriveShellHelper2022.dll)

This module provides supplementary functionality for the component; please refer to the Helper DLL topic for more information.

Note: Not applicable when calling the GetDriverStatus method.

This method is available in both the component API and the Installer DLL included with the product; please refer to the Driver Installation in Windows topic for more information about the latter.

Note: This method cannot be called within events.

GetFileAttributes Method (CBVaultDrive Component)

This method retrieves the attributes of a vault item.

Syntax

func (obj *CBVaultDrive) GetFileAttributes(FileName string) (int32, error)

Remarks

This method retrieves the attributes of the vault item (e.g., file, directory, symbolic link, or alternate stream) specified by FileName.

The value passed for FileName must be a vault-local absolute path.

The specified vault item's attributes are returned as a 32-bit integer composed of one or more of the following values:

VAULT_FATTR_FILE0x00000001The entry is a file.

VAULT_FATTR_DIRECTORY0x00000002The entry is a directory.

VAULT_FATTR_DATA_STREAM0x00000004The entry is an alternate data stream.

VAULT_FATTR_COMPRESSED0x00000008The file or stream is compressed.

VAULT_FATTR_ENCRYPTED0x00000010The file or stream is encrypted.

VAULT_FATTR_SYMLINK0x00000020The entry is a symbolic link.

VAULT_FATTR_READONLY0x00000040The file is read-only.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_ARCHIVE0x00000080The file requires archiving.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_HIDDEN0x00000100The file is hidden.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_SYSTEM0x00000200The file is a system file.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_TEMPORARY0x00000400The file is temporary.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_DELETE_ON_CLOSE0x00000800The file should be deleted when the last handle to the file is closed.

This attribute is currently not supported by CBFS Storage.

VAULT_FATTR_RESERVED_00x00001000Reserved.

VAULT_FATTR_RESERVED_10x00002000Reserved.

VAULT_FATTR_RESERVED_20x00004000Reserved.

VAULT_FATTR_RESERVED_30x00008000Reserved.

VAULT_FATTR_NO_USER_CHANGE0x0000F03FA mask that includes all attributes that cannot be changed.

Applications cannot use the SetFileAttributes method to directly change any of the following attributes: FILE, DIRECTORY, DATA_STREAM, COMPRESSED, ENCRYPTED, SYMLINK, RESERVED_0, RESERVED_1, RESERVED_2, or RESERVED_3.

VAULT_FATTR_USER_DEFINED0x7FF00000A mask for application-defined attributes.

Applications can use the SetFileAttributes method to set custom attributes, as long as their values are covered by this mask.

VAULT_FATTR_ANY_FILE0x7FFFFFFFA mask that includes any and all attributes.

Note: This method can be called only when Active is true.

GetFileCompression Method (CBVaultDrive Component)

This method retrieves the compression mode of a file or alternate stream.

Syntax

func (obj *CBVaultDrive) GetFileCompression(FileName string) (int32, error)

Remarks

This method retrieves the compression mode of the file or alternate stream specified by FileName.

The value passed for FileName must be a vault-local absolute path.

The returned compression mode will be one of the following values:

VAULT_CM_NONE0Do not use compression.

VAULT_CM_DEFAULT1Use default compression (zlib).

VAULT_CM_CUSTOM2Use event-based custom compression.

This compression level is not used.

VAULT_CM_ZLIB3Use zlib compression.

Valid compression levels are 1-9.

VAULT_CM_RLE4Use RLE compression.

This compression level is not used.

Applications that use custom compression must implement the DataCompress and DataDecompress events. Please refer to the Compression topic for more information.

Note: This method can be called only when Active is true.

GetFileCreationTime Method (CBVaultDrive Component)

This method retrieves the creation time of a vault item.

Syntax

func (obj *CBVaultDrive) GetFileCreationTime(FileName string) (time.Time, error)

Remarks

This method retrieves the creation time of the vault item (e.g., file, directory, symbolic link, or alternate stream) specified by FileName. The timestamps returned by this method are specified in UTC.

The value passed for FileName must be a vault-local absolute path.

Note: This method can be called only when Active is true.

GetFileEncryption Method (CBVaultDrive Component)

This method retrieves the encryption mode of a file or alternate stream.

Syntax

func (obj *CBVaultDrive) GetFileEncryption(FileName string) (int32, error)

Remarks

This method retrieves the encryption mode of the file or alternate stream specified by FileName.

The value passed for FileName must be a vault-local absolute path.

The returned encryption mode will be one of the following values:

VAULT_EM_NONE0x0Do not use encryption.

VAULT_EM_DEFAULT0x1Use default encryption (VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA256).

VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA2560x2Use AES256 encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

VAULT_EM_CUSTOM256_PBKDF2_HMAC_SHA2560x3Use event-based custom 256-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_PBKDF2_HMAC_SHA2560x4Use event-based custom 512-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_PBKDF2_HMAC_SHA2560x5Use event-based custom 1024-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_CUSTOM_KEY_DERIVE0x23Use event-based custom 256-bit encryption with custom key derivation.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_CUSTOM_KEY_DERIVE0x24Use event-based custom 512-bit encryption with custom key derivation.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_CUSTOM_KEY_DERIVE0x25Use event-based custom 1024-bit encryption with custom key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_DIRECT_KEY0x43Use event-based custom 256-bit encryption with no key derivation.

A 256-bit (32-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM512_DIRECT_KEY0x44Use event-based custom 512-bit encryption with no key derivation.

A 512-bit (64-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM1024_DIRECT_KEY0x45Use event-based custom 1024-bit encryption with no key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_UNKNOWN0xFFUnidentified or unknown encryption.

Applications that use custom encryption must implement at least the DataEncrypt and DataDecrypt events. Certain custom encryption modes may require that the HashCalculate or KeyDerive event be implemented as well. Please refer to the Encryption topic for more information.

Note: This method can be called only when Active is true.

GetFileLastAccessTime Method (CBVaultDrive Component)

This method retrieves the last access time of a vault item.

Syntax

func (obj *CBVaultDrive) GetFileLastAccessTime(FileName string) (time.Time, error)

Remarks

This method retrieves the creation time of the vault item (e.g., file, directory, symbolic link, or alternate stream) specified by FileName. The timestamps returned by this method are specified in UTC.

Note: Vault items' last access times are updated only if the UseAccessTime property is enabled.

The value passed for FileName must be a vault-local absolute path.

Note: This method can be called only when Active is true.

GetFileModificationTime Method (CBVaultDrive Component)

This method retrieves the modification time of a vault item.

Syntax

func (obj *CBVaultDrive) GetFileModificationTime(FileName string) (time.Time, error)

Remarks

This method retrieves the modification time of the vault item (e.g., file, directory, symbolic link, or alternate stream) specified by FileName. The timestamps returned by this method are specified in UTC.

The value passed for FileName must be a vault-local absolute path.

Note: This method can be called only when Active is true.

GetFileSize Method (CBVaultDrive Component)

This method retrieves the size of a file or alternate stream.

Syntax

func (obj *CBVaultDrive) GetFileSize(FileName string) (int64, error)

Remarks

This method retrieves the size, in bytes, of the file or alternate stream specified by FileName.

Note: For files, the returned value reflects only the size of the file's immediate contents, it does not account for any alternate streams the file may or may not contain.

The value passed for FileName must be a vault-local absolute path.

Note: This method can be called only when Active is true.

GetFileTag Method (CBVaultDrive Component)

This method retrieves the binary data held by a raw file tag attached to the specified vault item.

Syntax

func (obj *CBVaultDrive) GetFileTag(FileName string, TagId int32) ([]byte, error)

Remarks

This method retrieves the binary data held by a raw file tag, identified by TagId, attached to the vault item (e.g., file, directory, or alternate stream) specified by FileName. If a raw file tag with the specified TagId is not attached to the specified vault item, this method returns an error.

The value passed for FileName must be a vault-local absolute path. The value passed for TagId must be in the range 0x0001 to 0xCFFF (inclusive).

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true.

GetFileTagAsAnsiString Method (CBVaultDrive Component)

This method retrieves the value of an AnsiString-typed file tag attached to the specified vault item.

Syntax

func (obj *CBVaultDrive) GetFileTagAsAnsiString(FileName string, TagName string) (string, error)

Remarks

This method retrieves the value of an AnsiString-typed file tag, identified by TagName, attached to the vault item (e.g., file, directory, or alternate stream) specified by FileName. If an AnsiString-typed file tag with the specified TagName is not attached to the specified vault item, this method returns an error.

The value passed for FileName must be a vault-local absolute path. The value passed for TagName may be up to 4095 characters in length (not including the null terminator).

Please refer to the File Tags topic for more information.

This method can only retrieve typed file tags created with the SetFileTagAsAnsiString method. Typed file tags created with the SetFileTagAsString method must be retrieved using the GetFileTagAsString method.

Note: This method can be called only when Active is true.

GetFileTagAsBoolean Method (CBVaultDrive Component)

This method retrieves the value of a Boolean-typed file tag attached to the specified vault item.

Syntax

func (obj *CBVaultDrive) GetFileTagAsBoolean(FileName string, TagName string) (bool, error)

Remarks

This method retrieves the value of a Boolean-typed file tag, identified by TagName, attached to the vault item (e.g., file, directory, or alternate stream) specified by FileName. If a Boolean-typed file tag with the specified TagName is not attached to the specified vault item, this method returns an error.

The value passed for FileName must be a vault-local absolute path. The value passed for TagName may be up to 4095 characters in length (not including the null terminator).

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true.

GetFileTagAsDateTime Method (CBVaultDrive Component)

This method retrieves the value of a DateTime-typed file tag attached to the specified vault item.

Syntax

func (obj *CBVaultDrive) GetFileTagAsDateTime(FileName string, TagName string) (time.Time, error)

Remarks

This method retrieves the value of a DateTime-typed file tag, identified by TagName, attached to the vault item (e.g., file, directory, or alternate stream) specified by FileName. If a DateTime-typed file tag with the specified TagName is not attached to the specified vault item, this method returns an error.

The timestamps returned by this method are specified in UTC.

The value passed for FileName must be a vault-local absolute path. The value passed for TagName may be up to 4095 characters in length (not including the null terminator).

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true.

GetFileTagAsNumber Method (CBVaultDrive Component)

This method retrieves the value of a Number-typed file tag attached to the specified vault item.

Syntax

func (obj *CBVaultDrive) GetFileTagAsNumber(FileName string, TagName string) (int64, error)

Remarks

This method retrieves the value of a Number-typed file tag, identified by TagName, attached to the vault item (e.g., file, directory, or alternate stream) specified by FileName. If a Number-typed file tag with the specified TagName is not attached to the specified vault item, this method returns an error.

The value passed for FileName must be a vault-local absolute path. The value passed for TagName may be up to 4095 characters in length (not including the null terminator).

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true.

GetFileTagAsString Method (CBVaultDrive Component)

This method retrieves the value of a String-typed file tag attached to the specified vault item.

Syntax

func (obj *CBVaultDrive) GetFileTagAsString(FileName string, TagName string) (string, error)

Remarks

This method retrieves the value of a String-typed file tag, identified by TagName, attached to the vault item (e.g., file, directory, or alternate stream) specified by FileName. If a String-typed file tag with the specified TagName is not attached to the specified vault item, this method returns an error.

The value passed for FileName must be a vault-local absolute path. The value passed for TagName may be up to 4095 characters in length (not including the null terminator).

Please refer to the File Tags topic for more information.

This method can only retrieve typed file tags created with the SetFileTagAsString method. Typed file tags created with the SetFileTagAsAnsiString method must be retrieved using the GetFileTagAsAnsiString method.

Note: This method can be called only when Active is true.

GetFileTagDataType Method (CBVaultDrive Component)

This method retrieves the data type of a typed file tag attached to a specific vault item.

Syntax

func (obj *CBVaultDrive) GetFileTagDataType(FileName string, TagName string) (int32, error)

Remarks

This method retrieves the data type of a typed file tag, identified by TagName, attached to the vault item (e.g., file, directory, or alternate stream) specified by FileName. If a typed file tag with the specified TagName is not attached to the specified vault item, this method returns an error.

The value passed for FileName must be a vault-local absolute path. The value passed for TagName may be up to 4095 characters in length (not including the null terminator).

The value returned by this method will be one of the following (except VAULT_TDT_RAWDATA, which is not applicable):

VAULT_TDT_RAWDATA0x0The tag is untyped and must be addressed by Id.

VAULT_TDT_BOOLEAN0x1The tag contains Boolean data and must be addressed by name.

VAULT_TDT_STRING0x2The tag contains String (UTF-16LE) data and must be addressed by name.

VAULT_TDT_DATETIME0x3The tag contains DateTime data and must be addressed by name.

VAULT_TDT_NUMBER0x4The tag contains numeric (signed 64-bit) data and must be addressed by name.

VAULT_TDT_ANSISTRING0x5The tag contains AnsiString (8-bit string) data and must be addressed by name.

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true.

GetFileTagSize Method (CBVaultDrive Component)

This method retrieves the size of a raw file tag attached to the specified vault item.

Syntax

func (obj *CBVaultDrive) GetFileTagSize(FileName string, TagId int32) (int32, error)

Remarks

This method retrieves the size of the binary data held by a raw file tag, identified by TagId, attached to the vault item (e.g., file, directory, or alternate stream) specified by FileName. If a raw file tag with the specified TagId is not attached to the specified vault item, this method returns 0 as the tag size.

The value passed for FileName must be a vault-local absolute path. The value passed for TagId must be in the range 0x0001 to 0xCFFF (inclusive).

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true.

GetModuleVersion Method (CBVaultDrive Component)

Retrieves the version of a given product module.

Syntax

func (obj *CBVaultDrive) GetModuleVersion(ProductGUID string, Module int32) (int64, error)

Remarks

This method retrieves the version of the product module specified by Module. The value is returned as a 64-bit integer composed of four 16-bit words that each correspond to a piece of the overall module version. For example, a version of 2.32.6.28 would cause the value 0x000200200006001C to be returned.

If the specified module is not installed, this method returns 0.

ProductGUID is used to distinguish between driver installations performed by different applications. Such information is necessary to guard against unexpected situations such as, e.g., the driver being uninstalled by one application despite other applications still needing it.

The GUID must be specified in so-called "Registry Format" (e.g., "{1FAD0EF2-9A03-4B87-B4BC-645B7035ED90}") with curly braces included.

To ensure proper operation, it is critical that each individual application have its own unique ProductGUID value, and that applications (and their installation scripts) use that value when calling any of the following methods:

The Module parameter specifies which driver module to query the status of. Possible values are:

MODULE_DRIVER_PNP_BUS0x00000001PnP Bus Driver (.sys file).

This module must be installed if the application wishes to make use of Plug-and-Play (PnP) storage features component in Windows. PnP storage devices are those visible as disks in the Device Manager, and the system treats such storage devices differently from other purely virtual devices.

The virtual disk driver must be re-installed anytime this module is added or removed.

MODULE_DRIVER_BLOCK0x00000002Virtual disk driver (.sys file).

The product's virtual disk driver module, which provides core functionality; it must be installed for the component to function correctly.

MODULE_DRIVER_FS0x00000004Filesystem driver (.sys file).

The product's filesystem driver module, which provides core functionality; it must be installed for the component to function correctly.

MODULE_HELPER_DLL0x00010000Shell Helper DLL (CBVaultDriveShellHelper2022.dll)

This module provides supplementary functionality for the component; please refer to the Helper DLL topic for more information.

Note: Not applicable when calling the GetDriverStatus method.

This method is available in both the component API and the Installer DLL included with the product; please refer to the Driver Installation in Windows topic for more information about the latter.

Note: This method cannot be called within events.

GetOriginatorProcessId Method (CBVaultDrive Component)

Retrieves the Id of the process (PID) that initiated the operation.

Syntax

func (obj *CBVaultDrive) GetOriginatorProcessId() (int32, error)

Remarks

This method can be called within the FilePasswordNeeded and FileAccess events to retrieve the Id of the process (PID) that initiated the operation. If the query fails, this method returns 0.

Please note that PIDs are not unique, and may be reused by different processes over time (though in practice, this is uncommon).

CBVaultDrive/Windows-specific: Applications cannot use this method to retrieve information about remote processes accessing virtual drives shared on the network. Windows does not provide such information due to the nature of remote access.

GetOriginatorProcessName Method (CBVaultDrive Component)

Retrieves the name of the process that initiated the operation.

Syntax

func (obj *CBVaultDrive) GetOriginatorProcessName() (string, error)

Remarks

This method can be called within the FilePasswordNeeded and and FileAccess events to retrieve the name of the process that initiated the operation. If the query fails, this method returns empty string.

CBVaultDrive/Windows-specific: Applications cannot use this method to retrieve information about remote processes accessing virtual drives shared on the network. Windows does not provide such information due to the nature of remote access.

GetOriginatorThreadId Method (CBVaultDrive Component)

Retrieves the Id of the thread that initiated the operation (Windows only).

Syntax

func (obj *CBVaultDrive) GetOriginatorThreadId() (int32, error)

Remarks

This method can be called within the FilePasswordNeeded and FileAccess events to retrieve the Id of the thread that initiated the operation. If the query fails, this method returns 0.

Please note that thread Ids are not unique, and may be reused by different threads over time.

GetOriginatorToken Method (CBVaultDrive Component)

Retrieves the security token associated with the process that initiated the operation (Windows only).

Syntax

func (obj *CBVaultDrive) GetOriginatorToken() (int64, error)

Remarks

This method can be called within the FilePasswordNeeded event to retrieve the security token associated with the process that initiated the operation. If the query fails, this method returns INVALID_HANDLE_VALUE.

The security token returned by this method can be passed to the Windows API's GetTokenInformation function to obtain more information about the process.

Important: When applications are finished using the returned security token, they must close it using the Windows API's CloseHandle function.

Network Access Notes (CBVaultDrive-specific)

For virtual drives shared on the network, applications may wish to obtain information about the network users accessing it (e.g., account names). Drives can be shared in several modes in Windows, which can affect the information retrievable via the security token this method returns:

  • Authenticated mode, in which case the Helper DLL (which, in general, is responsible for relaying remote drive requests to and from the system driver) will impersonate the network user, allowing that account's actual information to be retrieved.
  • Guest mode, in which case the retrievable information is for the system's GUEST account.
  • Administrative shares (those which exist by default and whose names end with '$'; e.g., C$, ADMIN$, etc.), in which case the retrievable information is for the LOCAL_SYSTEM account.

GetSearchResultAttributes Method (CBVaultDrive Component)

This method retrieves the attributes of a vault item found during a search operation.

Syntax

func (obj *CBVaultDrive) GetSearchResultAttributes(SearchId int64) (int32, error)

Remarks

This method retrieves the attributes of a vault item (e.g., file, directory, symbolic link, or alternate stream) found via FindFirst/FindFirstByQuery/FindNext as part of the search operation identified by SearchId. Please refer to those methods' documentation for more information.

The value passed for SearchId must be a search operation Id returned by FindFirst or FindFirstByQuery.

The vault item's attributes are returned as a 32-bit integer composed of one or more of the following values:

VAULT_FATTR_FILE0x00000001The entry is a file.

VAULT_FATTR_DIRECTORY0x00000002The entry is a directory.

VAULT_FATTR_DATA_STREAM0x00000004The entry is an alternate data stream.

VAULT_FATTR_COMPRESSED0x00000008The file or stream is compressed.

VAULT_FATTR_ENCRYPTED0x00000010The file or stream is encrypted.

VAULT_FATTR_SYMLINK0x00000020The entry is a symbolic link.

VAULT_FATTR_READONLY0x00000040The file is read-only.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_ARCHIVE0x00000080The file requires archiving.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_HIDDEN0x00000100The file is hidden.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_SYSTEM0x00000200The file is a system file.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_TEMPORARY0x00000400The file is temporary.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_DELETE_ON_CLOSE0x00000800The file should be deleted when the last handle to the file is closed.

This attribute is currently not supported by CBFS Storage.

VAULT_FATTR_RESERVED_00x00001000Reserved.

VAULT_FATTR_RESERVED_10x00002000Reserved.

VAULT_FATTR_RESERVED_20x00004000Reserved.

VAULT_FATTR_RESERVED_30x00008000Reserved.

VAULT_FATTR_NO_USER_CHANGE0x0000F03FA mask that includes all attributes that cannot be changed.

Applications cannot use the SetFileAttributes method to directly change any of the following attributes: FILE, DIRECTORY, DATA_STREAM, COMPRESSED, ENCRYPTED, SYMLINK, RESERVED_0, RESERVED_1, RESERVED_2, or RESERVED_3.

VAULT_FATTR_USER_DEFINED0x7FF00000A mask for application-defined attributes.

Applications can use the SetFileAttributes method to set custom attributes, as long as their values are covered by this mask.

VAULT_FATTR_ANY_FILE0x7FFFFFFFA mask that includes any and all attributes.

If, however, attributes were not requested as part of the specified search operation (by passing either 0 or a value including VAULT_FF_NEED_ATTRIBUTES for the FindFirst/FindFirstByQuery method's Flags parameter), this method will always return 0. Please refer to the documentation for these methods for more information.

Note: This method can be called only when Active is true.

GetSearchResultCreationTime Method (CBVaultDrive Component)

This method retrieves the creation time of a vault item found during a search operation.

Syntax

func (obj *CBVaultDrive) GetSearchResultCreationTime(SearchId int64) (time.Time, error)

Remarks

This method retrieves the creation time of a vault item (e.g., file, directory, symbolic link, or alternate stream) found via FindFirst/FindFirstByQuery/FindNext as part of the search operation identified by SearchId. Please refer to those methods' documentation for more information.

The value passed for SearchId must be a search operation Id returned by FindFirst or FindFirstByQuery.

The timestamps returned by this method are specified in UTC.

If times were not requested as part of the specified search operation (by passing either 0 or a value including VAULT_FF_NEED_TIMES for the FindFirst/FindFirstByQuery method's Flags parameter), this method will always return January 1, 1601 00:00:00 UTC. Please refer to the documentation for these methods for more information.

Note: This method can be called only when Active is true.

GetSearchResultFullName Method (CBVaultDrive Component)

This method retrieves the fully qualified name of a vault item found during a search operation.

Syntax

func (obj *CBVaultDrive) GetSearchResultFullName(SearchId int64) (string, error)

Remarks

This method retrieves the fully qualified name of a vault item (e.g., file, directory, symbolic link, or alternate stream) found via FindFirst/FindFirstByQuery/FindNext as part of the search operation identified by SearchId (i.e., the vault item's vault-local absolute path). Please refer to those methods' documentation for more information.

The value passed for SearchId must be a search operation Id returned by FindFirst or FindFirstByQuery.

If fully qualified names were not requested as part of the specified search operation (by passing either 0 or a value including VAULT_FF_NEED_FULL_NAME for the FindFirst/FindFirstByQuery method's Flags parameter), this method will always return an empty string. Please refer to the documentation for these methods for more information.

Note: This method can be called only when Active is true.

GetSearchResultLastAccessTime Method (CBVaultDrive Component)

This method retrieves the last access time of a vault item found during a search operation.

Syntax

func (obj *CBVaultDrive) GetSearchResultLastAccessTime(SearchId int64) (time.Time, error)

Remarks

This method retrieves the creation time of a vault item (e.g., file, directory, symbolic link, or alternate stream) found via FindFirst/FindFirstByQuery/FindNext as part of the search operation identified by SearchId. Please refer to those methods' documentation for more information.

The value passed for SearchId must be a search operation Id returned by FindFirst or FindFirstByQuery.

The timestamps returned by this method are specified in UTC.

If times were not requested as part of the specified search operation (by passing either 0 or a value including VAULT_FF_NEED_TIMES for the FindFirst/FindFirstByQuery method's Flags parameter), this method will always return January 1, 1601 00:00:00 UTC. Please refer to the documentation for these methods for more information.

Note: Vault items' last access times are updated only if the UseAccessTime property is enabled.

Note: This method can be called only when Active is true.

GetSearchResultLinkDestination Method (CBVaultDrive Component)

This method retrieves the destination of a symbolic link found during a search operation.

Syntax

func (obj *CBVaultDrive) GetSearchResultLinkDestination(SearchId int64) (string, error)

Remarks

This method retrieves the fully qualified name of a symbolic link found via FindFirst/FindFirstByQuery/FindNext as part of the search operation identified by SearchId. Please refer to those methods' documentation for more information.

The value passed for SearchId must be a search operation Id returned by FindFirst or FindFirstByQuery.

If the most recently found vault item is not a symbolic link, or if symbolic link destinations were not requested as part of the specified search operation (by passing either 0 or a value including VAULT_FF_NEED_LINK_DEST for the FindFirst/FindFirstByQuery method's Flags parameter), this method will always return an empty string. Please refer to the documentation for these methods for more information.

Note: This method can be called only when Active is true.

GetSearchResultMetadataSize Method (CBVaultDrive Component)

This method retrieves the size of the metadata associated with a vault item found during a search operation.

Syntax

func (obj *CBVaultDrive) GetSearchResultMetadataSize(SearchId int64) (int64, error)

Remarks

This method retrieves the size of the metadata associated with a vault item (e.g., file, directory, symbolic link, or alternate stream) found via FindFirst/FindFirstByQuery/FindNext as part of the search operation identified by SearchId. Please refer to those methods' documentation for more information.

The metadata size of a vault item reflects the total size of all vault pages associated with it that do not contain actual file/stream data; this includes file tags (both internal and application defined), index pages, B-trees, and all other "filesystem information".

The value passed for SearchId must be a search operation Id returned by FindFirst or FindFirstByQuery.

If metadata sizes were not requested as part of the specified search operation (by passing either 0 or a value including VAULT_FF_NEED_METADATA_SIZE for the FindFirst/FindFirstByQuery method's Flags parameter), this method will always return 0. Please refer to the documentation for these methods for more information.

Note: This method can be called only when Active is true.

GetSearchResultModificationTime Method (CBVaultDrive Component)

This method retrieves the modification time of a vault item found during a search operation.

Syntax

func (obj *CBVaultDrive) GetSearchResultModificationTime(SearchId int64) (time.Time, error)

Remarks

This method retrieves the modification time of a vault item (e.g., file, directory, symbolic link, or alternate stream) found via FindFirst/FindFirstByQuery/FindNext as part of the search operation identified by SearchId. Please refer to those methods' documentation for more information.

The value passed for SearchId must be a search operation Id returned by FindFirst or FindFirstByQuery.

The timestamps returned by this method are specified in UTC.

If times were not requested as part of the specified search operation (by passing either 0 or a value including VAULT_FF_NEED_TIMES for the FindFirst/FindFirstByQuery method's Flags parameter), this method will always return January 1, 1601 00:00:00 UTC. Please refer to the documentation for these methods for more information.

Note: This method can be called only when Active is true.

GetSearchResultName Method (CBVaultDrive Component)

This method retrieves the name of a vault item found during a search operation.

Syntax

func (obj *CBVaultDrive) GetSearchResultName(SearchId int64) (string, error)

Remarks

This method retrieves the name of a vault item (e.g., file, directory, symbolic link, or alternate stream) found via FindFirst/FindFirstByQuery/FindNext as part of the search operation identified by SearchId. Please refer to those methods' documentation for more information.

The value passed for SearchId must be a search operation Id returned by FindFirst or FindFirstByQuery.

The names returned by this method do not include a path; use GetSearchResultFullName if a path is needed.

If names were not requested as part of the specified search operation (by passing either 0 or a value including VAULT_FF_NEED_NAME for the FindFirst/FindFirstByQuery method's Flags parameter), this method will always return an empty string. Please refer to the documentation for these methods for more information.

Note: This method can be called only when Active is true.

GetSearchResultSize Method (CBVaultDrive Component)

This method retrieves the size of a vault item found during a search operation.

Syntax

func (obj *CBVaultDrive) GetSearchResultSize(SearchId int64) (int64, error)

Remarks

This method retrieves the size of a vault item (e.g., file, directory, symbolic link, or alternate stream) found via FindFirst/FindFirstByQuery/FindNext as part of the search operation identified by SearchId. Please refer to those methods' documentation for more information.

Note: For files, the returned value reflects only the size of the file's immediate contents; it does not account for any alternate streams the file may or may not contain.

The value passed for SearchId must be a search operation Id returned by FindFirst or FindFirstByQuery.

If the vault item is a directory, or if sizes were not requested as part of the specified search operation (by passing either 0 or a value including VAULT_FF_NEED_SIZE for the FindFirst/FindFirstByQuery method's Flags parameter), this method will always return 0. Please refer to the documentation for these methods for more information.

Note: This method can be called only when Active is true.

Initialize Method (CBVaultDrive Component)

This method initializes the component.

Syntax

func (obj *CBVaultDrive) Initialize(ProductGUID string) error

Remarks

This method initializes the component and must be called each time the application starts before attempting to call any of the component's other methods with the exception of installation-related methods.

ProductGUID is used to distinguish between driver installations performed by different applications. Such information is necessary to guard against unexpected situations such as, e.g., the driver being uninstalled by one application despite other applications still needing it.

The GUID must be specified in so-called "Registry Format" (e.g., "{1FAD0EF2-9A03-4B87-B4BC-645B7035ED90}") with curly braces included.

To ensure proper operation, it is critical that each individual application have its own unique ProductGUID value, and that applications (and their installation scripts) use that value when calling any of the following methods:

If the required driver was not installed using the Install method with the same value of ProductGUID, Initialize will return a ERROR_FILE_NOT_FOUND error (Win32 error code 2).

If the loaded kernel-mode driver is older than the user-mode API, Initialize will return a ERROR_INVALID_KERNEL_INFO_VERSION error (Win32 error code 340). In this situation, an update of the driver using the Install method is required before the component can be used.

Install Method (CBVaultDrive Component)

Installs (or upgrades) the product's system drivers and/or the helper DLL (Windows only).

Syntax

func (obj *CBVaultDrive) Install(CabFileName string, ProductGUID string, PathToInstall string, ModulesToInstall int32, Flags int32) (int32, error)

Remarks

This method is used to install or upgrade the product's various modules (i.e., the system drivers and the Helper DLL). The ModulesToInstall parameter selects which modules should be installed. If the system must be rebooted to complete the installation process, this method will return a non-zero value indicating which module(s) requested the reboot (out of those initially selected).

Important: To upgrade the product's modules, use only the Install method. Previously installed versions of the modules should not be uninstalled first. Calling the Install method will upgrade the previously installed version.

Please refer to the Driver Installation in Windows topic for more information.

CabFileName must be the path of the .cab file containing the product modules. Important: This .cab file must remain on the target system (or be available in some other way) after installation, as it is required for uninstalling the modules from the system.

ProductGUID is used to distinguish between driver installations performed by different applications. Such information is necessary to guard against unexpected situations such as, e.g., the driver being uninstalled by one application despite other applications still needing it.

The GUID must be specified in so-called "Registry Format" (e.g., "{1FAD0EF2-9A03-4B87-B4BC-645B7035ED90}") with curly braces included.

To ensure proper operation, it is critical that each individual application have its own unique ProductGUID value, and that applications (and their installation scripts) use that value when calling any of the following methods:

PathToInstall controls where the modules are installed. Pass empty string (highly recommended) to automatically install them to the appropriate Windows system directory.

ModulesToInstall should contain one or more of the following flags, OR'd together:

MODULE_DRIVER_PNP_BUS0x00000001PnP Bus Driver (.sys file).

This module must be installed if the application wishes to make use of Plug-and-Play (PnP) storage features component in Windows. PnP storage devices are those visible as disks in the Device Manager, and the system treats such storage devices differently from other purely virtual devices.

The virtual disk driver must be re-installed anytime this module is added or removed.

MODULE_DRIVER_BLOCK0x00000002Virtual disk driver (.sys file).

The product's virtual disk driver module, which provides core functionality; it must be installed for the component to function correctly.

MODULE_DRIVER_FS0x00000004Filesystem driver (.sys file).

The product's filesystem driver module, which provides core functionality; it must be installed for the component to function correctly.

MODULE_HELPER_DLL0x00010000Shell Helper DLL (CBVaultDriveShellHelper2022.dll)

This module provides supplementary functionality for the component; please refer to the Helper DLL topic for more information.

Note: Not applicable when calling the GetDriverStatus method.

Flags specifies various installation options, and should contain zero or more of the following flags, OR'd together:

INSTALL_REMOVE_OLD_VERSIONS0x00000001Uninstall drivers and helper DLLs from previous component versions (e.g., 2017).

INSTALL_KEEP_START_TYPE0x00000002Keep the driver's current start type setting in the registry.

If this flag is not set (default), the installation logic will reset the driver's start type setting in the Windows registry to the default value. Setting this flag causes the installation logic to preserve the current value, which may be necessary if the user (or the application itself) set it previously.

INSTALL_OVERWRITE_SAME_VERSION0x00000004Install files when their version is the same as the version of already installed files.

If this flag is not set (default), the installation logic will overwrite the existing file only if the version number of the file being installed is larger than the version of the file being overwritten. Setting this flag causes the installation logic to overwrite the file even when it has the same version.

INSTALL_FORCE_SHA1_DRIVERS0x00000008Tell the installer to use SHA1-signed drivers regardless of the OS.

If this flag is not set (default), the installation logic will use SHA1 drivers only on Windows 7. However, some systems based on Windows 8.x, despite supporting SHA2 driver signatures, refuse to install the Plug-n-play drivers signed by Microsoft using SHA256 (error 0xe0000244 is reported). To work around this problem, you may use this flag - a system should accept SHA1-signed drivers then. Note that the flag should be used only as a fallback when the system returns the above-mentioned error code during the regular installation procedure.

This method is available in both the component API and the Installer DLL included with the product; please refer to the Driver Installation in Windows topic for more information about the latter.

This method requires administrative rights to execute successfully. If the user account of the process that calls this method doesn't have such rights, the call will fail with an ERROR_PRIVILEGE_NOT_HELD (0x0522) error.

Note: This method cannot be called within events.

IsDirectoryEmpty Method (CBVaultDrive Component)

This method checks whether a directory is empty.

Syntax

func (obj *CBVaultDrive) IsDirectoryEmpty(Directory string) (bool, error)

Remarks

This method checks whether the directory specified by Directory is empty (i.e., does not contain any files, subdirectories, or symbolic links). If the specified directory is empty, this method returns true; otherwise, it returns false.

The value passed for Directory must be a vault-local absolute path.

Note: This method can be called only when Active is true.

IsIconRegistered Method (CBVaultDrive Component)

Checks whether the specified icon is registered (Windows only).

Syntax

func (obj *CBVaultDrive) IsIconRegistered(IconId string) (bool, error)

Remarks

This method checks whether an icon with the specified IconId has been registered. If such an icon has been registered, this method returns true; otherwise it returns false.

Icons can be registered using the RegisterIcon method. Please refer to that method's documentation, as well as the Custom Drive Icons topic, for more information.

The Helper DLL must be installed in order for this method to function correctly. Applications can check to see whether the Helper DLL is installed using the GetModuleVersion method, and install it using the Install method if necessary.

IsValidVault Method (CBVaultDrive Component)

This method checks whether a local file is a CBFS Storage vault.

Syntax

func (obj *CBVaultDrive) IsValidVault() (bool, error)

Remarks

This method checks whether the file specified by the VaultFile property is a CBFS Storage vault that can be opened by the component. The file being checked must be fully closed when this method is called.

If the specified file is a CBFS Storage vault, this method returns true; otherwise, it returns false.

If the CallbackMode property is enabled, the check will be performed by the appropriate Vault* events (and the value held by VaultFile is simply passed to such events for the application to use).

Note: This method uses a simple detection mechanism; it does not perform a full consistency check or attempt any repairs, so applications may still need to call CheckAndRepair even if this method returns true. If an error occurs during the detection process, this method returns an error.

Note: This method cannot be called when Active is true, and it cannot be called within events.

IsValidVaultVolume Method (CBVaultDrive Component)

Checks whether a storage partition or volume is formatted with the CBFS Storage filesystem (Windows only).

Syntax

func (obj *CBVaultDrive) IsValidVaultVolume(VolumeName string) (bool, error)

Remarks

This method checks whether the storage partition or volume specified by VolumeName is formatted with the CBFS Storage filesystem. If the specified storage volume or partition is formatted with the CBFS Storage filesystem, this method returns true; otherwise it returns false.

A storage volume or partition formatted with the CBFS Storage filesystem can be opened as a vault using the OpenVolume method.

The VolumeName parameter specifies the fully-qualified name of a storage volume or partition. DOS names, such as X:, are also valid.

Note that this method uses a simple detection mechanism; it doesn't perform a full consistency check or attempt any repairs, so applications may still need to call CheckAndRepair even if this method returns true. If an error occurs during the detection process, this method returns an error.

Note: This method cannot be called within events.

MoveFile Method (CBVaultDrive Component)

This method renames or moves a vault item.

Syntax

func (obj *CBVaultDrive) MoveFile(OldFileName string, NewFileName string, Overwrite bool) error

Remarks

This method renames or moves a vault item (e.g., file, directory, symbolic link, or alternate stream) from the specified OldFileName to the specified NewFileName. For alternate streams, renaming is always possible, but moving them from one file to another is allowed only if the AllowMoveStreamsBetweenFiles configuration setting is enabled.

The values passed for OldFileName and NewFileName must both be vault-local absolute paths (including the item's old and new names, respectively) in the same vault.

The Overwrite parameter specifies what to do if a vault item with the specified NewFileName already exists. If Overwrite is true, and such an item exists, it will be overwritten by the item specified by OldFileName. But if such an item exists, and Overwrite is false, this method returns an error.

Note: The usual rules of deletion still apply for an item being overwritten. Notably, a nonempty directory cannot be overwritten.

Note: This method can be called only when Active is true, and it cannot be called within events.

OpenFile Method (CBVaultDrive Component)

This method opens a new or existing file or alternate stream in the vault.

Syntax

func (obj *CBVaultDrive) OpenFile(FileName string, OpenMode int32, ReadEnabled bool, WriteEnabled bool, Password string) (*CBFSStorageStream, error)

Remarks

This method opens the file or alternate stream specified by FileName, creating it if necessary based on the specified OpenMode, and returns a stream object that provides access to its data.

Note: Files and alternate streams cannot be created or written to if the vault is open in ReadOnly mode.

The value passed for FileName must be a vault-local absolute path.

The OpenMode parameter specifies what behavior to use when opening a file or alternate stream. Valid values are as follows:

VAULT_FOM_CREATE_NEW0Creates a new file or alternate stream if possible, failing if one already exists.

VAULT_FOM_CREATE_ALWAYS1Creates a new file or stream, overwriting an existing one if necessary.

VAULT_FOM_OPEN_EXISTING2Opens a file or stream if it exists; fails otherwise.

VAULT_FOM_OPEN_ALWAYS3Opens a file or stream if it exists; creates a new one otherwise.

The ReadEnabled and WriteEnabled parameters specify which kinds of access the returned stream object should permit.

Note: WriteEnabled is ignored if ReadOnly is true.

The Password parameter works as follows:

  • If the specified file or alternate stream already exists and is encrypted, the specified Password is used to decrypt and access its data.
  • If a new file or alternate stream is created, and the DefaultFileEncryption property is not VAULT_EM_NONE, the specified Password is used to encrypt it.
If the value passed for Password is null or empty string and the password is needed, the component will use the current value of either the DefaultFileCreatePassword or DefaultFileAccessPassword property depending on whether the file is being created or opened.

Internally, this method simply calls OpenFileEx, passing on all shared parameters' values and using the following defaults for the others:

Please refer to the OpenFileEx method's documentation for more information.

Note: This method can be called only when Active is true, and it cannot be called within events.

OpenFileEx Method (CBVaultDrive Component)

This method opens a new or existing file or alternate stream in the vault.

Syntax

func (obj *CBVaultDrive) OpenFileEx(FileName string, OpenMode int32, ReadEnabled bool, WriteEnabled bool, ShareDenyRead bool, ShareDenyWrite bool, Encryption int32, Password string, Compression int32, CompressionLevel int32, PagesPerBlock int32) (*CBFSStorageStream, error)

Remarks

This method opens the file or alternate stream specified by FileName, creating it if necessary based on the specified OpenMode, and returns a stream object that provides access to its data.

Note: Files and alternate streams cannot be created or written to if the vault is open in ReadOnly mode.

The value passed for FileName must be a vault-local absolute path.

The OpenMode parameter specifies what behavior to use when opening a file or alternate stream. Valid values are as follows:

VAULT_FOM_CREATE_NEW0Creates a new file or alternate stream if possible, failing if one already exists.

VAULT_FOM_CREATE_ALWAYS1Creates a new file or stream, overwriting an existing one if necessary.

VAULT_FOM_OPEN_EXISTING2Opens a file or stream if it exists; fails otherwise.

VAULT_FOM_OPEN_ALWAYS3Opens a file or stream if it exists; creates a new one otherwise.

The ReadEnabled and WriteEnabled parameters specify which kinds of access the returned stream object should permit.

Note: WriteEnabled is ignored if ReadOnly is true.

The ShareDenyRead and ShareDenyWrite parameters specify whether other accessors may read and/or write the specified file or alternate stream simultaneously. To prevent simultaneous read and/or write access, pass true; to allow it, pass false.

The Encryption parameter specifies the encryption mode to use when creating a file or alternate stream. Valid values are as follows:

VAULT_EM_NONE0x0Do not use encryption.

VAULT_EM_DEFAULT0x1Use default encryption (VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA256).

VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA2560x2Use AES256 encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

VAULT_EM_CUSTOM256_PBKDF2_HMAC_SHA2560x3Use event-based custom 256-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_PBKDF2_HMAC_SHA2560x4Use event-based custom 512-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_PBKDF2_HMAC_SHA2560x5Use event-based custom 1024-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_CUSTOM_KEY_DERIVE0x23Use event-based custom 256-bit encryption with custom key derivation.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_CUSTOM_KEY_DERIVE0x24Use event-based custom 512-bit encryption with custom key derivation.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_CUSTOM_KEY_DERIVE0x25Use event-based custom 1024-bit encryption with custom key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_DIRECT_KEY0x43Use event-based custom 256-bit encryption with no key derivation.

A 256-bit (32-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM512_DIRECT_KEY0x44Use event-based custom 512-bit encryption with no key derivation.

A 512-bit (64-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM1024_DIRECT_KEY0x45Use event-based custom 1024-bit encryption with no key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_UNKNOWN0xFFUnidentified or unknown encryption.

Applications that use custom encryption must implement at least the DataEncrypt and DataDecrypt events. Certain custom encryption modes may require that the HashCalculate or KeyDerive event be implemented as well. Please refer to the Encryption topic for more information.

The Password parameter works as follows:

  • If the specified file or alternate stream already exists and is encrypted, the specified Password is used to decrypt and access its data.
  • If a file or alternate stream is created, and Encryption is not VAULT_EM_NONE, the specified Password is used to encrypt it.
If the value passed for Password is null or empty string and the password is needed, the component will use the current value of either the DefaultFileCreatePassword or DefaultFileAccessPassword property depending on whether the file is being created or opened.

The Compression parameter specifies the compression mode to use when creating a file or alternate stream. Valid values are as follows:

VAULT_CM_NONE0Do not use compression.

VAULT_CM_DEFAULT1Use default compression (zlib).

VAULT_CM_CUSTOM2Use event-based custom compression.

This compression level is not used.

VAULT_CM_ZLIB3Use zlib compression.

Valid compression levels are 1-9.

VAULT_CM_RLE4Use RLE compression.

This compression level is not used.

Applications that use custom compression must implement the DataCompress and DataDecompress events. Please refer to the Compression topic for more information.

The CompressionLevel parameter specifies the compression level to use, if applicable.

The PagesPerBlock parameter specifies how many pages should be compressed as a single block, if applicable. Valid values are powers of 2 up to and including 128 (i.e., 2, 4, 8, 16, 32, 64, or 128), or 0, which is interpreted as "default" (currently 16 for both zlib and run-length encoding [RLE]). Larger values allow for more efficient compression; however, because a block must be decompressed (and, for writes, recompressed) anytime its data are accessed, larger values can also cause excessive slowdown, especially for random access.

Note: This method can be called only when Active is true, and it cannot be called within events.

OpenRootData Method (CBVaultDrive Component)

This method opens the vault's root data stream.

Syntax

func (obj *CBVaultDrive) OpenRootData() (*CBFSStorageStream, error)

Remarks

This method opens the vault's root data stream, returning a stream object that provides access to its data.

Please refer to the Using RootData topic for more information.

Note: This method can be called only when Active is true, and it cannot be called within events.

OpenVault Method (CBVaultDrive Component)

This method opens a new or existing vault.

Syntax

func (obj *CBVaultDrive) OpenVault(OpenMode int32, JournalingMode int32) error

Remarks

This method opens a vault, creating it if necessary based on the specified OpenMode.

The OpenMode parameter specifies what behavior to use when opening a vault. Valid values are as follows:

VAULT_OM_CREATE_NEW0Creates a new vault if possible, failing if one already exists.

VAULT_OM_CREATE_ALWAYS1Creates a new vault, overwriting an existing one if necessary.

VAULT_OM_OPEN_EXISTING2Opens a vault if it exists; fails otherwise.

VAULT_OM_OPEN_ALWAYS3Opens a vault if it exists; creates a new one otherwise.

The JournalingMode parameter specifies whether any form of journaling should be used when working with the vault. Valid values are as follows:

VAULT_JM_NONE0No journaling is used.

This mode ensures the fastest operations, but if the application crashes, corruption of the vault is possible.

VAULT_JM_METADATA1Journaling is used only for metadata (filesystem structure and directory contents).

This mode is a balance between speed and reliability.

VAULT_JM_FULL2Journaling is used for both filesystem structure and file data and metadata.

This mode is the slowest but the most reliable option.

When a vault is being created or opened, the VaultFile and/or CallbackMode properties are used to specify its location. If CallbackMode is disabled (default), the component creates or opens a file-based vault at the path specified by VaultFile.

If CallbackMode is enabled, then the application controls where the vault is located and how it is accessed by the Vault* events (and the value held by VaultFile is simply passed to said events for the application to use). For brevity, vaults created and accessed using callback mode are referred to as "callback mode vaults"; please refer to the Callback Mode topic for more information.

The component also has a number of other properties and configuration settings used when creating or opening a vault, all of which are listed below. Please refer to each one's documentation for more information, including usage restrictions.

If a file-based vault's storage file (or the storage device it is located on) is marked as read-only, then the ReadOnly property must be enabled before this method is called. If an application attempts to open a vault with a read-only storage file in read-write mode, this method returns an error.

For the CBVaultDrive component on Windows, an attempt to open a vault file that is compressed or encrypted using NTFS capabilities will lead to an error being reported by this method. It is necessary to not use NTFS compression or encryption on the file to avoid a systemwide deadlock in Windows internals.

Note: This method cannot be called when Active is true, and it cannot be called within events.

OpenVolume Method (CBVaultDrive Component)

Opens a storage volume or partition formatted with the CBFS Storage filesystem as a vault (Windows only).

Syntax

func (obj *CBVaultDrive) OpenVolume(VolumeName string, JournalingMode int32) error

Remarks

This method opens the storage volume or partition specified by VolumeName as a vault.

If the specified volume or partition is not formatted with the CBFS Storage filesystem, this method returns an error.

The JournalingMode parameter specifies whether any form of journaling should be used when working with the vault. Valid values are:

VAULT_JM_NONE0No journaling is used.

This mode ensures the fastest operations, but if the application crashes, corruption of the vault is possible.

VAULT_JM_METADATA1Journaling is used only for metadata (filesystem structure and directory contents).

This mode is a balance between speed and reliability.

VAULT_JM_FULL2Journaling is used for both filesystem structure and file data and metadata.

This mode is the slowest but the most reliable option.

The VolumeName parameter specifies the fully-qualified name of a storage volume or partition. DOS names, such as X:, are also valid.

Note: This method cannot be called when Active is true, and it cannot be called within events.

RegisterIcon Method (CBVaultDrive Component)

Registers an icon that can be displayed as an overlay on the virtual drive in Windows Explorer (Windows only).

Syntax

func (obj *CBVaultDrive) RegisterIcon(IconPath string, ProductGUID string, IconId string) (bool, error)

Remarks

This method registers an icon in the file specified by IconPath so that it can later be used to display an overlay on the virtual drive in Windows Explorer. If the system must be rebooted before the icon can be used, this method returns true, otherwise it returns false.

Please note that this method only registers overlay icons; Applications should call the SetIcon and ResetIcon methods to select an icon for display. Please refer to the Custom Drive Icons topic for more information.

IconPath must be the full path and file name of the .ico file whose icon should be registered. The file must exist and remain available in order for the icon to be used until the icon is unregistered using UnregisterIcon.

ProductGUID is used to distinguish between driver installations performed by different applications. Such information is necessary to guard against unexpected situations such as, e.g., the driver being uninstalled by one application despite other applications still needing it.

The GUID must be specified in so-called "Registry Format" (e.g., "{1FAD0EF2-9A03-4B87-B4BC-645B7035ED90}") with curly braces included.

To ensure proper operation, it is critical that each individual application have its own unique ProductGUID value, and that applications (and their installation scripts) use that value when calling any of the following methods:

IconId specifies an identifier that can later be passed to the SetIcon and UnregisterIcon methods. Each registered icon should have a unique IconId value; if a value is passed that is already in use, the existing icon will be removed (by calling UnregisterIcon internally) before the new one is registered.

This method is available in both the component API and the Installer DLL included with the product; please refer to the Driver Installation in Windows topic for more information about the latter. The Helper DLL must be installed in order for this method to function correctly. Applications can check to see whether the Helper DLL is installed using the GetModuleVersion method, and install it using the Install method if necessary.

This method requires administrative rights to execute successfully. If the user account of the process that calls this method doesn't have such rights, the call will fail with an ERROR_PRIVILEGE_NOT_HELD (0x0522) error.

Note: This method cannot be called within events.

RemoveDeniedProcess Method (CBVaultDrive Component)

Removes a rule that prevents a process from accessing the virtual drive.

Syntax

func (obj *CBVaultDrive) RemoveDeniedProcess(ProcessFileName string, ProcessId int32) error

Remarks

When the ProcessRestrictionsEnabled property is enabled, this method can be used to remove an access rule previously added with the AddDeniedProcess method.

Pass the same values for ProcessFileName and ProcessId as were used to add the rule when AddDeniedProcess was called previously. Please refer to that method's documentation for more information.

Note: This method can be called only when Active is true, and it cannot be called within events.

The methods and properties related to process access lists are not intended to be used from multiple threads at once. Applications that wish to use said methods and properties from multiple threads are responsible for employing proper thread synchronization techniques to ensure that manipulation and enumeration of process access information occurs in a thread-safe manner.

RemoveGrantedProcess Method (CBVaultDrive Component)

Removes a rule that allows a process to access the virtual drive.

Syntax

func (obj *CBVaultDrive) RemoveGrantedProcess(ProcessFileName string, ProcessId int32) error

Remarks

When the ProcessRestrictionsEnabled property is enabled, this method can be used to remove an access rule previously added with the AddGrantedProcess method.

Pass the same values for ProcessFileName and ProcessId as were used to add the rule when AddGrantedProcess was called previously. Please refer to that method's documentation for more information.

Note: This method can be called only when Active is true, and it cannot be called within events.

The methods and properties related to process access lists are not intended to be used from multiple threads at once. Applications that wish to use said methods and properties from multiple threads are responsible for employing proper thread synchronization techniques to ensure that manipulation and enumeration of process access information occurs in a thread-safe manner.

RemoveMountingPoint Method (CBVaultDrive Component)

Removes a mounting point for the virtual drive.

Syntax

func (obj *CBVaultDrive) RemoveMountingPoint(Index int32, MountingPoint string, Flags int32, AuthenticationId int64) error

Remarks

This method removes a previously-created mounting point for the virtual drive.

Index must be set to the index of an item in the MountingPoint* properties, or to -1 to remove an item based on the other method parameters.

If Index is -1, then the same values must be passed for MountingPoint, Flags, AuthenticationId as were used to add the mounting point when AddMountingPoint was called previously. Please refer to that method's documentation for more information. (If Index is not -1, these parameters are ignored.)

The sgSTGMPDRIVELETTERNOTIFYASYNC; flag may be passed in Flags to send notifications about removal of the mounting point asynchronously. Do not use this flag if the process quits right after a call to this method because asynchronous delivery involves a secondary thread, which will be terminated when the process quits.

Note: This method cannot be called within events.

The methods and properties related to mounting points are not intended to be used from multiple threads at once. Applications that wish to use said methods and properties from multiple threads are responsible for employing proper thread synchronization techniques to ensure that manipulation and enumeration of mounting points occurs in a thread-safe manner.

ResetIcon Method (CBVaultDrive Component)

Resets the virtual drive's icon back to default by deselecting the active overlay icon (Windows only).

Syntax

func (obj *CBVaultDrive) ResetIcon() error

Remarks

This method deselects the overlay icon currently in use, thus resetting the virtual drive's icon back to its default state (i.e., displayed without any overlay icons).

Please refer to the SetIcon method, as well as the Custom Drive Icons topic, for more information.

The Helper DLL must be installed in order for this method to function correctly. Applications can check to see whether the Helper DLL is installed using the GetModuleVersion method, and install it using the Install method if necessary.

Note: This method can be called only after creating a virtual drive, and it cannot be called within events.

ResolveLink Method (CBVaultDrive Component)

This method retrieves the destination of a symbolic link.

Syntax

func (obj *CBVaultDrive) ResolveLink(LinkName string, Normalize bool) (string, error)

Remarks

This method retrieves the destination pointed to by the symbolic link specified by LinkName.

The value passed for LinkName must be a vault-local absolute path.

As the CreateLink method's documentation describes, symbolic links can be created with either relative or absolute vault-local paths. The Normalize parameter specifies whether the component should normalize the specified link's destination before returning it. Passing true will ensure a vault-local absolute path is always returned; passing false will cause the original destination path to be returned.

Note: This method can be called only when Active is true.

SetFileAttributes Method (CBVaultDrive Component)

This method sets the attributes of a vault item.

Syntax

func (obj *CBVaultDrive) SetFileAttributes(FileName string, Attributes int32) error

Remarks

This method sets the attributes of the vault item (e.g., file, directory, symbolic link, or alternate stream) specified by FileName.

The value passed for FileName must be a vault-local absolute path.

The Attributes parameter specifies the new attributes for the vault item, which should be constructed by ORing together one or more of the following values:

VAULT_FATTR_FILE0x00000001The entry is a file.

VAULT_FATTR_DIRECTORY0x00000002The entry is a directory.

VAULT_FATTR_DATA_STREAM0x00000004The entry is an alternate data stream.

VAULT_FATTR_COMPRESSED0x00000008The file or stream is compressed.

VAULT_FATTR_ENCRYPTED0x00000010The file or stream is encrypted.

VAULT_FATTR_SYMLINK0x00000020The entry is a symbolic link.

VAULT_FATTR_READONLY0x00000040The file is read-only.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_ARCHIVE0x00000080The file requires archiving.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_HIDDEN0x00000100The file is hidden.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_SYSTEM0x00000200The file is a system file.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_TEMPORARY0x00000400The file is temporary.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_DELETE_ON_CLOSE0x00000800The file should be deleted when the last handle to the file is closed.

This attribute is currently not supported by CBFS Storage.

VAULT_FATTR_RESERVED_00x00001000Reserved.

VAULT_FATTR_RESERVED_10x00002000Reserved.

VAULT_FATTR_RESERVED_20x00004000Reserved.

VAULT_FATTR_RESERVED_30x00008000Reserved.

VAULT_FATTR_NO_USER_CHANGE0x0000F03FA mask that includes all attributes that cannot be changed.

Applications cannot use the SetFileAttributes method to directly change any of the following attributes: FILE, DIRECTORY, DATA_STREAM, COMPRESSED, ENCRYPTED, SYMLINK, RESERVED_0, RESERVED_1, RESERVED_2, or RESERVED_3.

VAULT_FATTR_USER_DEFINED0x7FF00000A mask for application-defined attributes.

Applications can use the SetFileAttributes method to set custom attributes, as long as their values are covered by this mask.

VAULT_FATTR_ANY_FILE0x7FFFFFFFA mask that includes any and all attributes.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileCompression Method (CBVaultDrive Component)

This method compresses or decompresses a file or alternate stream.

Syntax

func (obj *CBVaultDrive) SetFileCompression(FileName string, Compression int32, CompressionLevel int32, PagesPerBlock int32, Password string) error

Remarks

This method changes the compression mode used to compress the file or alternate stream specified by FileName.

The value passed for FileName must be a vault-local absolute path.

The Compression parameter specifies the new compression mode to use. Valid values are as follows:

VAULT_CM_NONE0Do not use compression.

VAULT_CM_DEFAULT1Use default compression (zlib).

VAULT_CM_CUSTOM2Use event-based custom compression.

This compression level is not used.

VAULT_CM_ZLIB3Use zlib compression.

Valid compression levels are 1-9.

VAULT_CM_RLE4Use RLE compression.

This compression level is not used.

Applications that use custom compression must implement the DataCompress and DataDecompress events. Please refer to the Compression topic for more information.

The CompressionLevel parameter specifies the compression level to use, if applicable.

The PagesPerBlock parameter specifies how many pages should be compressed as a single block, if applicable. Valid values are powers of 2 up to and including 128 (i.e., 2, 4, 8, 16, 32, 64, or 128), or 0, which is interpreted as "default" (currently 16 for both zlib and run-length encoding [RLE]). Larger values allow for more efficient compression; however, because a block must be decompressed (and, for writes, recompressed) anytime its data are accessed, larger values can also cause excessive slowdown, especially for random access.

The Password parameter specifies the password to use to access the file's data, if it is encrypted.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileCreationTime Method (CBVaultDrive Component)

This method sets the creation time of a vault item.

Syntax

func (obj *CBVaultDrive) SetFileCreationTime(FileName string, CreationTime time.Time) error

Remarks

This method sets the creation time of the vault item (e.g., file, directory, symbolic link, or alternate stream) specified by FileName.

The value passed for FileName must be a vault-local absolute path.

The CreationTime parameter specifies the new creation time for the vault item, which must be specified in UTC.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileEncryption Method (CBVaultDrive Component)

This method encrypts, decrypts, or changes the encryption password of a file or alternate stream.

Syntax

func (obj *CBVaultDrive) SetFileEncryption(FileName string, Encryption int32, OldPassword string, NewPassword string) error

Remarks

This method changes the encryption mode or password used to encrypt the file or alternate stream specified by FileName.

The value passed for FileName must be a vault-local absolute path.

The Encryption parameter specifies the new encryption mode to use. Valid values are as follows:

VAULT_EM_NONE0x0Do not use encryption.

VAULT_EM_DEFAULT0x1Use default encryption (VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA256).

VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA2560x2Use AES256 encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

VAULT_EM_CUSTOM256_PBKDF2_HMAC_SHA2560x3Use event-based custom 256-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_PBKDF2_HMAC_SHA2560x4Use event-based custom 512-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_PBKDF2_HMAC_SHA2560x5Use event-based custom 1024-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_CUSTOM_KEY_DERIVE0x23Use event-based custom 256-bit encryption with custom key derivation.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_CUSTOM_KEY_DERIVE0x24Use event-based custom 512-bit encryption with custom key derivation.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_CUSTOM_KEY_DERIVE0x25Use event-based custom 1024-bit encryption with custom key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_DIRECT_KEY0x43Use event-based custom 256-bit encryption with no key derivation.

A 256-bit (32-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM512_DIRECT_KEY0x44Use event-based custom 512-bit encryption with no key derivation.

A 512-bit (64-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM1024_DIRECT_KEY0x45Use event-based custom 1024-bit encryption with no key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_UNKNOWN0xFFUnidentified or unknown encryption.

Applications that use custom encryption must implement at least the DataEncrypt and DataDecrypt events. Certain custom encryption modes may require that the HashCalculate or KeyDerive event be implemented as well. Please refer to the Encryption topic for more information.

The OldPassword parameter specifies the current encryption password, if applicable.

The NewPassword parameter specifies the new encryption password to use, if applicable.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileLastAccessTime Method (CBVaultDrive Component)

This method sets the last access time of a vault item.

Syntax

func (obj *CBVaultDrive) SetFileLastAccessTime(FileName string, LastAccessTime time.Time) error

Remarks

This method sets the last access time of the vault item (e.g., file, directory, symbolic link, or alternate stream) specified by FileName.

The value passed for FileName must be a vault-local absolute path.

The LastAccessTime parameter specifies the new last access time for the vault item, which must be specified in UTC.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileModificationTime Method (CBVaultDrive Component)

This method sets the modification time of a vault item.

Syntax

func (obj *CBVaultDrive) SetFileModificationTime(FileName string, ModificationTime time.Time) error

Remarks

This method sets the modification time of the vault item (e.g., file, directory, symbolic link, or alternate stream) specified by FileName.

The value passed for FileName must be a vault-local absolute path.

The ModificationTime parameter specifies the new modification time for the vault item, which must be specified in UTC.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileSize Method (CBVaultDrive Component)

This method sets the size of a file or alternate stream.

Syntax

func (obj *CBVaultDrive) SetFileSize(FileName string, Size int64, Password string) error

Remarks

This method sets the size of the file or alternate stream specified by FileName.

The value passed for FileName must be a vault-local absolute path.

The Size parameter specifies the new size of the file or alternate stream, which must be greater than or equal to 0.

Applications can also change the size of a file or alternate stream using the stream objects returned by the OpenFile and OpenFileEx methods.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileTag Method (CBVaultDrive Component)

This method attaches a raw file tag with binary data to the specified vault item.

Syntax

func (obj *CBVaultDrive) SetFileTag(FileName string, TagId int32, Data []byte) error

Remarks

This method attaches a raw file tag with binary data to the vault item (e.g., file, directory, or alternate stream) specified by FileName using the specified TagId. If a raw file tag with the specified TagId is already attached to the specified vault item, it is replaced.

The value passed for FileName must be a vault-local absolute path. The value passed for TagId must be in the range 0x0001 to 0xCFFF (inclusive).

The Data parameter specifies the raw binary data to store in the file tag; it may be up to 65531 bytes in length.

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileTagAsAnsiString Method (CBVaultDrive Component)

This method attaches an AnsiString-typed file tag to the specified vault item.

Syntax

func (obj *CBVaultDrive) SetFileTagAsAnsiString(FileName string, TagName string, Value string) error

Remarks

This method attaches an AnsiString-typed file tag to the vault item (e.g., file, directory, or alternate stream) specified by FileTag using the specified TagName. If a typed file tag with the specified TagName is already attached to the specified vault item, it is replaced.

The value passed for FileName must be a vault-local absolute path. The value passed for TagName may be up to 4095 characters in length (not including the null terminator).

The Value parameter specifies the AnsiString value to store in the file tag; it may be up to 65529 - (name_length * 2) bytes in length (where name_length is measured in characters), including null terminators for both the AnsiString value and the name.

Please refer to the File Tags topic for more information.

Note: AnsiString file tag values are converted to UTF-16LE when referenced in a search query string. To reduce the chance of string-conversion-related issues, it is recommended that applications only store ASCII characters in AnsiString-typed file tags, and prefer String-typed file tags (created using SetFileTagAsString) in all other cases.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileTagAsBoolean Method (CBVaultDrive Component)

This method attaches a Boolean-typed file tag to the specified vault item.

Syntax

func (obj *CBVaultDrive) SetFileTagAsBoolean(FileName string, TagName string, Value bool) error

Remarks

This method attaches a Boolean-typed file tag to the vault item (e.g., file, directory, or alternate stream) specified by FileTag using the specified TagName. If a typed file tag with the specified TagName is already attached to the specified vault item, it is replaced.

The value passed for FileName must be a vault-local absolute path. The value passed for TagName may be up to 4095 characters in length (not including the null terminator).

The Value parameter specifies the Boolean value to store in the file tag.

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileTagAsDateTime Method (CBVaultDrive Component)

This method attaches a DateTime-typed file tag to the specified vault item.

Syntax

func (obj *CBVaultDrive) SetFileTagAsDateTime(FileName string, TagName string, Value time.Time) error

Remarks

This method attaches a DateTime-typed file tag to the vault item (e.g., file, directory, or alternate stream) specified by FileTag using the specified TagName. If a typed file tag with the specified TagName is already attached to the specified vault item, it is replaced.

The value passed for FileName must be a vault-local absolute path. The value passed for TagName may be up to 4095 characters in length (not including the null terminator).

The Value parameter specifies the DateTime value to store in the file tag, which must be specified in UTC.

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileTagAsNumber Method (CBVaultDrive Component)

This method attaches a Number-typed file tag to the specified vault item.

Syntax

func (obj *CBVaultDrive) SetFileTagAsNumber(FileName string, TagName string, Value int64) error

Remarks

This method attaches a Number-typed file tag to the vault item (e.g., file, directory, or alternate stream) specified by FileTag using the specified TagName. If a typed file tag with the specified TagName is already attached to the specified vault item, it is replaced.

The value passed for FileName must be a vault-local absolute path. The value passed for TagName may be up to 4095 characters in length (not including the null terminator).

The Value parameter specifies the Number value to store in the file tag.

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetFileTagAsString Method (CBVaultDrive Component)

This method attaches a String-typed file tag to the specified vault item.

Syntax

func (obj *CBVaultDrive) SetFileTagAsString(FileName string, TagName string, Value string) error

Remarks

This method attaches a String-typed file tag to the vault item (e.g., file, directory, or alternate stream) specified by FileTag using the specified TagName. If a typed file tag with the specified TagName is already attached to the specified vault item, it is replaced.

The value passed for FileName must be a vault-local absolute path. The value passed for TagName may be up to 4095 characters in length (not including the null terminator).

The Value parameter specifies the UTF-16LE String value to store in the file tag; it may be up to 65529 - (name_length * 2) bytes in length (where name_length is measured in characters), including null terminators for both the String value and the name.

Please refer to the File Tags topic for more information.

Note: This method can be called only when Active is true, and it cannot be called within events.

SetIcon Method (CBVaultDrive Component)

Selects a registered overlay icon for display on the virtual drive in Windows Explorer (Windows only).

Syntax

func (obj *CBVaultDrive) SetIcon(IconId string) error

Remarks

This method selects the overlay icon specified by IconId for display, causing it to be shown on the virtual drive in Windows Explorer. The desired icon must have already been registered using the RegisterIcon method, and the value passed for IconId must match the one passed RegisterIcon at that time.

To switch to a different overlay icon later, call this method again with a different IconId. To reset the virtual drive's icon back to its default state (i.e., displayed without any overlay icons), call the ResetIcon method. Please refer to the Custom Drive Icons topic for more information.

The Helper DLL must be installed in order for this method to function correctly. Applications can check to see whether the Helper DLL is installed using the GetModuleVersion method, and install it using the Install method if necessary.

Note: This method can be called only after creating a virtual drive, and it cannot be called within events. Also, note that the effects of this method only last until the virtual drive is destroyed; applications that always want to have some overlay icon displayed must call this method each time the virtual drive is created.

ShutdownSystem Method (CBVaultDrive Component)

Shuts down or reboots the operating system.

Syntax

func (obj *CBVaultDrive) ShutdownSystem(ShutdownPrompt string, Timeout int32, ForceCloseApps bool, Reboot bool) (bool, error)

Remarks

This method shuts down or (if Reboot is true) reboots the operating system. If the appropriate privileges cannot be obtained, or if the InitiateSystemShutdown system call returns false, then this method will return false; otherwise, it returns true. This method can be used if the installation or uninstallation function requires the system to be rebooted in order to complete.

ShutdownPrompt, if non-empty, specifies a message that the OS should display to the user for Timeout seconds. If empty string is passed for ShutdownPrompt, no message is displayed and the Timeout parameter's value is ignored.

ForceCloseApps specifies whether the OS should forcefully close all applications. Please keep in mind that forceful closing of applications with unsaved data can lead to data loss.

Reboot specifies whether the OS should reboot (true) or just shut down (false).

This method is available in both the component API and the Installer DLL included with the product; please refer to the Driver Installation in Windows topic for more information about the latter.

Note: This method cannot be called within events.

Uninstall Method (CBVaultDrive Component)

Uninstalls the product's system drivers and/or helper DLL (Windows only).

Syntax

func (obj *CBVaultDrive) Uninstall(CabFileName string, ProductGUID string, InstalledPath string, Flags int32) (int32, error)

Remarks

This method is used to uninstall the product's various modules (i.e., the system drivers and Helper DLL). If the system must be rebooted to complete the uninstallation process, this method will return a non-zero value indicating which module(s) requested the reboot (see Install for possible values).

Important: To upgrade the product's modules, use only the Install method. Previously installed versions of the modules should not be uninstalled first. Calling the Install method will upgrade the previously installed version.

Please refer to the Driver Installation in Windows topic for more information.

The same values must be passed for the CabFileName, ProductGUID, and InstalledPath parameters as were passed when Install was called; please refer to its documentation for more information.

Flags specifies which versions of the product's modules should be uninstalled, and should be set by OR'ing together one or more of the following values:

UNINSTALL_VERSION_PREVIOUS0x00000001Uninstall modules from previous product versions.

UNINSTALL_VERSION_CURRENT0x00000002Uninstall modules from the current product version.

UNINSTALL_VERSION_ALL0x00000003Uninstall modules from all product versions.

This method is available in both the component API and the Installer DLL included with the product; please refer to the Driver Installation in Windows topic for more information about the latter.

This method requires administrative rights to execute successfully. If the user account of the process that calls this method doesn't have such rights, the call will fail with an ERROR_PRIVILEGE_NOT_HELD (0x0522) error.

Note: This method cannot be called within events.

UnixTimeToFileTime Method (CBVaultDrive Component)

This method converts the date/time in Unix format to the Windows FileTime format.

Syntax

func (obj *CBVaultDrive) UnixTimeToFileTime(UnixTime int64, Nanoseconds int32) (time.Time, error)

Remarks

Use this method to convert the date/time in Unix format to the Windows FileTime format.

Pass the Unix time value to UnixTime and optionally pass the subsecond part of the time, expressed in nanoseconds, to the Nanoseconds parameter. If the subsecond part of the time is not available, set Nanoseconds to zero (0) value.

UnregisterIcon Method (CBVaultDrive Component)

Unregisters an existing overlay icon (Windows only).

Syntax

func (obj *CBVaultDrive) UnregisterIcon(ProductGUID string, IconId string) (bool, error)

Remarks

This method unregisters the overlay icon identified by IconId. If the system must be rebooted to completely remove the icon, this method returns true, otherwise it returns false.

The same values must be passed for the ProductGUID and IconId parameters as were passed when RegisterIcon was called; please refer to its documentation, as well as the Custom Drive Icons topic, for more information.

This method is available in both the component API and the Installer DLL included with the product; please refer to the Driver Installation in Windows topic for more information about the latter. The Helper DLL must be installed in order for this method to function correctly. Applications can check to see whether the Helper DLL is installed using the GetModuleVersion method, and install it using the Install method if necessary.

This method requires administrative rights to execute successfully. If the user account of the process that calls this method doesn't have such rights, the call will fail with an ERROR_PRIVILEGE_NOT_HELD (0x0522) error.

Note: This method cannot be called within events.

UpdateVaultEncryption Method (CBVaultDrive Component)

This method encrypts, decrypts, or changes the encryption password of the vault.

Syntax

func (obj *CBVaultDrive) UpdateVaultEncryption(Encryption int32, OldPassword string, NewPassword string) error

Remarks

This method changes the encryption mode or password used to encrypt the vault.

The Encryption parameter specifies the new encryption mode to use. Valid values are as follows:

VAULT_EM_NONE0x0Do not use encryption.

VAULT_EM_DEFAULT0x1Use default encryption (VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA256).

VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA2560x2Use AES256 encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

VAULT_EM_CUSTOM256_PBKDF2_HMAC_SHA2560x3Use event-based custom 256-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_PBKDF2_HMAC_SHA2560x4Use event-based custom 512-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_PBKDF2_HMAC_SHA2560x5Use event-based custom 1024-bit encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_CUSTOM_KEY_DERIVE0x23Use event-based custom 256-bit encryption with custom key derivation.

A 256-bit (32-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM512_CUSTOM_KEY_DERIVE0x24Use event-based custom 512-bit encryption with custom key derivation.

A 512-bit (64-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM1024_CUSTOM_KEY_DERIVE0x25Use event-based custom 1024-bit encryption with custom key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode.

VAULT_EM_CUSTOM256_DIRECT_KEY0x43Use event-based custom 256-bit encryption with no key derivation.

A 256-bit (32-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM512_DIRECT_KEY0x44Use event-based custom 512-bit encryption with no key derivation.

A 512-bit (64-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_CUSTOM1024_DIRECT_KEY0x45Use event-based custom 1024-bit encryption with no key derivation.

A 1024-bit (128-byte) block size is used with this encryption mode. This mode is useful for cases in which the password is an identifier for an external key and should not be used for key derivation.

VAULT_EM_UNKNOWN0xFFUnidentified or unknown encryption.

Applications that use custom encryption must implement at least the DataEncrypt and DataDecrypt events. Certain custom encryption modes may require that the HashCalculate or KeyDerive event be implemented as well. Please refer to the Encryption topic for more information.

The OldPassword parameter specifies the current encryption password, if applicable.

The NewPassword parameter specifies the new encryption password to use, if applicable.

Note: This method can be called only when Active is true, and it cannot be called within events.

DataCompress Event (CBVaultDrive Component)

This event fires to compress a block of data using a custom compression algorithm.

Syntax

// CBVaultDriveDataCompressEventArgs carries the CBVaultDrive DataCompress event's parameters.
type CBVaultDriveDataCompressEventArgs struct {...}

func (args *CBVaultDriveDataCompressEventArgs) InData() []byte
func (args *CBVaultDriveDataCompressEventArgs) InSize() int32
func (args *CBVaultDriveDataCompressEventArgs) OutData() []byte
func (args *CBVaultDriveDataCompressEventArgs) SetOutData(value []byte)

func (args *CBVaultDriveDataCompressEventArgs) OutSize() int32
func (args *CBVaultDriveDataCompressEventArgs) SetOutSize(value int32)

func (args *CBVaultDriveDataCompressEventArgs) CompressionLevel() int32
func (args *CBVaultDriveDataCompressEventArgs) ResultCode() int32
func (args *CBVaultDriveDataCompressEventArgs) SetResultCode(value int32)

// CBVaultDriveDataCompressEvent defines the signature of the CBVaultDrive DataCompress event's handler function.
type CBVaultDriveDataCompressEvent func(sender *CBVaultDrive, args *CBVaultDriveDataCompressEventArgs)

func (obj *CBVaultDrive) GetOnDataCompressHandler() CBVaultDriveDataCompressEvent
func (obj *CBVaultDrive) SetOnDataCompressHandler(handlerFunc CBVaultDriveDataCompressEvent)

Remarks

This event fires when the component needs to compress a block of data using an application-defined compression algorithm. Please refer to the Compression topic for more information.

This event only needs to be handled by applications that use the VAULT_CM_CUSTOM compression mode. To handle this event properly, applications must compress all InSize bytes of data in the InData buffer, write the compressed data to the OutData buffer, and set OutSize to reflect the total number of bytes written to OutData.

Note: OutSize is initially set to the capacity of the OutData buffer. If the OutData buffer is not large enough to accommodate all of the data after compression (which, while uncommon, may occur with some compression algorithms), do not write any data to OutData. Instead, set ResultCode to VAULT_ERR_BUFFER_TOO_SMALL to inform the component that the current block of data should remain uncompressed.

Please see the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The CompressionLevel specifies the requested compression level. Possible values are 0 through 9; where 0 means "use the default compression level". Applications may ignore this value if it is not needed by their compression algorithm.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

DataDecompress Event (CBVaultDrive Component)

This event fires to decompress a block of data using a custom compression algorithm.

Syntax

// CBVaultDriveDataDecompressEventArgs carries the CBVaultDrive DataDecompress event's parameters.
type CBVaultDriveDataDecompressEventArgs struct {...}

func (args *CBVaultDriveDataDecompressEventArgs) InData() []byte
func (args *CBVaultDriveDataDecompressEventArgs) InSize() int32
func (args *CBVaultDriveDataDecompressEventArgs) OutData() []byte
func (args *CBVaultDriveDataDecompressEventArgs) SetOutData(value []byte)

func (args *CBVaultDriveDataDecompressEventArgs) OutSize() int32
func (args *CBVaultDriveDataDecompressEventArgs) SetOutSize(value int32)

func (args *CBVaultDriveDataDecompressEventArgs) ResultCode() int32
func (args *CBVaultDriveDataDecompressEventArgs) SetResultCode(value int32)

// CBVaultDriveDataDecompressEvent defines the signature of the CBVaultDrive DataDecompress event's handler function.
type CBVaultDriveDataDecompressEvent func(sender *CBVaultDrive, args *CBVaultDriveDataDecompressEventArgs)

func (obj *CBVaultDrive) GetOnDataDecompressHandler() CBVaultDriveDataDecompressEvent
func (obj *CBVaultDrive) SetOnDataDecompressHandler(handlerFunc CBVaultDriveDataDecompressEvent)

Remarks

This event fires when the component needs to decompress a block of data using an application-defined compression algorithm. Please refer to the Compression topic for more information.

This event only needs to be handled by applications that use the VAULT_CM_CUSTOM compression mode. To handle this event properly, applications must decompress all InSize bytes of data in the InData buffer, write the decompressed data to the OutData buffer, and set OutSize to reflect the total number of bytes written to OutData.

Note: OutSize is initially set to the capacity of the OutData buffer, which (under normal circumstances) should be large enough to accommodate all of the decompressed data. Only if the vault is corrupted should the OutData buffer ever be too small to hold the decompressed data; so if this occurs, do not write any data to OutData. Instead, set ResultCode to VAULT_ERR_VAULT_CORRUPTED.

Please see the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

DataDecrypt Event (CBVaultDrive Component)

This event fires to decrypt a block of data using a custom encryption implementation.

Syntax

// CBVaultDriveDataDecryptEventArgs carries the CBVaultDrive DataDecrypt event's parameters.
type CBVaultDriveDataDecryptEventArgs struct {...}

func (args *CBVaultDriveDataDecryptEventArgs) Key() []byte
func (args *CBVaultDriveDataDecryptEventArgs) KeyLength() int32
func (args *CBVaultDriveDataDecryptEventArgs) Salt1() []byte
func (args *CBVaultDriveDataDecryptEventArgs) Salt1Size() int32
func (args *CBVaultDriveDataDecryptEventArgs) Salt2() []byte
func (args *CBVaultDriveDataDecryptEventArgs) Salt2Size() int32
func (args *CBVaultDriveDataDecryptEventArgs) Data() []byte
func (args *CBVaultDriveDataDecryptEventArgs) SetData(value []byte)

func (args *CBVaultDriveDataDecryptEventArgs) DataSize() int32
func (args *CBVaultDriveDataDecryptEventArgs) ResultCode() int32
func (args *CBVaultDriveDataDecryptEventArgs) SetResultCode(value int32)

// CBVaultDriveDataDecryptEvent defines the signature of the CBVaultDrive DataDecrypt event's handler function.
type CBVaultDriveDataDecryptEvent func(sender *CBVaultDrive, args *CBVaultDriveDataDecryptEventArgs)

func (obj *CBVaultDrive) GetOnDataDecryptHandler() CBVaultDriveDataDecryptEvent
func (obj *CBVaultDrive) SetOnDataDecryptHandler(handlerFunc CBVaultDriveDataDecryptEvent)

Remarks

This event fires when the component needs to decrypt a block of data using an application-defined encryption implementation. Please refer to the Encryption topic for more information.

This event only needs to be handled by applications that use one of the VAULT_EM_CUSTOM* encryption modes. To handle this event properly, applications must decrypt all DataSize bytes of data in the Data buffer. After decrypting the data, applications must write it back to the Data buffer. The size of the decrypted data must match DataSize, which is always a multiple of 32.

The Key buffer contains the encryption key (e.g., password) specified for the file, alternate stream, or vault whose data are being decrypted. The KeyLength parameter specifies the length, in bytes, of Key.

The Salt1 and Salt2 buffers contain the same salt values provided when the data were encrypted in an earlier DataEncrypt event. The Salt1Size and Salt2Size parameters specify the length, in bytes, of Salt1 and Salt2.

Please see the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

DataEncrypt Event (CBVaultDrive Component)

This event fires to encrypt a block of data using a custom encryption implementation.

Syntax

// CBVaultDriveDataEncryptEventArgs carries the CBVaultDrive DataEncrypt event's parameters.
type CBVaultDriveDataEncryptEventArgs struct {...}

func (args *CBVaultDriveDataEncryptEventArgs) Key() []byte
func (args *CBVaultDriveDataEncryptEventArgs) KeyLength() int32
func (args *CBVaultDriveDataEncryptEventArgs) Salt1() []byte
func (args *CBVaultDriveDataEncryptEventArgs) Salt1Size() int32
func (args *CBVaultDriveDataEncryptEventArgs) Salt2() []byte
func (args *CBVaultDriveDataEncryptEventArgs) Salt2Size() int32
func (args *CBVaultDriveDataEncryptEventArgs) Data() []byte
func (args *CBVaultDriveDataEncryptEventArgs) SetData(value []byte)

func (args *CBVaultDriveDataEncryptEventArgs) DataSize() int32
func (args *CBVaultDriveDataEncryptEventArgs) ResultCode() int32
func (args *CBVaultDriveDataEncryptEventArgs) SetResultCode(value int32)

// CBVaultDriveDataEncryptEvent defines the signature of the CBVaultDrive DataEncrypt event's handler function.
type CBVaultDriveDataEncryptEvent func(sender *CBVaultDrive, args *CBVaultDriveDataEncryptEventArgs)

func (obj *CBVaultDrive) GetOnDataEncryptHandler() CBVaultDriveDataEncryptEvent
func (obj *CBVaultDrive) SetOnDataEncryptHandler(handlerFunc CBVaultDriveDataEncryptEvent)

Remarks

This event fires when the component needs to encrypt a block of data using an application-defined encryption implementation. Please refer to the Encryption topic for more information.

This event only needs to be handled by applications that use one of the VAULT_EM_CUSTOM* encryption modes. To handle this event properly, applications must encrypt all DataSize bytes of data in the Data buffer. After encrypting the data, applications must write it back to the Data buffer. The size of the encrypted data must match DataSize, which is always a multiple of 32.

The Key buffer contains the encryption key (e.g., password) specified for the file, alternate stream, or vault whose data are being decrypted. The KeyLength parameter specifies the length, in bytes, of Key.

The Salt1 and Salt2 buffers contain salt values that can be used to strengthen encryption, if desired. The Salt1Size and Salt2Size parameters specify the length, in bytes, of Salt1 and Salt2.

Please see the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

Ejected Event (CBVaultDrive Component)

Fires when the media and virtual drive have been ejected (Windows only).

Syntax

// CBVaultDriveEjectedEventArgs carries the CBVaultDrive Ejected event's parameters.
type CBVaultDriveEjectedEventArgs struct {...}

func (args *CBVaultDriveEjectedEventArgs) ResultCode() int32
func (args *CBVaultDriveEjectedEventArgs) SetResultCode(value int32)

// CBVaultDriveEjectedEvent defines the signature of the CBVaultDrive Ejected event's handler function.
type CBVaultDriveEjectedEvent func(sender *CBVaultDrive, args *CBVaultDriveEjectedEventArgs)

func (obj *CBVaultDrive) GetOnEjectedHandler() CBVaultDriveEjectedEvent
func (obj *CBVaultDrive) SetOnEjectedHandler(handlerFunc CBVaultDriveEjectedEvent)

Remarks

This event fires when a user has ejected the media and virtual drive using the Eject command in Windows Explorer.

For ejection via the system notification area (tray) to work correctly, the StorageType property must be set to STGT_DISK_PNP, and the StorageCharacteristics property must include ejection-related flags.

This event is optional; it is provided to give applications a chance to, e.g., free up resources associated with the virtual drive. Since the virtual drive has already been destroyed by the time this event fires, applications must not call CloseVault (it is called automatically with its Force parameter set to true) .

The ResultCode parameter will always be initially set to the result of a storage deletion operation. The expected value is 0. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a non-zero value to report an appropriate error. Note that as ejection has already occured, this non-zero value will not have effect on the media's state. Please refer to the Error Reporting and Handling topic for more information.

Error Event (CBVaultDrive Component)

This event fires if an unhandled error occurs during an event.

Syntax

// CBVaultDriveErrorEventArgs carries the CBVaultDrive Error event's parameters.
type CBVaultDriveErrorEventArgs struct {...}

func (args *CBVaultDriveErrorEventArgs) ErrorCode() int32
func (args *CBVaultDriveErrorEventArgs) Description() string
// CBVaultDriveErrorEvent defines the signature of the CBVaultDrive Error event's handler function.
type CBVaultDriveErrorEvent func(sender *CBVaultDrive, args *CBVaultDriveErrorEventArgs)

func (obj *CBVaultDrive) GetOnErrorHandler() CBVaultDriveErrorEvent
func (obj *CBVaultDrive) SetOnErrorHandler(handlerFunc CBVaultDriveErrorEvent)

Remarks

This event fires if an unhandled error occurs during another event. Developers can use this information to track down unhandled errors in an application's event handlers.

FileAccess Event (CBVaultDrive Component)

Fires when the OS wants to create or open a file or directory.

Syntax

// CBVaultDriveFileAccessEventArgs carries the CBVaultDrive FileAccess event's parameters.
type CBVaultDriveFileAccessEventArgs struct {...}

func (args *CBVaultDriveFileAccessEventArgs) FileName() string
func (args *CBVaultDriveFileAccessEventArgs) ExistingAttributes() int32
func (args *CBVaultDriveFileAccessEventArgs) DesiredAccess() int32
func (args *CBVaultDriveFileAccessEventArgs) Attributes() int32
func (args *CBVaultDriveFileAccessEventArgs) Options() int32
func (args *CBVaultDriveFileAccessEventArgs) ShareMode() int32
func (args *CBVaultDriveFileAccessEventArgs) ResultCode() int32
func (args *CBVaultDriveFileAccessEventArgs) SetResultCode(value int32)

// CBVaultDriveFileAccessEvent defines the signature of the CBVaultDrive FileAccess event's handler function.
type CBVaultDriveFileAccessEvent func(sender *CBVaultDrive, args *CBVaultDriveFileAccessEventArgs)

func (obj *CBVaultDrive) GetOnFileAccessHandler() CBVaultDriveFileAccessEvent
func (obj *CBVaultDrive) SetOnFileAccessHandler(handlerFunc CBVaultDriveFileAccessEvent)

Remarks

This optional event fires when the OS wants to create or open the existing file or directory specified by FileName. It can be used to control and optionally restrict access to files and directories. The event fires when FireFileAccessEvent setting is enabled (by default, it is disabled for performance reasons).

This event also fires when the OS wants to create or open a named data stream in a file. Such requests are distinguished by the presence of a colon (:) in the FileName value; the text before the colon is the name of the file itself, and the text after the colon is the name of the stream to open.

The ExistingAttributes parameter contains the attributes of the file or directory being opened, if one already exists; otherwise, it contains 0. To determine whether the request is for a file or a directory, compare ExistingAttributes against the VAULT_FATTR_DIRECTORY or VAULT_FATTR_FILE constant respectively, like so: // Check whether the request is for a file or a directory. bool isDirectory = ExistingAttributes & CBFSVAULT_FATTR_DIRECTORY == CBFSVAULT_FATTR_DIRECTORY; bool isFile = ExistingAttributes & CBFSVAULT_FATTR_FILE == CBFSVAULT_FATTR_FILE;

The DesiredAccess parameter specifies the mode of access to the file or directory desired by the process that initiated the request. It can be one of the following values:

STG_DACCESS_READ0x00000001Grant/deny read access.

STG_DACCESS_WRITE0x00000002Grant/deny write access.

STG_DACCESS_READWRITE0x00000003Grant/deny read and write access.

The Attributes parameter contains the value of Attributes, passed by the originator process; it may contain zero or more of the following attributes:

VAULT_FATTR_FILE0x00000001The entry is a file.

VAULT_FATTR_DIRECTORY0x00000002The entry is a directory.

VAULT_FATTR_DATA_STREAM0x00000004The entry is an alternate data stream.

VAULT_FATTR_COMPRESSED0x00000008The file or stream is compressed.

VAULT_FATTR_ENCRYPTED0x00000010The file or stream is encrypted.

VAULT_FATTR_SYMLINK0x00000020The entry is a symbolic link.

VAULT_FATTR_READONLY0x00000040The file is read-only.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_ARCHIVE0x00000080The file requires archiving.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_HIDDEN0x00000100The file is hidden.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_SYSTEM0x00000200The file is a system file.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_TEMPORARY0x00000400The file is temporary.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_DELETE_ON_CLOSE0x00000800The file should be deleted when the last handle to the file is closed.

This attribute is currently not supported by CBFS Storage.

VAULT_FATTR_RESERVED_00x00001000Reserved.

VAULT_FATTR_RESERVED_10x00002000Reserved.

VAULT_FATTR_RESERVED_20x00004000Reserved.

VAULT_FATTR_RESERVED_30x00008000Reserved.

VAULT_FATTR_NO_USER_CHANGE0x0000F03FA mask that includes all attributes that cannot be changed.

Applications cannot use the SetFileAttributes method to directly change any of the following attributes: FILE, DIRECTORY, DATA_STREAM, COMPRESSED, ENCRYPTED, SYMLINK, RESERVED_0, RESERVED_1, RESERVED_2, or RESERVED_3.

VAULT_FATTR_USER_DEFINED0x7FF00000A mask for application-defined attributes.

Applications can use the SetFileAttributes method to set custom attributes, as long as their values are covered by this mask.

VAULT_FATTR_ANY_FILE0x7FFFFFFFA mask that includes any and all attributes.

Windows: The Options parameter includes flags and options that are described in the CreateOptions parameter of the Native API's ZwCreateFile function. Most of those flags correspond to flags passed in the FlagsAndAttributes parameter of the Windows API's CreateFile function, but some flags are specific to Native API. If you need those flags, check both functions' descriptions.

Linux, macOS: this parameter is not used.

The ShareMode parameter specifies the access sharing mode desired by the process that initiated the request; it may contain zero or more of the following share mode flags:

FILE_SYS_SHARE_READ0x00000001Enables subsequent open operations on a file to request read access.

Otherwise, other processes cannot open the file if they request read access. If this flag is not specified, but the file has been opened for read access, file creation or opening fails.

FILE_SYS_SHARE_WRITE0x00000002Enables subsequent open operations on a file to request write access.

Otherwise, other processes cannot open the file if they request write access. If this flag is not specified, but the file has been opened for write access or has a file mapping with write access, file creation or opening fails.

FILE_SYS_SHARE_DELETE0x00000004Enables subsequent open operations on a file to request delete access.

Otherwise, other processes cannot open the file if they request delete access. If this flag is not specified, but the file has been opened for delete access, the function fails.

Note: Delete access allows both delete and rename operations.

The ResultCode parameter will always be 0 when the event is fired. Applications may perform the necessary access control using one of GetOriginator* methods, and set ResultCode to 0 to indicate that the file or directory may be opened, or to a system-specific error code to tell the OS about an error. Please refer to the Error Reporting and Handling topic for more information.

Note: an application may not access the drive and its contents from an event handler, as this will cause a deadlock.

FileAfterCopy Event (CBVaultDrive Component)

This event fires after the file has been copied during file export/import operations.

Syntax

// CBVaultDriveFileAfterCopyEventArgs carries the CBVaultDrive FileAfterCopy event's parameters.
type CBVaultDriveFileAfterCopyEventArgs struct {...}

func (args *CBVaultDriveFileAfterCopyEventArgs) SourcePath() string
func (args *CBVaultDriveFileAfterCopyEventArgs) DestinationPath() string
func (args *CBVaultDriveFileAfterCopyEventArgs) Attributes() int32
func (args *CBVaultDriveFileAfterCopyEventArgs) ResultCode() int32
func (args *CBVaultDriveFileAfterCopyEventArgs) SetResultCode(value int32)

// CBVaultDriveFileAfterCopyEvent defines the signature of the CBVaultDrive FileAfterCopy event's handler function.
type CBVaultDriveFileAfterCopyEvent func(sender *CBVaultDrive, args *CBVaultDriveFileAfterCopyEventArgs)

func (obj *CBVaultDrive) GetOnFileAfterCopyHandler() CBVaultDriveFileAfterCopyEvent
func (obj *CBVaultDrive) SetOnFileAfterCopyHandler(handlerFunc CBVaultDriveFileAfterCopyEvent)

Remarks

This event fires when the component is executing the CopyToVault or CopyFromVault method after the file specified by SourcePath has been copied to a file identified by DestinationPath.

For a directory, the event fires after the directory identified by SourcePath has been created as DestinationPath and all of the source directory's contents have been processed.

The event will fire only if the VAULT_CFF_FIRE_COPY_EVENTS flag is included in the Flags parameter of the CopyFromVault or CopyToVault method. Also, the event will not fire for the base directory that was passed to the CopyToVault or CopyFromVault method.

A process may check whether it was a file or directory copied by inspecting the value of the Attributes parameter, which contains the attributes of the file as a 32-bit integer. The attributes are composed of one or more of the following values:

VAULT_FATTR_FILE0x00000001The entry is a file.

VAULT_FATTR_DIRECTORY0x00000002The entry is a directory.

VAULT_FATTR_DATA_STREAM0x00000004The entry is an alternate data stream.

VAULT_FATTR_COMPRESSED0x00000008The file or stream is compressed.

VAULT_FATTR_ENCRYPTED0x00000010The file or stream is encrypted.

VAULT_FATTR_SYMLINK0x00000020The entry is a symbolic link.

VAULT_FATTR_READONLY0x00000040The file is read-only.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_ARCHIVE0x00000080The file requires archiving.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_HIDDEN0x00000100The file is hidden.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_SYSTEM0x00000200The file is a system file.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_TEMPORARY0x00000400The file is temporary.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_DELETE_ON_CLOSE0x00000800The file should be deleted when the last handle to the file is closed.

This attribute is currently not supported by CBFS Storage.

VAULT_FATTR_RESERVED_00x00001000Reserved.

VAULT_FATTR_RESERVED_10x00002000Reserved.

VAULT_FATTR_RESERVED_20x00004000Reserved.

VAULT_FATTR_RESERVED_30x00008000Reserved.

VAULT_FATTR_NO_USER_CHANGE0x0000F03FA mask that includes all attributes that cannot be changed.

Applications cannot use the SetFileAttributes method to directly change any of the following attributes: FILE, DIRECTORY, DATA_STREAM, COMPRESSED, ENCRYPTED, SYMLINK, RESERVED_0, RESERVED_1, RESERVED_2, or RESERVED_3.

VAULT_FATTR_USER_DEFINED0x7FF00000A mask for application-defined attributes.

Applications can use the SetFileAttributes method to set custom attributes, as long as their values are covered by this mask.

VAULT_FATTR_ANY_FILE0x7FFFFFFFA mask that includes any and all attributes.

To cancel further copying, return the VAULT_ERR_INTERRUPTED_BY_USER error code via ResultCode.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

FileBeforeCopy Event (CBVaultDrive Component)

This event fires before the file is copied during file export/import operations.

Syntax

// CBVaultDriveFileBeforeCopyEventArgs carries the CBVaultDrive FileBeforeCopy event's parameters.
type CBVaultDriveFileBeforeCopyEventArgs struct {...}

func (args *CBVaultDriveFileBeforeCopyEventArgs) SourcePath() string
func (args *CBVaultDriveFileBeforeCopyEventArgs) DestinationPath() string
func (args *CBVaultDriveFileBeforeCopyEventArgs) Attributes() int32
func (args *CBVaultDriveFileBeforeCopyEventArgs) SetAttributes(value int32)

func (args *CBVaultDriveFileBeforeCopyEventArgs) DestinationExists() bool
func (args *CBVaultDriveFileBeforeCopyEventArgs) Skip() bool
func (args *CBVaultDriveFileBeforeCopyEventArgs) SetSkip(value bool)

func (args *CBVaultDriveFileBeforeCopyEventArgs) ResultCode() int32
func (args *CBVaultDriveFileBeforeCopyEventArgs) SetResultCode(value int32)

// CBVaultDriveFileBeforeCopyEvent defines the signature of the CBVaultDrive FileBeforeCopy event's handler function.
type CBVaultDriveFileBeforeCopyEvent func(sender *CBVaultDrive, args *CBVaultDriveFileBeforeCopyEventArgs)

func (obj *CBVaultDrive) GetOnFileBeforeCopyHandler() CBVaultDriveFileBeforeCopyEvent
func (obj *CBVaultDrive) SetOnFileBeforeCopyHandler(handlerFunc CBVaultDriveFileBeforeCopyEvent)

Remarks

This event fires when the component is executing the CopyToVault or CopyFromVault method before the file specified by SourcePath is copied to a file identified by DestinationPath or before the directory identified by SourcePath is about to be created as DestinationPath.

This event will fire only if the VAULT_CFF_FIRE_COPY_EVENTS flag is included in the Flags parameter of the CopyFromVault or CopyToVault method. Also, the event will not fire for the base directory that was passed to the CopyToVault or CopyFromVault method.

A process may check whether it is a file or a directory being copied by inspecting the value of the Attributes parameter, which contains the attributes of the file as a 32-bit integer. The attributes are composed of one or more of the following values:

VAULT_FATTR_FILE0x00000001The entry is a file.

VAULT_FATTR_DIRECTORY0x00000002The entry is a directory.

VAULT_FATTR_DATA_STREAM0x00000004The entry is an alternate data stream.

VAULT_FATTR_COMPRESSED0x00000008The file or stream is compressed.

VAULT_FATTR_ENCRYPTED0x00000010The file or stream is encrypted.

VAULT_FATTR_SYMLINK0x00000020The entry is a symbolic link.

VAULT_FATTR_READONLY0x00000040The file is read-only.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_ARCHIVE0x00000080The file requires archiving.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_HIDDEN0x00000100The file is hidden.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_SYSTEM0x00000200The file is a system file.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_TEMPORARY0x00000400The file is temporary.

This attribute is not used by CBFS Storage, but it can be set and retrieved.

VAULT_FATTR_DELETE_ON_CLOSE0x00000800The file should be deleted when the last handle to the file is closed.

This attribute is currently not supported by CBFS Storage.

VAULT_FATTR_RESERVED_00x00001000Reserved.

VAULT_FATTR_RESERVED_10x00002000Reserved.

VAULT_FATTR_RESERVED_20x00004000Reserved.

VAULT_FATTR_RESERVED_30x00008000Reserved.

VAULT_FATTR_NO_USER_CHANGE0x0000F03FA mask that includes all attributes that cannot be changed.

Applications cannot use the SetFileAttributes method to directly change any of the following attributes: FILE, DIRECTORY, DATA_STREAM, COMPRESSED, ENCRYPTED, SYMLINK, RESERVED_0, RESERVED_1, RESERVED_2, or RESERVED_3.

VAULT_FATTR_USER_DEFINED0x7FF00000A mask for application-defined attributes.

Applications can use the SetFileAttributes method to set custom attributes, as long as their values are covered by this mask.

VAULT_FATTR_ANY_FILE0x7FFFFFFFA mask that includes any and all attributes.

An event handler may change the following attributes: VAULT_FATTR_READONLY, VAULT_FATTR_ARCHIVE, VAULT_FATTR_HIDDEN, VAULT_FATTR_SYSTEM, VAULT_FATTR_TEMPORARY. When files are imported to the vault, an event handler may set user-defined flags that match the VAULT_FATTR_USER_DEFINED mask.

The DestinationExists flag indicates the presence of the file or directory at the moment when the event is fired.

Note: When copying the files from the vault, it is possible that a file gets created or deleted outside of the component; the value of this parameter may become inaccurate.

To skip the file, set the Skip parameter to true. When the file is skipped, FileAfterCopy does not fire.

To cancel copying, return the VAULT_ERR_INTERRUPTED_BY_USER error code via ResultCode.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

FilePasswordNeeded Event (CBVaultDrive Component)

This event fires if a password is needed to open an encrypted file.

Syntax

// CBVaultDriveFilePasswordNeededEventArgs carries the CBVaultDrive FilePasswordNeeded event's parameters.
type CBVaultDriveFilePasswordNeededEventArgs struct {...}

func (args *CBVaultDriveFilePasswordNeededEventArgs) FileName() string
func (args *CBVaultDriveFilePasswordNeededEventArgs) Password() string
func (args *CBVaultDriveFilePasswordNeededEventArgs) SetPassword(value string)

func (args *CBVaultDriveFilePasswordNeededEventArgs) TTLInCache() int32
func (args *CBVaultDriveFilePasswordNeededEventArgs) SetTTLInCache(value int32)

func (args *CBVaultDriveFilePasswordNeededEventArgs) ResultCode() int32
func (args *CBVaultDriveFilePasswordNeededEventArgs) SetResultCode(value int32)

// CBVaultDriveFilePasswordNeededEvent defines the signature of the CBVaultDrive FilePasswordNeeded event's handler function.
type CBVaultDriveFilePasswordNeededEvent func(sender *CBVaultDrive, args *CBVaultDriveFilePasswordNeededEventArgs)

func (obj *CBVaultDrive) GetOnFilePasswordNeededHandler() CBVaultDriveFilePasswordNeededEvent
func (obj *CBVaultDrive) SetOnFilePasswordNeededHandler(handlerFunc CBVaultDriveFilePasswordNeededEvent)

Remarks

This event fires when the encrypted file specified by FileName is being opened if a valid password has not been provided (either directly, or via the DefaultFileAccessPassword property or CacheFilePassword method). This event will not fire if a valid password has already been provided, or if the file specified by FileName does not exist in the vault.

To allow access to the specified file, set the Password parameter to the correct password.

If an invalid password is provided by the event handler, the event will fire again.

To prevent access to the specified file or to stop being asked for a password in a loop, return the VAULT_ERR_INVALID_PASSWORD error code via ResultCode.

The TTLInCache parameter specifies time to seconds that the component keeps the password in the internal cache to reduce the number of requests for a password. The value of 0 tells the component to discard the password after the first use.

Note: This event can be fired on different threads, and possibly even on several threads concurrently. As an alternative to handling this event, applications can provide a default file encryption password using the DefaultFileAccessPassword property or can call the CacheFilePassword method (before a file is opened) to specify a one-time-use password.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

HashCalculate Event (CBVaultDrive Component)

This event fires to calculate a password hash using a custom hashing implementation.

Syntax

// CBVaultDriveHashCalculateEventArgs carries the CBVaultDrive HashCalculate event's parameters.
type CBVaultDriveHashCalculateEventArgs struct {...}

func (args *CBVaultDriveHashCalculateEventArgs) Password() []byte
func (args *CBVaultDriveHashCalculateEventArgs) PasswordSize() int32
func (args *CBVaultDriveHashCalculateEventArgs) Salt() []byte
func (args *CBVaultDriveHashCalculateEventArgs) SaltSize() int32
func (args *CBVaultDriveHashCalculateEventArgs) Hash() []byte
func (args *CBVaultDriveHashCalculateEventArgs) SetHash(value []byte)

func (args *CBVaultDriveHashCalculateEventArgs) HashSize() int32
func (args *CBVaultDriveHashCalculateEventArgs) ResultCode() int32
func (args *CBVaultDriveHashCalculateEventArgs) SetResultCode(value int32)

// CBVaultDriveHashCalculateEvent defines the signature of the CBVaultDrive HashCalculate event's handler function.
type CBVaultDriveHashCalculateEvent func(sender *CBVaultDrive, args *CBVaultDriveHashCalculateEventArgs)

func (obj *CBVaultDrive) GetOnHashCalculateHandler() CBVaultDriveHashCalculateEvent
func (obj *CBVaultDrive) SetOnHashCalculateHandler(handlerFunc CBVaultDriveHashCalculateEvent)

Remarks

This event fires when the component needs to calculate a password hash using an application-defined hashing implementation. The calculated hash is used to check the password's validity before using it for encryption. Please refer to the Encryption topic for more information.

This event needs to be handled only by applications that use one of the VAULT_EM_CUSTOM*_DIRECT_KEY encryption modes. To handle this event property, applications must calculate a hash of the data in the Password buffer (whose length, in bytes, is specified by PasswordSize). The calculated hash must be written to the Hash buffer. The size of the calculated hash must not exceed HashSize.

Applications may perform, if desired, their own password validation and return a predefined value for the hash. Applications should not use the same process for key derivation and hash calculation (or should, at the very least, ensure that Salt is used in both operations).

The Salt buffer contains a salt value that can be used (if desired) to strengthen security by increasing the uniqueness of the hash. The SaltSize parameter specifies the length, in bytes, of Salt.

Please see the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

KeyDerive Event (CBVaultDrive Component)

This event fires to derive an encryption key using a custom key derivation implementation.

Syntax

// CBVaultDriveKeyDeriveEventArgs carries the CBVaultDrive KeyDerive event's parameters.
type CBVaultDriveKeyDeriveEventArgs struct {...}

func (args *CBVaultDriveKeyDeriveEventArgs) Password() []byte
func (args *CBVaultDriveKeyDeriveEventArgs) PasswordSize() int32
func (args *CBVaultDriveKeyDeriveEventArgs) Salt() []byte
func (args *CBVaultDriveKeyDeriveEventArgs) SaltSize() int32
func (args *CBVaultDriveKeyDeriveEventArgs) Key() []byte
func (args *CBVaultDriveKeyDeriveEventArgs) SetKey(value []byte)

func (args *CBVaultDriveKeyDeriveEventArgs) KeySize() int32
func (args *CBVaultDriveKeyDeriveEventArgs) ResultCode() int32
func (args *CBVaultDriveKeyDeriveEventArgs) SetResultCode(value int32)

// CBVaultDriveKeyDeriveEvent defines the signature of the CBVaultDrive KeyDerive event's handler function.
type CBVaultDriveKeyDeriveEvent func(sender *CBVaultDrive, args *CBVaultDriveKeyDeriveEventArgs)

func (obj *CBVaultDrive) GetOnKeyDeriveHandler() CBVaultDriveKeyDeriveEvent
func (obj *CBVaultDrive) SetOnKeyDeriveHandler(handlerFunc CBVaultDriveKeyDeriveEvent)

Remarks

This event fires when the component needs to derive an encryption key using an application-defined key derivation implementation. Please refer to the Encryption topic for more information.

This event needs to be handled only by applications that use one of the VAULT_EM_CUSTOM*_CUSTOM_KEY_DERIVE encryption modes. To handle this event properly, applications must derive an encryption key from the data in the Password buffer (whose length, in bytes, is specified by PasswordSize). The derived encryption key must be written to the Key buffer. The size of the derived encryption key must not exceed KeySize.

Applications should not use the same process for key derivation and hash calculation (or should, at the very least, ensure that Salt is used in both operations).

The Salt buffer contains a salt value that can be used (if desired) to strengthen security by increasing the uniqueness of the derived key. The SaltSize parameter specifies the length, in bytes, of Salt.

Please see the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

Progress Event (CBVaultDrive Component)

This event fires to indicate the progress of long-running vault operations.

Syntax

// CBVaultDriveProgressEventArgs carries the CBVaultDrive Progress event's parameters.
type CBVaultDriveProgressEventArgs struct {...}

func (args *CBVaultDriveProgressEventArgs) Operation() int32
func (args *CBVaultDriveProgressEventArgs) FileName() string
func (args *CBVaultDriveProgressEventArgs) Progress() int32
func (args *CBVaultDriveProgressEventArgs) Total() int32
func (args *CBVaultDriveProgressEventArgs) CanStop() bool
func (args *CBVaultDriveProgressEventArgs) Stop() bool
func (args *CBVaultDriveProgressEventArgs) SetStop(value bool)

// CBVaultDriveProgressEvent defines the signature of the CBVaultDrive Progress event's handler function.
type CBVaultDriveProgressEvent func(sender *CBVaultDrive, args *CBVaultDriveProgressEventArgs)

func (obj *CBVaultDrive) GetOnProgressHandler() CBVaultDriveProgressEvent
func (obj *CBVaultDrive) SetOnProgressHandler(handlerFunc CBVaultDriveProgressEvent)

Remarks

This event fires anytime the component needs to report the progress of a long-running vault operation. Certain operations may cause this event to fire repeatedly.

The Operation parameter specifies which long-running operation caused this event to fire. Possible values are as follows:

VAULT_PO_FORMATTING0Formatting a vault.

VAULT_PO_CHECKING_11Checking a vault (stage 1).

VAULT_PO_CHECKING_22Checking a vault (stage 2).

VAULT_PO_CHECKING_33Checking a vault (stage 3).

VAULT_PO_CHECKING_44Checking a vault (stage 4).

VAULT_PO_CHECKING_55Checking a vault (stage 5).

VAULT_PO_PAGE_CORRUPTED8Processing a corrupted vault page.

VAULT_PO_PAGE_ORPHANED9Processing an orphaned vault page.

VAULT_PO_COMPRESSING10Compressing a file or alternate stream.

VAULT_PO_DECOMPRESSING11Decompressing a file or alternate stream.

VAULT_PO_ENCRYPTING12Encrypting a vault, file, or alternate stream.

VAULT_PO_DECRYPTING13Decrypting a vault, file, or alternate stream

VAULT_PO_COMPACTING14Compacting a vault.

VAULT_PO_RESIZING15Resizing a vault.

VAULT_PO_CALCULATING_SIZE16Calculating a vault's size.

VAULT_PO_COPYING_FILES_TO_VAULT17Copying files to a vault.

VAULT_PO_COPYING_FILES_FROM_VAULT18Copying files from a vault.

When the operation is copying files from or to the vault, FileName contains the path of the source file being copied.

The Progress and Total parameters reflect the current and maximum progress values. Both will be 0 if the operation's progression cannot be determined.

The CanStop parameter indicates whether the application may interrupt the operation by setting the Stop parameter to true.

Note: Some operations can be interrupted only at certain points over the course of their lifetime.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

VaultClose Event (CBVaultDrive Component)

This event fires to close a callback mode vault.

Syntax

// CBVaultDriveVaultCloseEventArgs carries the CBVaultDrive VaultClose event's parameters.
type CBVaultDriveVaultCloseEventArgs struct {...}

func (args *CBVaultDriveVaultCloseEventArgs) VaultHandle() int64
func (args *CBVaultDriveVaultCloseEventArgs) ResultCode() int32
func (args *CBVaultDriveVaultCloseEventArgs) SetResultCode(value int32)

// CBVaultDriveVaultCloseEvent defines the signature of the CBVaultDrive VaultClose event's handler function.
type CBVaultDriveVaultCloseEvent func(sender *CBVaultDrive, args *CBVaultDriveVaultCloseEventArgs)

func (obj *CBVaultDrive) GetOnVaultCloseHandler() CBVaultDriveVaultCloseEvent
func (obj *CBVaultDrive) SetOnVaultCloseHandler(handlerFunc CBVaultDriveVaultCloseEvent)

Remarks

This event fires when the component needs to close the callback mode vault specified by VaultHandle.

This event needs to be handled only if the CallbackMode property is enabled; please refer to the Callback Mode topic for more information. To handle this event properly, applications must close the vault specified by VaultHandle and invalidate the handle itself.

The VaultHandle parameter contains an application-defined information, associated with an open callback mode vault, as returned by the application in an earlier VaultOpen event.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

VaultDelete Event (CBVaultDrive Component)

This event fires to delete a callback mode vault.

Syntax

// CBVaultDriveVaultDeleteEventArgs carries the CBVaultDrive VaultDelete event's parameters.
type CBVaultDriveVaultDeleteEventArgs struct {...}

func (args *CBVaultDriveVaultDeleteEventArgs) Vault() string
func (args *CBVaultDriveVaultDeleteEventArgs) ResultCode() int32
func (args *CBVaultDriveVaultDeleteEventArgs) SetResultCode(value int32)

// CBVaultDriveVaultDeleteEvent defines the signature of the CBVaultDrive VaultDelete event's handler function.
type CBVaultDriveVaultDeleteEvent func(sender *CBVaultDrive, args *CBVaultDriveVaultDeleteEventArgs)

func (obj *CBVaultDrive) GetOnVaultDeleteHandler() CBVaultDriveVaultDeleteEvent
func (obj *CBVaultDrive) SetOnVaultDeleteHandler(handlerFunc CBVaultDriveVaultDeleteEvent)

Remarks

This event fires when the component needs to delete the callback mode vault identified by Vault.

This event needs to be handled only if the CallbackMode property is enabled; please refer to the Callback Mode topic for more information. To handle this event properly, applications must delete the vault identified by Vault.

The Vault parameter contains an application-defined vault identifier (e.g., name, file path). The value of this parameter will always match the current value of the VaultFile property.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

VaultFlush Event (CBVaultDrive Component)

This event fires to flush a callback mode vault's data out to storage.

Syntax

// CBVaultDriveVaultFlushEventArgs carries the CBVaultDrive VaultFlush event's parameters.
type CBVaultDriveVaultFlushEventArgs struct {...}

func (args *CBVaultDriveVaultFlushEventArgs) VaultHandle() int64
func (args *CBVaultDriveVaultFlushEventArgs) ResultCode() int32
func (args *CBVaultDriveVaultFlushEventArgs) SetResultCode(value int32)

// CBVaultDriveVaultFlushEvent defines the signature of the CBVaultDrive VaultFlush event's handler function.
type CBVaultDriveVaultFlushEvent func(sender *CBVaultDrive, args *CBVaultDriveVaultFlushEventArgs)

func (obj *CBVaultDrive) GetOnVaultFlushHandler() CBVaultDriveVaultFlushEvent
func (obj *CBVaultDrive) SetOnVaultFlushHandler(handlerFunc CBVaultDriveVaultFlushEvent)

Remarks

This event fires when the component needs to flush the data of the callback mode vault specified by VaultHandle out to storage.

This event needs to be handled only if the CallbackMode property is enabled; please refer to the Callback Mode topic for more information. To handle this event properly, applications must flush all data currently buffered for the vault specified by VaultHandle out to storage. For example, if the application is storing vault data in a file on disk, it could call FlushFileBuffers() on Windows.

The VaultHandle parameter contains an application-defined information, associated with an open callback mode vault, as returned by the application in an earlier VaultOpen event.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

VaultGetParentSize Event (CBVaultDrive Component)

This event fires to determine how much free space is available for growing a callback mode vault.

Syntax

// CBVaultDriveVaultGetParentSizeEventArgs carries the CBVaultDrive VaultGetParentSize event's parameters.
type CBVaultDriveVaultGetParentSizeEventArgs struct {...}

func (args *CBVaultDriveVaultGetParentSizeEventArgs) Vault() string
func (args *CBVaultDriveVaultGetParentSizeEventArgs) VaultHandle() int64
func (args *CBVaultDriveVaultGetParentSizeEventArgs) FreeSpace() int64
func (args *CBVaultDriveVaultGetParentSizeEventArgs) SetFreeSpace(value int64)

func (args *CBVaultDriveVaultGetParentSizeEventArgs) ResultCode() int32
func (args *CBVaultDriveVaultGetParentSizeEventArgs) SetResultCode(value int32)

// CBVaultDriveVaultGetParentSizeEvent defines the signature of the CBVaultDrive VaultGetParentSize event's handler function.
type CBVaultDriveVaultGetParentSizeEvent func(sender *CBVaultDrive, args *CBVaultDriveVaultGetParentSizeEventArgs)

func (obj *CBVaultDrive) GetOnVaultGetParentSizeHandler() CBVaultDriveVaultGetParentSizeEvent
func (obj *CBVaultDrive) SetOnVaultGetParentSizeHandler(handlerFunc CBVaultDriveVaultGetParentSizeEvent)

Remarks

This event fires when the component needs to determine how much free space is available for growing the callback mode vault specified by VaultHandle.

This event needs to be handled only if the CallbackMode property is enabled; please refer to the Callback Mode topic for more information. To handle this event properly, applications must set FreeSpace to indicate how many bytes of free space are available in the "parent storage" of the vault specified by VaultHandle. For example:

  • If the vault is stored in a file, return the amount of free space on the associated disk.
  • If the vault is stored in memory, return the amount of memory available to the application (keeping in mind any other memory needs the application may have).
  • If the vault is stored on some remote system, query it to determine how much free space is available.

The Vault parameter contains an application-defined vault identifier (e.g., name, file path). The value of this parameter will always match the current value of the VaultFile property.

The VaultHandle parameter contains an application-defined information, associated with an open callback mode vault, as returned by the application in an earlier VaultOpen event.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

VaultGetSize Event (CBVaultDrive Component)

This event fires to determine the size of a callback mode vault.

Syntax

// CBVaultDriveVaultGetSizeEventArgs carries the CBVaultDrive VaultGetSize event's parameters.
type CBVaultDriveVaultGetSizeEventArgs struct {...}

func (args *CBVaultDriveVaultGetSizeEventArgs) VaultHandle() int64
func (args *CBVaultDriveVaultGetSizeEventArgs) Size() int64
func (args *CBVaultDriveVaultGetSizeEventArgs) SetSize(value int64)

func (args *CBVaultDriveVaultGetSizeEventArgs) ResultCode() int32
func (args *CBVaultDriveVaultGetSizeEventArgs) SetResultCode(value int32)

// CBVaultDriveVaultGetSizeEvent defines the signature of the CBVaultDrive VaultGetSize event's handler function.
type CBVaultDriveVaultGetSizeEvent func(sender *CBVaultDrive, args *CBVaultDriveVaultGetSizeEventArgs)

func (obj *CBVaultDrive) GetOnVaultGetSizeHandler() CBVaultDriveVaultGetSizeEvent
func (obj *CBVaultDrive) SetOnVaultGetSizeHandler(handlerFunc CBVaultDriveVaultGetSizeEvent)

Remarks

This event fires when the component needs to determine the size of the callback mode vault specified by VaultHandle.

This event needs to be handled only if the CallbackMode property is enabled; please refer to the Callback Mode topic for more information. To handle this event properly, applications must set Size to indicate the size, in bytes, of the vault specified by VaultHandle.

The VaultHandle parameter contains an application-defined information, associated with an open callback mode vault, as returned by the application in an earlier VaultOpen event.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

VaultOpen Event (CBVaultDrive Component)

This event fires to open a new or existing callback mode vault.

Syntax

// CBVaultDriveVaultOpenEventArgs carries the CBVaultDrive VaultOpen event's parameters.
type CBVaultDriveVaultOpenEventArgs struct {...}

func (args *CBVaultDriveVaultOpenEventArgs) Vault() string
func (args *CBVaultDriveVaultOpenEventArgs) VaultHandle() int64
func (args *CBVaultDriveVaultOpenEventArgs) SetVaultHandle(value int64)

func (args *CBVaultDriveVaultOpenEventArgs) OpenMode() int32
func (args *CBVaultDriveVaultOpenEventArgs) ReadOnly() bool
func (args *CBVaultDriveVaultOpenEventArgs) SetReadOnly(value bool)

func (args *CBVaultDriveVaultOpenEventArgs) ResultCode() int32
func (args *CBVaultDriveVaultOpenEventArgs) SetResultCode(value int32)

// CBVaultDriveVaultOpenEvent defines the signature of the CBVaultDrive VaultOpen event's handler function.
type CBVaultDriveVaultOpenEvent func(sender *CBVaultDrive, args *CBVaultDriveVaultOpenEventArgs)

func (obj *CBVaultDrive) GetOnVaultOpenHandler() CBVaultDriveVaultOpenEvent
func (obj *CBVaultDrive) SetOnVaultOpenHandler(handlerFunc CBVaultDriveVaultOpenEvent)

Remarks

This event fires when the component wants to open the callback mode vault identified by Vault.

This event needs to be handled only if the CallbackMode property is enabled; please refer to the Callback Mode topic for more information. To handle this event properly, applications must open the vault identified by Vault, creating it if necessary based on the specified OpenMode, and return any associated information in VaultHandle.

If the ReadOnly parameter is initially true, the application must open the vault in read-only mode. If ReadOnly is initially false, the application may choose whether to open the vault in read-only or read-write mode. It should update the ReadOnly parameter accordingly, if necessary.

If, for any reason, the vault cannot be opened in a manner consistent with the specified OpenMode, the application must return an appropriate error code via ResultCode.

The Vault parameter contains an application-defined vault identifier (e.g., name, file path). The value of this parameter will always match the current value of the VaultFile property.

The VaultHandle parameter is used to return some application-defined handle that uniquely identifies the opened vault. The component uses the returned handle to populate the VaultHandle parameters of the other Vault* events fired for the vault later.

The OpenMode parameter specifies what behavior to use when opening the vault. Valid values are as follows:

VAULT_OM_CREATE_NEW0Creates a new vault if possible, failing if one already exists.

VAULT_OM_CREATE_ALWAYS1Creates a new vault, overwriting an existing one if necessary.

VAULT_OM_OPEN_EXISTING2Opens a vault if it exists; fails otherwise.

VAULT_OM_OPEN_ALWAYS3Opens a vault if it exists; creates a new one otherwise.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

VaultRead Event (CBVaultDrive Component)

This event fires to read data from a callback mode vault.

Syntax

// CBVaultDriveVaultReadEventArgs carries the CBVaultDrive VaultRead event's parameters.
type CBVaultDriveVaultReadEventArgs struct {...}

func (args *CBVaultDriveVaultReadEventArgs) VaultHandle() int64
func (args *CBVaultDriveVaultReadEventArgs) Offset() int64
func (args *CBVaultDriveVaultReadEventArgs) Buffer() []byte
func (args *CBVaultDriveVaultReadEventArgs) SetBuffer(value []byte)

func (args *CBVaultDriveVaultReadEventArgs) Count() int32
func (args *CBVaultDriveVaultReadEventArgs) ResultCode() int32
func (args *CBVaultDriveVaultReadEventArgs) SetResultCode(value int32)

// CBVaultDriveVaultReadEvent defines the signature of the CBVaultDrive VaultRead event's handler function.
type CBVaultDriveVaultReadEvent func(sender *CBVaultDrive, args *CBVaultDriveVaultReadEventArgs)

func (obj *CBVaultDrive) GetOnVaultReadHandler() CBVaultDriveVaultReadEvent
func (obj *CBVaultDrive) SetOnVaultReadHandler(handlerFunc CBVaultDriveVaultReadEvent)

Remarks

This event fires when the component needs to read data from the callback mode vault specified by VaultHandle.

This event needs to be handled only if the CallbackMode property is enabled; please refer to the Callback Mode topic for more information. To handle this event properly, applications must read Count bytes of data from the vault specified by VaultHandle into Buffer, starting at the specified Offset in the vault.

Count is always a multiple of the vault's PageSize. If, for any reason, an application cannot read exactly Count bytes of data from the vault, it must return an appropriate error code via ResultCode.

Please see the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The VaultHandle parameter contains an application-defined information, associated with an open callback mode vault, as returned by the application in an earlier VaultOpen event.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

VaultSetSize Event (CBVaultDrive Component)

This event fires to resize a callback mode vault.

Syntax

// CBVaultDriveVaultSetSizeEventArgs carries the CBVaultDrive VaultSetSize event's parameters.
type CBVaultDriveVaultSetSizeEventArgs struct {...}

func (args *CBVaultDriveVaultSetSizeEventArgs) VaultHandle() int64
func (args *CBVaultDriveVaultSetSizeEventArgs) NewSize() int64
func (args *CBVaultDriveVaultSetSizeEventArgs) ResultCode() int32
func (args *CBVaultDriveVaultSetSizeEventArgs) SetResultCode(value int32)

// CBVaultDriveVaultSetSizeEvent defines the signature of the CBVaultDrive VaultSetSize event's handler function.
type CBVaultDriveVaultSetSizeEvent func(sender *CBVaultDrive, args *CBVaultDriveVaultSetSizeEventArgs)

func (obj *CBVaultDrive) GetOnVaultSetSizeHandler() CBVaultDriveVaultSetSizeEvent
func (obj *CBVaultDrive) SetOnVaultSetSizeHandler(handlerFunc CBVaultDriveVaultSetSizeEvent)

Remarks

This event fires when the component needs to resize the callback mode vault specified by VaultHandle.

This event needs to be handled only if the CallbackMode property is enabled; please refer to the Callback Mode topic for more information. To handle this event properly, applications must grow or shrink the vault specified by VaultHandle to reach the specified NewSize. When growing a vault, applications do not need to sanitize newly allocated space.

The VaultHandle parameter contains an application-defined information, associated with an open callback mode vault, as returned by the application in an earlier VaultOpen event.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

VaultWrite Event (CBVaultDrive Component)

This event fires to write data to a callback mode vault.

Syntax

// CBVaultDriveVaultWriteEventArgs carries the CBVaultDrive VaultWrite event's parameters.
type CBVaultDriveVaultWriteEventArgs struct {...}

func (args *CBVaultDriveVaultWriteEventArgs) VaultHandle() int64
func (args *CBVaultDriveVaultWriteEventArgs) Offset() int64
func (args *CBVaultDriveVaultWriteEventArgs) Buffer() []byte
func (args *CBVaultDriveVaultWriteEventArgs) Count() int32
func (args *CBVaultDriveVaultWriteEventArgs) ResultCode() int32
func (args *CBVaultDriveVaultWriteEventArgs) SetResultCode(value int32)

// CBVaultDriveVaultWriteEvent defines the signature of the CBVaultDrive VaultWrite event's handler function.
type CBVaultDriveVaultWriteEvent func(sender *CBVaultDrive, args *CBVaultDriveVaultWriteEventArgs)

func (obj *CBVaultDrive) GetOnVaultWriteHandler() CBVaultDriveVaultWriteEvent
func (obj *CBVaultDrive) SetOnVaultWriteHandler(handlerFunc CBVaultDriveVaultWriteEvent)

Remarks

This event fires when the component needs to write data to the callback mode vault specified by VaultHandle.

This event needs to be handled only if the CallbackMode property is enabled; please refer to the Callback Mode topic for more information. To handle this event properly, applications must write Count bytes of data from Buffer to the vault specified by VaultHandle, starting at the specified Offset in the vault.

Count is always a multiple of the vault's PageSize. If, for any reason, an application cannot write exactly Count bytes of data to the vault, it must return an appropriate error code via ResultCode.

Please see the Buffer Parameters topic for more information on how to work with memory buffer event parameters.

The VaultHandle parameter contains an application-defined information, associated with an open callback mode vault, as returned by the application in an earlier VaultOpen event.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

Note: An application should not attempt to call component's methods from handlers of this event. Doing this is guaranteed to cause a deadlock.

Note: When a storage is opened concurrently in read-only mode by several applications using CBVaultDrive or CBMemoryDrive component, the event will fire only in the first application. To prevent such a situation, always open a vault in read-write mode.

WorkerThreadCreation Event (CBVaultDrive Component)

Fires just after a new worker thread is created.

Syntax

// CBVaultDriveWorkerThreadCreationEventArgs carries the CBVaultDrive WorkerThreadCreation event's parameters.
type CBVaultDriveWorkerThreadCreationEventArgs struct {...}

func (args *CBVaultDriveWorkerThreadCreationEventArgs) ResultCode() int32
func (args *CBVaultDriveWorkerThreadCreationEventArgs) SetResultCode(value int32)

// CBVaultDriveWorkerThreadCreationEvent defines the signature of the CBVaultDrive WorkerThreadCreation event's handler function.
type CBVaultDriveWorkerThreadCreationEvent func(sender *CBVaultDrive, args *CBVaultDriveWorkerThreadCreationEventArgs)

func (obj *CBVaultDrive) GetOnWorkerThreadCreationHandler() CBVaultDriveWorkerThreadCreationEvent
func (obj *CBVaultDrive) SetOnWorkerThreadCreationHandler(handlerFunc CBVaultDriveWorkerThreadCreationEvent)

Remarks

This event fires just after a worker thread is created, in the context of that worker thread.

This event is optional; it is provided to give applications a chance to perform additional processing when a new worker thread is created, such as allocating per-thread objects.

The component maintains a pool of worker threads and uses them to fire events; please refer to the Threading and Concurrency topic for more information.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource is not available or security checks failed), set it to a nonzero value to report an appropriate error. Please see the Error Reporting and Handling topic for more information.

WorkerThreadTermination Event (CBVaultDrive Component)

Fires just before a worker thread is terminated.

Syntax

// CBVaultDriveWorkerThreadTerminationEventArgs carries the CBVaultDrive WorkerThreadTermination event's parameters.
type CBVaultDriveWorkerThreadTerminationEventArgs struct {...}

// CBVaultDriveWorkerThreadTerminationEvent defines the signature of the CBVaultDrive WorkerThreadTermination event's handler function.
type CBVaultDriveWorkerThreadTerminationEvent func(sender *CBVaultDrive, args *CBVaultDriveWorkerThreadTerminationEventArgs)

func (obj *CBVaultDrive) GetOnWorkerThreadTerminationHandler() CBVaultDriveWorkerThreadTerminationEvent
func (obj *CBVaultDrive) SetOnWorkerThreadTerminationHandler(handlerFunc CBVaultDriveWorkerThreadTerminationEvent)

Remarks

This event fires just before a worker thread is terminated, in the context of that worker thread.

This event is optional; it is provided to give applications a chance to perform additional processing before a worker thread is terminated, such as deallocating per-thread objects.

The component maintains a pool of worker threads and uses them to fire events; please refer to the Threading and Concurrency topic for more information.

Any errors that occur during this event are ignored.

CBFSStorageStream Type

Syntax

cbfsstorage.CBFSStorageStream

Remarks

The CBFSStorageStream type is returned by some of the CBVaultDrive component's methods. All stream types in CBFS Storage share a common API, which implements multiple interfaces from Go's io package, documented below.

Properties

Length Gets or sets the length of the stream, in bytes.

func (obj *CBFSStorageStream) GetLength() (int64, error)
func (obj *CBFSStorageStream) SetLength(value int64) error
Position Gets or sets the current position within the stream.

func (obj *CBFSStorageStream) GetPosition() (int64, error)
func (obj *CBFSStorageStream) SetPosition(value int64) error

Methods

Close Closes the stream. Has no effect if the stream is already closed.

func (obj *CBFSStorageStream) Close() error
Flush Forces all data held by the stream's buffers to be written out to storage.

func (obj *CBFSStorageStream) Flush() error
Read Reads a sequence of bytes from the stream and advances the current position within the stream by the number of bytes read.

func (obj *CBFSStorageStream) Read(p []byte) (n int, err error)

Up to len(p) bytes will be read from the stream into p. Fewer than len(p) bytes may be read if fewer than len(p) bytes are available. Returns the number of bytes read in n, and any error encountered (including, but not limited to, EOF) in err.

ReadByte Reads and returns the next byte from the stream or any error encountered.

func (obj *CBFSStorageStream) ReadByte() (byte, error)
Seek Sets the current position within the stream based on a particular point of origin.

func (obj *CBFSStorageStream) Seek(offset int64, whence int) (int64, error)

Returns the new offset relative to the start of the stream, and any error encountered.

Write Writes a sequence of bytes to the stream and advances the current position within the stream by the number of bytes written.

func (obj *CBFSStorageStream) Write(p []byte) (n int, err error)

Writes len(p) bytes to the stream. Returns the number of bytes written in n, and any error encountered in err.

WriteByte Writes a single byte to the stream and returns any error encountered.

func (obj *CBFSStorageStream) WriteByte(c byte) error

Config Settings (CBVaultDrive Component)

The component accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.

CBVaultDrive Config Settings

AllowMoveStreamsBetweenFiles:   Whether alternate streams may be moved from one file to another.

This configuration setting specifies whether alternate streams may be moved from one file to another using MoveFile or (for the CBVaultDrive or CBMemoryDrive component) directly by the OS.

By default, this setting is disabled, and alternate streams can be renamed only within the same file, and cannot be moved between them.

Note: This setting cannot be changed within events.

AsyncDeleteStorageNotifications:   Whether system broadcasts for virtual drive deletion are sent asynchronously.

This setting specifies whether the WM_DEVICECHANGE broadcast is sent asynchronously (true) or synchronously (false) when the virtual drive is deleted using CloseVault.

By default, this setting is enabled, and the broadcast is sent asynchronously. This is typically sufficient, but applications may disable this setting if they find that Windows Explorer is still presenting virtual drives as available after they've been deleted (which may occur if the application exits immediately after deleting a virtual drive).

AutoCompactDelay:   How long a vault must remain idle before starting automatic compaction.

When a vault is open, and the AutoCompactAt property is set to a nonzero value, the component will automatically compact the vault in the background, as necessary (assuming it is eligible for automatic compaction, as described by the AutoCompactAt documentation). This configuration setting specifies how many milliseconds a vault must remain idle before starting automatic compaction operations.

By default, this setting is set to 0, and automatic compaction operations will start without delay.

Note: This setting cannot be changed within events.

DefaultFileCompressionLevel:   The default compression level to use when creating files and alternate streams.

This configuration setting specifies the default compression level that the component should use when creating files and alternate streams, if applicable. Valid values are 0 through 9; where 0 means "use the default compression level for the selected compression algorithm".

By default, this setting is set to 0.

FireFileAccessEvent:   Whether FileAccess event is fired.

This setting specifies whether FileAccess event is fired; it is disabled by default.

LoggingEnabled:   Whether extended logging is enabled.

This setting specifies whether extended logging is enabled for this component; it is disabled by default. Please refer to the Error Reporting and Handling topic for more information.

This setting's value is stored in the registry and is persistent; it requires administrative rights to be changed.

MaxNonPagedNameLength:   The maximum number of name characters to store directly within a vault item.

This configuration setting specifies the maximum number of name characters that may be stored within a vault item directly. If a vault item's name is longer than the specified value, then the first MaxNonPagedNameLength characters are stored directly, and the rest are stored in a dedicated vault page. The minimum valid nonpaged name length is four characters (4).

A vault's maximum nonpaged name length is permanent, and it cannot be changed after the vault is created. When a vault is open, this configuration setting cannot be changed, and it can be queried only to obtain the value used by the vault.

By default, this setting is set to 0, and the component will automatically choose an optimal value when creating a vault based on PageSize.

Note: This setting cannot be changed when Active is true, and it cannot be changed within events.

MaxWorkerThreadCount:   The maximum number of worker threads to use to fire events.

This setting specifies the maximum number of worker threads the component may create to fire events on when the SerializeEvents property is set to seOnMultipleThreads. (If other cases, this setting does not apply.)

By default, this setting is set to 0, and the driver automatically chooses an optimal number of threads using this equation: 4 * number_of_processors.

MinWorkerThreadCount:   The minimum number of worker threads to use to fire events.

This setting specifies the minimum number of worker threads the component should create to fire events on when the SerializeEvents property is set to seOnMultipleThreads. (In other cases, this setting does not apply.)

By default, this setting is set to 0, and the driver automatically chooses an optimal number of threads using this equation: max(number_of_processors, 4). If this setting's value exceeds the MaxWorkerThreadCount value, the latter is used instead.

PageCacheSize:   The size of the in-memory vault page cache.

This configuration setting controls the size of the built-in data cache; it is specified in bytes. The cache must be large enough to contain at least eight pages, so this setting's minimum valid value is eight times the value of the PageSize property.

By default, this configuration setting is set to 16777216 (16 MB).

Note: This setting can be changed only when Active is true.

PartSize:   The part size used by a multipart vault.

This configuration setting controls the part size to use when creating new multipart vaults, and it reflects the part size used by the currently open vault. Part size is specified in bytes.

A multipart vault's part size is permanent, and it cannot be changed after the vault is created. When a vault is open, this configuration setting cannot be changed, and it can be queried only to obtain the value used by the vault.

By default, this setting is set to 0, and the component will not create multipart vaults.

Note: This setting cannot be changed when Active is true, and it cannot be changed within events.

SupportSearchIndexer:   Specifies whether the driver must take additional measures to support indexing by Windows Search.

The Search Indexer of Windows 10 has been recently modified in the way that Search Indexer stopped indexing virtual disks. This happens because of the missing mounting point when the disk is created.

This setting, when enabled, tells the driver to create a fake mounting point and use it to work around the Search Indexer bug. By default, this setting is disabled.

Note: This property cannot be changed within events.

VolumeGuidName:   The GUID of the mounted volume.

Use this setting to obtain the guild of the created disk device. The value is returned as a string in the "Volume{GUID}" format, where GUID is the actual GUID.

WorkerInitialStackSize:   The initial stack size to create worker threads with.

This setting specifies the initial size of the stack each worker thread is created with. The system rounds this value to the nearest page.

By default, this setting is set to 0, and the driver uses a default stack size (currently, 1 MB).

Note: This setting cannot be changed when Active is true, and it cannot be changed within events.

Trappable Errors (CBVaultDrive Component)

The component uses the error codes shown below, all of which are also available as constants for applications' convenience. System error codes, all of which are positive, may also be used as necessary for virtual-drive-related errors. Please refer to the Error Reporting and Handling topic for more information.

CBVaultDrive Errors

-1   The specified file is not a CBFS Storage vault. (VAULT_ERR_INVALID_VAULT_FILE)
-2   The specified page size is not valid. (VAULT_ERR_INVALID_PAGE_SIZE)
-3   The vault is corrupted. Please call CheckAndRepair. (VAULT_ERR_VAULT_CORRUPTED)
-4   Too many transactions active. (VAULT_ERR_TOO_MANY_TRANSACTIONS)
-5   A file, directory, symbolic link, or alternate stream with the specified name already exists. (VAULT_ERR_FILE_ALREADY_EXISTS)
-6   One or more transactions are still active. (VAULT_ERR_TRANSACTIONS_STILL_ACTIVE)
-7   The specified file tag already exists. (VAULT_ERR_TAG_ALREADY_EXISTS)
-8   The specified file, directory, symbolic link, or alternate stream was not found. (VAULT_ERR_FILE_NOT_FOUND)
-9   The specified path was not found. (VAULT_ERR_PATH_NOT_FOUND)
-10   The specified file or alternate stream is already open in an exclusive access mode. (VAULT_ERR_SHARING_VIOLATION)
-11   Cannot seek beyond the end of a file or alternate stream. (VAULT_ERR_SEEK_BEYOND_EOF)
-12   No other files, directories, symbolic links, or alternate streams match the search criteria. (VAULT_ERR_NO_MORE_FILES)
-13   The specified name is not valid. (VAULT_ERR_INVALID_FILE_NAME)
-14   The requested operation cannot be performed while a vault is open. (VAULT_ERR_VAULT_ACTIVE)
-15   A vault must be open before the requested operation can be performed. (VAULT_ERR_VAULT_NOT_ACTIVE)
-16   The specified password is incorrect. (VAULT_ERR_INVALID_PASSWORD)
-17   The requested operation cannot be performed; the vault is open in read-only mode. (VAULT_ERR_VAULT_READ_ONLY)
-18   Cannot use custom encryption; no custom encryption event handlers provided. (VAULT_ERR_NO_ENCRYPTION_HANDLERS)
-19   Out of memory. (VAULT_ERR_OUT_OF_MEMORY)
-20   A symbolic link's destination file could not be found. (VAULT_ERR_SYMLINK_DESTINATION_NOT_FOUND)
-21   The specified file is not a symbolic link. (VAULT_ERR_FILE_IS_NOT_SYMLINK)
-22   The specified buffer is too small to hold the requested value. (VAULT_ERR_BUFFER_TOO_SMALL)
-23   Decompression failed (possibly due to corruption). (VAULT_ERR_BAD_COMPRESSED_DATA)
-24   Invalid parameter. (VAULT_ERR_INVALID_PARAMETER)
-25   The vault is full (and cannot be automatically resized). (VAULT_ERR_VAULT_FULL)
-26   Operation interrupted by user. (VAULT_ERR_INTERRUPTED_BY_USER)
-27   The specified file tag was not found. (VAULT_ERR_TAG_NOT_FOUND)
-28   The specified directory is not empty. (VAULT_ERR_DIRECTORY_NOT_EMPTY)
-29   The file or alternate stream was closed unexpectedly; the handle is no longer valid. (VAULT_ERR_HANDLE_CLOSED)
-30   Invalid file or alternate stream handle. (VAULT_ERR_INVALID_STREAM_HANDLE)
-31   Access denied. (VAULT_ERR_FILE_ACCESS_DENIED)
-32   Cannot use custom compression; no custom compression event handlers provided. (VAULT_ERR_NO_COMPRESSION_HANDLERS)
-33   Not implemented in this version of CBFS Storage. (VAULT_ERR_NOT_IMPLEMENTED)
-35   The CBFS Storage system driver has not been installed. (VAULT_ERR_DRIVER_NOT_INSTALLED)
-37   The specified vault cannot be opened, it was created using a newer version of CBFS Storage. (VAULT_ERR_NEW_VAULT_VERSION)
-38   The specified file is not a directory. (VAULT_ERR_FILE_IS_NOT_DIRECTORY)
-39   The specified file tag data type is not valid. (VAULT_ERR_INVALID_TAG_DATA_TYPE)
-40   The specified vault storage file does not exist. (VAULT_ERR_VAULT_FILE_DOES_NOT_EXIST)
-41   The specified vault storage file already exists. (VAULT_ERR_VAULT_FILE_ALREADY_EXISTS)
-42   Some callback mode event handler has returned an unidentified error. (VAULT_ERR_CALLBACK_MODE_FAILURE)
-43   External library could not be initialized or used. (VAULT_ERR_EXTERNAL_ERROR)

Special Use Errors

21   ERROR_NOT_READY: Reported by the methods of the component if Initialize has not been called or did not succeed.
575   ERROR_APP_INIT_FAILURE: Reported by the methods of the component if Initialize has not been called or did not succeed. Differs from ERROR_NOT_READY (21) in that it indicates a specific situation in the internal code.
588   ERROR_FS_DRIVER_REQUIRED: Reported if the required system module was not correctly installed for the given ProductGUID.
614   ERROR_NO_CALLBACK_ACTIVE: Reported by any method that can only be called within event handlers if it is called outside an event handler.
618   ERROR_UNSUPPORTED_COMPRESSION: Reported by the OpenVault method of CBVaultDrive when the vault file is compressed or encrypted (e.g., using built-in NTFS mechanisms), which is not supported.
1292   ERROR_IMPLEMENTATION_LIMIT: Reported when the timeout value provided is less than 3 seconds.
1314   ERROR_PRIVILEGE_NOT_HELD: Reported by any method that requires elevated permissions if it is called without such permissions.
6002   ERROR_FILE_ENCRYPTED: Reported by the by the OpenVault method of CBVaultDrive when the vault file is encrypted, which is not supported.