winsdk: Fix multiple RT uninstall issue
authorMark Young <marky@lunarg.com>
Wed, 22 Jun 2016 22:55:31 +0000 (16:55 -0600)
committerMark Young <marky@lunarg.com>
Wed, 22 Jun 2016 23:00:08 +0000 (17:00 -0600)
Change originally by David Pinedo.  If the same Vulkan Run-time
installer is executed multiple times, it will bump the install count
for the RT installation.  There was a problem during uninstall
which failed to look at the install count and would always remove
some important files.  This fixes that issue.

Change-Id: I4dda50b0dbdd9ec901aa25713be7d7348f3d67ec

windowsRuntimeInstaller/InstallerRT.nsi

index 0bfd47f..92da393 100644 (file)
@@ -618,31 +618,44 @@ Section "uninstall"
 
         # Delete vulkaninfo.exe in C:\Windows\System32 and C:\Windows\SysWOW64
         Delete /REBOOTOK $WINDIR\SysWow64\vulkaninfo.exe
-        Delete /REBOOTOK "$WINDIR\SysWow64\vulkaninfo-$FileVersion.exe"
         Delete /REBOOTOK $WINDIR\System32\vulkaninfo.exe
-        Delete /REBOOTOK "$WINDIR\System32\vulkaninfo-$FileVersion.exe"
 
-        # Delete vullkan dll files: vulkan-<majorabi>.dll and vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll
+        # Delete vulkan-<majorabi>.dll in C:\Windows\System32 and C:\Windows\SysWOW64
         Delete /REBOOTOK $WINDIR\SysWow64\vulkan-${VERSION_ABI_MAJOR}.dll
-        Delete /REBOOTOK $WINDIR\SysWow64\vulkan-$FileVersion.dll
         Delete /REBOOTOK $WINDIR\System32\vulkan-${VERSION_ABI_MAJOR}.dll
-        Delete /REBOOTOK $WINDIR\System32\vulkan-$FileVersion.dll
 
     # Else, running on a 32-bit OS machine
     ${Else}
 
         # Delete vulkaninfo.exe in C:\Windows\System32
         Delete /REBOOTOK $WINDIR\System32\vulkaninfo.exe
-        Delete /REBOOTOK "$WINDIR\System32\vulkaninfo-$FileVersion.exe"
 
-        # Delete vullkan dll files: vulkan-<majorabi>.dll and vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll
+        # Delete vulkan-<majorabi>.dll in C:\Windows\System32
         Delete /REBOOTOK $WINDIR\System32\vulkan-${VERSION_ABI_MAJOR}.dll
-        Delete /REBOOTOK $WINDIR\System32\vulkan-$FileVersion.dll
 
     ${EndIf}
     StrCpy $1 80
     Call un.CheckForError
 
+    # If Ref Count is zero, remove files in C:\Windows\System32 and C:\Windows\SysWow64
+    ${If} $IC <= 0
+
+        ${If} ${RunningX64}
+            # Delete vulkaninfo.exe in C:\Windows\System32 and C:\Windows\SysWOW64
+            Delete /REBOOTOK "$WINDIR\SysWow64\vulkaninfo-$FileVersion.exe"
+            Delete /REBOOTOK "$WINDIR\System32\vulkaninfo-$FileVersion.exe"
+            # Delete vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll from sys dirs
+            Delete /REBOOTOK $WINDIR\SysWow64\vulkan-$FileVersion.dll
+            Delete /REBOOTOK $WINDIR\System32\vulkan-$FileVersion.dll
+        ${Else}
+            # Delete vulkaninfo.exe in C:\Windows\System32
+            Delete /REBOOTOK "$WINDIR\System32\vulkaninfo-$FileVersion.exe"
+            # Delete vulkan-<majorabi>-<major>-<minor>-<patch>-<buildno>.dll from sys dir
+            Delete /REBOOTOK $WINDIR\System32\vulkan-$FileVersion.dll
+        ${EndIf}
+
+    ${Endif}
+
     # Run the ConfigLayersAndVulkanDLL.ps1 script to copy the most recent version of
     # vulkan-<abimajor>-*.dll to vulkan-<abimajor>.dll, and to set up layer registry
     # entries to use layers from the corresponding SDK
@@ -664,7 +677,7 @@ Section "uninstall"
     ${Endif}
     Call un.CheckForError
 
-    # If Ref Count is zero, uninstall everything
+    # If Ref Count is zero, remove install dir
     ${If} $IC <= 0
 
         # Remove files in install dir