IVssSoftwareSnapshotProvider::SetContext method (vsprov.h)

Sets the context for subsequent shadow copy-related operations.

Syntax

HRESULT SetContext(
  [in] LONG lContext
);

Parameters

[in] lContext

The context to be set. The context must be one of the supported values of _VSS_SNAPSHOT_CONTEXT or a supported combination of _VSS_VOLUME_SNAPSHOT_ATTRIBUTES and _VSS_SNAPSHOT_CONTEXT values.

Return value

The following are the valid return codes for this method.

Value Meaning
S_OK
The context was set successfully.
E_ACCESSDENIED
The caller does not have sufficient backup privileges or is not an administrator.
E_INVALIDARG
One of the parameter values is not valid.
E_OUTOFMEMORY
The caller is out of memory or other system resources.
VSS_E_BAD_STATE
The context is frozen and cannot be changed.

Remarks

The default context for VSS shadow copies is VSS_CTX_BACKUP.

Windows XP:  The only supported context is the default context, VSS_CTX_BACKUP. Therefore, calling SetContext under Windows XP returns E_NOTIMPL.

For more information about how the context that is set by SetContext affects how a shadow copy is created and managed, see Implementation Details for Creating Shadow Copies.

For a complete discussion of the permitted shadow copy contexts, see _VSS_SNAPSHOT_CONTEXT and _VSS_VOLUME_SNAPSHOT_ATTRIBUTES.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header vsprov.h
Library VssApi.lib

See also

IVssSoftwareSnapshotProvider