OverviewExamples
number System.SetRestorePoint ( |
nSeqNum = System.SetRestorePoint(SYSTEM_CHANGE_BEGIN, SYS_RESTORE_APP_INSTALL, 0, "My Program Install");
Begins a system restore point of an application install and returns the sequence number in the variable "nSeqNum."
-- Check to see if the system has system restore capability
bSysRestoreAvailable = System.IsSystemRestoreAvailable();
if bSysRestoreAvailable then
-- Restore is available, mark start point
nSequenceNum = System.SetRestorePoint(SYSTEM_CHANGE_BEGIN, SYS_RESTORE_APP_INSTALL, 0, "Installed Sample Product v. 3.7")
else
-- Restore is unavailable, confirm with the user to continue
nChoice = Dialog.Message("Restore Unavailable", "Your system does not support System Restore. Do you want to continue with the setup?", MB_YESNO, MB_ICONSTOP);
if nChoice == 7 then
-- The user chose not to continue, exit the script
Application.ExitScript();
end
end
-- DO UPDATE TASKS HERE
if bSysRestoreAvailable then
-- Restore is available, mark end point
nSequenceNum = System.SetRestorePoint(SYSTEM_CHANGE_END, SYS_RESTORE_APP_INSTALL, nSequenceNumber, "Installed Sample Product v. 3.7")
-- Write sequence number to the registry for later use
Registry.SetValue(HKEY_LOCAL_MACHINE, SessionVar.Expand("Software\\%CompanyName%\\%ProductName%\\RestorePointInfo"), "SequenceNumber", nSequenceNum, REG_SZ)
end
Checks if the user's system supports system restore. If it does not, the user is asked if the setup should continue. If the system supports system restore, or the user chooses to continue, a restore point is set and the setup tasks are completed.
See also: Related Actions