Specifies the beginning and the ending of a set of changes so that System Restore can create a restore point.
For a scriptable equivalent, see
CreateRestorePoint.
Syntax
BOOL SRSetRestorePoint(
__in PRESTOREPOINTINFO pRestorePtSpec,
__out PSTATEMGRSTATUS pSMgrStatus
);
Parameters
- pRestorePtSpec [in]
-
A pointer to a
RESTOREPOINTINFO structure that specifies the restore point.
- pSMgrStatus [out]
-
A pointer to a
STATEMGRSTATUS structure that receives the status information.
Return Value
If the function succeeds, the return value is TRUE. The llSequenceNumber member of pSMgrStatus receives the sequence number of the restore point.
If the function fails, the return value is FALSE. The nStatus member of pSMgrStatus receives error information.
Remarks
You must initialize COM security to allow NetworkService, LocalService and System to call back into any process that uses SRSetRestorePoint. This is necessary for SRSetRestorePoint to operate properly. For information on setting up the COM calls to CoInitializeEx and CoInitializeSecurity, see Using System Restore.
This function cannot be called in safe mode. It also fails if System Restore has been disabled (see
Disable).
When you call this function, System Restore takes a full snapshot of the registry and other system databases.
Applications should not call System Restore functions using load-time dynamic linking. Instead, use the LoadLibrary function to load SrClient.dll and GetProcAddress to call the function.
Create restore points just prior to a system change, by calling
SRSetRestorePoint with the dwEventType member of the
RESTOREPOINTINFO structure set to BEGIN_SYSTEM_CHANGE. After the changes to the system have been completed, call
SRSetRestorePoint with dwEventType set to END_SYSTEM_CHANGE.
If the user cancels the application installation, the installer may remove the restore point it created when the installation began. Removing the restore point is optional and can prevent the user from recovering from unintentional changes made by the installer during the cancellation. If the installer is to remove a restore point, it can call the
SRRemoveRestorePoint function, or call
SRSetRestorePoint with dwRestorePointType set to CANCELLED_OPERATION, dwEventType set to END_SYSTEM_CHANGE, and llSequenceNumber set to the value returned by the initial call to SRSetRestorePoint.
Be careful when making nested calls to
SRSetRestorePoint. For more information, see
Nested calls to SRSetRestorePoint.
Examples
For an example, see Using System Restore.
Requirements
| Minimum supported client | Windows XP |
| Minimum supported server | None supported |
| Header | SRRestorePtAPI.h |
| DLL | SrClient.dll |
| Unicode and ANSI names | SRSetRestorePointW (Unicode) and SRSetRestorePointA (ANSI) |
See Also
- SRRemoveRestorePoint
Send comments about this topic to Microsoft
Build date: 7/30/2009