浏览代码

/LOG: Now logs some additional information about uninstall info saving.

Martijn Laan 7 年之前
父节点
当前提交
37dc8eaf5d
共有 2 个文件被更改,包括 15 次插入3 次删除
  1. 13 2
      Projects/Install.pas
  2. 2 1
      whatsnew.htm

+ 13 - 2
Projects/Install.pas

@@ -515,18 +515,24 @@ var
     else
     else
       RootKey := HKEY_CURRENT_USER;
       RootKey := HKEY_CURRENT_USER;
     SubkeyName := NEWREGSTR_PATH_UNINSTALL + '\' + UninstallRegKeyBaseName + '_is1';
     SubkeyName := NEWREGSTR_PATH_UNINSTALL + '\' + UninstallRegKeyBaseName + '_is1';
+ 
+    Log('Deleting any uninstall keys left over from previous installs');
 
 
-    { Delete any uninstall keys left over from previous installs }
     RegDeleteKeyIncludingSubkeys(InstallDefaultRegView, HKEY_CURRENT_USER, PChar(SubkeyName));
     RegDeleteKeyIncludingSubkeys(InstallDefaultRegView, HKEY_CURRENT_USER, PChar(SubkeyName));
     if IsAdmin then
     if IsAdmin then
       RegDeleteKeyIncludingSubkeys(InstallDefaultRegView, HKEY_LOCAL_MACHINE, PChar(SubkeyName));
       RegDeleteKeyIncludingSubkeys(InstallDefaultRegView, HKEY_LOCAL_MACHINE, PChar(SubkeyName));
 
 
+    LogFmt('Creating new uninstall key: %s\%s', [GetRegRootKeyName(RootKey), SubkeyName]);
+
     { Create uninstall key }
     { Create uninstall key }
     ErrorCode := RegCreateKeyExView(InstallDefaultRegView, RootKey, PChar(SubkeyName),
     ErrorCode := RegCreateKeyExView(InstallDefaultRegView, RootKey, PChar(SubkeyName),
       0, nil, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, nil, H2, nil);
       0, nil, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, nil, H2, nil);
     if ErrorCode <> ERROR_SUCCESS then
     if ErrorCode <> ERROR_SUCCESS then
       RegError(reRegCreateKeyEx, RootKey, SubkeyName, ErrorCode);
       RegError(reRegCreateKeyEx, RootKey, SubkeyName, ErrorCode);
+ 
     try
     try
+      Log('Writing uninstall key values.');
+    
       { do not localize or change any of the following strings }
       { do not localize or change any of the following strings }
       SetStringValue(H2, 'Inno Setup: Setup Version', SetupVersion);
       SetStringValue(H2, 'Inno Setup: Setup Version', SetupVersion);
       if shCreateAppDir in SetupHeader.Options then
       if shCreateAppDir in SetupHeader.Options then
@@ -2118,7 +2124,7 @@ var
           NotifyBeforeInstallEntry(BeforeInstall);
           NotifyBeforeInstallEntry(BeforeInstall);
           Log('-- Registry entry --');
           Log('-- Registry entry --');
           S := ExpandConst(Subkey);
           S := ExpandConst(Subkey);
-          LogFmt('Key: %s\%s', [GetRegRootKeyName(RootKey), Subkey]); {LOG rootkey}
+          LogFmt('Key: %s\%s', [GetRegRootKeyName(RootKey), Subkey]);
           N := ExpandConst(ValueName);
           N := ExpandConst(ValueName);
           if N <> '' then
           if N <> '' then
             LogFmt('Value name: %s', [N]);
             LogFmt('Value name: %s', [N]);
@@ -2759,6 +2765,7 @@ var
       replacing an existing uninstall EXE, exit. }
       replacing an existing uninstall EXE, exit. }
     if UninstallTempExeFilename = '' then
     if UninstallTempExeFilename = '' then
       Exit;
       Exit;
+    Log('Renaming uninstaller.');
     RetriesLeft := 4;
     RetriesLeft := 4;
     while True do begin
     while True do begin
       Timer.Start(1000);
       Timer.Start(1000);
@@ -2769,6 +2776,8 @@ var
       if (LastError = ERROR_ACCESS_DENIED) or
       if (LastError = ERROR_ACCESS_DENIED) or
          (LastError = ERROR_SHARING_VIOLATION) then begin
          (LastError = ERROR_SHARING_VIOLATION) then begin
         if RetriesLeft > 0 then begin
         if RetriesLeft > 0 then begin
+          LogFmt('The existing file appears to be in use (%d). ' +
+            'Retrying.', [LastError]);
           Dec(RetriesLeft);
           Dec(RetriesLeft);
           Timer.SleepUntilExpired;
           Timer.SleepUntilExpired;
           ProcessEvents;
           ProcessEvents;
@@ -2800,6 +2809,7 @@ var
       do nothing }
       do nothing }
     if (UninstallExeCreated <> ueNone) and
     if (UninstallExeCreated <> ueNone) and
        ((shSignedUninstaller in SetupHeader.Options) or DetachedUninstMsgFile) then begin
        ((shSignedUninstaller in SetupHeader.Options) or DetachedUninstMsgFile) then begin
+      LogFmt('Writing uninstaller messages: %s', [UninstallMsgFilename]);
       F := TFile.Create(UninstallMsgFilename, fdCreateAlways, faWrite, fsNone);
       F := TFile.Create(UninstallMsgFilename, fdCreateAlways, faWrite, fsNone);
       try
       try
         if UninstallExeCreated = ueNew then
         if UninstallExeCreated = ueNew then
@@ -3032,6 +3042,7 @@ begin
         modifications you want to add must be done before this is called. }
         modifications you want to add must be done before this is called. }
       if Uninstallable then begin
       if Uninstallable then begin
         SetStatusLabelText(SetupMessages[msgStatusSavingUninstall]);
         SetStatusLabelText(SetupMessages[msgStatusSavingUninstall]);
+        Log('Saving uninstall information.');
         RenameUninstallExe;
         RenameUninstallExe;
         CreateUninstallMsgFile;
         CreateUninstallMsgFile;
         { Register uninstall information so the program can be uninstalled
         { Register uninstall information so the program can be uninstalled

+ 2 - 1
whatsnew.htm

@@ -28,8 +28,9 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
 
 
 <p><a name="5.6.1"></a><span class="ver">5.6.1 </span><span class="date">(?)</span></p>
 <p><a name="5.6.1"></a><span class="ver">5.6.1 </span><span class="date">(?)</span></p>
 <ul>
 <ul>
+<li>/LOG: Now logs some additional information about uninstall info saving.</li>
 <li>The <tt>{sendto}</tt> constant has been renamed to <tt>{usersendto}</tt> and now can correctly trigger a <a href="#useduserareaswarnings">used user areas warning</a>. It still returns the same directory: the path to the current user's Send To folder. (There is no common Send To folder.)</li>
 <li>The <tt>{sendto}</tt> constant has been renamed to <tt>{usersendto}</tt> and now can correctly trigger a <a href="#useduserareaswarnings">used user areas warning</a>. It still returns the same directory: the path to the current user's Send To folder. (There is no common Send To folder.)</li>
-<li>Minor improvements to the registry entries logging and improved syntax highlighting introduced by the previous version.</li>
+<li>Minor fixes to the registry entries logging and improved syntax highlighting introduced by the previous version.</li>
 <li>Minor tweaks.</li>
 <li>Minor tweaks.</li>
 </ul>
 </ul>