using System; using System.Runtime.InteropServices; using Vanara.Collections; using Vanara.InteropServices; using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; namespace Vanara.PInvoke.VssApi { /// /// /// The VSS_APPLICATION_LEVEL enumeration indicates the application level, the point in the course of the creation of a shadow /// copy that a writer is notified of a freeze. /// /// /// VSS first sends a Freeze event to writers initialized with VSS_APP_FRONT_END (called front-end level applications), then to /// writers initialized with VSS_APP_BACK_END (called back-end level applications), and finally to writers initialized with /// VSS_APP_SYSTEM (called system-level applications). /// /// /// /// /// VSS_APPLICATION_LEVEL is provided to allow application developers to control at what point a writer will receive a Freeze /// event. This may be important if one writer uses or depends on another writer. /// /// /// For instance, if an application X is storing data using application Y as an intermediate layer (for example, if Y implements a /// database used by X), we would describe X as a front-end application, and Y as a back-end application. /// /// /// In this example, when freezing applications that participate in a shadow copy, you would want X (the front-end application) to /// suspend its writes to the database prior to freezing Y (the back-end application), the database service itself. /// /// The application level of a writer is set by CVssWriter::Initialize and retrieved by CVssWriter::GetCurrentLevel. /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_application_level typedef enum _VSS_APPLICATION_LEVEL { // VSS_APP_UNKNOWN, VSS_APP_SYSTEM, VSS_APP_BACK_END, VSS_APP_FRONT_END, VSS_APP_SYSTEM_RM, VSS_APP_AUTO } VSS_APPLICATION_LEVEL, *PVSS_APPLICATION_LEVEL; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_APPLICATION_LEVEL")] public enum VSS_APPLICATION_LEVEL { /// /// The level at which this writer's freeze state will occur is not known. This indicates an application /// error. /// VSS_APP_UNKNOWN, /// This writer freeze state will occur at the system application level. VSS_APP_SYSTEM, /// This writer freeze state will occur at the back-end application level. VSS_APP_BACK_END, /// This writer freeze state will occur at the front-end application level. VSS_APP_FRONT_END, /// VSS_APP_SYSTEM_RM, /// /// This writer freeze state will be determined automatically. This enumeration value is reserved for future /// use. /// VSS_APP_AUTO = -1, } /// /// The VSS_BACKUP_SCHEMA enumeration is used by a writer to indicate the types of backup operations it can participate in. The /// supported kinds of backup are expressed as a bit mask (or bitwise OR) of VSS_BACKUP_SCHEMA values. /// /// /// Writer set their backup schemas with calls to IVssCreateWriterMetadata::SetBackupSchema. /// Requesters use IVssExamineWriterMetadata::GetBackupSchema to determine the backup schema that a writer supports. /// /// For a specific kind of backup operation to be supported, the writer must support the corresponding schema, and the requester must /// set the corresponding backup type. /// /// /// For example, to involve a writer in an incremental backup operation, the requester must set the backup type to /// VSS_BT_INCREMENTAL, and the writer should have a backup schema that includes VSS_BS_INCREMENTAL. /// /// /// A writer that does not support the backup schema corresponding to a requester's backup type should treat the backup operation that /// is being performed as if it were a default (full) backup. If the desired backup type is not supported by the writer's backup schema, /// the requester can either perform a full backup for this writer or exclude the writer from the backup operation. A requester can /// exclude a writer by selecting none of the writer's components (see Working with Selectability and Logical Paths), or by disabling /// the writer (see IVssBackupComponents::DisableWriterClasses or IVssBackupComponents::DisableWriterInstances). /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_backup_schema typedef enum _VSS_BACKUP_SCHEMA { VSS_BS_UNDEFINED, // VSS_BS_DIFFERENTIAL, VSS_BS_INCREMENTAL, VSS_BS_EXCLUSIVE_INCREMENTAL_DIFFERENTIAL, VSS_BS_LOG, VSS_BS_COPY, VSS_BS_TIMESTAMPED, // VSS_BS_LAST_MODIFY, VSS_BS_LSN, VSS_BS_WRITER_SUPPORTS_NEW_TARGET, VSS_BS_WRITER_SUPPORTS_RESTORE_WITH_MOVE, // VSS_BS_INDEPENDENT_SYSTEM_STATE, VSS_BS_ROLLFORWARD_RESTORE, VSS_BS_RESTORE_RENAME, VSS_BS_AUTHORITATIVE_RESTORE, // VSS_BS_WRITER_SUPPORTS_PARALLEL_RESTORES } VSS_BACKUP_SCHEMA, *PVSS_BACKUP_SCHEMA; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_BACKUP_SCHEMA")] [Flags] public enum VSS_BACKUP_SCHEMA { /// /// The writer supports a simple full backup and restoration of entire files (as defined by a /// VSS_BACKUP_TYPE /// value of /// VSS_BT_FULL /// ). This backup scheme can be used as the basis of an incremental or /// differential backup. This is the default value. /// VSS_BS_UNDEFINED = 0, /// /// The writer supports differential backups (corresponding to the /// VSS_BACKUP_TYPE /// value /// VSS_BT_DIFFERENTIAL /// ). Files created or changed since the last full backup are saved. /// Files are not marked as having been backed up. /// This setting does not preclude mixing of incremental and differential backups. /// This value is not supported for express writers. /// VSS_BS_DIFFERENTIAL = 0x0001, /// /// The writer supports incremental backups (corresponding to the /// VSS_BACKUP_TYPE /// value /// VSS_BT_INCREMENTAL /// ). Files created or changed since the last full or incremental /// backup are saved. Files are marked as having been backed up. /// This setting does not preclude mixing of incremental and differential backups. /// This value is not supported for express writers. /// VSS_BS_INCREMENTAL = 0x0002, /// /// The writer supports both differential and incremental backup schemas, but only exclusively: for example, /// you cannot follow a differential backup with an incremental one. A writer cannot support this schema if it does /// not support both incremental and differential schemas ( /// VSS_BS_DIFFERENTIAL /// VSS_BS_EXCLUSIVE_INCREMENTAL_DIFFERENTIAL = 0x0004, /// /// The writer supports backups that involve only the log files it manages (corresponding to a /// VSS_BACKUP_TYPE /// value of /// VSS_BT_LOG /// ). This schema requires a writer to have added at least one file to at /// least one component using the /// IVssCreateWriterMetadata::AddDataBaseLogFiles /// method. Requesters retrieve log file information using the /// IVssWMComponent::GetDatabaseLogFile /// method. /// VSS_BS_LOG = 0x0008, /// /// Similar to the default backup schema ( /// VSS_BT_UNDEFINED /// ), the writer supports /// copy backup operations (corresponding to /// VSS_BT_COPY /// ) where file access information /// (such as information as to when a file was last backed up) will not be updated either in the writer's own state /// information or in the file system information. This type of backup cannot be used as the basis of an incremental /// or differential backup. /// VSS_BS_COPY = 0x0010, /// /// A writer supports using the VSS time-stamp mechanism when evaluating if a file should be included in /// differential or incremental operations (corresponding to /// VSS_BT_DIFFERENTIAL /// and /// VSS_BT_INCREMENTAL /// , respectively) using the /// IVssComponent::GetBackupStamp /// , /// IVssComponent::GetPreviousBackupStamp /// , /// IVssComponent::SetBackupStamp /// , and /// IVssBackupComponents::SetPreviousBackupStamp /// methods. /// A writer cannot support this schema if it does not support either differential or incremental backup schemas /// ( /// VSS_BS_DIFFERENTIAL /// or /// VSS_BS_INCREMENTAL /// ). /// This value is not supported for express writers. /// VSS_BS_TIMESTAMPED = 0x0020, /// /// When implementing incremental or differential backups with differenced files, a writer can provide last /// modification time information for files (using /// IVssComponent::AddDifferencedFilesByLastModifyTime /// ). /// A requester then can use /// IVssComponent::GetDifferencedFile /// to /// obtain candidate files and information about their last modification data. The requester can use this /// information (along with any records about previous backup operations it maintains) to decide if a file should be /// included in incremental and differential backups. /// This scheme does not apply to partial file implementations of incremental and differential backup /// operations. /// A writer cannot support this schema if it does not support either incremental or differential backup schemas /// ( /// VSS_BS_DIFFERENTIAL /// or /// VSS_BS_INCREMENTAL /// ). /// This value is not supported for express writers. /// VSS_BS_LAST_MODIFY = 0x0040, /// Reserved for system use. VSS_BS_LSN = 0x0080, /// /// The writer supports a requester changing the target for file restoration using /// IVssBackupComponents::AddNewTarget /// . /// (See /// Non-Default Backup And Restore Locations /// for more information.) /// This value is not supported for express writers. /// VSS_BS_WRITER_SUPPORTS_NEW_TARGET = 0x0100, /// /// /// The writer supports running multiple writer instances with the same class ID, and it supports a requester moving a component to /// a different writer instance at restore time using /// /// IVssBackupComponentsEx::SetSelectedForRestoreEx /// . /// This value is not supported for express writers. /// Windows Server 2003: /// This value is not supported until Windows Server 2003 with SP1. /// VSS_BS_WRITER_SUPPORTS_RESTORE_WITH_MOVE = 0x0200, /// /// /// The writer supports backing up data that is part of the system state, but that can also be backed up independently of the system state. /// /// Windows Server 2003: /// This value is not supported until Windows Vista. /// VSS_BS_INDEPENDENT_SYSTEM_STATE = 0x0400, /// /// The writer supports a requester setting a roll-forward restore point using /// IVssBackupComponentsEx2::SetRollForward /// . /// This value is not supported for express writers. /// Windows Server 2003: /// This value is not supported until Windows Vista. /// VSS_BS_ROLLFORWARD_RESTORE = 0x1000, /// /// The writer supports a requester setting a restore name using /// IVssBackupComponentsEx2::SetRestoreName /// . /// This value is not supported for express writers. /// Windows Server 2003: /// This value is not supported until Windows Vista. /// VSS_BS_RESTORE_RENAME = 0x2000, /// /// The writer supports a requester setting authoritative restore using /// IVssBackupComponentsEx2::SetAuthoritativeRestore /// . /// This value is not supported for express writers. /// Windows Server 2003: /// This value is not supported until Windows Vista. /// VSS_BS_AUTHORITATIVE_RESTORE = 0x4000, /// /// The writer supports multiple unsynchronized restore events. /// This value is not supported for express writers. /// Windows Vista and Windows Server 2003: /// This value is not supported until Windows Server 2008. /// VSS_BS_WRITER_SUPPORTS_PARALLEL_RESTORES = 0x8000, } /// The VSS_BACKUP_TYPE enumeration indicates the type of backup to be performed using VSS writer/requester coordination. /// /// An implementation of a backup type defined by a VSS_BACKUP_TYPE value must be done using the VSS API. /// /// This is particularly true in the case of incremental ( VSS_BT_INCREMENTAL) and differential ( VSS_BT_DIFFERENTIAL) /// backups. In these cases, requesters and writers work together using the file backup specification masks (VSS_FILE_SPEC_BACKUP_TYPE), /// and designations of files as being part of partial and differenced file operations to select which files must be backed up. /// /// /// A requester may also use other more traditional techniques to implement an incremental or differential restore, but it must not /// override the information provided through the VSS interfaces. /// /// /// If a requester, when processing a given backup type, encounters a writer that does not support that backup type, the requester /// performs backup or restore operations for that particular writer's data as if the backup type was VSS_BT_FULL. /// /// Requesters set the backup type with a call to IVssBackupComponents::SetBackupState. /// Writers use CVssWriter::GetBackupType to determine the backup type. /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_backup_type typedef enum _VSS_BACKUP_TYPE { VSS_BT_UNDEFINED, // VSS_BT_FULL, VSS_BT_INCREMENTAL, VSS_BT_DIFFERENTIAL, VSS_BT_LOG, VSS_BT_COPY, VSS_BT_OTHER } VSS_BACKUP_TYPE, *PVSS_BACKUP_TYPE; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_BACKUP_TYPE")] public enum VSS_BACKUP_TYPE { /// /// The backup type is not known. /// This value indicates an application error. /// VSS_BT_UNDEFINED = 0, /// /// Full backup: all files, regardless of whether they have been marked as backed up or not, are saved. This is /// the default backup type and schema, and all writers support it. /// Each file's backup history will be updated to reflect that it was backed up. /// VSS_BT_FULL, /// /// Incremental backup: files created or changed since the last full or incremental backup are saved. Files are /// marked as having been backed up. /// A requester can implement this sort of backup on a particular writer only if it supports the /// VSS_BS_INCREMENTAL /// schema. /// If a requester's backup type is /// VSS_BT_INCREMENTAL /// and a particular writer's /// backup schema does not support that sort of backup, the requester will always perform a full /// ( /// VSS_BT_FULL /// ) backup on that writer's data. /// VSS_BT_INCREMENTAL, /// /// Differential backup: files created or changed since the last full backup are saved. Files are not marked as /// having been backed up. /// A requester can implement this sort of backup on a particular writer only if it supports the /// VSS_BS_DIFFERENTIAL /// schema. /// If a requester's backup type is /// VSS_BT_DIFFERENTIAL /// and a particular writer's /// backup schema does not support that sort of backup, the requester will always perform a full /// ( /// VSS_BT_FULL /// ) backup on that writer's data. /// VSS_BT_DIFFERENTIAL, /// /// The log file of a writer is to participate in backup or restore operations. /// A requester can implement this sort of backup on a particular writer only if it supports the /// VSS_BS_LOG /// schema. /// If a requester's backup type is /// VSS_BT_LOG /// and a particular writer's backup /// schema does not support that sort of backup, the requester will always perform a full /// ( /// VSS_BT_FULL /// ) backup on that writer's data. /// VSS_BT_LOG, /// /// Files on disk will be copied to a backup medium regardless of the state of each file's backup history, and /// the backup history will not be updated. /// A requester can implement this sort of backup on a particular writer only if it supports the /// VSS_BS_COPY /// schema. /// If a requester's backup type is /// VSS_BT_COPY /// and a particular writer's backup /// schema does not support that sort of backup, the requester will always perform a full /// ( /// VSS_BT_FULL /// ) backup on that writer's data. /// VSS_BT_COPY, /// Backup type that is not full, copy, log, incremental, or differential. VSS_BT_OTHER, } /// /// /// The VSS_FILE_SPEC_BACKUP_TYPE enumeration is used by writers to indicate their support of certain backup operations—such as /// incremental or differential backup—on the basis of file sets (a specified file or files). /// /// /// File sets stored in the Writer Metadata Document are tagged with a bit mask (or bitwise OR) of VSS_FILE_SPEC_BACKUP_TYPE /// values indicating the following: /// /// /// /// Whether the writer and the requester have to evaluate a given file set for participation in the specified type of backup operations /// /// /// Whether backing up the specified file will require a shadow copy /// /// /// /// /// /// When a writer sets a backup-required value of the VSS_FILE_SPEC_BACKUP_TYPE enumeration, it is indicating that the requester /// perform the backup in such a way that, when the backup is restored, the current version of the file set is restored. Typically, this /// means that the file set is copied as part of the backup. /// /// /// This setting can be overridden if a file is added to the Backup Components Document as a differenced file (using /// IVssComponent::AddDifferencedFilesByLastModifyTime) or as a partial file (using IVssComponent::AddPartialFile). /// /// /// If a file is added as a differenced file, the writer establishes criteria by which the requester should decide whether or not to /// actually copy a file to a backup medium. A writer typically adds differenced files to the Backup Components Document for inclusion /// in a backup PostSnapshot event (see CVssWriter::OnPostSnapshot). See Incremental and Differential Backups for details. /// /// /// When a writer sets a shadow copy-required value of the VSS_FILE_SPEC_BACKUP_TYPE enumeration, it indicates that the file set /// should be backed up from a shadow-copied volume. File sets not tagged with a shadow copy-required value can be backed up from the /// original volume. /// /// Writers set VSS_FILE_SPEC_BACKUP_TYPE values while handling an Identify event (see CVssWriter::OnIdentify). /// /// A bit mask (or bitwise OR) of VSS_FILE_SPEC_BACKUP_TYPE values can be applied to a file set when adding it to a component /// using the IVssCreateWriterMetadata::AddFilesToFileGroup, IVssCreateWriterMetadata::AddDatabaseFiles, or /// IVssCreateWriterMetadata::AddDatabaseLogFiles method. /// /// /// If no explicit file specification backup type is supplied during the addition of a file specification to a component, the /// specification is tagged with the default VSS_FILE_SPEC_BACKUP_TYPE value: (VSS_FSBT_ALL_BACKUP_REQUIRED | VSS_FSBT_ALL_SNAPSHOT_REQUIRED). /// /// /// Requesters or writers can recover a file set's file specification backup type by using the IVssWMFiledesc::GetBackupTypeMask method. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_file_spec_backup_type typedef enum _VSS_FILE_SPEC_BACKUP_TYPE { // VSS_FSBT_FULL_BACKUP_REQUIRED, VSS_FSBT_DIFFERENTIAL_BACKUP_REQUIRED, VSS_FSBT_INCREMENTAL_BACKUP_REQUIRED, // VSS_FSBT_LOG_BACKUP_REQUIRED, VSS_FSBT_FULL_SNAPSHOT_REQUIRED, VSS_FSBT_DIFFERENTIAL_SNAPSHOT_REQUIRED, // VSS_FSBT_INCREMENTAL_SNAPSHOT_REQUIRED, VSS_FSBT_LOG_SNAPSHOT_REQUIRED, VSS_FSBT_CREATED_DURING_BACKUP, VSS_FSBT_ALL_BACKUP_REQUIRED, // VSS_FSBT_ALL_SNAPSHOT_REQUIRED } VSS_FILE_SPEC_BACKUP_TYPE, *PVSS_FILE_SPEC_BACKUP_TYPE; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_FILE_SPEC_BACKUP_TYPE")] [Flags] public enum VSS_FILE_SPEC_BACKUP_TYPE { /// /// A file set tagged with this value must be involved in all types of backup operations. /// A writer tags a file set with this value to indicate to the requester that it expects a copy of the current /// version of the file set to be available following the restore of any backup operation with a /// VSS_BACKUP_TYPE /// of /// VSS_BT_FULL /// . /// VSS_FSBT_FULL_BACKUP_REQUIRED = 0x001, /// /// A writer tags a file set with this value to indicate to the requester that it expects a copy of the current /// version of the file set to be available following the restore of any backup operation with a /// VSS_BACKUP_TYPE /// of /// VSS_BT_DIFFERENTIAL /// . /// This value is not supported for express writers. /// VSS_FSBT_DIFFERENTIAL_BACKUP_REQUIRED = 0x002, /// /// A writer tags a file set with this value to indicate to the requester that it expects a copy of the current /// version of the file set to be available following the restore of any backup operation with a /// VSS_BACKUP_TYPE /// of /// VSS_BT_INCREMENTAL /// . /// This value is not supported for express writers. /// VSS_FSBT_INCREMENTAL_BACKUP_REQUIRED = 0x004, /// /// A writer tags a file set with this value to indicate to the requester that it expects a copy of the current /// version of the file set to be available following the restore of any backup operation with a /// VSS_BACKUP_TYPE /// of /// VSS_BT_LOG /// . /// This value is not supported for express writers. /// VSS_FSBT_LOG_BACKUP_REQUIRED = 0x008, /// /// A file set tagged with this value must be backed up from a shadow copy of a volume (and never from the /// original volume) when participating in a backup operation with a /// VSS_BACKUP_TYPE /// of /// VSS_BT_FULL /// . /// VSS_FSBT_FULL_SNAPSHOT_REQUIRED = 0x100, /// /// A file set tagged with this value must be backed up from a shadow copy of a volume (and never from the /// original volume) when participating in a backup operation with a /// VSS_BACKUP_TYPE /// of /// VSS_BT_DIFFERENTIAL /// . /// VSS_FSBT_DIFFERENTIAL_SNAPSHOT_REQUIRED = 0x200, /// /// A file set tagged with this value must be backed up from a shadow copy of a volume (and never from the /// original volume) when participating in a backup operation with a /// VSS_BACKUP_TYPE /// of /// VSS_BT_INCREMENTAL /// . /// VSS_FSBT_INCREMENTAL_SNAPSHOT_REQUIRED = 0x400, /// /// A file set tagged with this value must be backed up from a shadow copy of a volume (and never from the /// original volume) when participating in a backup operation with a /// VSS_BACKUP_TYPE /// of /// VSS_BT_LOG /// ). /// VSS_FSBT_LOG_SNAPSHOT_REQUIRED = 0x800, /// /// A writer tags a file set with this value to indicate to the requester that they expect the file to be created during the /// snapshot sequence. /// VSS_FSBT_CREATED_DURING_BACKUP = 0x10000, /// /// The default file backup specification type. A file set tagged with this value must always participate in /// backup and restore operations. /// VSS_FSBT_ALL_BACKUP_REQUIRED = 0xF, /// /// The shadow copy requirement for backup. A file set tagged with this value must always be backed up from a /// shadow copy of a volume (and never from the original volume) when participating in a backup operation. /// VSS_FSBT_ALL_SNAPSHOT_REQUIRED = 0xF00, } /// Defines shadow copy LUN flags. // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_hardware_options typedef enum _VSS_HARDWARE_OPTIONS { // VSS_BREAKEX_FLAG_MASK_LUNS, VSS_BREAKEX_FLAG_MAKE_READ_WRITE, VSS_BREAKEX_FLAG_REVERT_IDENTITY_ALL, // VSS_BREAKEX_FLAG_REVERT_IDENTITY_NONE, VSS_ONLUNSTATECHANGE_NOTIFY_READ_WRITE, VSS_ONLUNSTATECHANGE_NOTIFY_LUN_PRE_RECOVERY, // VSS_ONLUNSTATECHANGE_NOTIFY_LUN_POST_RECOVERY, VSS_ONLUNSTATECHANGE_DO_MASK_LUNS } VSS_HARDWARE_OPTIONS, *PVSS_HARDWARE_OPTIONS; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_HARDWARE_OPTIONS")] [Flags] public enum VSS_HARDWARE_OPTIONS { /// The shadow copy LUN will be masked from the host. VSS_BREAKEX_FLAG_MASK_LUNS = 0x001, /// The shadow copy LUN will be exposed to the host as a read-write volume. VSS_BREAKEX_FLAG_MAKE_READ_WRITE = 0x002, /// /// The disk identifiers of all of the shadow copy LUNs will be reverted to that of the original LUNs. However, if any of the /// original LUNs are present on the system, the operation will fail and none of the identifiers will be reverted. /// VSS_BREAKEX_FLAG_REVERT_IDENTITY_ALL = 0x004, /// None of the disk identifiers of the shadow copy LUNs will be reverted. VSS_BREAKEX_FLAG_REVERT_IDENTITY_NONE = 0x008, /// /// /// The shadow copy LUNs will be converted permanently to read-write. This flag is set only as a notification for the provider; no /// provider action is required. For more information, see the /// /// IVssHardwareSnapshotProviderEx::OnLunStateChange /// method. /// VSS_ONLUNSTATECHANGE_NOTIFY_READ_WRITE = 0x100, /// /// /// The shadow copy LUNs will be converted temporarily to read-write and are about to undergo TxF recovery or VSS auto-recovery. /// This flag is set only as a notification for the provider; no provider action is required. For more information, see the /// /// IVssHardwareSnapshotProviderEx::OnLunStateChange /// method. /// VSS_ONLUNSTATECHANGE_NOTIFY_LUN_PRE_RECOVERY = 0x200, /// /// /// The shadow copy LUNs have just undergone TxF recovery or VSS auto-recovery and have been converted back to read-only. This flag /// is set only as a notification for the provider; no provider action is required. For more information, see the /// /// IVssHardwareSnapshotProviderEx::OnLunStateChange /// method. /// VSS_ONLUNSTATECHANGE_NOTIFY_LUN_POST_RECOVERY = 0x400, /// /// The provider must mask shadow copy LUNs from this computer. For more information, see the /// IVssHardwareSnapshotProviderEx::OnLunStateChange /// method. /// VSS_ONLUNSTATECHANGE_DO_MASK_LUNS = 0x800, } /// /// The VSS_OBJECT_TYPE enumeration is used by requesters to identify an object as a shadow copy set, shadow copy, or provider. /// /// /// /// VSS_OBJECT_TYPE is used when calling IVssBackupComponents::Query to specify the types of objects about which to obtain /// information. An input of VSS_OBJECT_NONE will return information about all objects. /// /// /// In addition, VSS_OBJECT_TYPE is used as an input to IVssBackupComponents::DeleteSnapshots. However, DeleteSnapshots /// accepts only VSS_OBJECT_TYPE values of VSS_OBJECT_SNAPSHOT_SET or VSS_OBJECT_SNAPSHOT. /// /// The Type member of VSS_OBJECT_PROP is a member of the VSS_OBJECT_TYPE enumeration. /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_object_type typedef enum _VSS_OBJECT_TYPE { VSS_OBJECT_UNKNOWN, // VSS_OBJECT_NONE, VSS_OBJECT_SNAPSHOT_SET, VSS_OBJECT_SNAPSHOT, VSS_OBJECT_PROVIDER, VSS_OBJECT_TYPE_COUNT } VSS_OBJECT_TYPE, *PVSS_OBJECT_TYPE; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_OBJECT_TYPE")] public enum VSS_OBJECT_TYPE { /// /// The object type is not known. /// This indicates an application error. /// VSS_OBJECT_UNKNOWN = 0, /// /// The interpretation of this value depends on whether it is used as an input to a VSS method or returned as /// an output from a VSS method. /// When used as an input to a VSS method, it indicates that the method is not restricted to any particular /// object type, but should act on all appropriate objects. In this sense, /// VSS_OBJECT_NONE /// can be thought of as a wildcard input. /// When returned as an output, the object type is not known and means that there has been an application /// error. /// VSS_OBJECT_NONE, /// Shadow copy set. VSS_OBJECT_SNAPSHOT_SET, /// Shadow copy. VSS_OBJECT_SNAPSHOT, /// Shadow copy provider. VSS_OBJECT_PROVIDER, /// Reserved value. VSS_OBJECT_TYPE_COUNT, } /// /// Not supported. /// This enumeration is reserved for future use. /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_provider_capabilities typedef enum _VSS_PROVIDER_CAPABILITIES { // VSS_PRV_CAPABILITY_LEGACY, VSS_PRV_CAPABILITY_COMPLIANT, VSS_PRV_CAPABILITY_LUN_REPOINT, VSS_PRV_CAPABILITY_LUN_RESYNC, // VSS_PRV_CAPABILITY_OFFLINE_CREATION, VSS_PRV_CAPABILITY_MULTIPLE_IMPORT, VSS_PRV_CAPABILITY_RECYCLING, VSS_PRV_CAPABILITY_PLEX, // VSS_PRV_CAPABILITY_DIFFERENTIAL, VSS_PRV_CAPABILITY_CLUSTERED } VSS_PROVIDER_CAPABILITIES, *PVSS_PROVIDER_CAPABILITIES; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_PROVIDER_CAPABILITIES")] [Flags] public enum VSS_PROVIDER_CAPABILITIES : ulong { /// VSS_PRV_CAPABILITY_LEGACY = 0x001, /// VSS_PRV_CAPABILITY_COMPLIANT = 0x002, /// VSS_PRV_CAPABILITY_LUN_REPOINT = 0x004, /// VSS_PRV_CAPABILITY_LUN_RESYNC = 0x008, /// VSS_PRV_CAPABILITY_OFFLINE_CREATION = 0x010, /// VSS_PRV_CAPABILITY_MULTIPLE_IMPORT = 0x020, /// VSS_PRV_CAPABILITY_RECYCLING = 0x040, /// VSS_PRV_CAPABILITY_PLEX = 0x080, /// VSS_PRV_CAPABILITY_DIFFERENTIAL = 0x100, /// VSS_PRV_CAPABILITY_CLUSTERED = 0x200, } /// The VSS_PROVIDER_TYPE enumeration specifies the provider type. // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_provider_type typedef enum _VSS_PROVIDER_TYPE { VSS_PROV_UNKNOWN, // VSS_PROV_SYSTEM, VSS_PROV_SOFTWARE, VSS_PROV_HARDWARE, VSS_PROV_FILESHARE } VSS_PROVIDER_TYPE, *PVSS_PROVIDER_TYPE; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_PROVIDER_TYPE")] public enum VSS_PROVIDER_TYPE { /// /// The provider type is unknown. /// This indicates an error in the application or the VSS service, or that no provider is available. /// VSS_PROV_UNKNOWN = 0, /// The default provider that ships with Windows. VSS_PROV_SYSTEM, /// A software provider. VSS_PROV_SOFTWARE, /// A hardware provider. VSS_PROV_HARDWARE, /// /// A file share provider. /// Windows 7, Windows Server 2008 R2, Windows Vista, Windows Server 2008, Windows XP and Windows Server 2003: /// This enumeration value is not supported until Windows 8 and Windows Server 2012. /// VSS_PROV_FILESHARE, } /// Used by a requester to specify how a resynchronization operation is to be performed. // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_recovery_options typedef enum _VSS_RECOVERY_OPTIONS { // VSS_RECOVERY_REVERT_IDENTITY_ALL, VSS_RECOVERY_NO_VOLUME_CHECK } VSS_RECOVERY_OPTIONS, *PVSS_RECOVERY_OPTIONS; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_RECOVERY_OPTIONS")] [Flags] public enum VSS_RECOVERY_OPTIONS { /// /// After the resynchronization operation is complete, the signature of each target LUN should be identical to that of the original /// LUN that was used to create the shadow copy. /// VSS_RECOVERY_REVERT_IDENTITY_ALL = 0x100, /// Volume safety checks should not be performed. VSS_RECOVERY_NO_VOLUME_CHECK = 0x200, } /// /// The VSS_RESTORE_TYPE enumeration is used by a requester to indicate the type of restore operation it is about to perform. /// /// /// A requester can optionally set the type of a restore operation using IVssBackupComponents::SetRestoreState. /// A writer can retrieve the type of a restore operation by calling CVssWriter::GetRestoreType. /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_restore_type typedef enum _VSS_RESTORE_TYPE { VSS_RTYPE_UNDEFINED, // VSS_RTYPE_BY_COPY, VSS_RTYPE_IMPORT, VSS_RTYPE_OTHER } VSS_RESTORE_TYPE, *PVSS_RESTORE_TYPE; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_RESTORE_TYPE")] public enum VSS_RESTORE_TYPE { /// /// No restore type is defined. /// This is the default restore type. However, writers should treat this restore type as if it were VSS_RTYPE_BY_COPY. /// This indicates an error on the part of the requester. /// VSS_RTYPE_UNDEFINED = 0, /// /// A requester restores backed-up data to the original volume from a backup /// medium. /// VSS_RTYPE_BY_COPY, /// /// A requester does not copy data from a backup medium, but imports a transportable shadow copy and uses this /// imported volume for operations such as data mining. /// Windows Server 2003, Standard Edition and Windows Server 2003, Web Edition: /// This value is not supported. All editions of Windows Server 2003 with SP1 support this value. /// VSS_RTYPE_IMPORT, /// A restore type not currently enumerated. This value indicates an application error. VSS_RTYPE_OTHER, } /// /// The VSS_ROLLFORWARD_TYPE enumeration is used by a requester to indicate the type of roll-forward operation it is about to perform. /// /// /// A requester sets the roll-forward operation type and specifies the restore point for partial roll-forward operations using IVssBackupComponentsEx2::SetRollForward. /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_rollforward_type typedef enum _VSS_ROLLFORWARD_TYPE { // VSS_RF_UNDEFINED, VSS_RF_NONE, VSS_RF_ALL, VSS_RF_PARTIAL } VSS_ROLLFORWARD_TYPE, *PVSS_ROLLFORWARD_TYPE; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_ROLLFORWARD_TYPE")] public enum VSS_ROLLFORWARD_TYPE { /// /// No roll-forward type is defined. /// This indicates an error on the part of the requester. /// VSS_RF_UNDEFINED = 0, /// The roll-forward operation should not roll forward through logs. VSS_RF_NONE, /// The roll-forward operation should roll forward through all logs. VSS_RF_ALL, /// The roll-forward operation should roll forward through logs up to a specified restore point. VSS_RF_PARTIAL, } /// /// The VSS_SNAPSHOT_COMPATIBILITY enumeration indicates which volume control or file I/O operations are disabled for the volume /// that has been shadow copied. /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_snapshot_compatibility typedef enum _VSS_SNAPSHOT_COMPATIBILITY { // VSS_SC_DISABLE_DEFRAG, VSS_SC_DISABLE_CONTENTINDEX } VSS_SNAPSHOT_COMPATIBILITY; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_SNAPSHOT_COMPATIBILITY")] [Flags] public enum VSS_SNAPSHOT_COMPATIBILITY { /// /// The provider managing the shadow copies for a specified volume does not support defragmentation operations /// on that volume. /// VSS_SC_DISABLE_DEFRAG = 0x01, /// /// The provider managing the shadow copies for a specified volume does not support content index operations on /// that volume. /// VSS_SC_DISABLE_CONTENTINDEX = 0x02, } /// /// The _VSS_SNAPSHOT_CONTEXT enumeration enables a requester using IVssBackupComponents::SetContext to specify how a shadow copy /// is to be created, queried, or deleted and the degree of writer involvement. /// /// /// The data type to be used with values of _VSS_SNAPSHOT_CONTEXT is LONG. /// The default context for VSS shadow copies is VSS_CTX_BACKUP. /// /// Windows XP: The only supported context is the default, VSS_CTX_BACKUP. Calling IVssBackupComponents::SetContext will /// return E_NOTIMPL. /// /// For details on how to use VSS shadow copies contexts, see Implementation Details for Creating Shadow Copies. /// /// Shadow copy behavior can be further controlled by using a bitwise OR to combine a supported _VSS_VOLUME_SNAPSHOT_ATTRIBUTES with /// valid _VSS_SNAPSHOT_CONTEXT values as an argument to the IVssBackupComponents::SetContext method. /// /// /// Currently, the only supported modifications are the bitwise OR of a _VSS_SNAPSHOT_CONTEXT value with the /// VSS_VOLSNAP_ATTR_TRANSPORTABLE and either the VSS_VOLSNAP_ATTR_DIFFERENTIAL or the VSS_VOLSNAP_ATTR_PLEX value /// of the _VSS_VOLUME_SNAPSHOT_ATTRIBUTES enumeration. /// /// However, these values cannot be used to modify VSS_CTX_CLIENT_ACCESSIBLE context. /// /// The use of VSS_VOLSNAP_ATTR_TRANSPORTABLE is limited to systems running Windows Server 2008 Enterprise, Windows Server 2008 /// Datacenter, Windows Server 2003, Enterprise Edition, or Windows Server 2003, Datacenter Edition. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_snapshot_context typedef enum _VSS_SNAPSHOT_CONTEXT { // VSS_CTX_BACKUP, VSS_CTX_FILE_SHARE_BACKUP, VSS_CTX_NAS_ROLLBACK, VSS_CTX_APP_ROLLBACK, VSS_CTX_CLIENT_ACCESSIBLE, // VSS_CTX_CLIENT_ACCESSIBLE_WRITERS, VSS_CTX_ALL } VSS_SNAPSHOT_CONTEXT, *PVSS_SNAPSHOT_CONTEXT; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_SNAPSHOT_CONTEXT")] [Flags] public enum VSS_SNAPSHOT_CONTEXT : uint { /// /// The standard backup context. Specifies an auto-release, nonpersistent shadow copy in which writers are /// involved in the creation. /// VSS_CTX_BACKUP = 0, /// Specifies an auto-release, nonpersistent shadow copy created without writer involvement. VSS_CTX_FILE_SHARE_BACKUP = VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_NO_WRITERS, /// /// Specifies a persistent, non-auto-release shadow copy without writer involvement. This context should be /// used when there is no need for writer involvement to ensure that files are in a consistent state at the time /// of the shadow copy. /// Lightweight automated file rollback mechanisms or persistent shadow copies of file shares or data volumes /// that are not expected to contain any system-related files or databases might run under this context. For /// example, a requester could use this context for creating a shadow copy of a NAS volume hosting documents and /// simple user shares. Those types of data do not need writer involvement to create a consistent shadow copy. /// VSS_CTX_NAS_ROLLBACK = VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_PERSISTENT | VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE | VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_NO_WRITERS, /// /// Specifies a persistent, non-auto-release shadow copy with writer involvement. This context is designed /// to be used when writers are needed to ensure that files are in a well-defined state prior to shadow copy. /// Automated file rollback mechanisms of system volumes and shadow copies to be used in data mining or restore /// operations might run under this context. This context is similar to /// VSS_CTX_BACKUP /// but allows a requester more control over the persistence of the shadow copy. /// VSS_CTX_APP_ROLLBACK = VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_PERSISTENT | VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE, /// /// Specifies a read-only, /// client-accessible shadow copy /// /// that supports Shadow Copies for Shared Folders and is created without writer involvement. Only the system provider (the default /// provider available on the system) can create this type of shadow copy. /// /// Most requesters will want to use the /// VSS_CTX_NAS_ROLLBACK /// context for persistent, non-auto-release shadow copies without writer involvement. /// VSS_CTX_CLIENT_ACCESSIBLE = VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_PERSISTENT | VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE | VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE | VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_NO_WRITERS, /// /// Specifies a read-only, /// client-accessible shadow copy /// /// that is created with writer involvement. Only the system provider (the default provider available on the system) can create this /// type of shadow copy. /// /// Most requesters will want to use the /// VSS_CTX_APP_ROLLBACK /// context for persistent, non-auto-release shadow copies with writer involvement. /// Windows Server 2003 and Windows XP: /// This context is not supported by Windows Server 2003 and Windows XP. /// VSS_CTX_CLIENT_ACCESSIBLE_WRITERS = VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_PERSISTENT | VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE | VSS_VOLUME_SNAPSHOT_ATTRIBUTES.VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE, /// /// All types of currently live shadow copies are available for administrative operations, such as shadow copy /// queries (see /// IVssBackupComponents::Query /// ). /// VSS_CTX_ALL /// is a valid context for all VSS interfaces except /// IVssBackupComponents::StartSnapshotSet /// and /// IVssBackupComponents::DoSnapshotSet /// . /// VSS_CTX_ALL = 0xffffffff, } /// Specifies the property to be set for a shadow copy. // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_snapshot_property_id // typedef enum _VSS_SNAPSHOT_PROPERTY_ID { VSS_SPROPID_UNKNOWN, VSS_SPROPID_SNAPSHOT_ID, VSS_SPROPID_SNAPSHOT_SET_ID, VSS_SPROPID_SNAPSHOTS_COUNT, VSS_SPROPID_SNAPSHOT_DEVICE, VSS_SPROPID_ORIGINAL_VOLUME, VSS_SPROPID_ORIGINATING_MACHINE, VSS_SPROPID_SERVICE_MACHINE, VSS_SPROPID_EXPOSED_NAME, VSS_SPROPID_EXPOSED_PATH, VSS_SPROPID_PROVIDER_ID, VSS_SPROPID_SNAPSHOT_ATTRIBUTES, VSS_SPROPID_CREATION_TIMESTAMP, VSS_SPROPID_STATUS } VSS_SNAPSHOT_PROPERTY_ID, *PVSS_SNAPSHOT_PROPERTY_ID; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_SNAPSHOT_PROPERTY_ID")] public enum VSS_SNAPSHOT_PROPERTY_ID { /// /// The property is not known. /// This value indicates an application error. /// VSS_SPROPID_UNKNOWN, /// /// The shadow copy identifier. For more information, see the /// m_SnapshotId /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_SNAPSHOT_ID, /// /// The shadow copy set identifier. For more information, see the /// m_SnapshotSetId /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_SNAPSHOT_SET_ID, /// /// The number of volumes included with the shadow copy in the shadow copy set when it was created. For more /// information, see the /// m_lSnapshotsCount /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_SNAPSHOTS_COUNT, /// /// Null-terminated wide character string that specifies the name of the device object for the shadow copy of the /// volume. For more information, see the /// m_pwszSnapshotDeviceObject /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_SNAPSHOT_DEVICE, /// /// A null-terminated wide character string that specifies the name of the original volume. For more information, see the /// m_pwszOriginalVolumeName /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_ORIGINAL_VOLUME, /// /// A null-terminated wide character string that specifies the name of the machine that contains the original /// volume. For more information, see the /// m_pwszOriginatingMachine /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_ORIGINATING_MACHINE, /// /// A null-terminated wide character string that specifies the name of the machine that is running the Volume Shadow Copy /// Service that created the shadow copy. For more information, see the /// m_pwszServiceMachine /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_SERVICE_MACHINE, /// /// A null-terminated wide character string that specifies the name of the shadow copy when it is exposed. For more information, see the /// m_pwszExposedName /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_EXPOSED_NAME, /// /// A null-terminated wide character string that specifies the portion of the volume that is made available /// when the shadow copy is exposed as a file share. For more information, see the /// m_pwszExposedPath /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_EXPOSED_PATH, /// /// The provider identifier. For more information, see the /// m_ProviderId /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_PROVIDER_ID, /// /// A bitmask of /// _VSS_VOLUME_SNAPSHOT_ATTRIBUTES /// values that specify the properties of the shadow copy. For more information, see the /// m_lSnapshotAttributes /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_SNAPSHOT_ATTRIBUTES, /// /// A time stamp that specifies when the shadow copy was created. For more information, see the /// m_tsCreationTimestamp /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_CREATION_TIMESTAMP, /// /// The status of the current shadow copy creation operation. For more information, see the /// m_eStatus /// member of the /// VSS_SNAPSHOT_PROP /// structure. /// VSS_SPROPID_STATUS, } /// The VSS_SNAPSHOT_STATE enumeration is returned by a provider to specify the state of a given shadow copy operation. /// /// /// The shadow copy state is contained in the m_eStatus member of a VSS_SNAPSHOT_PROP object, which can be obtained for a single /// shadow copy by calling IVssBackupComponents::GetSnapshotProperties. /// /// /// Because IVssBackupComponents::GetSnapshotProperties fails during shadow copy creation with VSS_E_OBJECT_NOT_FOUND, a /// requester cannot obtain any VSS_SNAPSHOT_STATE value other than VSS_SS_CREATED. /// /// /// Calls to IVssBackupComponents::Query can also be used to obtain the shadow copy state. IVssBackupComponents::Query is used to /// return lists of shadow copies, which may be iterated over by means of the IVssEnumObject interface to obtain VSS_SNAPSHOT_PROP /// objects for each shadow copy that have completed on a given system. This means that, like /// IVssBackupComponents::GetSnapshotProperties, the IVssBackupComponents::Query method can return only a shadow copy state of VSS_SS_CREATED. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_snapshot_state typedef enum _VSS_SNAPSHOT_STATE { VSS_SS_UNKNOWN, // VSS_SS_PREPARING, VSS_SS_PROCESSING_PREPARE, VSS_SS_PREPARED, VSS_SS_PROCESSING_PRECOMMIT, VSS_SS_PRECOMMITTED, // VSS_SS_PROCESSING_COMMIT, VSS_SS_COMMITTED, VSS_SS_PROCESSING_POSTCOMMIT, VSS_SS_PROCESSING_PREFINALCOMMIT, VSS_SS_PREFINALCOMMITTED, // VSS_SS_PROCESSING_POSTFINALCOMMIT, VSS_SS_CREATED, VSS_SS_ABORTED, VSS_SS_DELETED, VSS_SS_POSTCOMMITTED, VSS_SS_COUNT } // VSS_SNAPSHOT_STATE, *PVSS_SNAPSHOT_STATE; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_SNAPSHOT_STATE")] public enum VSS_SNAPSHOT_STATE { /// /// Reserved for system use. /// Unknown shadow copy state. /// VSS_SS_UNKNOWN = 0, /// /// Reserved for system use. /// Shadow copy is being prepared. /// VSS_SS_PREPARING, /// /// Reserved for system use. /// Processing of the shadow copy preparation is in progress. /// VSS_SS_PROCESSING_PREPARE, /// /// Reserved for system use. /// Shadow copy has been prepared. /// VSS_SS_PREPARED, /// /// Reserved for system use. /// Processing of the shadow copy precommit is in process. /// VSS_SS_PROCESSING_PRECOMMIT, /// /// Reserved for system use. /// Shadow copy is precommitted. /// VSS_SS_PRECOMMITTED, /// /// Reserved for system use. /// Processing of the shadow copy commit is in process. /// VSS_SS_PROCESSING_COMMIT, /// /// Reserved for system use. /// Shadow copy is committed. /// VSS_SS_COMMITTED, /// /// Reserved for system use. /// Processing of the shadow copy postcommit is in process. /// VSS_SS_PROCESSING_POSTCOMMIT, /// /// Reserved for system use. /// Processing of the shadow copy file commit operation is underway. /// VSS_SS_PROCESSING_PREFINALCOMMIT, /// /// Reserved for system use. /// Processing of the shadow copy file commit operation is done. /// VSS_SS_PREFINALCOMMITTED, /// /// Reserved for system use. /// Processing of the shadow copy following the final commit and prior to shadow copy create is underway. /// VSS_SS_PROCESSING_POSTFINALCOMMIT, /// Shadow copy is created. VSS_SS_CREATED, /// /// Reserved for system use. /// Shadow copy creation is aborted. /// VSS_SS_ABORTED, /// /// Reserved for system use. /// Shadow copy has been deleted. /// VSS_SS_DELETED, /// VSS_SS_POSTCOMMITTED, /// Reserved value. VSS_SS_COUNT, } /// /// Allows additional attributes to be specified for a shadow copy. The context of a shadow copy (as set by the /// IVssBackupComponents::SetContext method) may be modified by a bitmask that contains a valid combination of /// _VSS_VOLUME_SNAPSHOT_ATTRIBUTES and _VSS_SNAPSHOT_CONTEXT enumeration values. /// /// /// The default context for VSS shadow copies is VSS_CTX_BACKUP. /// /// A requester sets the context for a shadow copy about to be created by passing the member of the _VSS_SNAPSHOT_CONTEXT enumeration to /// the IVssBackupComponents::SetContext method. /// /// /// Requesters can modify this context by using a bitwise OR of the _VSS_SNAPSHOT_CONTEXT value with a supported value from the /// _VSS_VOLUME_SNAPSHOT_ATTRIBUTES enumeration as an argument to IVssBackupComponents::SetContext. /// /// /// Unless specifically requested to support a given mechanism, providers are free to use any type of mechanism to implement a shadow /// copy. Therefore, in the case where a shadow copy method is not specified, the provider is free to choose a differential mechanism ( /// VSS_VOLSNAP_ATTR_DIFFERENTIAL), a PLEX mechanism ( VSS_VOLSNAP_ATTR_PLEX), or any other mechanism to support the /// shadow copy. /// /// /// While a provider can support both mechanisms, they are mutually exclusive for a given shadow copy. Requesters should not use both /// VSS_VOLSNAP_ATTR_DIFFERENTIAL and VSS_VOLSNAP_ATTR_PLEX to modify a specific shadow copy context. /// /// /// Currently, VSS_VOLSNAP_ATTR_DIFFERENTIAL, VSS_VOLSNAP_ATTR_PLEX, and VSS_VOLSNAP_ATTR_TRANSPORTABLE are the /// only values of the _VSS_VOLUME_SNAPSHOT_ATTRIBUTES enumeration that can be used to modify any context. /// /// In addition, it cannot be used to modify a VSS_CTX_CLIENT_ACCESSIBLE context. /// /// A requester can obtain information about a specific shadow copy (identified by VSS_ID) by unpacking the VSS_SNAPSHOT_PROP structure /// from the VSS_OBJECT_PROP structure returned by a call to IVssBackupComponents::GetSnapshotProperties. /// /// /// A requester can also obtain a VSS_SNAPSHOT_PROP structure for each of multiple shadow copies by calling IVssBackupComponents::Query /// and using IVssEnumObject to iterate the returns. /// /// /// The shadow copies' context and attributes are found as a bit mask contained in the m_lSnapshotAttributes member of the /// VSS_SNAPSHOT_PROP structure. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_volume_snapshot_attributes typedef enum // _VSS_VOLUME_SNAPSHOT_ATTRIBUTES { VSS_VOLSNAP_ATTR_PERSISTENT, VSS_VOLSNAP_ATTR_NO_AUTORECOVERY, VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE, // VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE, VSS_VOLSNAP_ATTR_NO_WRITERS, VSS_VOLSNAP_ATTR_TRANSPORTABLE, VSS_VOLSNAP_ATTR_NOT_SURFACED, // VSS_VOLSNAP_ATTR_NOT_TRANSACTED, VSS_VOLSNAP_ATTR_HARDWARE_ASSISTED, VSS_VOLSNAP_ATTR_DIFFERENTIAL, VSS_VOLSNAP_ATTR_PLEX, // VSS_VOLSNAP_ATTR_IMPORTED, VSS_VOLSNAP_ATTR_EXPOSED_LOCALLY, VSS_VOLSNAP_ATTR_EXPOSED_REMOTELY, VSS_VOLSNAP_ATTR_AUTORECOVER, // VSS_VOLSNAP_ATTR_ROLLBACK_RECOVERY, VSS_VOLSNAP_ATTR_DELAYED_POSTSNAPSHOT, VSS_VOLSNAP_ATTR_TXF_RECOVERY, VSS_VOLSNAP_ATTR_FILE_SHARE // } VSS_VOLUME_SNAPSHOT_ATTRIBUTES, *PVSS_VOLUME_SNAPSHOT_ATTRIBUTES; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_VOLUME_SNAPSHOT_ATTRIBUTES")] [Flags] public enum VSS_VOLUME_SNAPSHOT_ATTRIBUTES : uint { /// /// The shadow copy is persistent across reboots. /// This attribute is automatically set for /// _VSS_SNAPSHOT_CONTEXT /// contexts of /// VSS_CTX_APP_ROLLBACK /// , /// VSS_CTX_CLIENT_ACCESSIBLE /// , /// VSS_CTX_CLIENT_ACCESSIBLE_WRITERS /// , and /// VSS_CTX_NAS_ROLLBACK /// . /// This attribute should not be used explicitly by requesters when setting the context of a shadow copy. /// VSS_VOLSNAP_ATTR_PERSISTENT = 0x01, /// /// Auto-recovery /// is disabled for the shadow copy. /// /// A requester can modify a shadow copy context with a bitwise OR of this attribute. By doing this, the requester instructs VSS to /// make the shadow copy read-only immediately after it is created, without allowing writers or other applications to update /// components in the shadow copy. /// /// /// Disabling auto-recovery can cause the shadow copy to be in an inconsistent state if any of its components are involved in /// transactional database operations, such as transactional read and write operations managed by Transactional NTFS (TxF). This is /// because disabling auto-recovery prevents incomplete transactions from being rolled back. /// /// /// Disabling auto-recovery also prevents writers from excluding files from the shadow copy. When auto-recovery is disabled, a /// writer can still call the /// /// IVssCreateWriterMetadataEx::AddExcludeFilesFromSnapshot /// method, but the writer's /// CVssWriter::OnPostSnapshot /// method cannot delete the files from the shadow copy. /// Windows Server 2003 and Windows XP: /// This value is not supported until Windows Vista. /// VSS_VOLSNAP_ATTR_NO_AUTORECOVERY = 0x02, /// /// The specified shadow copy is a /// client-accessible shadow copy /// that supports Shadow Copies for Shared Folders, and should not be exposed. /// This attribute is automatically set for /// VSS_CTX_CLIENT_ACCESSIBLE /// and /// VSS_CTX_CLIENT_ACCESSIBLE_WRITERS /// . /// This attribute should not be used explicitly by requesters when setting the context of a shadow copy. /// VSS_VOLSNAP_ATTR_CLIENT_ACCESSIBLE = 0x04, /// /// The shadow copy is not automatically deleted when the shadow copy requester process ends. The shadow copy /// can be deleted only by a call to /// IVssBackupComponents::DeleteSnapshots /// . /// This attribute is automatically set for /// _VSS_SNAPSHOT_CONTEXT /// contexts of /// VSS_CTX_APP_ROLLBACK /// , /// VSS_CTX_CLIENT_ACCESSIBLE /// , /// VSS_CTX_CLIENT_ACCESSIBLE_WRITERS /// , and /// VSS_CTX_NAS_ROLLBACK /// . /// This attribute should not be used explicitly by requesters when setting the context of a shadow copy. /// VSS_VOLSNAP_ATTR_NO_AUTO_RELEASE = 0x08, /// /// No writers are involved in creating the shadow copy. /// This attribute is automatically set for /// _VSS_SNAPSHOT_CONTEXT /// contexts of /// VSS_CTX_NAS_ROLLBACK /// , /// VSS_CTX_FILE_SHARE_BACKUP /// , and /// VSS_CTX_CLIENT_ACCESSIBLE /// . /// This attribute should not be used explicitly by requesters when setting the context of a shadow copy. /// VSS_VOLSNAP_ATTR_NO_WRITERS = 0x10, /// /// The shadow copy is to be transported and therefore should not be surfaced locally. /// This attribute can be used explicitly by requesters when setting the context of a shadow copy, if the /// provider for shadow copy supports transportable shadow copies. /// Windows Server 2003, Standard Edition, Windows Server 2003, Web Edition and Windows XP: /// This attribute is not supported. All editions of Windows Server 2003 with SP1 support this attribute. /// See /// Importing Transportable Shadow Copied Volumes /// for more information. /// VSS_VOLSNAP_ATTR_TRANSPORTABLE = 0x20, /// /// The shadow copy is not currently exposed. /// Unless the shadow copy is explicitly exposed or mounted, this attribute is set for all shadow copies. /// This attribute should not be used explicitly by requesters when setting the context of a shadow copy. /// VSS_VOLSNAP_ATTR_NOT_SURFACED = 0x40, /// /// The shadow copy is not transacted. /// /// A requester can modify a shadow copy context with a bitwise OR of this attribute. By doing this, the requester instructs VSS to /// disable built-in integration between VSS and transaction and resource managers. /// /// /// Setting this attribute guarantees that the requester will not receive VSS_E_TRANSACTION_FREEZE_TIMEOUT errors. However, it may /// cause unwanted consequences, such as the loss of transactional integrity or even data loss. /// /// Windows Server 2003 and Windows XP: /// This value is not supported until Windows Vista. /// VSS_VOLSNAP_ATTR_NOT_TRANSACTED = 0x80, /// /// Indicates that a given provider is a hardware provider. /// This attribute is automatically set for hardware providers. /// This enumeration value cannot be used to manually set the context (using the /// IVssBackupComponents::SetContext /// method) of a shadow copy by a bit mask (or bitwise OR) of this enumeration value and a valid shadow copy /// context value from /// _VSS_SNAPSHOT_CONTEXT /// . /// VSS_VOLSNAP_ATTR_HARDWARE_ASSISTED = 0x10000, /// /// Indicates that a given provider uses differential data or a copy-on-write mechanism to implement shadow copies. /// A requester can modify a shadow copy context with a bitwise OR of this attribute. By doing this, the /// requester instructs providers to create a shadow copy using a differential implementation. If no shadow copy /// provider installed on the system supports the requested attributes, a VSS_E_VOLUME_NOT_SUPPORTED error will be /// returned to /// IVssBackupComponents::AddToSnapshotSet /// . /// VSS_VOLSNAP_ATTR_DIFFERENTIAL = 0x20000, /// /// Indicates that a given provider uses a PLEX or mirrored split mechanism to implement shadow copies. /// A requester can modify a shadow copy context with a bitwise OR of this attribute. By doing this, the /// requester instructs the providers to create a shadow copy using a PLEX implementation. If no shadow copy /// provider installed on the system supports the requested attributes, a VSS_E_VOLUME_NOT_SUPPORTED error will be /// returned to /// IVssBackupComponents::AddToSnapshotSet /// . /// VSS_VOLSNAP_ATTR_PLEX = 0x40000, /// /// The shadow copy of the volume was imported onto this machine using the /// IVssBackupComponents::ImportSnapshots /// method rather than created using the /// IVssBackupComponents::DoSnapshotSet /// method. /// This attribute is automatically set if a shadow copy is imported. /// This attribute should not be used explicitly by requesters when setting the context of a shadow copy. /// VSS_VOLSNAP_ATTR_IMPORTED = 0x80000, /// /// The shadow copy is locally exposed. If this bit flag and the VSS_VOLSNAP_ATTR_EXPOSED_REMOTELY bit flag are /// not set, the shadow copy is hidden. /// The attribute is automatically added to a shadow copy context upon calling the /// IVssBackupComponents::ExposeSnapshot /// method to expose a shadow copy locally. /// This attribute should not be used explicitly by requesters when setting the context of a shadow copy. /// VSS_VOLSNAP_ATTR_EXPOSED_LOCALLY = 0x100000, /// /// The shadow copy is remotely exposed. If this bit flag and the VSS_VOLSNAP_ATTR_EXPOSED_LOCALLY bit flag are /// not set, the shadow copy is hidden. /// The attribute is automatically added to a shadow copy context upon calling the /// IVssBackupComponents::ExposeSnapshot /// method to expose a shadow copy locally. /// This attribute should not be used explicitly by requesters when setting the context of a shadow copy. /// VSS_VOLSNAP_ATTR_EXPOSED_REMOTELY = 0x200000, /// /// Indicates that the writer will need to /// auto-recover /// the component in /// CVssWriter::OnPostSnapshot /// . /// This attribute should not be used explicitly by requesters when setting the context of a shadow copy. /// VSS_VOLSNAP_ATTR_AUTORECOVER = 0x400000, /// /// Indicates that the writer will need to /// auto-recover /// the component in /// CVssWriter::OnPostSnapshot /// if the shadow copy is being used for rollback (for data mining, for example). /// /// A requester would set this flag in the shadow copy context to indicate that the shadow copy is being created for a non-backup /// purpose such as data mining. /// /// VSS_VOLSNAP_ATTR_ROLLBACK_RECOVERY = 0x800000, /// /// Reserved for system use. /// Windows Vista, Windows Server 2003 and Windows XP: /// This value is not supported until Windows Server 2008. /// VSS_VOLSNAP_ATTR_DELAYED_POSTSNAPSHOT = 0x1000000, /// /// Indicates that TxF recovery should be enforced during shadow copy creation. /// Windows Vista, Windows Server 2003 and Windows XP: /// This value is not supported until Windows Server 2008. /// VSS_VOLSNAP_ATTR_TXF_RECOVERY = 0x2000000, /// VSS_VOLSNAP_ATTR_FILE_SHARE = 0x4000000, } /// The VSS_WRITER_STATE enumeration indicates the current state of the writer. /// A requester determines the state of a writer through IVssBackupComponents::GetWriterStatus. // https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_writer_state typedef enum _VSS_WRITER_STATE { VSS_WS_UNKNOWN, // VSS_WS_STABLE, VSS_WS_WAITING_FOR_FREEZE, VSS_WS_WAITING_FOR_THAW, VSS_WS_WAITING_FOR_POST_SNAPSHOT, // VSS_WS_WAITING_FOR_BACKUP_COMPLETE, VSS_WS_FAILED_AT_IDENTIFY, VSS_WS_FAILED_AT_PREPARE_BACKUP, VSS_WS_FAILED_AT_PREPARE_SNAPSHOT, // VSS_WS_FAILED_AT_FREEZE, VSS_WS_FAILED_AT_THAW, VSS_WS_FAILED_AT_POST_SNAPSHOT, VSS_WS_FAILED_AT_BACKUP_COMPLETE, // VSS_WS_FAILED_AT_PRE_RESTORE, VSS_WS_FAILED_AT_POST_RESTORE, VSS_WS_FAILED_AT_BACKUPSHUTDOWN, VSS_WS_COUNT } VSS_WRITER_STATE, *PVSS_WRITER_STATE; [PInvokeData("vss.h", MSDNShortId = "NE:vss._VSS_WRITER_STATE")] public enum VSS_WRITER_STATE { /// /// The writer's state is not known. /// This indicates an error on the part of the writer. /// VSS_WS_UNKNOWN = 0, /// /// The writer has completed processing current shadow copy events and is ready to proceed, or /// CVssWriter::OnPrepareSnapshot /// has not yet /// been called. /// VSS_WS_STABLE, /// The writer is waiting for the freeze state. VSS_WS_WAITING_FOR_FREEZE, /// The writer is waiting for the thaw state. VSS_WS_WAITING_FOR_THAW, /// /// The writer is waiting for the /// PostSnapshot /// state. /// VSS_WS_WAITING_FOR_POST_SNAPSHOT, /// The writer is waiting for the requester to finish its backup operation. VSS_WS_WAITING_FOR_BACKUP_COMPLETE, /// The writer vetoed the shadow copy creation process at the writer identification state. VSS_WS_FAILED_AT_IDENTIFY, /// The writer vetoed the shadow copy creation process during the backup preparation state. VSS_WS_FAILED_AT_PREPARE_BACKUP, /// /// The writer vetoed the shadow copy creation process during the /// PrepareForSnapshot /// state. /// VSS_WS_FAILED_AT_PREPARE_SNAPSHOT, /// The writer vetoed the shadow copy creation process during the freeze state. VSS_WS_FAILED_AT_FREEZE, /// The writer vetoed the shadow copy creation process during the thaw state. VSS_WS_FAILED_AT_THAW, /// /// The writer vetoed the shadow copy creation process during the /// PostSnapshot /// state. /// VSS_WS_FAILED_AT_POST_SNAPSHOT, /// /// The shadow copy has been created and the writer failed during the /// BackupComplete /// state. A writer /// should save information about this failure to the error log. For additional information on logging, see /// Event and Error Handling Under VSS /// . /// VSS_WS_FAILED_AT_BACKUP_COMPLETE, /// /// The writer failed during the /// PreRestore /// state. /// VSS_WS_FAILED_AT_PRE_RESTORE, /// /// The writer failed during the /// PostRestore /// state. /// VSS_WS_FAILED_AT_POST_RESTORE, /// The writer failed during the shutdown of the backup application. VSS_WS_FAILED_AT_BACKUPSHUTDOWN, /// Reserved value. VSS_WS_COUNT, } /// /// /// The IVssAsync interface is returned to calling applications by methods that initiate asynchronous operations, which run in /// the background and typically require a long time to complete. /// /// /// The IVssAsync interface permits an application to monitor and control an asynchronous operation by waiting on its completion, /// querying its status, or canceling it. /// /// The following methods return an IVssAsync interface: /// /// /// IVssBackupComponents::BackupComplete /// /// /// IVssBackupComponents::DoSnapshotSet /// /// /// IVssBackupComponents::GatherWriterMetadata /// /// /// IVssBackupComponents::GatherWriterStatus /// /// /// IVssBackupComponents::ImportSnapshots /// /// /// IVssBackupComponents::PostRestore /// /// /// IVssBackupComponents::PrepareForBackup /// /// /// IVssBackupComponents::PreRestore /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/nn-vss-ivssasync [PInvokeData("vss.h", MSDNShortId = "NN:vss.IVssAsync")] [ComImport, Guid("507C37B4-CF5B-4e95-B0AF-14EB9767467E"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IVssAsync { /// The Cancel method cancels an incomplete asynchronous operation. /// /// All calls to Cancel for all IVssAsync objects support the following status codes. /// /// /// Value /// Meaning /// /// /// S_OK /// The asynchronous operation had been successfully canceled. /// /// /// VSS_S_ASYNC_CANCELLED /// The asynchronous operation had been canceled prior to calling this method. /// /// /// VSS_S_ASYNC_FINISHED /// The asynchronous operation had completed prior to calling this method. /// /// /// VSS_E_UNEXPECTED /// /// Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS. /// Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This value is not supported until Windows Server 2008 R2 /// and Windows 7. E_UNEXPECTED is used instead. /// /// /// /// /// If an operation has completed unsuccessfully before Cancel was called, then Cancel returns the error that /// operation encountered. /// /// /// To obtain a complete list of return values for a specific IVssAsync::Cancel, see the error codes of the method that /// returned the IVssAsync object. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/nf-vss-ivssasync-cancel HRESULT Cancel(); [PreserveSig] HRESULT Cancel(); /// The Wait method waits until an incomplete asynchronous operation finishes. /// /// Length of time, in milliseconds, that the method will wait for an asynchronous process to return before timing out. /// The default value for this argument is INFINITE. /// /// Windows Server 2003: This parameter is reserved and must be INFINITE. If any other value is specified for this parameter, /// the call to Wait fails with E_INVALIDARG. /// /// Windows XP: This method has no parameters. /// /// /// All calls to Wait for all IVssAsync objects support the following status codes. /// /// /// Value /// Meaning /// /// /// S_OK /// The wait operation was successful. Call IVssAsync::QueryStatus to determine the final status of the asynchronous operation. /// /// /// E_ACCESSDENIED /// The wait operation failed because the user did not have the correct privileges. /// /// /// VSS_E_UNEXPECTED /// /// Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS. /// Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This value is not supported until Windows Server 2008 R2 /// and Windows 7. E_UNEXPECTED is used instead. /// /// /// /// If an operation fails while being waited on, Wait returns the error that operation encountered. /// /// To obtain a complete list of return values for a specific Wait, see the error codes of the method that returned the /// IVssAsync object. /// /// /// This method can succeed even if the method that returns it failed. // https://docs.microsoft.com/en-us/windows/win32/api/vss/nf-vss-ivssasync-wait HRESULT Wait( [in] DWORD dwMilliseconds ); [PreserveSig] HRESULT Wait(uint dwMilliseconds = 0xffffffff); /// The QueryStatus method queries the status of an asynchronous operation. /// /// The status of the asynchronous operation that returned the current IVssAsync object. /// All calls to QueryStatus for all IVssAsync objects support the following status codes. /// /// /// Value /// Meaning /// /// /// VSS_S_ASYNC_CANCELLED /// The asynchronous operation was canceled by a previous call to IVssAsync::Cancel. /// /// /// VSS_S_ASYNC_FINISHED /// The asynchronous operation was completed successfully. /// /// /// VSS_S_ASYNC_PENDING /// The asynchronous operation is still running. /// /// /// /// Additional return values can be returned, but depend on the return codes of the method that initially returned the IVssAsync object. /// /// /// The value of this parameter should be NULL. /// /// The following are the valid return codes for this method. /// /// /// Value /// Meaning /// /// /// S_OK /// The query operation was successful. /// /// /// E_ACCESSDENIED /// The query operation failed because the user did not have the correct privileges. /// /// /// E_INVALIDARG /// The pointer to the variable used to hold the pHrResult return value is NULL or is not a valid memory location. /// /// /// VSS_E_UNEXPECTED /// /// Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS. /// Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This value is not supported until Windows Server 2008 R2 /// and Windows 7. E_UNEXPECTED is used instead. /// /// /// /// /// /// /// In the event of an error during the course of an asynchronous operation, QueryStatus will return the same error code as /// the method that initially returned the IVssAsync object. /// /// /// To obtain a complete list of return values for an IVssAsync::QueryStatus object returned by a specific method, see the /// error codes documented for that method. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/nf-vss-ivssasync-querystatus HRESULT QueryStatus( [out] HRESULT // *pHrResult, [out] INT *pReserved ); [PreserveSig] HRESULT QueryStatus(out HRESULT pHrResult, [In, Optional] IntPtr pReserved); } /// /// /// The IVssEnumObject interface contains methods to iterate over and perform other operations on a list of enumerated objects. /// /// The IVssBackupComponents::Query method returns an IVssEnumObject object. /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/nn-vss-ivssenumobject [PInvokeData("vss.h", MSDNShortId = "NN:vss.IVssEnumObject")] [ComImport, Guid("AE1C7110-2F60-11d3-8A39-00C04F72D8E3"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IVssEnumObject : ICOMEnum { /// The Next method returns the specified number of objects from the specified list of enumerated objects. /// The number of elements to be read from the list of enumerated objects into the rgelt buffer. /// /// The address of a caller-allocated buffer that receives celtVSS_OBJECT_PROP structures that contain the returned objects. This /// parameter is required and cannot be NULL. /// /// The number of elements that were returned in the rgelt buffer. /// /// The following are the valid return codes for this method. /// /// /// Value /// Meaning /// /// /// S_OK /// The operation was successful. /// /// /// S_FALSE /// The number of returned items is less than the number requested. /// /// /// E_FAIL /// There is an internal error in the enumerator. /// /// /// E_POINTER /// One of the required pointer parameters is NULL. /// /// /// /// /// /// When requesting the return of more than one VSS_OBJECT_PROP object, a return value of S_FALSE indicates that the end of the /// enumeration list has been reached. If more objects were requested than remained in the list, Next will return all the /// remaining objects, set the pceltFetched parameter to a nonzero value, and return S_FALSE. /// /// /// The output rgelt parameter must point to an allocated array containing celt VSS_OBJECT_PROP structures, and cannot be NULL. /// /// /// It is the caller's responsibility to free system resources returned by IVssEnumObject::Next to the VSS_OBJECT_PROP /// structure pointed to by the rgelt parameter. /// /// /// The callers must use CoTaskMemFree for every string value in the VSS_SNAPSHOT_PROP or VSS_PROVIDER_PROP object in the returned /// VSS_OBJECT_PROP structure. /// /// /// In the case of VSS_SNAPSHOT_PROP, this can be done manually, or the utility function VssFreeSnapshotProperties can be used. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/nf-vss-ivssenumobject-next HRESULT Next( [in] ULONG celt, [out] // VSS_OBJECT_PROP *rgelt, [out] ULONG *pceltFetched ); [PreserveSig] HRESULT Next(uint celt, [Out, MarshalAs(UnmanagedType.LPArray)] VSS_OBJECT_PROP[] rgelt, out uint pceltFetched); /// The Skip method skips the specified number of objects. /// Number of elements to be skipped in the list of enumerated objects. /// /// The following are the valid return codes for this method. /// /// /// Value /// Meaning /// /// /// S_OK /// The operation was successful. /// /// /// S_FALSE /// An attempt was made to access a location beyond the end of the list of items. /// /// /// E_FAIL /// There was an internal error in the enumerator. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/nf-vss-ivssenumobject-skip HRESULT Skip( [in] ULONG celt ); [PreserveSig] HRESULT Skip(uint celt); /// The Reset method resets the enumerator so that IVssEnumObject:Next starts at the first enumerated object. // https://docs.microsoft.com/en-us/windows/win32/api/vss/nf-vss-ivssenumobject-reset HRESULT Reset(); void Reset(); /// /// The Clone method creates a copy of the specified list of enumerated elements by creating a copy of the IVssEnumObject /// enumerator object. /// /// /// An IVssEnumObject enumerator object. Set the value of this parameter to NULL before calling /// this method. /// /// /// The cloned enumerator object will refer to the same list of VSS_OBJECT_PROP structures. /// /// The caller must call the Release method of the returned interface pointer to deallocate the system resources held by the /// IVssEnumObject enumerator object pointed to by the ppEnum parameter. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/nf-vss-ivssenumobject-clone HRESULT Clone( [in, out] IVssEnumObject // **ppenum ); IVssEnumObject Clone(); } /// The VSS_OBJECT_PROP structure defines the properties of a provider, volume, shadow copy, or shadow copy set. /// /// /// A requester obtains VSS_OBJECT_PROP structures by using IVssEnumObject::Next to iterate over the list of objects returned by /// a call to IVssBackupComponents::Query. /// /// /// As its members are filled by a COM interface, prior to deleting the property structures VSS_SNAPSHOT_PROP and VSS_PROVIDER_PROP, the /// memory they contain must be released by calling CoTaskMemFree for every string and byte array value contained in each structure. /// /// In the case of VSS_SNAPSHOT_PROP, this can be done manually, or the utility function VssFreeSnapshotProperties can be used. /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ns-vss-vss_object_prop typedef struct _VSS_OBJECT_PROP { VSS_OBJECT_TYPE Type; // VSS_OBJECT_UNION Obj; } VSS_OBJECT_PROP, *PVSS_OBJECT_PROP; [PInvokeData("vss.h", MSDNShortId = "NS:vss._VSS_OBJECT_PROP")] [StructLayout(LayoutKind.Sequential)] public struct VSS_OBJECT_PROP { /// Object type. Refer to VSS_OBJECT_TYPE. public VSS_OBJECT_TYPE Type; /// /// Object properties: a union of VSS_SNAPSHOT_PROP and VSS_PROVIDER_PROP structures. (See VSS_OBJECT_UNION.) /// /// It contains information for an object of the type specified by the Type member of the VSS_OBJECT_PROP structure. /// Objects can be providers, volumes, shadow copies, or shadow copy sets. /// /// public VSS_OBJECT_UNION Obj; } /// /// The VSS_OBJECT_UNION defines the union of object types that can be defined by the VSS_OBJECT_PROP structure (section 2.2.3.2). /// [PInvokeData("vss.h", MSDNShortId = "NS:vss._VSS_OBJECT_PROP")] [StructLayout(LayoutKind.Explicit)] public struct VSS_OBJECT_UNION { /// The structure specifies a shadow copy object as a VSS_SNAPSHOT_PROP structure (section 2.2.3.3). [FieldOffset(0)] public VSS_SNAPSHOT_PROP Snap; /// /// The structure specifies a VSS provider object. The Shadow Copy Management Protocol is not used to manage VSS provider objects; /// therefore, this member MUST NOT be referenced and MUST be ignored on receipt. /// [FieldOffset(0)] public VSS_PROVIDER_PROP Prov; } /// The VSS_PROVIDER_PROP structure specifies shadow copy provider properties. // https://docs.microsoft.com/en-us/windows/win32/api/vss/ns-vss-vss_provider_prop typedef struct _VSS_PROVIDER_PROP { VSS_ID // m_ProviderId; VSS_PWSZ m_pwszProviderName; VSS_PROVIDER_TYPE m_eProviderType; VSS_PWSZ m_pwszProviderVersion; VSS_ID // m_ProviderVersionId; CLSID m_ClassId; } VSS_PROVIDER_PROP, *PVSS_PROVIDER_PROP; [PInvokeData("vss.h", MSDNShortId = "NS:vss._VSS_PROVIDER_PROP")] [StructLayout(LayoutKind.Sequential)] public struct VSS_PROVIDER_PROP { /// Identifies the provider who supports shadow copies of this class. public Guid m_ProviderId; /// String containing the provider name. public StrPtrUni m_pwszProviderName; /// Provider type. See VSS_PROVIDER_TYPE for more information. public VSS_PROVIDER_TYPE m_eProviderType; /// String containing the provider version in readable format. public StrPtrUni m_pwszProviderVersion; /// A VSS_ID (GUID) uniquely identifying the version of a provider. public Guid m_ProviderVersionId; /// Class identifier of the component registered in the local machine's COM catalog. public Guid m_ClassId; } /// The VSS_SNAPSHOT_PROP structure contains the properties of a shadow copy or shadow copy set. /// /// /// Requesters typically obtain a pointer to a VSS_SNAPSHOT_PROP structure by using the /// IVssBackupComponents::GetSnapshotProperties method or the IVssSoftwareSnapshotProvider::GetSnapshotProperties method. When this /// structure is no longer needed, the caller is responsible for freeing it by using the VssFreeSnapshotProperties function. /// /// /// The shadow copy device object contained in m_pwszSnapshotDeviceObject is used to address files on the shadow copy of the /// volume. For instance, if the original volume has a file with a path of "\topleveldir\File.html", then the path to the shadow copy of /// the file is " m_pwszSnapshotDeviceObject"+"\topleveldir\File.html". /// /// /// When a shadow copy is exposed as a share, the value of m_pwszExposedName will be the share name. When the shadow copy is /// exposed as a drive letter or mounted folder, the shadow copy m_pwszExposedName is a drive letter followed by a colon—for /// example, "X:" or a mounted folder path (for example, "Y:\MountX"). /// /// /// If a shadow copy is exposed as a drive letter or mounted folder, then (as with mounting any device) the entire shadow copy starting /// at its root will be exposed at the mount point. In this case, m_pwszExposedPath will be null. /// /// /// If the shadow copy is exposed as a share, the value of m_pwszExposedPath will be the path to the portion of the volume that /// is shared. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/vss/ns-vss-vss_snapshot_prop typedef struct _VSS_SNAPSHOT_PROP { VSS_ID // m_SnapshotId; VSS_ID m_SnapshotSetId; LONG m_lSnapshotsCount; VSS_PWSZ m_pwszSnapshotDeviceObject; VSS_PWSZ m_pwszOriginalVolumeName; // VSS_PWSZ m_pwszOriginatingMachine; VSS_PWSZ m_pwszServiceMachine; VSS_PWSZ m_pwszExposedName; VSS_PWSZ m_pwszExposedPath; VSS_ID // m_ProviderId; LONG m_lSnapshotAttributes; VSS_TIMESTAMP m_tsCreationTimestamp; VSS_SNAPSHOT_STATE m_eStatus; } VSS_SNAPSHOT_PROP, *PVSS_SNAPSHOT_PROP; [PInvokeData("vss.h", MSDNShortId = "NS:vss._VSS_SNAPSHOT_PROP")] [StructLayout(LayoutKind.Sequential)] public struct VSS_SNAPSHOT_PROP { /// A VSS_ID (GUID) uniquely identifying the shadow copy identifier. public Guid m_SnapshotId; /// A VSS_ID (GUID) uniquely identifying the shadow copy set containing the shadow copy. public Guid m_SnapshotSetId; /// /// /// Number of volumes included with the shadow copy in the shadow copy set when it was created. Because it is possible for /// applications to release individual shadow copies without releasing the shadow copy set, at any given time the number of shadow /// copies in the shadow copy set may be less than m_LSnapshotsCount. /// /// The maximum number of shadow-copied volumes permitted in a shadow copy set is 64. /// public int m_lSnapshotsCount; /// /// /// String containing the name of the device object for the shadow copy of the volume. The device object can be thought of as the /// root of a shadow copy of a volume. Requesters will use this device name when accessing files on a shadow-copied volume that it /// needs to work with. /// /// The device name does not contain a trailing "". /// public StrPtrUni m_pwszSnapshotDeviceObject; /// String containing the name of the volume that had been shadow copied. public StrPtrUni m_pwszOriginalVolumeName; /// String containing the name of the machine containing the original volume. public StrPtrUni m_pwszOriginatingMachine; /// String containing the name of the machine running the Volume Shadow Copy Service that created the shadow copy. public StrPtrUni m_pwszServiceMachine; /// /// String containing the name of the shadow copy when it is exposed. This is a drive letter or mounted folder (if the shadow copy /// is exposed as a local volume), or a share name. Corresponds to the wszExpose parameter of the /// IVssBackupComponents::ExposeSnapshot method. /// public StrPtrUni m_pwszExposedName; /// /// String indicating the portion of the shadow copy of a volume made available if it is exposed as a share. Corresponds to the /// wszPathFromRoot parameter of the IVssBackupComponents::ExposeSnapshot method. /// public StrPtrUni m_pwszExposedPath; /// A VSS_ID (GUID) uniquely identifying the provider used to create this shadow copy. public Guid m_ProviderId; /// /// The attributes of the shadow copy expressed as a bit mask (or bitwise OR) of members of the _VSS_VOLUME_SNAPSHOT_ATTRIBUTES enumeration. /// public VSS_VOLUME_SNAPSHOT_ATTRIBUTES m_lSnapshotAttributes; /// /// Time stamp indicating when the shadow copy was created. The exact time is determined by the provider. See VSS_TIMESTAMP for /// information about the time-stamp format. /// public FILETIME m_tsCreationTimestamp; /// Current shadow copy creation status. See VSS_SNAPSHOT_STATE. public VSS_SNAPSHOT_STATE m_eStatus; } }