System Restore
Project:This information applies to InstallScript projects.
System Restore is a Windows feature that enables end users to restore PCs corrupted during software installation. The System Restore feature automatically monitors and records key system changes to the end user’s PC. System Restore reduces support costs and increases customer satisfaction by letting the end user easily undo a change that may have harmed their system or revert to a time when they knew that their system was performing optimally.
InstallScript installations support System Restore by setting a restore point before starting the file transfer; the end user can then use System Restore to restore the system to the state it was in before the file transfer.
Note:Installation actions (for example, registry changes and file modifications) that take place before file transfer cannot be undone by System Restore.
Your installations are System Restore compatible by default. You can disable System Restore compatibility by placing the following code in your script’s OnBegin event handler:
Disable( PCRESTORE );
If the file Wininit.ini exists in the target machine’s Windows folder, the installation cannot set a restore point. To handle Wininit.ini, put code like the following in the OnFirstUIBefore and OnMaintUIBefore event handler functions:
/* Look for Wininit.ini in the Windows folder. If it is found ... */
if FindFile( WINDIR, "Wininit.ini", svResult )=0 then
bRebootForSystemRestore = TRUE;
/* ... get its size. */
GetFileInfo( WINDIR ^ "Wininit.ini", FILE_SIZE, nvSize, svResult );
/* If its size is zero bytes ... */
if nvSize=0 then
/* ... delete Wininit.ini. */
if DeleteFile( WINDIR ^ "Wininit.ini" )=0 then
bRebootForSystemRestore = FALSE;
endif;
endif;
/* If Wininit.ini has a non-zero size or could not be deleted, notify the end user and allow a reboot. */
if bRebootForSystemRestore then
szQuestion = "Windows System Restore lets you undo " +
"changes to your computer. If you want to be able " +
"to use System Restore to undo this installation, " +
"you must reboot your computer now.\n\n" +
"Do you want to reboot your computer now?"
if AskYesNo( szQuestion, YES )=YES then
System( SYS_BOOTMACHINE );
endif;
endif;
endif;