CVssWriter::GetSnapshotDeviceName method (vswriter.h)

The GetSnapshotDeviceName method returns the name of the device that hosts the shadow copy of the specified volume or file share. This method allows writers to support auto-recover shadow copies, and can only be called during the processing of the OnPostSnapshot method.

Syntax

HRESULT GetSnapshotDeviceName(
  [in]  LPCWSTR wszOriginalVolume,
  [out] LPCWSTR *ppwszSnapshotDevice
);

Parameters

[in] wszOriginalVolume

Name of the original volume or the UNC path of the original file share that contains data used for the current shadow copy set. The name of the volume 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)
  • A UNC path that specifies a remote file share, for example, \\Clusterx\Share1\

[out] ppwszSnapshotDevice

The address of a LPCWSTR that will receive a pointer to the device name of the shadow copy.

Return value

This method can return one of these values.

Value Meaning
S_OK
Successfully returned the shadow copy volume name.
E_INVALIDARG
One of the parameter values is not valid.
VSS_E_BAD_STATE
The call was not made during the PostSnapshot event.
VSS_E_OBJECT_NOT_FOUND
The wszOriginalVolume parameter is not one of the volumes or file shares in the shadow copy set.

Remarks

Windows 7, Windows Server 2008 R2, Windows Vista, Windows Server 2008, Windows XP and Windows Server 2003:  Remote file shares are not supported until Windows 8 and Windows Server 2012.

To get the name of the original volume for the wszOriginalVolume parameter, first call the CVssWriter::GetCurrentVolumeCount method to query the number of volumes in the shadow copy set. Then call the CVssWriter::GetCurrentVolumeArray method to enumerate the original names of the volumes in the shadow copy set.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008, Windows Server 2003 with SP1 [desktop apps only]
Target Platform Windows
Header vswriter.h (include Vss.h, VsWriter.h)
Library VssApi.lib