Setting VSS Restore Methods
The configuration of restore operations actually begins during data backup, when writers specify, in their Writer Metadata Documents, how their data should be restored.
Note
The API MoveFileEx cannot be used to restore registry files.
These specifications, referred to either as restore methods or original restore targets, can be modified during restore by writers setting new restore targets or by requesters restoring to new locations (see Non-Default Backup and Restore Locations).
By calling IVssCreateWriterMetadata::SetRestoreMethod, a writer indicates which restore method should be used in its Writer Metadata Document. The restore method is set writer wide and applied to all files in all components that a writer manages.
A requester obtains (and must respect) this information by calling IVssExamineWriterMetadata::GetRestoreMethod.
The restore method is defined by a VSS_RESTOREMETHOD_ENUM enumeration, which is passed to IVssCreateWriterMetadata::SetRestoreMethod and returned from IVssExamineWriterMetadata::GetRestoreMethod.
The Writer Metadata Document supports the following valid restore methods (a restore method of VSS_RME_UNDEFINED indicates a writer error). The figures summarize how the various supported and defined restore methods should be implemented (VSS_RME_CUSTOM has no figure associated with it, because by definition it is specific to the writer and must follow the specific writer APIs and documentation):
- VSS_RME_RESTORE_IF_NOT_THERE. Restore component files to disk if none of the files are on the disk already. Target file status should be checked after a PreRestore event.
- VSS_RME_RESTORE_IF_CAN_REPLACE. Restore files to disk if all the files can be replaced. Target file status should be checked after a PreRestore event.
- VSS_RME_STOP_RESTORE_START. A service will be stopped prior to restoring the files.
- VSS_RME_RESTORE_TO_ALTERNATE_LOCATION. Restore files to disk in an alternate location. The alternate location mappings are specified in the Writer Metadata Document.
- VSS_RME_RESTORE_AT_REBOOT. Cause files to be restored (overwritten) when the computer is rebooted.
- VSS_RME_RESTORE_AT_REBOOT_IF_CANNOT_REPLACE. If a file could not be restored to disk on a running system, then it is restored (overwritten) when the computer is rebooted.
- VSS_RME_CUSTOM. None of the predefined methods will work; the backup application must use specialized APIs to perform the restore operation. For this backup method, the requester must completely understand the writer in question. See Special VSS Usage Cases for currently supported instances.