namespace Vanara.PInvoke.VssApi;
/// The IVssAdmin interface manages providers registered with VSS.
// 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
{
/// The RegisterProvider method registers a new shadow copy provider.
///
/// The VSS_ID 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.
///
/// The CLSID of the provider.
/// The name of the provider.
///
/// A VSS_PROVIDER_TYPE enumeration value that specifies the provider type. Note that VSS_PROV_HARDWARE is not a valid
/// provider type on Windows client operating system versions. Hardware providers will run only on Windows server operating system versions.
///
/// The version of the provider.
///
/// The VSS_ID 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.
///
///
///
/// If the hardware provider is updated, the setup application should call the UnregisterProvider method to unregister the outdated
/// version, and then call the RegisterProvider method to register the updated provider.
///
/// Note Hardware providers can only be registered on Windows Server operating systems.
///
// 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);
/// The UnregisterProvider method unregisters an existing provider.
/// The VSS_ID of the provider.
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-unregisterprovider HRESULT UnregisterProvider(
// [in] VSS_ID ProviderId );
void UnregisterProvider(Guid ProviderId);
/// The QueryProviders method queries all registered providers.
/// The address of an IVssEnumObject interface pointer, which is initialized on return. Callers must release the interface.
///
/// 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.
///
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-queryproviders HRESULT QueryProviders( [out]
// IVssEnumObject **ppEnum );
IVssEnumObject QueryProviders();
///
/// Not supported.
/// This method is reserved for system use.
///
/// None
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-abortallsnapshotsinprogress HRESULT AbortAllSnapshotsInProgress();
void AbortAllSnapshotsInProgress();
}
/// Undocumented.
[ComImport, Guid("7858A9F8-B1FA-41a6-964F-B9B36B8CD8D8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(VSSCoordinator))]
public interface IVssAdminEx : IVssAdmin
{
/// The RegisterProvider method registers a new shadow copy provider.
///
/// The VSS_ID 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.
///
/// The CLSID of the provider.
/// The name of the provider.
///
/// A VSS_PROVIDER_TYPE enumeration value that specifies the provider type. Note that VSS_PROV_HARDWARE is not a valid
/// provider type on Windows client operating system versions. Hardware providers will run only on Windows server operating system versions.
///
/// The version of the provider.
///
/// The VSS_ID 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.
///
///
///
/// If the hardware provider is updated, the setup application should call the UnregisterProvider method to unregister the outdated
/// version, and then call the RegisterProvider method to register the updated provider.
///
/// Note Hardware providers can only be registered on Windows Server operating systems.
///
// 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);
/// The UnregisterProvider method unregisters an existing provider.
/// The VSS_ID of the provider.
// 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);
/// The QueryProviders method queries all registered providers.
/// The address of an IVssEnumObject interface pointer, which is initialized on return. Callers must release the interface.
///
/// 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.
///
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-queryproviders HRESULT QueryProviders( [out]
// IVssEnumObject **ppEnum );
new IVssEnumObject QueryProviders();
///
/// Not supported.
/// This method is reserved for system use.
///
/// None
// https://docs.microsoft.com/en-us/windows/win32/api/vsadmin/nf-vsadmin-ivssadmin-abortallsnapshotsinprogress HRESULT AbortAllSnapshotsInProgress();
new void AbortAllSnapshotsInProgress();
/// Inform caller of features that provider supports
/// The provider identifier.
/// The original capability mask
VSS_PROVIDER_CAPABILITIES GetProviderCapability(Guid pProviderId);
/// Retrieve persistent context of given provider
/// The provider identifier.
/// The context
int GetProviderContext(Guid ProviderId);
///
/// 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
///
/// The provider identifier.
/// The context.
void SetProviderContext(Guid ProviderId, int lContext);
}
/// CLSID_VSSCoordinator.
[ComImport, Guid("E579AB5F-1CC4-44b4-BED9-DE0991FF0623"), ClassInterface(ClassInterfaceType.None)]
public class VSSCoordinator { }