The OnPostSnapshot method is called by a writer following a PostSnapshot event.
OnPostSnapshot is a virtual method. It is implemented by the CVssWriter base class but can be overridden by derived classes.
- pComponent [in]
A pointer to an IVssWriterComponents object passed in by VSS to provide the method with access to the writer's component information. The value of this parameter may be NULL if the requester does not support components (if CVssWriter::AreComponentsSelected returns false).
As implemented by the base class, OnPostSnapshot always returns true.
Any other implementation of this method must return true except in the case of a fatal error. If a fatal error occurs, the method must call the CVssWriter::SetWriterFailure method to provide a description of the failure before returning false. If a nonfatal error occurs, the method should still call SetWriterFailure but return true. If the error is caused by a transient problem, the method should specify VSS_E_WRITERERROR_RETRYABLE in the call to SetWriterFailure.
In all cases when a failure occurs, the method should write an event to the event log to report the exact reason for the failure.
The default implementation of this method by the CVssWriter base class returns true without performing any other operation.
CVssWriter::OnPostSnapshot is typically used to process any final updates by the writer to the backup components metadata and clean up (such as removing temporary files).
If an incremental or differential backup is being performed, the writer may call IVssComponent::GetPreviousBackupStamp and IVssComponent::SetBackupStamp. For more information, see Writer Role in Backing Up Complex Stores. Another method that can be called at this time is IVssComponent::AddDifferencedFilesByLastModifyTime.
Most of the work needed to return the writer to normal operation (reversing the actions of CVssWriter::OnPrepareSnapshot and CVssWriter::OnFreeze) is typically performed in CVssWriter::OnThaw, not in OnPostSnapshot.
Writers should never throw an exception from this method or any other CVssWriter(Ex)::OnXxx callback method.
If the shadow copy has the VSS_VOLSNAP_ATTR_AUTORECOVER flag set in the context, the writer should perform any recovery required (for example, rolling back any incomplete transactions) so that the component will be usable on a read-only copy for data mining (without adding load to the live server) or restore purposes (for example, to restore selected items from a database).
To retrieve the volume name of the shadow copy of a volume, perform the following steps:
- Call the CVssWriter::GetCurrentVolumeCount method to query the number of volumes in the shadow copy set.
- Call the CVssWriter::GetCurrentVolumeArray method to enumerate the original names of the volumes in the shadow copy set.
- Call the CVssWriter::GetSnapshotDeviceName to retrieve the name of the shadow copy volume.
If this method calls the CVssWriterEx2::GetSessionId, CVssWriter::SetWriterFailure, or CVssWriterEx2::SetWriterFailureEx method, it must do so in the same thread that called this method. For more information, see Writer Event Handling.
Minimum supported client
|Windows XP [desktop apps only]|
Minimum supported server
|Windows Server 2003 [desktop apps only]|