Fixeds, updates and additions to VssApi

pull/267/head
dahall 2021-12-12 10:03:59 -07:00
parent 99ba5422b9
commit 75a4110f04
7 changed files with 11466 additions and 8261 deletions

444
PInvoke/VssApi/vdslun.cs Normal file
View File

@ -0,0 +1,444 @@
using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke.VssApi
{
/// <summary>
/// <para>
/// [Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage
/// Management API.]
/// </para>
/// <para>Defines the set of the valid address types of a physical interconnect.</para>
/// </summary>
/// <remarks>
/// <para>
/// The VDS_INTERCONNECT structure includes a <c>VDS_INTERCONNECT_ADDRESS_TYPE</c> value as a member to indicate an interconnect address type.
/// </para>
/// <para>
/// <c>Note</c> Additional constants might be added to the <c>VDS_INTERCONNECT_ADDRESS_TYPE</c> enumeration in future Windows versions.
/// For this reason, your application must be designed to gracefully handle an unrecognized <c>VDS_INTERCONNECT_ADDRESS_TYPE</c>
/// enumeration constant.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vdslun/ne-vdslun-vds_interconnect_address_type typedef enum
// _VDS_INTERCONNECT_ADDRESS_TYPE { VDS_IA_UNKNOWN, VDS_IA_FCFS, VDS_IA_FCPH, VDS_IA_FCPH3, VDS_IA_MAC, VDS_IA_SCSI } VDS_INTERCONNECT_ADDRESS_TYPE;
[PInvokeData("vdslun.h", MSDNShortId = "NE:vdslun._VDS_INTERCONNECT_ADDRESS_TYPE")]
public enum VDS_INTERCONNECT_ADDRESS_TYPE
{
/// <summary>This value is reserved.</summary>
VDS_IA_UNKNOWN = 0,
/// <summary>The address type is FCFS.</summary>
VDS_IA_FCFS,
/// <summary>The address type is FCPH.</summary>
VDS_IA_FCPH,
/// <summary>The address type is FCPH3.</summary>
VDS_IA_FCPH3,
/// <summary>The address type is MAC.</summary>
VDS_IA_MAC,
/// <summary>The address type is SCSI.</summary>
VDS_IA_SCSI,
}
/// <summary>
/// <para>
/// [Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage
/// Management API.]
/// </para>
/// <para>Defines the set of valid bus types of a storage device.</para>
/// </summary>
/// <remarks>
/// <para>
/// The VDS_LUN_INFORMATION, VDS_DISK_PROP, VDS_DISK_PROP2, and VDS_DRIVE_PROP2 structures include a <c>VDS_STORAGE_BUS_TYPE</c> value
/// as a member to specify the bus type of a LUN, disk, or drive.
/// </para>
/// <para>
/// <c>Note</c> The type specified in these structures matches the type that the driver or drivers reported and may not exactly match
/// the hardware.
/// </para>
/// <para>
/// <c>Note</c> Additional constants might be added to the <c>VDS_STORAGE_BUS_TYPE</c> enumeration in future Windows versions. For this
/// reason, your application must be designed to gracefully handle an unrecognized <c>VDS_STORAGE_BUS_TYPE</c> enumeration constant.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vdslun/ne-vdslun-vds_storage_bus_type typedef enum _VDS_STORAGE_BUS_TYPE {
// VDSBusTypeUnknown, VDSBusTypeScsi, VDSBusTypeAtapi, VDSBusTypeAta, VDSBusType1394, VDSBusTypeSsa, VDSBusTypeFibre, VDSBusTypeUsb,
// VDSBusTypeRAID, VDSBusTypeiScsi, VDSBusTypeSas, VDSBusTypeSata, VDSBusTypeSd, VDSBusTypeMmc, VDSBusTypeMax, VDSBusTypeVirtual,
// VDSBusTypeFileBackedVirtual, VDSBusTypeSpaces, VDSBusTypeNVMe, VDSBusTypeScm, VDSBusTypeUfs, VDSBusTypeMaxReserved } VDS_STORAGE_BUS_TYPE;
[PInvokeData("vdslun.h", MSDNShortId = "NE:vdslun._VDS_STORAGE_BUS_TYPE")]
public enum VDS_STORAGE_BUS_TYPE
{
/// <summary>This value is reserved.</summary>
VDSBusTypeUnknown = 0,
/// <summary>The storage bus type is SCSI.</summary>
VDSBusTypeScsi,
/// <summary>The storage bus type is ATAPI.</summary>
VDSBusTypeAtapi,
/// <summary>The storage bus type is ATA.</summary>
VDSBusTypeAta,
/// <summary>The storage bus type is IEEE 1394.</summary>
VDSBusType1394,
/// <summary>The storage bus type is SSA.</summary>
VDSBusTypeSsa,
/// <summary>The storage bus type is Fibre Channel.</summary>
VDSBusTypeFibre,
/// <summary>The storage bus type is USB.</summary>
VDSBusTypeUsb,
/// <summary>The storage bus type is RAID.</summary>
VDSBusTypeRAID,
/// <summary>The storage bus type is iSCSI.</summary>
VDSBusTypeiScsi,
/// <summary>The storage bus type is Serial Attached SCSI (SAS).</summary>
VDSBusTypeSas,
/// <summary>The storage bus type is SATA.</summary>
VDSBusTypeSata,
/// <summary>
/// <para>The storage bus type is Secure Digital (SD).</para>
/// <para>Windows Server 2008, Windows Vista and Windows Server 2003:</para>
/// <para>Not supported.</para>
/// </summary>
VDSBusTypeSd,
/// <summary>
/// <para>The storage bus type is MultiMedia Card (MMC).</para>
/// <para>Windows Server 2008, Windows Vista and Windows Server 2003:</para>
/// <para>Not supported.</para>
/// </summary>
VDSBusTypeMmc,
/// <summary>
/// <para>This value is reserved for system use.</para>
/// <para>Windows Server 2008, Windows Vista and Windows Server 2003:</para>
/// <para>Not supported.</para>
/// </summary>
VDSBusTypeMax,
/// <summary/>
VDSBusTypeVirtual = 0xe,
/// <summary>
/// <para>The storage bus type is file-backed virtual.</para>
/// <para>Windows Server 2008, Windows Vista and Windows Server 2003:</para>
/// <para>Not supported.</para>
/// </summary>
VDSBusTypeFileBackedVirtual,
/// <summary/>
VDSBusTypeSpaces,
/// <summary/>
VDSBusTypeNVMe,
/// <summary/>
VDSBusTypeScm,
/// <summary/>
VDSBusTypeUfs,
/// <summary>The maximum value of the storage bus type range.</summary>
VDSBusTypeMaxReserved = 0x7f,
}
/// <summary>
/// <para>
/// [Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage
/// Management API.]
/// </para>
/// <para>Defines the set of the valid code sets (encodings) of a storage identifier.</para>
/// </summary>
/// <remarks>
/// <para>
/// The VDS_STORAGE_IDENTIFIER structure includes a <c>VDS_STORAGE_IDENTIFIER_CODE_SET</c> value as a member to indicate the code set of
/// a storage identifier.
/// </para>
/// <para>
/// <c>Note</c> Additional constants might be added to the <c>VDS_STORAGE_IDENTIFIER_CODE_SET</c> enumeration in future Windows
/// versions. For this reason, your application must be designed to gracefully handle an unrecognized
/// <c>VDS_STORAGE_IDENTIFIER_CODE_SET</c> enumeration constant.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vdslun/ne-vdslun-vds_storage_identifier_code_set typedef enum
// _VDS_STORAGE_IDENTIFIER_CODE_SET { VDSStorageIdCodeSetReserved, VDSStorageIdCodeSetBinary, VDSStorageIdCodeSetAscii,
// VDSStorageIdCodeSetUtf8 } VDS_STORAGE_IDENTIFIER_CODE_SET;
[PInvokeData("vdslun.h", MSDNShortId = "NE:vdslun._VDS_STORAGE_IDENTIFIER_CODE_SET")]
public enum VDS_STORAGE_IDENTIFIER_CODE_SET
{
/// <summary>This value is reserved.</summary>
VDSStorageIdCodeSetReserved = 0,
/// <summary>The storage identifier is encoded as binary data.</summary>
VDSStorageIdCodeSetBinary,
/// <summary>The storage identifier is encoded as ASCII data.</summary>
VDSStorageIdCodeSetAscii,
/// <summary>
/// <para>The storage identifier is encoded as UTF-8.</para>
/// <para>Windows Vista and Windows Server 2003:</para>
/// <para>Not supported before Windows Vista with SP1 and Windows Server 2008.</para>
/// </summary>
VDSStorageIdCodeSetUtf8,
}
/// <summary>
/// <para>
/// [Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage
/// Management API.]
/// </para>
/// <para>Defines the set of valid types for a storage identifier.</para>
/// </summary>
/// <remarks>
/// <para>
/// The VDS_STORAGE_IDENTIFIER structure includes a <c>VDS_STORAGE_IDENTIFIER_TYPE</c> value as a member to indicate the storage
/// identifier type.
/// </para>
/// <para>
/// <c>Note</c> Additional constants might be added to the <c>VDS_STORAGE_IDENTIFIER_TYPE</c> enumeration in future Windows versions.
/// For this reason, your application must be designed to gracefully handle an unrecognized <c>VDS_STORAGE_IDENTIFIER_TYPE</c>
/// enumeration constant.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vdslun/ne-vdslun-vds_storage_identifier_type typedef enum
// _VDS_STORAGE_IDENTIFIER_TYPE { VDSStorageIdTypeVendorSpecific, VDSStorageIdTypeVendorId, VDSStorageIdTypeEUI64,
// VDSStorageIdTypeFCPHName, VDSStorageIdTypePortRelative, VDSStorageIdTypeTargetPortGroup, VDSStorageIdTypeLogicalUnitGroup,
// VDSStorageIdTypeMD5LogicalUnitIdentifier, VDSStorageIdTypeScsiNameString } VDS_STORAGE_IDENTIFIER_TYPE;
[PInvokeData("vdslun.h", MSDNShortId = "NE:vdslun._VDS_STORAGE_IDENTIFIER_TYPE")]
public enum VDS_STORAGE_IDENTIFIER_TYPE
{
/// <summary>The storage identifier type is vendor specific.</summary>
VDSStorageIdTypeVendorSpecific = 0,
/// <summary>The storage identifier is the same as the vendor identifier.</summary>
VDSStorageIdTypeVendorId,
/// <summary>The storage identifier type follows the IEEE 64-bit Extended Unique Identifier (EUI-64) standard.</summary>
VDSStorageIdTypeEUI64,
/// <summary>
/// <para>The storage identifier type follows the Fibre Channel Physical and Signaling Interface (FC-PH) naming</para>
/// <para>convention.</para>
/// </summary>
VDSStorageIdTypeFCPHName,
/// <summary>
/// <para>VDS 1.1:</para>
/// <para>The storage identifier type is dependent on the port.</para>
/// </summary>
VDSStorageIdTypePortRelative,
/// <summary/>
VDSStorageIdTypeTargetPortGroup,
/// <summary/>
VDSStorageIdTypeLogicalUnitGroup,
/// <summary/>
VDSStorageIdTypeMD5LogicalUnitIdentifier,
/// <summary/>
VDSStorageIdTypeScsiNameString,
}
/// <summary>
/// <para>
/// [Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage
/// Management API.]
/// </para>
/// <para>Defines the address data of a physical interconnect.</para>
/// </summary>
/// <remarks>
/// The VDS_LUN_INFORMATION structure includes this structure as a member to specify an interconnect by which a LUN can be accessed.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vdslun/ns-vdslun-vds_interconnect typedef struct _VDS_INTERCONNECT {
// VDS_INTERCONNECT_ADDRESS_TYPE m_addressType; ULONG m_cbPort; BYTE *m_pbPort; ULONG m_cbAddress; BYTE *m_pbAddress; } VDS_INTERCONNECT;
[PInvokeData("vdslun.h", MSDNShortId = "NS:vdslun._VDS_INTERCONNECT")]
[StructLayout(LayoutKind.Sequential)]
public struct VDS_INTERCONNECT
{
/// <summary>The interconnect address type enumerated by VDS_INTERCONNECT_ADDRESS_TYPE.</summary>
public VDS_INTERCONNECT_ADDRESS_TYPE m_addressType;
/// <summary>The size of the interconnect address data for the LUN port ( <c>m_pbPort</c>), in bytes.</summary>
public uint m_cbPort;
/// <summary>Pointer to the interconnect address data for the LUN port.</summary>
public IntPtr m_pbPort;
/// <summary>The size of the interconnect address data for the LUN ( <c>m_pbAddress</c>), in bytes.</summary>
public uint m_cbAddress;
/// <summary>Pointer to the interconnect address data for the LUN.</summary>
public IntPtr m_pbAddress;
}
/// <summary>
/// <para>
/// [Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage
/// Management API.]
/// </para>
/// <para>Defines information about a LUN or disk. Applications can use this structure to uniquely identify a LUN at all times.</para>
/// </summary>
/// <remarks>
/// <para>
/// The <c>VDS_LUN_INFORMATION</c> structure includes fields from the SCSI Inquiry Data and Vital Product Data pages 0x80 and 0x83. The
/// <c>GetIdentificationData</c> method on both the IVdsLun and IVdsDisk interfaces return this structure. It is also passed as an
/// argument in the IVdsHwProviderPrivate::QueryIfCreatedLun method to determine whether a given provider owns a specified LUN.
/// </para>
/// <para>
/// To get the LUN object, use the IVdsService::GetObject method. You can then use the IVdsLun::GetProperties method to get the LUN properties.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vdslun/ns-vdslun-vds_lun_information typedef struct _VDS_LUN_INFORMATION { ULONG
// m_version; BYTE m_DeviceType; BYTE m_DeviceTypeModifier; BOOL m_bCommandQueueing; VDS_STORAGE_BUS_TYPE m_BusType; char *m_szVendorId;
// char *m_szProductId; char *m_szProductRevision; char *m_szSerialNumber; GUID m_diskSignature; VDS_STORAGE_DEVICE_ID_DESCRIPTOR
// m_deviceIdDescriptor; ULONG m_cInterconnects; VDS_INTERCONNECT *m_rgInterconnects; } VDS_LUN_INFORMATION;
[PInvokeData("vdslun.h", MSDNShortId = "NS:vdslun._VDS_LUN_INFORMATION")]
[StructLayout(LayoutKind.Sequential)]
public struct VDS_LUN_INFORMATION
{
/// <summary></summary>
public const uint VER_VDS_LUN_INFORMATION = 1;
/// <summary>The version of this structure. The current value is the constant <c>VER_VDS_LUN_INFORMATION</c>.</summary>
public uint m_version;
/// <summary>The SCSI-2 device type of the LUN.</summary>
public byte m_DeviceType;
/// <summary>The SCSI-2 device type modifier of the LUN. For LUNs that have no device type modifier, the value is zero.</summary>
public byte m_DeviceTypeModifier;
/// <summary>
/// If <c>TRUE</c>, the LUN supports multiple outstanding commands; otherwise, <c>FALSE</c>. The synchronization of the queue is the
/// responsibility of the port driver.
/// </summary>
[MarshalAs(UnmanagedType.Bool)]
public bool m_bCommandQueueing;
/// <summary>The bus type of the LUN enumerated by VDS_STORAGE_BUS_TYPE.</summary>
public VDS_STORAGE_BUS_TYPE m_BusType;
/// <summary>
/// Pointer to the LUN vendor identifier; a zero-terminated, human-readable string. For devices that have no vendor identifier, the
/// value is zero.
/// </summary>
[MarshalAs(UnmanagedType.LPStr)]
public string m_szVendorId;
/// <summary>
/// Pointer to the LUN product identifier, typically a model number; a zero-terminated, human-readable string. For devices that have
/// no product identifier, the value is zero.
/// </summary>
[MarshalAs(UnmanagedType.LPStr)]
public string m_szProductId;
/// <summary>
/// Pointer to the LUN product revision; a zero-terminated, human-readable string. For devices that have no product revision, the
/// value is zero.
/// </summary>
[MarshalAs(UnmanagedType.LPStr)]
public string m_szProductRevision;
/// <summary>
/// Pointer to the LUN serial number; a zero-terminated, human-readable string. For devices that have no serial number, the value is zero.
/// </summary>
[MarshalAs(UnmanagedType.LPStr)]
public string m_szSerialNumber;
/// <summary>
/// The signature of the LUN. For disks that use the Master Boot Record (MBR) partitioning structure, the first 32 bits of the GUID
/// comprise the disk signature, and the remaining bits are zeros. For disks that use the GUID Partition Table (GPT) partitioning
/// structure, the GUID consists of the GPT disk identifier. If this value is zero, the disk is uninitialized or the hardware
/// provider was unable to retrieve the signature.
/// </summary>
public Guid m_diskSignature;
/// <summary>
/// Array containing the LUN descriptor in various formats, such as "VDSStorageIdTypeFCPHName" and "VDSStorageIdTypeVendorSpecific".
/// Providers can use "VDSStorageIdTypeVendorSpecific" to store an arbitrary byte string of the vendor's choosing to uniquely
/// identify the LUN. See the VDS_STORAGE_DEVICE_ID_DESCRIPTOR structure and the VDS_STORAGE_IDENTIFIER structure.
/// </summary>
public VDS_STORAGE_DEVICE_ID_DESCRIPTOR m_deviceIdDescriptor;
/// <summary>The number of interconnect ports specified in <c>m_rgInterconnects</c>.</summary>
public uint m_cInterconnects;
/// <summary>
/// Pointer to an array of the interconnect ports by which the LUN can be accessed. See the <see cref="VDS_INTERCONNECT"/> structure.
/// </summary>
public IntPtr m_rgInterconnects;
}
/// <summary>
/// <para>
/// [Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage
/// Management API.]
/// </para>
/// <para>Defines one or more storage identifiers for a storage device (typically an instance, as opposed to a class, of device).</para>
/// </summary>
/// <remarks>
/// Storage devices can have multiple identifiers, and each of these identifiers can have a different code set and type. The
/// VDS_LUN_INFORMATION structure includes this structure as a member to specify the storage device identifiers of a LUN.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vdslun/ns-vdslun-vds_storage_device_id_descriptor typedef struct
// _VDS_STORAGE_DEVICE_ID_DESCRIPTOR { ULONG m_version; ULONG m_cIdentifiers; VDS_STORAGE_IDENTIFIER *m_rgIdentifiers; } VDS_STORAGE_DEVICE_ID_DESCRIPTOR;
[PInvokeData("vdslun.h", MSDNShortId = "NS:vdslun._VDS_STORAGE_DEVICE_ID_DESCRIPTOR")]
[StructLayout(LayoutKind.Sequential)]
public struct VDS_STORAGE_DEVICE_ID_DESCRIPTOR
{
/// <summary>The version of this structure.</summary>
public uint m_version;
/// <summary>The number of identifiers specified in <c>m_rgIdentifiers</c>.</summary>
public uint m_cIdentifiers;
/// <summary>Pointer to <see cref="VDS_STORAGE_IDENTIFIER"/> structure.</summary>
public IntPtr m_rgIdentifiers;
}
/// <summary>
/// <para>
/// [Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage
/// Management API.]
/// </para>
/// <para>Defines a storage device using a particular code set and type.</para>
/// </summary>
/// <remarks>
/// The VDS_STORAGE_DEVICE_ID_DESCRIPTOR structure includes this structure as a member to specify a particular storage device identifier
/// for a LUN.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vdslun/ns-vdslun-vds_storage_identifier typedef struct _VDS_STORAGE_IDENTIFIER {
// VDS_STORAGE_IDENTIFIER_CODE_SET m_CodeSet; VDS_STORAGE_IDENTIFIER_TYPE m_Type; ULONG m_cbIdentifier; BYTE *m_rgbIdentifier; } VDS_STORAGE_IDENTIFIER;
[PInvokeData("vdslun.h", MSDNShortId = "NS:vdslun._VDS_STORAGE_IDENTIFIER")]
[StructLayout(LayoutKind.Sequential)]
public struct VDS_STORAGE_IDENTIFIER
{
/// <summary>The encoding type of <c>m_rgbIdentifier</c> enumerated by VDS_STORAGE_IDENTIFIER_CODE_SET.</summary>
public VDS_STORAGE_IDENTIFIER_CODE_SET m_CodeSet;
/// <summary>The type of <c>m_rgbIdentifier</c> enumerated by VDS_STORAGE_IDENTIFIER_TYPE.</summary>
public VDS_STORAGE_IDENTIFIER_TYPE m_Type;
/// <summary>The size of the <c>m_rgbIdentifier</c> array, in bytes.</summary>
public uint m_cbIdentifier;
/// <summary>Pointer to the identifier data.</summary>
public IntPtr m_rgbIdentifier;
}
}

152
PInvoke/VssApi/vsadmin.cs Normal file
View File

@ -0,0 +1,152 @@
using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke.VssApi
{
/// <summary>The <c>IVssAdmin</c> interface manages providers registered with VSS.</summary>
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nn-vsadmin-ivssadmin
[PInvokeData("vsadmin.h", MSDNShortId = "NN:vsadmin.IVssAdmin")]
[ComImport, Guid("77ED5996-2F63-11d3-8A39-00C04F72D8E3"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(VSSCoordinator))]
public interface IVssAdmin
{
/// <summary>The <c>RegisterProvider</c> method registers a new shadow copy provider.</summary>
/// <param name="pProviderId">
/// The <c>VSS_ID</c> that uniquely and persistently identifies the provider. After it is defined, the ProviderId parameter should
/// remain the same, even when the software revision is updated. A ProviderId parameter should be changed only when the
/// functionality changes enough that both providers would be active on the same system. A requester may use the ProviderId
/// parameter to request that a specific provider be used in a shadow copy creation.
/// </param>
/// <param name="ClassId">The CLSID of the provider.</param>
/// <param name="pwszProviderName">The name of the provider.</param>
/// <param name="eProviderType">
/// A VSS_PROVIDER_TYPE enumeration value that specifies the provider type. Note that <c>VSS_PROV_HARDWARE</c> is not a valid
/// provider type on Windows client operating system versions. Hardware providers will run only on Windows server operating system versions.
/// </param>
/// <param name="pwszProviderVersion">The version of the provider.</param>
/// <param name="ProviderVersionId">
/// The <c>VSS_ID</c> that uniquely identifies this version of the provider. The combination of the pProviderId and
/// ProviderVersionId parameters should be unique. The ProviderVersionId parameter can be the same as the ProviderVersionId
/// parameter of another provider.
/// </param>
/// <remarks>
/// <para>
/// If the hardware provider is updated, the setup application should call the UnregisterProvider method to unregister the outdated
/// version, and then call the <c>RegisterProvider</c> method to register the updated provider.
/// </para>
/// <para><c>Note</c> Hardware providers can only be registered on Windows Server operating systems.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-registerprovider HRESULT RegisterProvider( [in]
// VSS_ID pProviderId, [in] CLSID ClassId, [in] VSS_PWSZ pwszProviderName, [in] VSS_PROVIDER_TYPE eProviderType, [in] VSS_PWSZ
// pwszProviderVersion, [in] VSS_ID ProviderVersionId );
void RegisterProvider(Guid pProviderId, Guid ClassId, [MarshalAs(UnmanagedType.LPWStr)] string pwszProviderName,
VSS_PROVIDER_TYPE eProviderType, [MarshalAs(UnmanagedType.LPWStr)] string pwszProviderVersion, Guid ProviderVersionId);
/// <summary>The <c>UnregisterProvider</c> method unregisters an existing provider.</summary>
/// <param name="ProviderId">The <c>VSS_ID</c> of the provider.</param>
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-unregisterprovider HRESULT UnregisterProvider(
// [in] VSS_ID ProviderId );
void UnregisterProvider(Guid ProviderId);
/// <summary>The <c>QueryProviders</c> method queries all registered providers.</summary>
/// <returns>The address of an IVssEnumObject interface pointer, which is initialized on return. Callers must release the interface.</returns>
/// <remarks>
/// Calling the IVssEnumObject::Next method on the IVssEnumObject interface returned though the ppEnum parameter will return
/// VSS_OBJECT_PROP structures containing a VSS_PROVIDER_PROP structure for each registered provider.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-queryproviders HRESULT QueryProviders( [out]
// IVssEnumObject **ppEnum );
IVssEnumObject QueryProviders();
/// <summary>
/// <para>Not supported.</para>
/// <para>This method is reserved for system use.</para>
/// </summary>
/// <returns>None</returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-abortallsnapshotsinprogress HRESULT AbortAllSnapshotsInProgress();
void AbortAllSnapshotsInProgress();
}
/// <summary>Undocumented.</summary>
[ComImport, Guid("7858A9F8-B1FA-41a6-964F-B9B36B8CD8D8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(VSSCoordinator))]
public interface IVssAdminEx : IVssAdmin
{
/// <summary>The <c>RegisterProvider</c> method registers a new shadow copy provider.</summary>
/// <param name="pProviderId">
/// The <c>VSS_ID</c> that uniquely and persistently identifies the provider. After it is defined, the ProviderId parameter should
/// remain the same, even when the software revision is updated. A ProviderId parameter should be changed only when the
/// functionality changes enough that both providers would be active on the same system. A requester may use the ProviderId
/// parameter to request that a specific provider be used in a shadow copy creation.
/// </param>
/// <param name="ClassId">The CLSID of the provider.</param>
/// <param name="pwszProviderName">The name of the provider.</param>
/// <param name="eProviderType">
/// A VSS_PROVIDER_TYPE enumeration value that specifies the provider type. Note that <c>VSS_PROV_HARDWARE</c> is not a valid
/// provider type on Windows client operating system versions. Hardware providers will run only on Windows server operating system versions.
/// </param>
/// <param name="pwszProviderVersion">The version of the provider.</param>
/// <param name="ProviderVersionId">
/// The <c>VSS_ID</c> that uniquely identifies this version of the provider. The combination of the pProviderId and
/// ProviderVersionId parameters should be unique. The ProviderVersionId parameter can be the same as the ProviderVersionId
/// parameter of another provider.
/// </param>
/// <remarks>
/// <para>
/// If the hardware provider is updated, the setup application should call the UnregisterProvider method to unregister the outdated
/// version, and then call the <c>RegisterProvider</c> method to register the updated provider.
/// </para>
/// <para><c>Note</c> Hardware providers can only be registered on Windows Server operating systems.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-registerprovider HRESULT RegisterProvider( [in]
// VSS_ID pProviderId, [in] CLSID ClassId, [in] VSS_PWSZ pwszProviderName, [in] VSS_PROVIDER_TYPE eProviderType, [in] VSS_PWSZ
// pwszProviderVersion, [in] VSS_ID ProviderVersionId );
new void RegisterProvider(Guid pProviderId, Guid ClassId, [MarshalAs(UnmanagedType.LPWStr)] string pwszProviderName,
VSS_PROVIDER_TYPE eProviderType, [MarshalAs(UnmanagedType.LPWStr)] string pwszProviderVersion, Guid ProviderVersionId);
/// <summary>The <c>UnregisterProvider</c> method unregisters an existing provider.</summary>
/// <param name="ProviderId">The <c>VSS_ID</c> of the provider.</param>
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-unregisterprovider HRESULT UnregisterProvider(
// [in] VSS_ID ProviderId );
new void UnregisterProvider(Guid ProviderId);
/// <summary>The <c>QueryProviders</c> method queries all registered providers.</summary>
/// <returns>The address of an IVssEnumObject interface pointer, which is initialized on return. Callers must release the interface.</returns>
/// <remarks>
/// Calling the IVssEnumObject::Next method on the IVssEnumObject interface returned though the ppEnum parameter will return
/// VSS_OBJECT_PROP structures containing a VSS_PROVIDER_PROP structure for each registered provider.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-queryproviders HRESULT QueryProviders( [out]
// IVssEnumObject **ppEnum );
new IVssEnumObject QueryProviders();
/// <summary>
/// <para>Not supported.</para>
/// <para>This method is reserved for system use.</para>
/// </summary>
/// <returns>None</returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-abortallsnapshotsinprogress HRESULT AbortAllSnapshotsInProgress();
new void AbortAllSnapshotsInProgress();
/// <summary>Inform caller of features that provider supports</summary>
/// <param name="pProviderId">The provider identifier.</param>
/// <returns>The original capability mask</returns>
VSS_PROVIDER_CAPABILITIES GetProviderCapability(Guid pProviderId);
/// <summary>Retrieve persistent context of given provider</summary>
/// <param name="ProviderId">The provider identifier.</param>
/// <returns>The context</returns>
int GetProviderContext(Guid ProviderId);
/// <summary>
/// Set persistent context of specified provider The setting is persisted in registry by VSS It is automatically applied to the
/// snapshot context Requestors should NOT call this method
/// </summary>
/// <param name="ProviderId">The provider identifier.</param>
/// <param name="lContext">The context.</param>
void SetProviderContext(Guid ProviderId, int lContext);
}
/// <summary>CLSID_VSSCoordinator.</summary>
[ComImport, Guid("E579AB5F-1CC4-44b4-BED9-DE0991FF0623"), ClassInterface(ClassInterfaceType.None)]
public class VSSCoordinator
{ }
}

File diff suppressed because it is too large Load Diff

View File

@ -3,16 +3,8 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using Vanara.Collections;
namespace Vanara.PInvoke
namespace Vanara.PInvoke.VssApi
{
public static partial class VssApi
{
/// <summary>Denotes that no maximum space is specified in AddDiffArea or ChangeDiffAreaMaximumSize</summary>
public const long VSS_ASSOC_NO_MAX_SPACE = -1;
/// <summary>If this constant is specified in ChangeDiffAreaMaximumSize then the association is removed</summary>
public const long VSS_ASSOC_REMOVE = 0;
/// <summary>
/// The <c>VSS_MGMT_OBJECT_TYPE</c> enumeration type is a discriminant for the VSS_MGMT_OBJECT_UNION union within the
/// VSS_MGMT_OBJECT_PROP structure.
@ -31,15 +23,13 @@ namespace Vanara.PInvoke
/// <summary>The object is a volume to hold a shadow copy storage area.</summary>
VSS_MGMT_OBJECT_DIFF_VOLUME,
/// <summary>
/// The object is an association between a volume to be shadow copied and a volume to hold the shadow copy storage area.
/// </summary>
/// <summary>The object is an association between a volume to be shadow copied and a volume to hold the shadow copy storage area.</summary>
VSS_MGMT_OBJECT_DIFF_AREA,
}
/// <summary>
/// Defines the set of shadow copy protection faults. A shadow copy protection fault occurs when the VSS service is unable to
/// perform a copy-on-write operation to the shadow copy storage area (also called the diff area).
/// Defines the set of shadow copy protection faults. A shadow copy protection fault occurs when the VSS service is unable to perform a
/// copy-on-write operation to the shadow copy storage area (also called the diff area).
/// </summary>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/ne-vsmgmt-vss_protection_fault typedef enum _VSS_PROTECTION_FAULT {
// VSS_PROTECTION_FAULT_NONE, VSS_PROTECTION_FAULT_DIFF_AREA_MISSING, VSS_PROTECTION_FAULT_IO_FAILURE_DURING_ONLINE,
@ -56,8 +46,8 @@ namespace Vanara.PInvoke
VSS_PROTECTION_FAULT_NONE = 0,
/// <summary>
/// The volume that contains the shadow copy storage area could not be found. Usually this fault means that the volume has not
/// yet arrived in the system.
/// The volume that contains the shadow copy storage area could not be found. Usually this fault means that the volume has not yet
/// arrived in the system.
/// </summary>
VSS_PROTECTION_FAULT_DIFF_AREA_MISSING,
@ -68,20 +58,19 @@ namespace Vanara.PInvoke
VSS_PROTECTION_FAULT_META_DATA_CORRUPTION,
/// <summary>
/// A memory allocation failure occurred. This could be caused by a temporary low-memory condition that does not happen again
/// after you clear the fault and restart the shadow copy operation.
/// A memory allocation failure occurred. This could be caused by a temporary low-memory condition that does not happen again after
/// you clear the fault and restart the shadow copy operation.
/// </summary>
VSS_PROTECTION_FAULT_MEMORY_ALLOCATION_FAILURE,
/// <summary>
/// A memory mapping failure occurred. This fault could mean that the page file is too small, or it could be caused by a
/// low-memory condition.
/// A memory mapping failure occurred. This fault could mean that the page file is too small, or it could be caused by a low-memory condition.
/// </summary>
VSS_PROTECTION_FAULT_MAPPED_MEMORY_FAILURE,
/// <summary>
/// A read failure occurred during the copy-on-write operation when data was being copied from the live volume to the shadow
/// copy storage area volume.
/// A read failure occurred during the copy-on-write operation when data was being copied from the live volume to the shadow copy
/// storage area volume.
/// </summary>
VSS_PROTECTION_FAULT_COW_READ_FAILURE,
@ -98,9 +87,7 @@ namespace Vanara.PInvoke
/// </para>
/// <list type="bullet">
/// <item>
/// <term>
/// Delete unused shadow copy storage areas by calling the IVssDifferentialSoftwareSnapshotMgmt3::DeleteUnusedDiffAreas method.
/// </term>
/// <term>Delete unused shadow copy storage areas by calling the IVssDifferentialSoftwareSnapshotMgmt3::DeleteUnusedDiffAreas method.</term>
/// </item>
/// <item>
/// <term>
@ -175,8 +162,8 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>
/// Specifies that shadow copies must be maintained at the expense of I/O to the original volume. This protection level is
/// called "shadow copy protection mode." All I/O to the original volume will fail if both of the following conditions occur:
/// Specifies that shadow copies must be maintained at the expense of I/O to the original volume. This protection level is called
/// "shadow copy protection mode." All I/O to the original volume will fail if both of the following conditions occur:
/// </para>
/// <list type="bullet">
/// <item>
@ -184,8 +171,8 @@ namespace Vanara.PInvoke
/// </item>
/// <item>
/// <term>
/// The corresponding write to the shadow copy storage area cannot be completed for some reason, such as a failure to write to
/// the shadow copy storage area or a failure to allocate sufficient memory.
/// The corresponding write to the shadow copy storage area cannot be completed for some reason, such as a failure to write to the
/// shadow copy storage area or a failure to allocate sufficient memory.
/// </term>
/// </item>
/// </list>
@ -194,8 +181,8 @@ namespace Vanara.PInvoke
}
/// <summary>
/// The <c>IVssDifferentialSoftwareSnapshotMgmt</c> interface contains methods that allow applications to query and manage shadow
/// copy storage areas generated by the system shadow copy provider.
/// The <c>IVssDifferentialSoftwareSnapshotMgmt</c> interface contains methods that allow applications to query and manage shadow copy
/// storage areas generated by the system shadow copy provider.
/// </summary>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nn-vsmgmt-ivssdifferentialsoftwaresnapshotmgmt
[PInvokeData("vsmgmt.h", MSDNShortId = "NN:vsmgmt.IVssDifferentialSoftwareSnapshotMgmt")]
@ -203,13 +190,13 @@ namespace Vanara.PInvoke
public interface IVssDifferentialSoftwareSnapshotMgmt
{
/// <summary>
/// The <c>AddDiffArea</c> method adds a shadow copy storage area association for the specified volume. If the association is
/// not supported, an error code will be returned.
/// The <c>AddDiffArea</c> method adds a shadow copy storage area association for the specified volume. If the association is not
/// supported, an error code will be returned.
/// </summary>
/// <param name="pwszVolumeName">
/// <para>
/// The name of the volume that will be the source of shadow copies. This volume is associated with a shadow copy storage area
/// on the pwszDiffAreaVolumeName volume.
/// The name of the volume that will be the source of shadow copies. This volume is associated with a shadow copy storage area on
/// the pwszDiffAreaVolumeName volume.
/// </para>
/// <para>The name of the volume must be in one of the following formats and must include a trailing backslash (\):</para>
/// <list type="bullet">
@ -250,18 +237,18 @@ namespace Vanara.PInvoke
/// </param>
/// <remarks>
/// <para>
/// A shadow copy storage area association cannot be created if any shadow copies already exist for the pwszVolumeName volume or
/// if there is already a shadow copy storage area association for that volume.
/// A shadow copy storage area association cannot be created if any shadow copies already exist for the pwszVolumeName volume or if
/// there is already a shadow copy storage area association for that volume.
/// </para>
/// <para>
/// The shadow copy storage area for a virtual hard disk (VHD) source volume must reside on the same volume. Likewise, a shadow
/// copy storage area can only be created on a VHD volume if the source volume is the same for both volumes.
/// The shadow copy storage area for a virtual hard disk (VHD) source volume must reside on the same volume. Likewise, a shadow copy
/// storage area can only be created on a VHD volume if the source volume is the same for both volumes.
/// </para>
/// <para><c>Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:</c> VHDs are not supported.</para>
/// <para>
/// To change the size of a shadow copy storage area, use the IVssDifferentialSoftwareSnapshotMgmt::ChangeDiffAreaMaximumSize or
/// IVssDifferentialSoftwareSnapshotMgmt2::ChangeDiffAreaMaximumSizeEx method. You can delete a shadow copy storage area by
/// changing its size to zero.
/// IVssDifferentialSoftwareSnapshotMgmt2::ChangeDiffAreaMaximumSizeEx method. You can delete a shadow copy storage area by changing
/// its size to zero.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivssdifferentialsoftwaresnapshotmgmt-adddiffarea HRESULT
@ -271,8 +258,8 @@ namespace Vanara.PInvoke
long llMaximumDiffSpace);
/// <summary>
/// The <c>ChangeDiffAreaMaximumSize</c> method updates the shadow copy storage area maximum size for a certain volume. This may
/// not have an immediate effect.
/// The <c>ChangeDiffAreaMaximumSize</c> method updates the shadow copy storage area maximum size for a certain volume. This may not
/// have an immediate effect.
/// </summary>
/// <param name="pwszVolumeName">
/// <para>
@ -308,8 +295,8 @@ namespace Vanara.PInvoke
/// </list>
/// </param>
/// <param name="llMaximumDiffSpace">
/// Specifies the maximum size, in bytes, for the shadow copy storage area to use for the volume. If this value is zero, the
/// shadow copy storage area will be deleted. If this value is 1, the maximum size is unlimited.
/// Specifies the maximum size, in bytes, for the shadow copy storage area to use for the volume. If this value is zero, the shadow
/// copy storage area will be deleted. If this value is 1, the maximum size is unlimited.
/// </param>
/// <remarks>
/// <para>
@ -318,8 +305,8 @@ namespace Vanara.PInvoke
/// </para>
/// <para>If the shadow copy storage area does not exist, this method creates it.</para>
/// <para>
/// <c>Windows Server 2008, Windows Vista and Windows Server 2003:</c> If the shadow copy storage area does not exist, this
/// method does not create it.
/// <c>Windows Server 2008, Windows Vista and Windows Server 2003:</c> If the shadow copy storage area does not exist, this method
/// does not create it.
/// </para>
/// <para>To create a shadow copy storage area, use the IVssDifferentialSoftwareSnapshotMgmt::AddDiffArea method.</para>
/// </remarks>
@ -330,8 +317,8 @@ namespace Vanara.PInvoke
[MarshalAs(UnmanagedType.LPWStr)] string pwszDiffAreaVolumeName, long llMaximumDiffSpace);
/// <summary>
/// The <c>QueryVolumesSupportedForDiffAreas</c> method queries volumes that support shadow copy storage areas (including
/// volumes with disabled shadow copy storage areas).
/// The <c>QueryVolumesSupportedForDiffAreas</c> method queries volumes that support shadow copy storage areas (including volumes
/// with disabled shadow copy storage areas).
/// </summary>
/// <param name="pwszOriginalVolumeName">
/// <para>
@ -354,8 +341,8 @@ namespace Vanara.PInvoke
/// The address of an IVssEnumMgmtObject interface pointer, which is initialized on return. Callers must release the interface.
/// </returns>
/// <remarks>
/// The returned IVssEnumMgmtObject enumerator object will contain VSS_DIFF_VOLUME_PROP structures inside the
/// VSS_MGMT_OBJECT_UNION union inside the VSS_MGMT_OBJECT_PROP structure.
/// The returned IVssEnumMgmtObject enumerator object will contain VSS_DIFF_VOLUME_PROP structures inside the VSS_MGMT_OBJECT_UNION
/// union inside the VSS_MGMT_OBJECT_PROP structure.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivssdifferentialsoftwaresnapshotmgmt-queryvolumessupportedfordiffareas
// HRESULT QueryVolumesSupportedForDiffAreas( [in] VSS_PWSZ pwszOriginalVolumeName, [out] IVssEnumMgmtObject **ppEnum );
@ -381,16 +368,14 @@ namespace Vanara.PInvoke
/// The address of an IVssEnumMgmtObject interface pointer, which is initialized on return. Callers must release the interface.
/// </returns>
/// <remarks>
/// The returned IVssEnumMgmtObject enumerator object will contain VSS_DIFF_AREA_PROP structures inside the
/// VSS_MGMT_OBJECT_UNION union inside the VSS_MGMT_OBJECT_PROP structure.
/// The returned IVssEnumMgmtObject enumerator object will contain VSS_DIFF_AREA_PROP structures inside the VSS_MGMT_OBJECT_UNION
/// union inside the VSS_MGMT_OBJECT_PROP structure.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivssdifferentialsoftwaresnapshotmgmt-querydiffareasforvolume
// HRESULT QueryDiffAreasForVolume( [in] VSS_PWSZ pwszVolumeName, [out] IVssEnumMgmtObject **ppEnum );
IVssEnumMgmtObject QueryDiffAreasForVolume([MarshalAs(UnmanagedType.LPWStr)] string pwszVolumeName);
/// <summary>
/// The <c>QueryDiffAreasOnVolume</c> method queries shadow copy storage areas that physically reside on the given volume.
/// </summary>
/// <summary>The <c>QueryDiffAreasOnVolume</c> method queries shadow copy storage areas that physically reside on the given volume.</summary>
/// <param name="pwszVolumeName">
/// <para>Name of the volume that contains shadow copy storage areas.</para>
/// <para>The name of the volume must be in one of the following formats and must include a trailing backslash (\):</para>
@ -410,24 +395,24 @@ namespace Vanara.PInvoke
/// The address of an IVssEnumMgmtObject interface pointer, which is initialized on return. Callers must release the interface.
/// </returns>
/// <remarks>
/// The returned IVssEnumMgmtObject enumerator object will contain VSS_DIFF_AREA_PROP structures inside the
/// VSS_MGMT_OBJECT_UNION union inside the VSS_MGMT_OBJECT_PROP structure.
/// The returned IVssEnumMgmtObject enumerator object will contain VSS_DIFF_AREA_PROP structures inside the VSS_MGMT_OBJECT_UNION
/// union inside the VSS_MGMT_OBJECT_PROP structure.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivssdifferentialsoftwaresnapshotmgmt-querydiffareasonvolume
// HRESULT QueryDiffAreasOnVolume( [in] VSS_PWSZ pwszVolumeName, [out] IVssEnumMgmtObject **ppEnum );
IVssEnumMgmtObject QueryDiffAreasOnVolume([MarshalAs(UnmanagedType.LPWStr)] string pwszVolumeName);
/// <summary>
/// The <c>QueryDiffAreasForSnapshot</c> method queries shadow copy storage areas in use by the original volume associated with
/// the input shadow copy.
/// The <c>QueryDiffAreasForSnapshot</c> method queries shadow copy storage areas in use by the original volume associated with the
/// input shadow copy.
/// </summary>
/// <param name="SnapshotId">The <c>VSS_ID</c> of a shadow copy.</param>
/// <returns>
/// The address of an IVssEnumMgmtObject interface pointer, which is initialized on return. Callers must release the interface.
/// </returns>
/// <remarks>
/// The returned IVssEnumMgmtObject enumerator object will contain VSS_DIFF_AREA_PROP structures inside the
/// VSS_MGMT_OBJECT_UNION union inside the VSS_MGMT_OBJECT_PROP structure.
/// The returned IVssEnumMgmtObject enumerator object will contain VSS_DIFF_AREA_PROP structures inside the VSS_MGMT_OBJECT_UNION
/// union inside the VSS_MGMT_OBJECT_PROP structure.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivssdifferentialsoftwaresnapshotmgmt-querydiffareasforsnapshot
// HRESULT QueryDiffAreasForSnapshot( [in] VSS_ID SnapshotId, [out] IVssEnumMgmtObject **ppEnum );
@ -436,8 +421,7 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>
/// Defines additional methods that allow applications to query and manage shadow copy storage areas generated by the system shadow
/// copy provider.
/// Defines additional methods that allow applications to query and manage shadow copy storage areas generated by the system shadow copy provider.
/// </para>
/// <para>
/// To obtain an instance of the <c>IVssDifferentialSoftwareSnapshotMgmt2</c> interface, call the QueryInterface method of the
@ -451,8 +435,8 @@ namespace Vanara.PInvoke
public interface IVssDifferentialSoftwareSnapshotMgmt2 : IVssDifferentialSoftwareSnapshotMgmt
{
/// <summary>
/// Updates the shadow copy storage area maximum size for a certain volume. This may not have an immediate effect. If the
/// bVolatile parameter is <c>FALSE</c>, the change continues even if the computer is rebooted.
/// Updates the shadow copy storage area maximum size for a certain volume. This may not have an immediate effect. If the bVolatile
/// parameter is <c>FALSE</c>, the change continues even if the computer is rebooted.
/// </summary>
/// <param name="pwszVolumeName">
/// <para>
@ -488,13 +472,13 @@ namespace Vanara.PInvoke
/// </list>
/// </param>
/// <param name="llMaximumDiffSpace">
/// Specifies the maximum size, in bytes, for the shadow copy storage area to use for the volume. If this value is zero, the
/// shadow copy storage area will be deleted. If this value is 1, the maximum size is unlimited.
/// Specifies the maximum size, in bytes, for the shadow copy storage area to use for the volume. If this value is zero, the shadow
/// copy storage area will be deleted. If this value is 1, the maximum size is unlimited.
/// </param>
/// <param name="bVolatile">
/// <para>
/// TRUE to indicate that the effect of calling the <c>ChangeDiffAreaMaximumSizeEx</c> method should not continue if the
/// computer is rebooted; otherwise, <c>FALSE</c>.
/// TRUE to indicate that the effect of calling the <c>ChangeDiffAreaMaximumSizeEx</c> method should not continue if the computer is
/// rebooted; otherwise, <c>FALSE</c>.
/// </para>
/// <para>The default value is <c>FALSE</c>.</para>
/// <para>If the llMaximumDiffSpace parameter is zero, the bVolatile parameter must be <c>FALSE</c>.</para>
@ -505,17 +489,17 @@ namespace Vanara.PInvoke
/// IVssDifferentialSoftwareSnapshotMgmt::ChangeDiffAreaMaximumSize method except for the bVolatile parameter.
/// </para>
/// <para>
/// Calling the <c>ChangeDiffAreaMaximumSizeEx</c> method with the bVolatile parameter set to <c>FALSE</c> is the same as
/// calling the ChangeDiffAreaMaximumSize method.
/// Calling the <c>ChangeDiffAreaMaximumSizeEx</c> method with the bVolatile parameter set to <c>FALSE</c> is the same as calling
/// the ChangeDiffAreaMaximumSize method.
/// </para>
/// <para>
/// <c>ChangeDiffAreaMaximumSizeEx</c> makes the shadow copy storage area explicit, which means that it is not deleted
/// automatically when all shadow copies are deleted.
/// <c>ChangeDiffAreaMaximumSizeEx</c> makes the shadow copy storage area explicit, which means that it is not deleted automatically
/// when all shadow copies are deleted.
/// </para>
/// <para>If the shadow copy storage area does not exist, this method creates it.</para>
/// <para>
/// <c>Windows Server 2008, Windows Vista and Windows Server 2003:</c> If the shadow copy storage area does not exist, this
/// method does not create it.
/// <c>Windows Server 2008, Windows Vista and Windows Server 2003:</c> If the shadow copy storage area does not exist, this method
/// does not create it.
/// </para>
/// <para>To create a shadow copy storage area, use the IVssDifferentialSoftwareSnapshotMgmt::AddDiffArea method.</para>
/// </remarks>
@ -573,9 +557,9 @@ namespace Vanara.PInvoke
/// </summary>
/// <remarks>
/// <para>
/// An application with administrator privilege can use the SetVolumeProtectLevel method to specify a shadow copy protection level
/// for a volume and the separate volume that contains its shadow copy storage area. The same protection level should be set for
/// both volumes. The possible protection levels are defined by the VSS_PROTECTION_LEVEL enumeration.
/// An application with administrator privilege can use the SetVolumeProtectLevel method to specify a shadow copy protection level for a
/// volume and the separate volume that contains its shadow copy storage area. The same protection level should be set for both volumes.
/// The possible protection levels are defined by the VSS_PROTECTION_LEVEL enumeration.
/// </para>
/// <para>
/// When a volume protection fault occurs, the application must call the GetVolumeProtectLevel method for the volume to identify the
@ -603,9 +587,7 @@ namespace Vanara.PInvoke
/// </item>
/// </list>
/// </param>
/// <param name="protectionLevel">
/// A value from the VSS_PROTECTION_LEVEL enumeration that specifies the shadow copy protection level.
/// </param>
/// <param name="protectionLevel">A value from the VSS_PROTECTION_LEVEL enumeration that specifies the shadow copy protection level.</param>
/// <remarks>
/// <para>
/// The <c>SetVolumeProtectLevel</c> method checks the current shadow copy protection level of the volume. If the volume is in a
@ -617,8 +599,8 @@ namespace Vanara.PInvoke
/// <c>SetVolumeProtectLevel</c> does nothing.
/// </para>
/// <para>
/// If the value of the protectionLevel parameter is <c>VSS_PROTECTION_LEVEL_SNAPSHOT</c>, requesters must set shadow copy
/// storage area (diff area) associations using the IVssDifferentialSoftwareSnapshotMgmt::AddDiffArea method.
/// If the value of the protectionLevel parameter is <c>VSS_PROTECTION_LEVEL_SNAPSHOT</c>, requesters must set shadow copy storage
/// area (diff area) associations using the IVssDifferentialSoftwareSnapshotMgmt::AddDiffArea method.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivssdifferentialsoftwaresnapshotmgmt3-setvolumeprotectlevel
@ -642,19 +624,19 @@ namespace Vanara.PInvoke
/// </list>
/// </param>
/// <returns>
/// The address of a caller-allocated buffer that receives a VSS_VOLUME_PROTECTION_INFO structure containing information about
/// the volume's shadow copy protection level.
/// The address of a caller-allocated buffer that receives a VSS_VOLUME_PROTECTION_INFO structure containing information about the
/// volume's shadow copy protection level.
/// </returns>
/// <remarks>
/// <para>
/// The <c>GetVolumeProtectLevel</c> method gets information about the volume's current protection level. If the volume is in a
/// faulted state, the <c>m_protectionFault</c> member of the VSS_VOLUME_PROTECTION_INFO structure contains the current
/// protection fault, and the <c>m_failureStatus</c> member contains the reason why the volume is in a faulted state. If the
/// volume is not in a faulted state, the <c>m_protectionFault</c> and <c>m_failureStatus</c> members will be zero.
/// faulted state, the <c>m_protectionFault</c> member of the VSS_VOLUME_PROTECTION_INFO structure contains the current protection
/// fault, and the <c>m_failureStatus</c> member contains the reason why the volume is in a faulted state. If the volume is not in a
/// faulted state, the <c>m_protectionFault</c> and <c>m_failureStatus</c> members will be zero.
/// </para>
/// <para>
/// If the value of the protectionLevel parameter is <c>VSS_PROTECTION_LEVEL_SNAPSHOT</c>, requesters must set shadow copy
/// storage area (diff area) associations using the IVssDifferentialSoftwareSnapshotMgmt::AddDiffArea method.
/// If the value of the protectionLevel parameter is <c>VSS_PROTECTION_LEVEL_SNAPSHOT</c>, requesters must set shadow copy storage
/// area (diff area) associations using the IVssDifferentialSoftwareSnapshotMgmt::AddDiffArea method.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivssdifferentialsoftwaresnapshotmgmt3-getvolumeprotectlevel
@ -678,8 +660,8 @@ namespace Vanara.PInvoke
/// </list>
/// </param>
/// <remarks>
/// The <c>ClearVolumeProtectFault</c> method dismounts the volume and resets the volume's protection fault member to
/// <c>FALSE</c> to allow normal I/O to continue on the volume. If the volume is not in a faulted state, this method does nothing.
/// The <c>ClearVolumeProtectFault</c> method dismounts the volume and resets the volume's protection fault member to <c>FALSE</c>
/// to allow normal I/O to continue on the volume. If the volume is not in a faulted state, this method does nothing.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivssdifferentialsoftwaresnapshotmgmt3-clearvolumeprotectfault
// HRESULT ClearVolumeProtectFault( [in] VSS_PWSZ pwszVolumeName );
@ -702,9 +684,9 @@ namespace Vanara.PInvoke
/// </list>
/// </param>
/// <remarks>
/// Unused shadow copy storage area files are found on storage area volumes when the associated original volume is offline due
/// to a protection fault. In certain cases, the original volume may be permanently lost, and calling the
/// <c>DeleteUnusedDiffAreas</c> method is the only way to recover the abandoned storage area space.
/// Unused shadow copy storage area files are found on storage area volumes when the associated original volume is offline due to a
/// protection fault. In certain cases, the original volume may be permanently lost, and calling the <c>DeleteUnusedDiffAreas</c>
/// method is the only way to recover the abandoned storage area space.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivssdifferentialsoftwaresnapshotmgmt3-deleteunuseddiffareas
// HRESULT DeleteUnusedDiffAreas( [in] VSS_PWSZ pwszDiffAreaVolumeName );
@ -736,8 +718,8 @@ namespace Vanara.PInvoke
/// objects (such as strings) returned during enumeration.
/// </para>
/// <para>
/// The IVssDifferentialSoftwareSnapshotMgmt::QueryDiffAreasForSnapshot,
/// IVssDifferentialSoftwareSnapshotMgmt::QueryDiffAreasForVolume, IVssDifferentialSoftwareSnapshotMgmt::QueryDiffAreasOnVolume, and
/// The IVssDifferentialSoftwareSnapshotMgmt::QueryDiffAreasForSnapshot, IVssDifferentialSoftwareSnapshotMgmt::QueryDiffAreasForVolume,
/// IVssDifferentialSoftwareSnapshotMgmt::QueryDiffAreasOnVolume, and
/// IVssDifferentialSoftwareSnapshotMgmt::QueryVolumesSupportedForDiffAreas methods return an <c>IVssEnumMgmtObject</c> object.
/// </para>
/// </summary>
@ -749,13 +731,13 @@ namespace Vanara.PInvoke
/// <summary>The <c>Next</c> method returns the specified number of objects from the specified list of enumerated objects.</summary>
/// <param name="celt">The number of elements to be read from the list of enumerated objects into the rgelt buffer.</param>
/// <param name="rgelt">
/// The address of a caller-allocated buffer that receives celtVSS_MGMT_OBJECT_PROP structures that contain the returned
/// objects. This parameter is required and cannot be <c>NULL</c>.
/// The address of a caller-allocated buffer that receives celtVSS_MGMT_OBJECT_PROP structures that contain the returned objects.
/// This parameter is required and cannot be <c>NULL</c>.
/// </param>
/// <param name="pceltFetched">The number of elements that were returned in the rgelt buffer.</param>
/// <returns>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivssenummgmtobject-next HRESULT Next( [in] ULONG celt,
// [out] VSS_MGMT_OBJECT_PROP *rgelt, [out] ULONG *pceltFetched );
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivssenummgmtobject-next HRESULT Next( [in] ULONG celt, [out]
// VSS_MGMT_OBJECT_PROP *rgelt, [out] ULONG *pceltFetched );
[PreserveSig]
HRESULT Next(uint celt, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] VSS_MGMT_OBJECT_PROP[] rgelt, out uint pceltFetched);
@ -771,8 +753,8 @@ namespace Vanara.PInvoke
void Reset();
/// <summary>
/// The <c>Clone</c> method creates a copy of the specified list of enumerated elements by creating a copy of the
/// IVssEnumMgmtObject enumerator object.
/// The <c>Clone</c> method creates a copy of the specified list of enumerated elements by creating a copy of the IVssEnumMgmtObject
/// enumerator object.
/// </summary>
/// <returns>
/// Address of an IVssEnumMgmtObject interface pointer. Set the value of this parameter to <c>NULL</c> before calling this method.
@ -782,27 +764,23 @@ namespace Vanara.PInvoke
IVssEnumMgmtObject Clone();
}
/// <summary>Enumerates the <see cref="VSS_MGMT_OBJECT_PROP"/> instances provided by an <see cref="IVssEnumMgmtObject"/>.</summary>
/// <param name="emo">The <see cref="IVssEnumMgmtObject"/> instance.</param>
/// <returns>A sequence of <see cref="VSS_MGMT_OBJECT_PROP"/> structures.</returns>
public static IEnumerable<VSS_MGMT_OBJECT_PROP> Enumerate(this IVssEnumMgmtObject emo) => new IEnumFromCom<VSS_MGMT_OBJECT_PROP>(emo.Next, emo.Reset);
/// <summary>
/// The <c>IVssSnapshotMgmt</c> interface provides a method that returns an interface to further configure a shadow copy provider.
/// </summary>
/// <remarks>
/// <para>
/// The <c>IVssSnapshotMgmt</c> interface can be invoked remotely using DCOM. The caller must be a member of the local
/// administrators group on the remote machine.
/// The <c>IVssSnapshotMgmt</c> interface can be invoked remotely using DCOM. The caller must be a member of the local administrators
/// group on the remote machine.
/// </para>
/// <para>Examples</para>
/// <para>
/// <code lang="cpp"><![CDATA[#include "vss.h"
/// <code lang="cpp">
///<![CDATA[#include "vss.h"
///#include "vsmgmt.h"
///
///void main() {
/// // software-provider id is {b5946137-7b9f-4925-af80-51abd60b20d5}
/// const VSS_ID ProviderId = { 0xb5946137, 0x7b9f, 0x4925, { 0xaf,0x80,0x51,0xab,0xd6,0xb,0x20,0xd5 } };
/// const VSS_ID ProviderId = { 0xb5946137, 0x7b9f, 0x4925, { 0xaf,0x80,0x51,0xab,0xd6,0xb,0x20,0xd5 } }
/// HRESULT hr = S_OK;
/// IVssSnapshotMgmt* pMgmt = NULL;
/// IVssDifferentialSoftwareSnapshotMgmt* pDiffMgmt = NULL;
@ -821,7 +799,8 @@ namespace Vanara.PInvoke
/// // processing code
/// pDiffMgmt->Release();
/// pMgmt->Release();
/// }]]></code>
///}]]>
/// </code>
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nn-vsmgmt-ivsssnapshotmgmt
@ -851,8 +830,8 @@ namespace Vanara.PInvoke
/// <param name="ProviderId">Reserved for system use. Do not use.</param>
/// <param name="lContext">Reserved for system use. Do not use.</param>
/// <returns>Reserved for system use. Do not use.</returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivsssnapshotmgmt-queryvolumessupportedforsnapshots
// HRESULT QueryVolumesSupportedForSnapshots( [in] VSS_ID ProviderId, [in] LONG lContext, [out] IVssEnumMgmtObject **ppEnum );
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivsssnapshotmgmt-queryvolumessupportedforsnapshots HRESULT
// QueryVolumesSupportedForSnapshots( [in] VSS_ID ProviderId, [in] LONG lContext, [out] IVssEnumMgmtObject **ppEnum );
IVssEnumMgmtObject QueryVolumesSupportedForSnapshots(Guid ProviderId, int lContext);
/// <summary>
@ -867,12 +846,10 @@ namespace Vanara.PInvoke
IVssEnumObject QuerySnapshotsByVolume([MarshalAs(UnmanagedType.LPWStr)] string pwszVolumeName, Guid ProviderId);
}
/// <summary>
/// The <c>IVssSnapshotMgmt2</c> interface provides a method to retrieve the minimum size of the shadow copy storage area.
/// </summary>
/// <summary>The <c>IVssSnapshotMgmt2</c> interface provides a method to retrieve the minimum size of the shadow copy storage area.</summary>
/// <remarks>
/// To obtain an instance of the <c>IVssSnapshotMgmt2</c> interface, call the QueryInterface method of the IVssSnapshotMgmt
/// interface, passing <c>IID_IVssSnapshotMgmt2</c> as the riid parameter.
/// To obtain an instance of the <c>IVssSnapshotMgmt2</c> interface, call the QueryInterface method of the IVssSnapshotMgmt interface,
/// passing <c>IID_IVssSnapshotMgmt2</c> as the riid parameter.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nn-vsmgmt-ivsssnapshotmgmt2
[PInvokeData("vsmgmt.h", MSDNShortId = "NN:vsmgmt.IVssSnapshotMgmt2")]
@ -882,36 +859,14 @@ namespace Vanara.PInvoke
/// <summary>Returns the current minimum size of the shadow copy storage area.</summary>
/// <returns>A pointer to a variable that receives the minimum size, in bytes, of the shadow copy storage area.</returns>
/// <remarks>
/// The shadow copy storage area minimum size is a per-computer setting that is specified by the <c>MinDiffAreaFileSize</c>
/// registry key. For more information, see the entry for <c>MinDiffAreaFileSize</c> in Registry Keys and Values for Backup and Restore.
/// The shadow copy storage area minimum size is a per-computer setting that is specified by the <c>MinDiffAreaFileSize</c> registry
/// key. For more information, see the entry for <c>MinDiffAreaFileSize</c> in Registry Keys and Values for Backup and Restore.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/nf-vsmgmt-ivsssnapshotmgmt2-getmindiffareasize HRESULT
// GetMinDiffAreaSize( [out] LONGLONG *pllMinDiffAreaSize );
long GetMinDiffAreaSize();
}
/// <summary>The <c>GetProviderMgmtInterface</c> method returns an interface to further configure the system provider.</summary>
/// <param name="sm">The <see cref="IVssSnapshotMgmt"/> instance.</param>
/// <param name="ProviderId">
/// This must be the system provider. The <c>VSS_ID</c> for the system provider
/// <code>{b5946137-7b9f-4925-af80-51abd60b20d5}</code>
/// .
/// </param>
/// <returns>A IVssDifferentialSoftwareSnapshotMgmt interface instance.</returns>
public static IVssDifferentialSoftwareSnapshotMgmt GetProviderMgmtInterface(this IVssSnapshotMgmt sm, Guid ProviderId) =>
sm.GetProviderMgmtInterface<IVssDifferentialSoftwareSnapshotMgmt>(ProviderId);
/// <summary>The <c>GetProviderMgmtInterface</c> method returns an interface to further configure the system provider.</summary>
/// <typeparam name="T">
/// Must be <c>IID_IVssDifferentialSoftwareSnapshotMgmt</c>, which represents the IVssDifferentialSoftwareSnapshotMgmt interface.
/// </typeparam>
/// <param name="sm">The <see cref="IVssSnapshotMgmt"/> instance.</param>
/// <param name="ProviderId">
/// This must be the system provider. The <c>VSS_ID</c> for the system provider <c>{b5946137-7b9f-4925-af80-51abd60b20d5}</c> .
/// </param>
/// <returns>An interface pointer that is filled in with the returned interface pointer.</returns>
public static T GetProviderMgmtInterface<T>(this IVssSnapshotMgmt sm, Guid ProviderId) where T : class => (T)sm.GetProviderMgmtInterface(ProviderId, typeof(T).GUID);
/// <summary>
/// The <c>VSS_DIFF_AREA_PROP</c> structure describes associations between volumes containing the original file data and volumes
/// containing the shadow copy storage area (also known as the diff area).
@ -921,9 +876,9 @@ namespace Vanara.PInvoke
/// IVssDifferentialSoftwareSnapshotMgmt::ChangeDiffAreaMaximumSize, and
/// IVssDifferentialSoftwareSnapshotMgmt2::ChangeDiffAreaMaximumSizeEx methods.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/VsMgmt/ns-vsmgmt-vss_diff_area_prop typedef struct _VSS_DIFF_AREA_PROP {
// VSS_PWSZ m_pwszVolumeName; VSS_PWSZ m_pwszDiffAreaVolumeName; LONGLONG m_llMaximumDiffSpace; LONGLONG m_llAllocatedDiffSpace;
// LONGLONG m_llUsedDiffSpace; } VSS_DIFF_AREA_PROP, *PVSS_DIFF_AREA_PROP;
// https://docs.microsoft.com/en-us/windows/win32/api/VsMgmt/ns-vsmgmt-vss_diff_area_prop typedef struct _VSS_DIFF_AREA_PROP { VSS_PWSZ
// m_pwszVolumeName; VSS_PWSZ m_pwszDiffAreaVolumeName; LONGLONG m_llMaximumDiffSpace; LONGLONG m_llAllocatedDiffSpace; LONGLONG
// m_llUsedDiffSpace; } VSS_DIFF_AREA_PROP, *PVSS_DIFF_AREA_PROP;
[PInvokeData("vsmgmt.h", MSDNShortId = "NS:vsmgmt._VSS_DIFF_AREA_PROP")]
[StructLayout(LayoutKind.Sequential)]
public struct VSS_DIFF_AREA_PROP
@ -939,9 +894,7 @@ namespace Vanara.PInvoke
/// <summary>Maximum space used on the shadow copy storage area volume for this association.</summary>
public long m_llMaximumDiffSpace;
/// <summary>
/// Allocated space on the shadow copy storage area volume by this association. This must be less than or equal to m_llMaximumDiffSpace.
/// </summary>
/// <summary>Allocated space on the shadow copy storage area volume by this association. This must be less than or equal to m_llMaximumDiffSpace.</summary>
public long m_llAllocatedDiffSpace;
/// <summary>Used space from the allocated area above. This must be less than or equal to m_llAllocatedDiffSpace.</summary>
@ -961,8 +914,8 @@ namespace Vanara.PInvoke
public string m_pwszVolumeName;
/// <summary>
/// Points to a null-terminated Unicode string that can be displayed to a user, for example C <c>:\</c>, for the shadow copy
/// storage area volume.
/// Points to a null-terminated Unicode string that can be displayed to a user, for example C <c>:\</c>, for the shadow copy storage
/// area volume.
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]
public string m_pwszVolumeDisplayName;
@ -975,8 +928,7 @@ namespace Vanara.PInvoke
}
/// <summary>
/// The <c>VSS_MGMT_OBJECT_PROP</c> structure defines the properties of a volume, shadow copy storage volume, or a shadow copy
/// storage area.
/// The <c>VSS_MGMT_OBJECT_PROP</c> structure defines the properties of a volume, shadow copy storage volume, or a shadow copy storage area.
/// </summary>
// https://docs.microsoft.com/en-us/windows/win32/api/vsmgmt/ns-vsmgmt-vss_mgmt_object_prop typedef struct _VSS_MGMT_OBJECT_PROP {
// VSS_MGMT_OBJECT_TYPE Type; VSS_MGMT_OBJECT_UNION Obj; } VSS_MGMT_OBJECT_PROP, *PVSS_MGMT_OBJECT_PROP;
@ -993,8 +945,8 @@ namespace Vanara.PInvoke
/// information, see VSS_MGMT_OBJECT_UNION.)
/// </para>
/// <para>
/// It contains information for an object of the type specified by the <c>Type</c> member. Management objects can be volumes,
/// shadow copy storage volumes, or shadow copy storage areas.
/// It contains information for an object of the type specified by the <c>Type</c> member. Management objects can be volumes, shadow
/// copy storage volumes, or shadow copy storage areas.
/// </para>
/// </summary>
public VSS_MGMT_OBJECT_UNION Obj;
@ -1055,8 +1007,7 @@ namespace Vanara.PInvoke
public bool m_volumeIsOfflineForProtection;
/// <summary>
/// A value from the VSS_PROTECTION_FAULT enumeration that describes the shadow copy protection fault that caused the volume to
/// go offline.
/// A value from the VSS_PROTECTION_FAULT enumeration that describes the shadow copy protection fault that caused the volume to go offline.
/// </summary>
public VSS_PROTECTION_FAULT m_protectionFault;
@ -1071,8 +1022,39 @@ namespace Vanara.PInvoke
public uint m_reserved;
}
/// <summary>VSS extension methods.</summary>
public static partial class Extensions
{
/// <summary>Enumerates the <see cref="VSS_MGMT_OBJECT_PROP"/> instances provided by an <see cref="IVssEnumMgmtObject"/>.</summary>
/// <param name="emo">The <see cref="IVssEnumMgmtObject"/> instance.</param>
/// <returns>A sequence of <see cref="VSS_MGMT_OBJECT_PROP"/> structures.</returns>
public static IEnumerable<VSS_MGMT_OBJECT_PROP> Enumerate(this IVssEnumMgmtObject emo) => new IEnumFromCom<VSS_MGMT_OBJECT_PROP>(emo.Next, emo.Reset);
/// <summary>The <c>GetProviderMgmtInterface</c> method returns an interface to further configure the system provider.</summary>
/// <param name="sm">The <see cref="IVssSnapshotMgmt"/> instance.</param>
/// <param name="ProviderId">
/// This must be the system provider. The <c>VSS_ID</c> for the system provider
/// <code>{b5946137-7b9f-4925-af80-51abd60b20d5}</code>
/// .
/// </param>
/// <returns>A IVssDifferentialSoftwareSnapshotMgmt interface instance.</returns>
public static IVssDifferentialSoftwareSnapshotMgmt GetProviderMgmtInterface(this IVssSnapshotMgmt sm, Guid ProviderId) =>
sm.GetProviderMgmtInterface<IVssDifferentialSoftwareSnapshotMgmt>(ProviderId);
/// <summary>The <c>GetProviderMgmtInterface</c> method returns an interface to further configure the system provider.</summary>
/// <typeparam name="T">
/// Must be <c>IID_IVssDifferentialSoftwareSnapshotMgmt</c>, which represents the IVssDifferentialSoftwareSnapshotMgmt interface.
/// </typeparam>
/// <param name="sm">The <see cref="IVssSnapshotMgmt"/> instance.</param>
/// <param name="ProviderId">
/// This must be the system provider. The <c>VSS_ID</c> for the system provider <c>{b5946137-7b9f-4925-af80-51abd60b20d5}</c> .
/// </param>
/// <returns>An interface pointer that is filled in with the returned interface pointer.</returns>
public static T GetProviderMgmtInterface<T>(this IVssSnapshotMgmt sm, Guid ProviderId) where T : class => (T)sm.GetProviderMgmtInterface(ProviderId, typeof(T).GUID);
}
/// <summary>CLSID_VssSnapshotMgmt</summary>
[ComImport, Guid("0B5A2C52-3EB9-470a-96E2-6C6D4570E40F"), ClassInterface(ClassInterfaceType.None)]
public class VssSnapshotMgmt { }
}
public class VssSnapshotMgmt
{ }
}

2197
PInvoke/VssApi/vsprov.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,20 @@
using System;
using System.Runtime.InteropServices;
using Vanara.Collections;
using Vanara.InteropServices;
using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME;
namespace Vanara.PInvoke
namespace Vanara.PInvoke.VssApi
{
/// <summary>Functions, structures and constants from vssapi.dll.</summary>
public static partial class VssApi
{
private const string Lib_VssApi = "vssapi.dll";
/// <summary>
/// <para>
/// The <c>VSS_APPLICATION_LEVEL</c> 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.
/// The <c>VSS_APPLICATION_LEVEL</c> 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.
/// </para>
/// <para>
/// VSS first sends a Freeze event to writers initialized with <c>VSS_APP_FRONT_END</c> (called front-end level applications), then
/// to writers initialized with <c>VSS_APP_BACK_END</c> (called back-end level applications), and finally to writers initialized
/// with <c>VSS_APP_SYSTEM</c> (called system-level applications).
/// VSS first sends a Freeze event to writers initialized with <c>VSS_APP_FRONT_END</c> (called front-end level applications), then to
/// writers initialized with <c>VSS_APP_BACK_END</c> (called back-end level applications), and finally to writers initialized with
/// <c>VSS_APP_SYSTEM</c> (called system-level applications).
/// </para>
/// </summary>
/// <remarks>
@ -67,31 +63,31 @@ namespace Vanara.PInvoke
}
/// <summary>
/// The <c>VSS_BACKUP_SCHEMA</c> 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 <c>VSS_BACKUP_SCHEMA</c> values.
/// The <c>VSS_BACKUP_SCHEMA</c> 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 <c>VSS_BACKUP_SCHEMA</c> values.
/// </summary>
/// <remarks>
/// <para>Writer set their backup schemas with calls to IVssCreateWriterMetadata::SetBackupSchema.</para>
/// <para>Requesters use IVssExamineWriterMetadata::GetBackupSchema to determine the backup schema that a writer supports.</para>
/// <para>
/// 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 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.
/// </para>
/// <para>
/// For example, to involve a writer in an incremental backup operation, the requester must set the backup type to
/// <c>VSS_BT_INCREMENTAL</c>, and the writer should have a backup schema that includes <c>VSS_BS_INCREMENTAL</c>.
/// </para>
/// <para>
/// 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).
/// 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).
/// </para>
/// </remarks>
// 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,
// 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")]
@ -231,8 +227,8 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>
/// 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
/// 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
/// </para>
/// <para>IVssBackupComponentsEx::SetSelectedForRestoreEx</para>
/// <para>.</para>
@ -244,8 +240,7 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>
/// 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.
/// 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.
/// </para>
/// <para>Windows Server 2003:</para>
/// <para>This value is not supported until Windows Vista.</para>
@ -296,9 +291,8 @@ namespace Vanara.PInvoke
/// <para>An implementation of a backup type defined by a <c>VSS_BACKUP_TYPE</c> value must be done using the VSS API.</para>
/// <para>
/// This is particularly true in the case of incremental ( <c>VSS_BT_INCREMENTAL</c>) and differential ( <c>VSS_BT_DIFFERENTIAL</c>)
/// 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.
/// 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.
/// </para>
/// <para>
/// A requester may also use other more traditional techniques to implement an incremental or differential restore, but it must not
@ -398,8 +392,8 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>
/// The <c>VSS_FILE_SPEC_BACKUP_TYPE</c> 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).
/// The <c>VSS_FILE_SPEC_BACKUP_TYPE</c> 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).
/// </para>
/// <para>
/// File sets stored in the Writer Metadata Document are tagged with a bit mask (or bitwise OR) of <c>VSS_FILE_SPEC_BACKUP_TYPE</c>
@ -407,9 +401,7 @@ namespace Vanara.PInvoke
/// </para>
/// <list type="bullet">
/// <item>
/// <term>
/// Whether the writer and the requester have to evaluate a given file set for participation in the specified type of backup operations
/// </term>
/// <term>Whether the writer and the requester have to evaluate a given file set for participation in the specified type of backup operations</term>
/// </item>
/// <item>
/// <term>Whether backing up the specified file will require a shadow copy</term>
@ -418,9 +410,9 @@ namespace Vanara.PInvoke
/// </summary>
/// <remarks>
/// <para>
/// When a writer sets a backup-required value of the <c>VSS_FILE_SPEC_BACKUP_TYPE</c> 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.
/// When a writer sets a backup-required value of the <c>VSS_FILE_SPEC_BACKUP_TYPE</c> 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.
/// </para>
/// <para>
/// This setting can be overridden if a file is added to the Backup Components Document as a differenced file (using
@ -428,13 +420,13 @@ namespace Vanara.PInvoke
/// </para>
/// <para>
/// 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.
/// 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.
/// </para>
/// <para>
/// When a writer sets a shadow copy-required value of the <c>VSS_FILE_SPEC_BACKUP_TYPE</c> 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.
/// When a writer sets a shadow copy-required value of the <c>VSS_FILE_SPEC_BACKUP_TYPE</c> 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.
/// </para>
/// <para>Writers set <c>VSS_FILE_SPEC_BACKUP_TYPE</c> values while handling an Identify event (see CVssWriter::OnIdentify).</para>
/// <para>
@ -453,8 +445,8 @@ namespace Vanara.PInvoke
// 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;
// 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
@ -588,8 +580,8 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>
/// 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
/// 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
/// </para>
/// <para>IVssHardwareSnapshotProviderEx::OnLunStateChange</para>
/// <para>method.</para>
@ -608,8 +600,8 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>
/// 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
/// 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
/// </para>
/// <para>IVssHardwareSnapshotProviderEx::OnLunStateChange</para>
/// <para>method.</para>
@ -633,8 +625,8 @@ namespace Vanara.PInvoke
/// information. An input of <c>VSS_OBJECT_NONE</c> will return information about all objects.
/// </para>
/// <para>
/// In addition, <c>VSS_OBJECT_TYPE</c> is used as an input to IVssBackupComponents::DeleteSnapshots. However,
/// <c>DeleteSnapshots</c> accepts only <c>VSS_OBJECT_TYPE</c> values of <c>VSS_OBJECT_SNAPSHOT_SET</c> or <c>VSS_OBJECT_SNAPSHOT</c>.
/// In addition, <c>VSS_OBJECT_TYPE</c> is used as an input to IVssBackupComponents::DeleteSnapshots. However, <c>DeleteSnapshots</c>
/// accepts only <c>VSS_OBJECT_TYPE</c> values of <c>VSS_OBJECT_SNAPSHOT_SET</c> or <c>VSS_OBJECT_SNAPSHOT</c>.
/// </para>
/// <para>The <c>Type</c> member of VSS_OBJECT_PROP is a member of the <c>VSS_OBJECT_TYPE</c> enumeration.</para>
/// </remarks>
@ -684,7 +676,7 @@ namespace Vanara.PInvoke
// 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
public enum VSS_PROVIDER_CAPABILITIES : ulong
{
/// <summary/>
VSS_PRV_CAPABILITY_LEGACY = 0x001,
@ -718,8 +710,8 @@ namespace Vanara.PInvoke
}
/// <summary>The <c>VSS_PROVIDER_TYPE</c> enumeration specifies the provider type.</summary>
// 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;
// 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
{
@ -754,8 +746,8 @@ namespace Vanara.PInvoke
public enum VSS_RECOVERY_OPTIONS
{
/// <summary>
/// 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.
/// 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.
/// </summary>
VSS_RECOVERY_REVERT_IDENTITY_ALL = 0x100,
@ -770,8 +762,8 @@ namespace Vanara.PInvoke
/// <para>A requester can optionally set the type of a restore operation using IVssBackupComponents::SetRestoreState.</para>
/// <para>A writer can retrieve the type of a restore operation by calling CVssWriter::GetRestoreType.</para>
/// </remarks>
// 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;
// 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
{
@ -828,11 +820,11 @@ namespace Vanara.PInvoke
}
/// <summary>
/// The <c>VSS_SNAPSHOT_COMPATIBILITY</c> enumeration indicates which volume control or file I/O operations are disabled for the
/// volume that has been shadow copied.
/// The <c>VSS_SNAPSHOT_COMPATIBILITY</c> enumeration indicates which volume control or file I/O operations are disabled for the volume
/// that has been shadow copied.
/// </summary>
// 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;
// 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
@ -851,15 +843,15 @@ namespace Vanara.PInvoke
}
/// <summary>
/// The <c>_VSS_SNAPSHOT_CONTEXT</c> 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 <c>_VSS_SNAPSHOT_CONTEXT</c> 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.
/// </summary>
/// <remarks>
/// <para>The data type to be used with values of <c>_VSS_SNAPSHOT_CONTEXT</c> is <c>LONG</c>.</para>
/// <para>The default context for VSS shadow copies is <c>VSS_CTX_BACKUP</c>.</para>
/// <para>
/// <c>Windows XP:</c> The only supported context is the default, <c>VSS_CTX_BACKUP</c>. Calling IVssBackupComponents::SetContext
/// will return <c>E_NOTIMPL</c>.
/// <c>Windows XP:</c> The only supported context is the default, <c>VSS_CTX_BACKUP</c>. Calling IVssBackupComponents::SetContext will
/// return <c>E_NOTIMPL</c>.
/// </para>
/// <para>For details on how to use VSS shadow copies contexts, see Implementation Details for Creating Shadow Copies.</para>
/// <para>
@ -868,13 +860,13 @@ namespace Vanara.PInvoke
/// </para>
/// <para>
/// Currently, the only supported modifications are the bitwise OR of a <c>_VSS_SNAPSHOT_CONTEXT</c> value with the
/// <c>VSS_VOLSNAP_ATTR_TRANSPORTABLE</c> and either the <c>VSS_VOLSNAP_ATTR_DIFFERENTIAL</c> or the <c>VSS_VOLSNAP_ATTR_PLEX</c>
/// value of the _VSS_VOLUME_SNAPSHOT_ATTRIBUTES enumeration.
/// <c>VSS_VOLSNAP_ATTR_TRANSPORTABLE</c> and either the <c>VSS_VOLSNAP_ATTR_DIFFERENTIAL</c> or the <c>VSS_VOLSNAP_ATTR_PLEX</c> value
/// of the _VSS_VOLUME_SNAPSHOT_ATTRIBUTES enumeration.
/// </para>
/// <para>However, these values cannot be used to modify <c>VSS_CTX_CLIENT_ACCESSIBLE</c> context.</para>
/// <para>
/// The use of <c>VSS_VOLSNAP_ATTR_TRANSPORTABLE</c> is limited to systems running Windows Server 2008 Enterprise, Windows Server
/// 2008 Datacenter, Windows Server 2003, Enterprise Edition, or Windows Server 2003, Datacenter Edition.
/// The use of <c>VSS_VOLSNAP_ATTR_TRANSPORTABLE</c> is limited to systems running Windows Server 2008 Enterprise, Windows Server 2008
/// Datacenter, Windows Server 2003, Enterprise Edition, or Windows Server 2003, Datacenter Edition.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vss/ne-vss-vss_snapshot_context typedef enum _VSS_SNAPSHOT_CONTEXT {
@ -918,8 +910,8 @@ namespace Vanara.PInvoke
/// <para>Specifies a read-only,</para>
/// <para>client-accessible shadow copy</para>
/// <para>
/// 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.
/// 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.
/// </para>
/// <para>Most requesters will want to use the</para>
/// <para>VSS_CTX_NAS_ROLLBACK</para>
@ -931,8 +923,8 @@ namespace Vanara.PInvoke
/// <para>Specifies a read-only,</para>
/// <para>client-accessible shadow copy</para>
/// <para>
/// that is created with writer involvement. Only the system provider (the default provider available on the system) can create
/// this type of 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.
/// </para>
/// <para>Most requesters will want to use the</para>
/// <para>VSS_CTX_APP_ROLLBACK</para>
@ -957,31 +949,152 @@ namespace Vanara.PInvoke
VSS_CTX_ALL = 0xffffffff,
}
/// <summary>Specifies the property to be set for a shadow copy.</summary>
// 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
{
/// <summary>
/// The <c>VSS_SNAPSHOT_STATE</c> enumeration is returned by a provider to specify the state of a given shadow copy operation.
/// <para>The property is not known.</para>
/// <para>This value indicates an application error.</para>
/// </summary>
VSS_SPROPID_UNKNOWN,
/// <summary>
/// <para>The shadow copy identifier. For more information, see the</para>
/// <para>m_SnapshotId</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_SNAPSHOT_ID,
/// <summary>
/// <para>The shadow copy set identifier. For more information, see the</para>
/// <para>m_SnapshotSetId</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_SNAPSHOT_SET_ID,
/// <summary>
/// <para>The number of volumes included with the shadow copy in the shadow copy set when it was created. For more</para>
/// <para>information, see the</para>
/// <para>m_lSnapshotsCount</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_SNAPSHOTS_COUNT,
/// <summary>
/// <para>Null-terminated wide character string that specifies the name of the device object for the shadow copy of the</para>
/// <para>volume. For more information, see the</para>
/// <para>m_pwszSnapshotDeviceObject</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_SNAPSHOT_DEVICE,
/// <summary>
/// <para>A null-terminated wide character string that specifies the name of the original volume. For more information, see the</para>
/// <para>m_pwszOriginalVolumeName</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_ORIGINAL_VOLUME,
/// <summary>
/// <para>A null-terminated wide character string that specifies the name of the machine that contains the original</para>
/// <para>volume. For more information, see the</para>
/// <para>m_pwszOriginatingMachine</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_ORIGINATING_MACHINE,
/// <summary>
/// <para>A null-terminated wide character string that specifies the name of the machine that is running the Volume Shadow Copy</para>
/// <para>Service that created the shadow copy. For more information, see the</para>
/// <para>m_pwszServiceMachine</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_SERVICE_MACHINE,
/// <summary>
/// <para>A null-terminated wide character string that specifies the name of the shadow copy when it is exposed. For more information, see the</para>
/// <para>m_pwszExposedName</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_EXPOSED_NAME,
/// <summary>
/// <para>A null-terminated wide character string that specifies the portion of the volume that is made available</para>
/// <para>when the shadow copy is exposed as a file share. For more information, see the</para>
/// <para>m_pwszExposedPath</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_EXPOSED_PATH,
/// <summary>
/// <para>The provider identifier. For more information, see the</para>
/// <para>m_ProviderId</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_PROVIDER_ID,
/// <summary>
/// <para>A bitmask of</para>
/// <para>_VSS_VOLUME_SNAPSHOT_ATTRIBUTES</para>
/// <para>values that specify the properties of the shadow copy. For more information, see the</para>
/// <para>m_lSnapshotAttributes</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_SNAPSHOT_ATTRIBUTES,
/// <summary>
/// <para>A time stamp that specifies when the shadow copy was created. For more information, see the</para>
/// <para>m_tsCreationTimestamp</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_CREATION_TIMESTAMP,
/// <summary>
/// <para>The status of the current shadow copy creation operation. For more information, see the</para>
/// <para>m_eStatus</para>
/// <para>member of the</para>
/// <para>VSS_SNAPSHOT_PROP</para>
/// <para>structure.</para>
/// </summary>
VSS_SPROPID_STATUS,
}
/// <summary>The <c>VSS_SNAPSHOT_STATE</c> enumeration is returned by a provider to specify the state of a given shadow copy operation.</summary>
/// <remarks>
/// <para>
/// The shadow copy state is contained in the <c>m_eStatus</c> member of a VSS_SNAPSHOT_PROP object, which can be obtained for a
/// single shadow copy by calling IVssBackupComponents::GetSnapshotProperties.
/// The shadow copy state is contained in the <c>m_eStatus</c> member of a VSS_SNAPSHOT_PROP object, which can be obtained for a single
/// shadow copy by calling IVssBackupComponents::GetSnapshotProperties.
/// </para>
/// <para>
/// Because IVssBackupComponents::GetSnapshotProperties fails during shadow copy creation with <c>VSS_E_OBJECT_NOT_FOUND</c>, a
/// requester cannot obtain any <c>VSS_SNAPSHOT_STATE</c> value other than <c>VSS_SS_CREATED</c>.
/// </para>
/// <para>
/// Calls to IVssBackupComponents::Query can also be used to obtain the shadow copy state. <c>IVssBackupComponents::Query</c> 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 <c>IVssBackupComponents::Query</c> method can return only a shadow copy state
/// of <c>VSS_SS_CREATED</c>.
/// Calls to IVssBackupComponents::Query can also be used to obtain the shadow copy state. <c>IVssBackupComponents::Query</c> 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 <c>IVssBackupComponents::Query</c> method can return only a shadow copy state of <c>VSS_SS_CREATED</c>.
/// </para>
/// </remarks>
// 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;
// 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
{
@ -1087,22 +1200,22 @@ namespace Vanara.PInvoke
/// <remarks>
/// <para>The default context for VSS shadow copies is VSS_CTX_BACKUP.</para>
/// <para>
/// 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.
/// 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.
/// </para>
/// <para>
/// Requesters can modify this context by using a bitwise OR of the _VSS_SNAPSHOT_CONTEXT value with a supported value from the
/// <c>_VSS_VOLUME_SNAPSHOT_ATTRIBUTES</c> enumeration as an argument to IVssBackupComponents::SetContext.
/// </para>
/// <para>
/// 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 ( <c>VSS_VOLSNAP_ATTR_DIFFERENTIAL</c>), a PLEX mechanism ( <c>VSS_VOLSNAP_ATTR_PLEX</c>), or any other mechanism to
/// support the shadow copy.
/// 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 (
/// <c>VSS_VOLSNAP_ATTR_DIFFERENTIAL</c>), a PLEX mechanism ( <c>VSS_VOLSNAP_ATTR_PLEX</c>), or any other mechanism to support the
/// shadow copy.
/// </para>
/// <para>
/// While a provider can support both mechanisms, they are mutually exclusive for a given shadow copy. Requesters should not use
/// both <c>VSS_VOLSNAP_ATTR_DIFFERENTIAL</c> and <c>VSS_VOLSNAP_ATTR_PLEX</c> to modify a specific shadow copy context.
/// While a provider can support both mechanisms, they are mutually exclusive for a given shadow copy. Requesters should not use both
/// <c>VSS_VOLSNAP_ATTR_DIFFERENTIAL</c> and <c>VSS_VOLSNAP_ATTR_PLEX</c> to modify a specific shadow copy context.
/// </para>
/// <para>
/// Currently, <c>VSS_VOLSNAP_ATTR_DIFFERENTIAL</c>, <c>VSS_VOLSNAP_ATTR_PLEX</c>, and <c>VSS_VOLSNAP_ATTR_TRANSPORTABLE</c> are the
@ -1110,12 +1223,12 @@ namespace Vanara.PInvoke
/// </para>
/// <para>In addition, it cannot be used to modify a <c>VSS_CTX_CLIENT_ACCESSIBLE</c> context.</para>
/// <para>
/// 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 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.
/// </para>
/// <para>
/// 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.
/// 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.
/// </para>
/// <para>
/// The shadow copies' context and attributes are found as a bit mask contained in the <c>m_lSnapshotAttributes</c> member of the
@ -1123,13 +1236,12 @@ namespace Vanara.PInvoke
/// </para>
/// </remarks>
// 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;
// _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
@ -1155,14 +1267,14 @@ namespace Vanara.PInvoke
/// <para>Auto-recovery</para>
/// <para>is disabled for the shadow copy.</para>
/// <para>
/// 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
/// 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.
/// </para>
/// <para>
/// 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.
/// 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.
/// </para>
/// <para>
/// Disabling auto-recovery also prevents writers from excluding files from the shadow copy. When auto-recovery is disabled, a
@ -1247,12 +1359,12 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>The shadow copy is not transacted.</para>
/// <para>
/// 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.
/// 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.
/// </para>
/// <para>
/// 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.
/// 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.
/// </para>
/// <para>Windows Server 2003 and Windows XP:</para>
/// <para>This value is not supported until Windows Vista.</para>
@ -1341,8 +1453,8 @@ namespace Vanara.PInvoke
/// <para>CVssWriter::OnPostSnapshot</para>
/// <para>if the shadow copy is being used for rollback (for data mining, for example).</para>
/// <para>
/// 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.
/// 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.
/// </para>
/// </summary>
VSS_VOLSNAP_ATTR_ROLLBACK_RECOVERY = 0x800000,
@ -1369,10 +1481,9 @@ namespace Vanara.PInvoke
/// <remarks>A requester determines the state of a writer through IVssBackupComponents::GetWriterStatus.</remarks>
// 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;
// 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
{
@ -1465,16 +1576,16 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>
/// The <c>IVssAsync</c> 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 <c>IVssAsync</c> 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.
/// </para>
/// <para>
/// The <c>IVssAsync</c> interface permits an application to monitor and control an asynchronous operation by waiting on its
/// completion, querying its status, or canceling it.
/// The <c>IVssAsync</c> interface permits an application to monitor and control an asynchronous operation by waiting on its completion,
/// querying its status, or canceling it.
/// </para>
/// <para>
/// The calling application is responsible for calling IUnknown::Release to release the resources held by the returned
/// <c>IVssAsync</c> interface when it is no longer needed.
/// The calling application is responsible for calling IUnknown::Release to release the resources held by the returned <c>IVssAsync</c>
/// interface when it is no longer needed.
/// </para>
/// <para>The following methods return an <c>IVssAsync</c> interface:</para>
/// <list type="bullet">
@ -1532,9 +1643,9 @@ namespace Vanara.PInvoke
/// <item>
/// <term>VSS_E_UNEXPECTED</term>
/// <term>
/// 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.
/// 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.
/// </term>
/// </item>
/// </list>
@ -1556,8 +1667,8 @@ namespace Vanara.PInvoke
/// <para>Length of time, in milliseconds, that the method will wait for an asynchronous process to return before timing out.</para>
/// <para>The default value for this argument is INFINITE.</para>
/// <para>
/// <c>Windows Server 2003:</c> This parameter is reserved and must be INFINITE. If any other value is specified for this
/// parameter, the call to <c>Wait</c> fails with E_INVALIDARG.
/// <c>Windows Server 2003:</c> This parameter is reserved and must be INFINITE. If any other value is specified for this parameter,
/// the call to <c>Wait</c> fails with E_INVALIDARG.
/// </para>
/// <para><c>Windows XP:</c> This method has no parameters.</para>
/// </param>
@ -1579,9 +1690,9 @@ namespace Vanara.PInvoke
/// <item>
/// <term>VSS_E_UNEXPECTED</term>
/// <term>
/// 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.
/// 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.
/// </term>
/// </item>
/// </list>
@ -1645,21 +1756,21 @@ namespace Vanara.PInvoke
/// <item>
/// <term>VSS_E_UNEXPECTED</term>
/// <term>
/// 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.
/// 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.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// In the event of an error during the course of an asynchronous operation, <c>QueryStatus</c> will return the same error code
/// as the method that initially returned the IVssAsync object.
/// In the event of an error during the course of an asynchronous operation, <c>QueryStatus</c> will return the same error code as
/// the method that initially returned the IVssAsync object.
/// </para>
/// <para>
/// To obtain a complete list of return values for an <c>IVssAsync::QueryStatus</c> object returned by a specific method, see
/// the error codes documented for that method.
/// To obtain a complete list of return values for an <c>IVssAsync::QueryStatus</c> object returned by a specific method, see the
/// error codes documented for that method.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vss/nf-vss-ivssasync-querystatus HRESULT QueryStatus( [out] HRESULT
@ -1674,8 +1785,8 @@ namespace Vanara.PInvoke
/// </para>
/// <para>
/// The calling application is responsible for calling IUnknown::Release to release the resources held by the returned
/// <c>IVssEnumObject</c> when it is no longer needed. It may also need to call <c>IUnknown::Release</c> to release temporary
/// objects (such as strings) returned during enumeration.
/// <c>IVssEnumObject</c> when it is no longer needed. It may also need to call <c>IUnknown::Release</c> to release temporary objects
/// (such as strings) returned during enumeration.
/// </para>
/// <para>The IVssBackupComponents::Query method returns an <c>IVssEnumObject</c> object.</para>
/// </summary>
@ -1687,8 +1798,8 @@ namespace Vanara.PInvoke
/// <summary>The <c>Next</c> method returns the specified number of objects from the specified list of enumerated objects.</summary>
/// <param name="celt">The number of elements to be read from the list of enumerated objects into the rgelt buffer.</param>
/// <param name="rgelt">
/// 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 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.
/// </param>
/// <param name="pceltFetched">The number of elements that were returned in the rgelt buffer.</param>
/// <returns>
@ -1730,8 +1841,8 @@ namespace Vanara.PInvoke
/// structure pointed to by the rgelt parameter.
/// </para>
/// <para>
/// 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.
/// 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.
/// </para>
/// <para>
/// In the case of VSS_SNAPSHOT_PROP, this can be done manually, or the utility function VssFreeSnapshotProperties can be used.
@ -1778,8 +1889,8 @@ namespace Vanara.PInvoke
/// enumerator object.
/// </summary>
/// <returns>
/// Doubly indirect pointer to an IVssEnumObject enumerator object. Set the value of this parameter to <c>NULL</c> before
/// calling this method.
/// Doubly indirect pointer to an IVssEnumObject enumerator object. Set the value of this parameter to <c>NULL</c> before calling
/// this method.
/// </returns>
/// <remarks>
/// <para>The cloned enumerator object will refer to the same list of VSS_OBJECT_PROP structures.</para>
@ -1791,24 +1902,22 @@ namespace Vanara.PInvoke
// https://docs.microsoft.com/en-us/windows/win32/api/vss/nf-vss-ivssenumobject-clone HRESULT Clone( [in, out] IVssEnumObject
// **ppenum );
IVssEnumObject Clone();
};
}
/// <summary>The <c>VSS_OBJECT_PROP</c> structure defines the properties of a provider, volume, shadow copy, or shadow copy set.</summary>
/// <remarks>
/// <para>
/// A requester obtains <c>VSS_OBJECT_PROP</c> structures by using IVssEnumObject::Next to iterate over the list of objects returned
/// by a call to IVssBackupComponents::Query.
/// A requester obtains <c>VSS_OBJECT_PROP</c> structures by using IVssEnumObject::Next to iterate over the list of objects returned by
/// a call to IVssBackupComponents::Query.
/// </para>
/// <para>
/// 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.
/// </para>
/// <para>
/// In the case of VSS_SNAPSHOT_PROP, this can be done manually, or the utility function VssFreeSnapshotProperties can be used.
/// 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.
/// </para>
/// <para>In the case of VSS_SNAPSHOT_PROP, this can be done manually, or the utility function VssFreeSnapshotProperties can be used.</para>
/// </remarks>
// 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;
// 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
@ -1819,8 +1928,8 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>Object properties: a union of VSS_SNAPSHOT_PROP and VSS_PROVIDER_PROP structures. (See VSS_OBJECT_UNION.)</para>
/// <para>
/// It contains information for an object of the type specified by the <c>Type</c> member of the <c>VSS_OBJECT_PROP</c>
/// structure. Objects can be providers, volumes, shadow copies, or shadow copy sets.
/// It contains information for an object of the type specified by the <c>Type</c> member of the <c>VSS_OBJECT_PROP</c> structure.
/// Objects can be providers, volumes, shadow copies, or shadow copy sets.
/// </para>
/// </summary>
public VSS_OBJECT_UNION Obj;
@ -1838,8 +1947,8 @@ namespace Vanara.PInvoke
public VSS_SNAPSHOT_PROP Snap;
/// <summary>
/// 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.
/// 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.
/// </summary>
[FieldOffset(0)]
public VSS_PROVIDER_PROP Prov;
@ -1856,15 +1965,14 @@ namespace Vanara.PInvoke
/// <summary>Identifies the provider who supports shadow copies of this class.</summary>
public Guid m_ProviderId;
/// <summary>Null-terminated wide character string containing the provider name.</summary>
[MarshalAs(UnmanagedType.LPWStr)]
public string m_pwszProviderName;
/// <summary>String containing the provider name.</summary>
public StrPtrUni m_pwszProviderName;
/// <summary>Provider type. See VSS_PROVIDER_TYPE for more information.</summary>
public VSS_PROVIDER_TYPE m_eProviderType;
/// <summary>Null-terminated wide character string containing the provider version in readable format.</summary>
[MarshalAs(UnmanagedType.LPWStr)] public string m_pwszProviderVersion;
/// <summary>String containing the provider version in readable format.</summary>
public StrPtrUni m_pwszProviderVersion;
/// <summary>A VSS_ID (GUID) uniquely identifying the version of a provider.</summary>
public Guid m_ProviderVersionId;
@ -1882,8 +1990,8 @@ namespace Vanara.PInvoke
/// </para>
/// <para>
/// The shadow copy device object contained in <c>m_pwszSnapshotDeviceObject</c> 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 " <c>m_pwszSnapshotDeviceObject</c>"+"\topleveldir\File.html".
/// 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 " <c>m_pwszSnapshotDeviceObject</c>"+"\topleveldir\File.html".
/// </para>
/// <para>
/// When a shadow copy is exposed as a share, the value of <c>m_pwszExposedName</c> will be the share name. When the shadow copy is
@ -1891,19 +1999,18 @@ namespace Vanara.PInvoke
/// example, "X:" or a mounted folder path (for example, "Y:\MountX").
/// </para>
/// <para>
/// 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, <c>m_pwszExposedPath</c> will be null.
/// 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, <c>m_pwszExposedPath</c> will be null.
/// </para>
/// <para>
/// If the shadow copy is exposed as a share, the value of <c>m_pwszExposedPath</c> will be the path to the portion of the volume
/// that is shared.
/// If the shadow copy is exposed as a share, the value of <c>m_pwszExposedPath</c> will be the path to the portion of the volume that
/// is shared.
/// </para>
/// </remarks>
// 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;
// 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
@ -1917,8 +2024,8 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>
/// 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 <c>m_LSnapshotsCount</c>.
/// 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 <c>m_LSnapshotsCount</c>.
/// </para>
/// <para>The maximum number of shadow-copied volumes permitted in a shadow copy set is 64.</para>
/// </summary>
@ -1926,44 +2033,35 @@ namespace Vanara.PInvoke
/// <summary>
/// <para>
/// Null-terminated wide character 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.
/// 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.
/// </para>
/// <para>The device name does not contain a trailing "".</para>
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]
public string m_pwszSnapshotDeviceObject;
public StrPtrUni m_pwszSnapshotDeviceObject;
/// <summary>Null-terminated wide character string containing the name of the volume that had been shadow copied.</summary>
[MarshalAs(UnmanagedType.LPWStr)]
public string m_pwszOriginalVolumeName;
/// <summary>String containing the name of the volume that had been shadow copied.</summary>
public StrPtrUni m_pwszOriginalVolumeName;
/// <summary>Null-terminated wide character string containing the name of the machine containing the original volume.</summary>
[MarshalAs(UnmanagedType.LPWStr)]
public string m_pwszOriginatingMachine;
/// <summary>String containing the name of the machine containing the original volume.</summary>
public StrPtrUni m_pwszOriginatingMachine;
/// <summary>String containing the name of the machine running the Volume Shadow Copy Service that created the shadow copy.</summary>
public StrPtrUni m_pwszServiceMachine;
/// <summary>
/// Null-terminated wide character string containing the name of the machine running the Volume Shadow Copy Service that created
/// the shadow copy.
/// 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.
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]
public string m_pwszServiceMachine;
public StrPtrUni m_pwszExposedName;
/// <summary>
/// Null-terminated wide character 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.
/// 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.
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]
public string m_pwszExposedName;
/// <summary>
/// Null-terminated wide character 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.
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]
public string m_pwszExposedPath;
public StrPtrUni m_pwszExposedPath;
/// <summary>A VSS_ID (GUID) uniquely identifying the provider used to create this shadow copy.</summary>
public Guid m_ProviderId;
@ -1971,7 +2069,7 @@ namespace Vanara.PInvoke
/// <summary>
/// The attributes of the shadow copy expressed as a bit mask (or bitwise OR) of members of the _VSS_VOLUME_SNAPSHOT_ATTRIBUTES enumeration.
/// </summary>
public int m_lSnapshotAttributes;
public VSS_VOLUME_SNAPSHOT_ATTRIBUTES m_lSnapshotAttributes;
/// <summary>
/// Time stamp indicating when the shadow copy was created. The exact time is determined by the provider. See VSS_TIMESTAMP for
@ -1983,4 +2081,3 @@ namespace Vanara.PInvoke
public VSS_SNAPSHOT_STATE m_eStatus;
}
}
}

File diff suppressed because it is too large Load Diff