Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
File Services
Backup
 IVssBackupComponents::AddToSnapshot...

  Switch on low bandwidth view
IVssBackupComponents::AddToSnapshotSet Method

The AddToSnapshotSet method adds an original volume to the shadow copy set.

Syntax

C++
HRESULT AddToSnapshotSet(
  [in]   VSS_PWSZ pwszVolumeName,
  [in]   VSS_ID ProviderId,
  [out]  VSS_ID *pidSnapshot
);

Parameters

pwszVolumeName [in]

Null-terminated wide character string containing the name of the volume to be shadow copied. The name must be in one of the following formats and must include a trailing backslash (\):

  • The path of a mounted folder, for example, Y:\MountX\
  • A drive letter, for example, D:\
  • A volume GUID path of the form \\?\Volume{GUID}\ (where GUID identifies the volume)
ProviderId [in]

The provider to be used. GUID_NULL can be used, in which case the default provider will be used.

pidSnapshot [out]

Returned identifier of the added shadow copy.

Return Value

The following are the valid return codes for this method.

ValueMeaning
S_OK
0x00000000L

Successfully added the volume to the shadow copy.

E_ACCESSDENIED
0x80070005L

Caller does not have sufficient backup privileges or is not an administrator.

E_INVALIDARG
0x80070057L

One of the parameter values is not valid.

E_OUTOFMEMORY
0x8007000EL

The caller is out of memory or other system resources.

E_UNEXPECTED
0x8000FFFFL

Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.

VSS_E_BAD_STATE
0x80042301L

The backup components object is not initialized, this method has been called during a restore operation, or this method has not been called within the correct sequence.

VSS_E_MAXIMUM_NUMBER_OF_VOLUMES_REACHED
0x80042312L

The maximum number of volumes has been added to the shadow copy set. The specified volume was not added to the shadow copy set.

VSS_E_MAXIMUM_NUMBER_OF_SNAPSHOTS_REACHED
0x80042317L

The volume has been added to the maximum number of shadow copy sets. The specified volume was not added to the shadow copy set.

VSS_E_NESTED_VOLUME_LIMIT
0x8004232CL

The specified volume is nested too deeply to participate in the VSS operation. Possible reasons for this error include the following:

  • Trying to create a shadow copy of a volume that resides on a VHD that is contained in another VHD.
  • Trying to create a shadow copy of a VHD volume when the volume that contains the VHD is also in the same shadow copy set.
Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP:  This return code is not supported.
VSS_E_OBJECT_NOT_FOUND
0x80042308L

pwszVolumeName does not correspond to an existing volume.

VSS_E_PROVIDER_NOT_REGISTERED
0x80042304L

ProviderId does not correspond to a registered provider.

VSS_E_PROVIDER_VETO
0x80042306L

Expected provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.

VSS_E_VOLUME_NOT_SUPPORTED
0x8004230CL

The value of the ProviderId parameter is GUID_NULL and no VSS provider indicates that it supports the specified volume.

VSS_E_VOLUME_NOT_SUPPORTED_BY_PROVIDER
0x8004230EL

The volume is not supported by the specified provider.

VSS_E_UNEXPECTED_PROVIDER_ERROR
0x8004230FL

The provider returned an unexpected error code. This error code is only returned via the QueryStatus method on the IVssAsync interface returned in the ppAsync parameter.

 

Remarks

The maximum number of shadow copied volumes in a single shadow copy set is 64.

If ProviderId is GUID_NULL, the default provider is selected according to the following algorithm:

  1. If any hardware-based provider supports the given volume, it is selected.
  2. If there is no hardware-based provider available, if any software-based provider supports the given volume, it is selected.
  3. If there is no hardware-based provider or software-based provider available, the system provider is selected. (There is only one preinstalled system provider, which must support all nonremovable local volumes.)

This method cannot be called for a virtual hard disk (VHD) that is nested inside another VHD.

Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP:  VHDs are not supported.

Requirements

Minimum supported clientWindows XP
Minimum supported serverWindows Server 2003
HeaderVsBackup.h (include VsBackup.h, Vss.h, or VsWriter.h)
LibraryVssApi.lib

See Also

IVssBackupComponents
_VSS_VOLUME_SNAPSHOT_ATTRIBUTES

Send comments about this topic to Microsoft

Build date: 6/18/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker