Windows: Save Wix config at start if possible
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 15 Aug 2011 04:23:57 +0000 (00:23 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Mon, 15 Aug 2011 04:51:49 +0000 (21:51 -0700)
Save the current configuration at the start of the install
process so the user can be presented with a dialog prior
to installation asking whether the existing or saved
configuration should be used or whether a new configuration
should be created.

Change-Id: I4a42ad597a7e1806bbae6d63bf1a2db365e6be8e
Reviewed-on: http://gerrit.openafs.org/5281
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/install/wix/custom/afscustom.cpp
src/WINNT/install/wix/lang/en_US/ui.wxi

index 3ea2c4a..714e853 100644 (file)
@@ -576,7 +576,8 @@ do_reg_copy_value(MSIHANDLE hInstall, HKEY hk_src, HKEY hk_dest, const TCHAR * v
 
     rv = RegQueryValueEx(hk_src, value, 0, &type, buffer, &cb);
     if (rv == ERROR_MORE_DATA) {
-        buffer = new BYTE[cb];
+        // Some types require space for a terminating NUL which might not be present
+        buffer = new BYTE[++cb];
         if (buffer == NULL) {
             ShowMsiActionData(hInstall, _T("Out of memory"));
             return;
@@ -827,6 +828,11 @@ SetAfscredsOptionsFromRegValue(MSIHANDLE hInstall, HKEY hk)
 //
 MSIDLLEXPORT DetectSavedConfiguration( MSIHANDLE hInstall )
 {
+    // Attempt a backup.  If there is something to save, it will be.
+    // If not, nothing has changed.
+    //
+    BackupAFSClientRegistryKeys( hInstall );
+
     {
         MSIHANDLE hRec;
 
index cd12f7b..a52ef61 100644 (file)
         </Control>
         <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="374" Height="44" FixedSize="yes" TabSkip="no" Text="[BannerBitmap]" />
         <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
-          <Text>Configuration settings from a prior OpenAFS installation is available.</Text>
+          <Text>Configuration settings from a previous OpenAFS installation are available.</Text>
         </Control>
         <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="374" Height="0" />
         <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="374" Height="0" />
         <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
-          <Text>[DlgTitleFont]Restore configuration?</Text>
+          <Text>[DlgTitleFont]Preserve configuration?</Text>
         </Control>
         <Control Id="CustomText" Type="Text" X="105" Y="131" Width="230" Height="30">
           <Text>Specify new settings.  Basic settings can be set via this installer.  All others will be reset to defaults.</Text>
         </Control>
         <Control Id="TypicalText" Type="Text" X="105" Y="78" Width="230" Height="20">
-          <Text>Restore and use the saved configuration settings.</Text>
+          <Text>Use the existing or saved configuration.</Text>
         </Control>
       </Dialog>