CopyToVault Method

Copies files and directories from a physical filesystem to the vault.

Syntax

ANSI (Cross Platform)
int CopyToVault(const char* lpszSystemPath, const char* lpszVaultPath, const char* lpszMask, int iFlags, int iEncryption, const char* lpszPassword, int iCompression, int iCompressionLevel, int iPagesPerBlock);

Unicode (Windows)
INT CopyToVault(LPCWSTR lpszSystemPath, LPCWSTR lpszVaultPath, LPCWSTR lpszMask, INT iFlags, INT iEncryption, LPCWSTR lpszPassword, INT iCompression, INT iCompressionLevel, INT iPagesPerBlock);
- (void)copyToVault:(NSString*)systemPath :(NSString*)vaultPath :(NSString*)mask :(int)flags :(int)encryption :(NSString*)password :(int)compression :(int)compressionLevel :(int)pagesPerBlock;
#define MID_CBVAULT_COPYTOVAULT 10

CBFSSTORAGE_EXTERNAL int CBFSSTORAGE_CALL CBFSStorage_CBVault_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

This method copies the files and directories from a physical filesystem location, specified by SystemPath, to the specified VaultPath. Only the files and directories whose names match the specified Mask are copied.

The values passed for SystemPath and VaultPath must be system-local and vault-local absolute paths, respectively. The value passed for Mask may contain wildcard characters.

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

CBFSSTORAGE_CFF_OVERWRITE_NONE0x00000000Never overwrite destination files.

CBFSSTORAGE_CFF_OVERWRITE_IF_NEWER0x00000001Overwrite a destination file only if the source file is newer.

CBFSSTORAGE_CFF_OVERWRITE_ALL0x00000002Always overwrite destination files.

CBFSSTORAGE_CFF_INCLUDE_SUBDIRS_WITH_CONTENTS0x00010000Include all subdirectories in source directory, and their contents, recursively.

CBFSSTORAGE_CFF_INCLUDE_SUBDIRS_NO_CONTENTS0x00020000Include all subdirectories in the source directory, without their contents.

The Encryption parameter specifies Encryption behavior for files created (or overwritten) during the copy operation. Valid values are:

CBFSSTORAGE_EM_NONE0x0Don't use encryption.

CBFSSTORAGE_EM_DEFAULT0x1Use default encryption (CBFSSTORAGE_EM_XTS_AES256_PBKDF2_HMAC_SHA256).

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

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

256-bit (32-byte) block size.

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

512-bit (64-byte) block size.

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

1024-bit (128-byte) block size.

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

256-bit (32-byte) block size.

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

512-bit (64-byte) block size.

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

1024-bit (128-byte) block size.

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

256-bit (32-byte) block size. Useful for cases where the password is an identifier for an external key and should not be used for key derivation.

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

512-bit (64-byte) block size. Useful for cases where the password is an identifier for an external key and should not be used for key derivation.

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

1024-bit (128-byte) block size. Useful for cases where the password is an identifier for an external key and should not be used for key derivation.

CBFSSTORAGE_EM_UNKNOWN0xFFUnidentified or unknown encryption.

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

The Password parameter specifies the password to use for encryption, if applicable.

The Compression parameter specifies the Compression behavior for files created (or overwritten) during the copy operation. Valid values are:

CBFSSTORAGE_CM_NONE0Don't use compression.

CBFSSTORAGE_CM_DEFAULT1Use default compression (zlib).

CBFSSTORAGE_CM_CUSTOM2Use event-based custom compression.

Compression level is not used.

CBFSSTORAGE_CM_ZLIB3Use zlib compression.

Valid compression levels are 1-9.

CBFSSTORAGE_CM_RLE4Use RLE compression.

Compression level is not used.

Applications that use custom compression must 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 RLE). Larger values allow for more efficient compression; however, since a block must be decompressed (and, for writes, recompressed) anytime its data is accessed, larger values can also cause excessive slowdown, especially for random access.

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

Error Handling (C++)

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Storage 2020 C++ Edition - Version 20.0 [Build 8031]