windowssdk: Handle silent installer/uninstaller message boxes appropriately.
authorMark Young <marky@lunarg.com>
Tue, 2 Feb 2016 17:56:42 +0000 (10:56 -0700)
committerMark Young <marky@lunarg.com>
Tue, 2 Feb 2016 18:00:36 +0000 (11:00 -0700)
If Silent Install or Uninstall is enabled, we want all the message boxes we
have control over to automatically make a selection.  In addition, return
an error if we are supposed to reboot, and the silent install doesn't show
the message for the user to choose.

windowsRuntimeInstaller/InstallerRT.nsi

index 4a94f08..edea8b6 100644 (file)
@@ -435,10 +435,15 @@ Section "uninstall"
         Call un.DeleteDirIfEmpty
 
         # If any of the remove commands failed, request a reboot
-        IfSilent noreboot
-            IfRebootFlag 0 noreboot
-                MessageBox MB_YESNO "A reboot is required to finish the uninstall. Do you wish to reboot now?" IDNO noreboot
-                Reboot
+        IfRebootFlag 0 noreboot
+            MessageBox MB_YESNO "A reboot is required to finish the uninstall. Do you wish to reboot now?" /SD IDNO IDNO returnerror
+            Reboot
+            
+            returnerror:
+        
+            # Set an error message to output because we should reboot but didn't (whether because silent uninstall or user choice)
+            SetErrorLevel 3 # ERROR_TOO_MANY_OPEN_FILES
+
         noreboot:
 
     ${Endif}
@@ -480,7 +485,7 @@ FunctionEnd
 Function UninstallIfError
     ${If} ${Errors}
         # IHV's using this install may want no message box.
-        MessageBox MB_OK|MB_ICONSTOP "${errorMessage1}${errorMessage2}"
+        MessageBox MB_OK|MB_ICONSTOP "${errorMessage1}${errorMessage2}" /SD IDOK
 
         # Copy the uninstaller to a temp folder of our own creation so we can completely
         # delete the old contents.