Constants

All constants are accessible through the cbfsstorage.Constants class.

Error Codes

VAULT_ERR_INVALID_VAULT_FILE
Value: -1
The specified file is not a CBFS Storage vault.
VAULT_ERR_INVALID_PAGE_SIZE
Value: -2
The specified page size is not valid.
VAULT_ERR_VAULT_CORRUPTED
Value: -3
The vault is corrupted.
VAULT_ERR_TOO_MANY_TRANSACTIONS
Value: -4
Too many transactions active.
VAULT_ERR_FILE_ALREADY_EXISTS
Value: -5
A file, directory, symbolic link, or alternate stream with the specified name already exists.
VAULT_ERR_TRANSACTIONS_STILL_ACTIVE
Value: -6
One or more transactions are still active.
VAULT_ERR_TAG_ALREADY_EXISTS
Value: -7
The specified file tag already exists.
VAULT_ERR_FILE_NOT_FOUND
Value: -8
The specified file, directory, symbolic link, or alternate stream was not found.
VAULT_ERR_PATH_NOT_FOUND
Value: -9
The specified path was not found.
VAULT_ERR_SHARING_VIOLATION
Value: -10
The specified file or alternate stream is already open in an exclusive access mode.
VAULT_ERR_SEEK_BEYOND_EOF
Value: -11
Cannot seek beyond the end of a file or alternate stream.
VAULT_ERR_NO_MORE_FILES
Value: -12
No other files, directories, symbolic links, or alternate streams match the search criteria.
VAULT_ERR_INVALID_FILE_NAME
Value: -13
The specified name is not valid.
VAULT_ERR_VAULT_ACTIVE
Value: -14
The requested operation cannot be performed while a vault is open.
VAULT_ERR_VAULT_NOT_ACTIVE
Value: -15
A vault must be open before the requested operation can be performed.
VAULT_ERR_INVALID_PASSWORD
Value: -16
The specified password is incorrect.
VAULT_ERR_VAULT_READ_ONLY
Value: -17
The requested operation cannot be performed; the vault is open in read-only mode.
VAULT_ERR_NO_ENCRYPTION_HANDLERS
Value: -18
Cannot use custom encryption; no custom encryption event handlers provided.
VAULT_ERR_OUT_OF_MEMORY
Value: -19
Out of memory.
VAULT_ERR_SYMLINK_DESTINATION_NOT_FOUND
Value: -20
A symbolic link's destination file could not be found.
Value: -21
The specified file is not a symbolic link.
VAULT_ERR_BUFFER_TOO_SMALL
Value: -22
The specified buffer is too small to hold the requested value.
VAULT_ERR_BAD_COMPRESSED_DATA
Value: -23
Decompression failed (possibly due to corruption).
VAULT_ERR_INVALID_PARAMETER
Value: -24
Invalid parameter.
VAULT_ERR_VAULT_FULL
Value: -25
The vault is full (and cannot be automatically resized).
VAULT_ERR_INTERRUPTED_BY_USER
Value: -26
Operation interrupted by user.
VAULT_ERR_TAG_NOT_FOUND
Value: -27
The specified file tag was not found.
VAULT_ERR_DIRECTORY_NOT_EMPTY
Value: -28
The specified directory is not empty.
VAULT_ERR_HANDLE_CLOSED
Value: -29
The file or alternate stream was closed unexpectedly; the handle is no longer valid.
VAULT_ERR_INVALID_STREAM_HANDLE
Value: -30
Invalid file or alternate stream handle.
VAULT_ERR_FILE_ACCESS_DENIED
Value: -31
Access denied.
VAULT_ERR_NO_COMPRESSION_HANDLERS
Value: -32
Cannot use custom compression; no custom compression event handlers provided.
VAULT_ERR_NOT_IMPLEMENTED
Value: -33
Not implemented in this version of CBFS Storage.
VAULT_ERR_DRIVER_NOT_INSTALLED
Value: -35
The CBFS Storage system driver has not been installed.
VAULT_ERR_NEW_VAULT_VERSION
Value: -37
The specified vault cannot be opened, it was created using a newer version of CBFS Storage.
VAULT_ERR_FILE_IS_NOT_DIRECTORY
Value: -38
The specified file is not a directory.
VAULT_ERR_INVALID_TAG_DATA_TYPE
Value: -39
The specified file tag data type is not valid.
VAULT_ERR_VAULT_FILE_DOES_NOT_EXIST
Value: -40
The specified vault storage file does not exist.
VAULT_ERR_VAULT_FILE_ALREADY_EXISTS
Value: -41
The specified vault storage file already exists.
VAULT_ERR_CALLBACK_MODE_FAILURE
Value: -42
Some callback mode event handler has returned an unidentified error.
VAULT_ERR_EXTERNAL_ERROR
Value: -43
External library could not be initialized or used.

File Attributes

VAULT_FATTR_FILE
Value: 0x00000001
The entry is a file.
VAULT_FATTR_DIRECTORY
Value: 0x00000002
The entry is a directory.
VAULT_FATTR_DATA_STREAM
Value: 0x00000004
The entry is an alternate data stream.
VAULT_FATTR_COMPRESSED
Value: 0x00000008
The file or stream is compressed.
VAULT_FATTR_ENCRYPTED
Value: 0x00000010
The file or stream is encrypted.
Value: 0x00000020
The entry is a symbolic link.
VAULT_FATTR_READONLY
Value: 0x00000040
The file is read-only. This attribute is not used by CBFS Storage, but it can be set and retrieved.
VAULT_FATTR_ARCHIVE
Value: 0x00000080
The file requires archiving. This attribute is not used by CBFS Storage, but it can be set and retrieved.
VAULT_FATTR_HIDDEN
Value: 0x00000100
The file is hidden. This attribute is not used by CBFS Storage, but it can be set and retrieved.
VAULT_FATTR_SYSTEM
Value: 0x00000200
The file is a system file. This attribute is not used by CBFS Storage, but it can be set and retrieved.
VAULT_FATTR_TEMPORARY
Value: 0x00000400
The file is temporary. This attribute is not used by CBFS Storage, but it can be set and retrieved.
VAULT_FATTR_DELETE_ON_CLOSE
Value: 0x00000800
The 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_0
Value: 0x00001000
Reserved.
VAULT_FATTR_RESERVED_1
Value: 0x00002000
Reserved.
VAULT_FATTR_RESERVED_2
Value: 0x00004000
Reserved.
VAULT_FATTR_RESERVED_3
Value: 0x00008000
Reserved.
VAULT_FATTR_NO_USER_CHANGE
Value: 0x0000F03F
A 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_DEFINED
Value: 0x7FF00000
A 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_FILE
Value: 0x7FFFFFFF
A mask that includes any and all attributes.

Check and Repair Flags

VAULT_CR_CHECK_ONLY
Value: 0x00000001
Check only, do not attempt any repairs.
VAULT_CR_CHECK_ALL_PAGES
Value: 0x00000002
Check all vault pages, including empty ones. When this flag is not present, only the vault pages that are marked as occupied are checked.

Format Flags

VAULT_FMF_FAST_FORMAT
Value: 0x00000001
Perform 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.

Vault Journaling Modes

VAULT_JM_NONE
Value: 0
No journaling is used. This mode ensures the fastest operations, but if the application crashes, corruption of the vault is possible.
VAULT_JM_METADATA
Value: 1
Journaling is used only for metadata (filesystem structure and directory contents). This mode is a balance between speed and reliability.
VAULT_JM_FULL
Value: 2
Journaling is used for both filesystem structure and file data and metadata. This mode is the slowest but the most reliable option.

Search Flags

VAULT_FF_NEED_NAME
Value: 0x00000001
Include entry names (without paths) when returning search results.
VAULT_FF_NEED_FULL_NAME
Value: 0x00000002
Include fully qualified entry names when returning search results.
VAULT_FF_NEED_ATTRIBUTES
Value: 0x00000004
Include entry attributes when returning search results.
VAULT_FF_NEED_SIZE
Value: 0x00000008
Include entry sizes when returning search results.
VAULT_FF_NEED_METADATA_SIZE
Value: 0x00000010
Include entry metadata sizes when returning search results.
VAULT_FF_NEED_TIMES
Value: 0x00000020
Include entry times when returning search results.
VAULT_FF_NEED_LINK_DEST
Value: 0x00000040
Include symbolic link destinations when returning search results.
VAULT_FF_EMULATE_FAT
Value: 0x00001000
Inserts . and .. pseudo-entries into search results for all directories except the root one.
VAULT_FF_RECURSIVE
Value: 0x00002000
Search recursively in all subdirectories.
VAULT_FF_CASE_INSENSITIVE
Value: 0x00004000
Forces case-insensitive search, even if the vault is case-sensitive.

Vault Open Modes

VAULT_OM_CREATE_NEW
Value: 0
Creates a new vault if possible, failing if one already exists.
VAULT_OM_CREATE_ALWAYS
Value: 1
Creates a new vault, overwriting an existing one if necessary.
VAULT_OM_OPEN_EXISTING
Value: 2
Opens a vault if it exists; fails otherwise.
VAULT_OM_OPEN_ALWAYS
Value: 3
Opens a vault if it exists; creates a new one otherwise.

Vault State Flags

VAULT_ST_FIXED_SIZE
Value: 0x00000001
The vault is a fixed size.
VAULT_ST_READ_ONLY
Value: 0x00000002
The vault was opened in read-only mode. Please refer to the ReadOnly property for more information.
VAULT_ST_CORRUPTED
Value: 0x00000004
The 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_USED
Value: 0x00000008
The vault was opened in journaling mode. Please refer to the UseJournaling property for more information.
VAULT_ST_ACCESS_TIME_USED
Value: 0x00000010
Last access times are being tracked. Please refer to the UseAccessTime property for more information.
VAULT_ST_ENCRYPTED
Value: 0x00000020
The vault is encrypted with whole-vault encryption. Please refer to the Encryption topic for more information.
VAULT_ST_VALID_PASSWORD_SET
Value: 0x00000040
The correct whole-vault encryption password has been provided. Please refer to the Encryption topic for more information.
VAULT_ST_PHYSICAL_VOLUME
Value: 0x00000080
The vault is backed by a storage volume or partition formatted with the CBFS Storage filesystem. This flag only applies when using the CBVaultDrive class.
VAULT_ST_PARTED
Value: 0x00000100
The vault's contents are split across multiple files on disk. Please refer to the Multipart Vaults topic for more information.

Tag Data Types

VAULT_TDT_RAWDATA
Value: 0x0
The tag is untyped and must be addressed by Id.
VAULT_TDT_BOOLEAN
Value: 0x1
The tag contains Boolean data and must be addressed by name.
VAULT_TDT_STRING
Value: 0x2
The tag contains String (UTF-16LE) data and must be addressed by name.
VAULT_TDT_DATETIME
Value: 0x3
The tag contains DateTime data and must be addressed by name.
VAULT_TDT_NUMBER
Value: 0x4
The tag contains numeric (signed 64-bit) data and must be addressed by name.
VAULT_TDT_ANSISTRING
Value: 0x5
The tag contains AnsiString (8-bit string) data and must be addressed by name.

Path Separator Characters

VAULT_PSC_BACKSLASH
Value: 92
Backslash ('\\'). This character is the Windows path separator.
VAULT_PSC_SLASH
Value: 47
Forward slash ('/'). This character is the Unix-style path separator.

Compression Modes

VAULT_CM_NONE
Value: 0
Do not use compression.
VAULT_CM_DEFAULT
Value: 1
Use default compression (zlib).
VAULT_CM_CUSTOM
Value: 2
Use event-based custom compression. This compression level is not used.
VAULT_CM_ZLIB
Value: 3
Use zlib compression. Valid compression levels are 1-9.
VAULT_CM_RLE
Value: 4
Use RLE compression. This compression level is not used.

Encryption Modes

VAULT_EM_NONE
Value: 0x0
Do not use encryption.
VAULT_EM_DEFAULT
Value: 0x1
Use default encryption (VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA256).
VAULT_EM_XTS_AES256_PBKDF2_HMAC_SHA256
Value: 0x2
Use AES256 encryption with PBKDF2 key derivation based on a HMAC_SHA256 key hash.
VAULT_EM_CUSTOM256_PBKDF2_HMAC_SHA256
Value: 0x3
Use 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_SHA256
Value: 0x4
Use 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_SHA256
Value: 0x5
Use 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_DERIVE
Value: 0x23
Use 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_DERIVE
Value: 0x24
Use 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_DERIVE
Value: 0x25
Use 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_KEY
Value: 0x43
Use 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_KEY
Value: 0x44
Use 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_KEY
Value: 0x45
Use 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_UNKNOWN
Value: 0xFF
Unidentified or unknown encryption.

File Open Modes

VAULT_FOM_CREATE_NEW
Value: 0
Creates a new file or alternate stream if possible, failing if one already exists.
VAULT_FOM_CREATE_ALWAYS
Value: 1
Creates a new file or stream, overwriting an existing one if necessary.
VAULT_FOM_OPEN_EXISTING
Value: 2
Opens a file or stream if it exists; fails otherwise.
VAULT_FOM_OPEN_ALWAYS
Value: 3
Opens a file or stream if it exists; creates a new one otherwise.

Progress Operations

VAULT_PO_FORMATTING
Value: 0
Formatting a vault.
VAULT_PO_CHECKING_1
Value: 1
Checking a vault (stage 1).
VAULT_PO_CHECKING_2
Value: 2
Checking a vault (stage 2).
VAULT_PO_CHECKING_3
Value: 3
Checking a vault (stage 3).
VAULT_PO_CHECKING_4
Value: 4
Checking a vault (stage 4).
VAULT_PO_CHECKING_5
Value: 5
Checking a vault (stage 5).
VAULT_PO_PAGE_CORRUPTED
Value: 8
Processing a corrupted vault page.
VAULT_PO_PAGE_ORPHANED
Value: 9
Processing an orphaned vault page.
VAULT_PO_COMPRESSING
Value: 10
Compressing a file or alternate stream.
VAULT_PO_DECOMPRESSING
Value: 11
Decompressing a file or alternate stream.
VAULT_PO_ENCRYPTING
Value: 12
Encrypting a vault, file, or alternate stream.
VAULT_PO_DECRYPTING
Value: 13
Decrypting a vault, file, or alternate stream
VAULT_PO_COMPACTING
Value: 14
Compacting a vault.
VAULT_PO_RESIZING
Value: 15
Resizing a vault.
VAULT_PO_CALCULATING_SIZE
Value: 16
Calculating a vault's size.
VAULT_PO_COPYING_FILES_TO_VAULT
Value: 17
Copying files to a vault.
VAULT_PO_COPYING_FILES_FROM_VAULT
Value: 18
Copying files from a vault.

Copy Flags

VAULT_CFF_OVERWRITE_NONE
Value: 0x00000000
Never overwrite destination files.
VAULT_CFF_OVERWRITE_IF_NEWER
Value: 0x00000001
Overwrite a destination file only if the source file is newer.
VAULT_CFF_OVERWRITE_ALL
Value: 0x00000002
Always overwrite destination files.
VAULT_CFF_INCLUDE_SUBDIRS_WITH_CONTENTS
Value: 0x00010000
Include all subdirectories in source directory, and their contents, recursively.
VAULT_CFF_INCLUDE_SUBDIRS_NO_CONTENTS
Value: 0x00020000
Include all subdirectories in the source directory, without their contents.
VAULT_CFF_COPY_DIRS_STRUCTURE
Value: 0x00040000
Include all subdirectories in the source directory, without their contents. Only the directory structure is copied, recursively.
VAULT_CFF_COPY_STRUCTURE
Value: 0x00080000
Include all subdirectories in source directory, and their contents, recursively, but without file content. For files, empty placeholders are created without any original file data.
VAULT_CFF_FIRE_COPY_EVENTS
Value: 0x40000000
Fire events related to file copying. When the flag is set, the class fires the FileBeforeCopy and FileAfterCopy events.

Module Flags

MODULE_DRIVER_PNP_BUS
Value: 0x00000001
PnP Bus Driver (.sys file). This module must be installed if the application wishes to make use of Plug-and-Play (PnP) storage features class 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_BLOCK
Value: 0x00000002
Virtual disk driver (.sys file). The product's virtual disk driver module, which provides core functionality; it must be installed for the class to function correctly.
MODULE_DRIVER_FS
Value: 0x00000004
Filesystem driver (.sys file). The product's filesystem driver module, which provides core functionality; it must be installed for the class to function correctly.
MODULE_HELPER_DLL
Value: 0x00010000
Shell Helper DLL (CBVaultDriveShellHelper2024.dll) This module provides supplementary functionality for the class; please refer to the Helper DLL topic for more information.

Note: Not applicable when calling the GetDriverStatus method.

Desired Access Flags

STG_DACCESS_READ
Value: 0x00000001
Grant/deny read access.
STG_DACCESS_WRITE
Value: 0x00000002
Grant/deny write access.
STG_DACCESS_READWRITE
Value: 0x00000003
Grant/deny read and write access.

Install Flags

INSTALL_REMOVE_OLD_VERSIONS
Value: 0x00000001
Uninstall drivers and helper DLLs from previous class versions (e.g., 2017). Note: This functionality is only available in Windows. This flag does not remove the old PnP driver (VPnpBus) from the system because that driver is not versioned. Use the installer DLL of the old version and its Uninstall() function if you need to uninstall the PnP driver.
INSTALL_KEEP_START_TYPE
Value: 0x00000002
Keep 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.

Note: This functionality is only available in Windows.

INSTALL_OVERWRITE_SAME_VERSION
Value: 0x00000004
Install 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.

Note: This functionality is only available in Windows.

Uninstall Version Flags

UNINSTALL_VERSION_PREVIOUS
Value: 0x00000001
Uninstall modules from previous product versions.

Note: This functionality is only available in Windows.

UNINSTALL_VERSION_CURRENT
Value: 0x00000002
Uninstall modules from the current product version.

Note: This functionality is only available in Windows.

UNINSTALL_VERSION_ALL
Value: 0x00000003
Uninstall modules from all product versions.

Note: This functionality is only available in Windows.

Module Status Flags

MODULE_STATUS_NOT_PRESENT
Value: 0x00000000
The specified module is not present on the system.

Note: This functionality is only available in Windows.

MODULE_STATUS_STOPPED
Value: 0x00000001
The specified module is in the Stopped state.

Note: This functionality is only available in Windows.

MODULE_STATUS_RUNNING
Value: 0x00000004
The specified module is loaded and running.

Note: This functionality is only available in Windows.

Mounting Point Flags in Windows

STGMP_SIMPLE
Value: 0x00010000
Create 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_MANAGER
Value: 0x00020000
Create 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_NETWORK
Value: 0x00040000
Create 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 File Explorer will not correctly recognize the "network" drive.

This flag cannot be combined with STGMP_SIMPLE or STGMP_MOUNT_MANAGER.

STGMP_LOCAL
Value: 0x10000000
Specifies 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_DRIVE
Value: 0x00000001
Indicates that users may assign a drive letter to the share (e.g., using the 'Map network drive...' context menu item in Windows File Explorer).
STGMP_NETWORK_HIDDEN_SHARE
Value: 0x00000002
Indicates 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_ACCESS
Value: 0x00000004
Makes 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 class 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."
STGMP_NETWORK_WRITE_ACCESS
Value: 0x00000008
Makes 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 class 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."
STGMP_NETWORK_CLAIM_SERVER_NAME
Value: 0x00000010
Specifies 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.
STGMP_DRIVE_LETTER_NOTIFY_ASYNC
Value: 0x20000000
Causes the method to return immediately without waiting for mounting notifications to be sent to the system.
STGMP_AUTOCREATE_DRIVE_LETTER
Value: 0x40000000
Tells the class that it should assign the drive letter automatically. When this flag is specified, the class 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.

Mounting Point Flags in Linux and macOS

STGMP_LOCAL_FUSE
Value: 0x10000000
Creates a mounting point, accessible only for current user. If this flag is not passed, the "-oallow_other" option of FUSE is used.
STGMP_SYMLINK_DEBUG
Value: 0x40000000
Prints debug messages to stderr The messages generated by the class are printed.
STGMP_SYMLINK_SYSTEM_DEBUG
Value: 0x20000000
Prints debug messages generated by the FUSE library to stderr
STGMP_NETWORK_MACOS
Value: 0x00040000
Create a network mounting point (macOS only). If this flag is not passed, the "-olocal" option of macFUSE is used.

Storage Type Values

STGT_DISK
Value: 0x00000000
Create a regular disk device.
STGT_CDROM
Value: 0x00000001
Create a CD-ROM or DVD device.
STGT_DISK_PNP
Value: 0x00000003
Create a plug-and-play storage device. Important: The PNP Bus system driver must be installed in PnP mode for this option to function properly; this is done by specifying the corresponding constant in a call to the Install method.

Storage Characteristics Flags

STGC_FLOPPY_DISKETTE
Value: 0x00000001
The storage is a floppy disk device. This flag is not supported when StorageType is set to STGT_DISK_PNP.
STGC_READONLY_DEVICE
Value: 0x00000002
The storage is a read-only device.
STGC_WRITE_ONCE_MEDIA
Value: 0x00000008
The 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_MEDIA
Value: 0x00000010
The 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_LETTER
Value: 0x00002000
The 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_TRAY
Value: 0x00004000
The 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_EJECTION
Value: 0x00008000
The 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_1
Value: 0x00010000
Reserved, do not use.
STGC_RESERVED_2
Value: 0x00020000
Reserved, do not use.

Share Modes

FILE_SYS_SHARE_READ
Value: 0x00000001
Enables 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_WRITE
Value: 0x00000002
Enables 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_DELETE
Value: 0x00000004
Enables 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.