<!-- Uninstall: Remove sync folders from Explorer's Navigation Pane, only effective for the current user (home users) -->
<Custom Action="RemoveNavigationPaneEntries" After="RemoveFiles">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
+
+ <!-- Uninstall: Cleanup the Registry -->
+ <Custom Action="RegistryCleanupCustomAction" After="RemoveFiles">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
<!-- Schedule Reboot for the Shell Extensions (in silent installation mode only, or if SCHEDULE_REBOOT argument is set-->
<ScheduleReboot After="InstallFinalize">(SCHEDULE_REBOOT=1) OR NOT (UILevel=2)</ScheduleReboot>
</InstallExecuteSequence>
<!-- "Add or Remove" Programs Entries -->
+ <Property Id="APPNAME">$(var.AppName)</Property>
<Property Id="ARPPRODUCTICON">$(var.AppIcon)</Property>
<Property Id="ARPHELPLINK">$(var.AppHelpLink)</Property>
<Property Id="ARPURLINFOABOUT">$(var.AppInfoLink)</Property>
--- /dev/null
+On Error goto 0
+
+Const HKEY_LOCAL_MACHINE = &H80000002
+
+Const strObjRegistry = "winmgmts:\\.\root\default:StdRegProv"
+
+Function RegistryDeleteKeyRecursive(regRoot, strKeyPath)
+ Set objRegistry = GetObject(strObjRegistry)
+ objRegistry.EnumKey regRoot, strKeyPath, arrSubkeys
+ If IsArray(arrSubkeys) Then
+ For Each strSubkey In arrSubkeys
+ RegistryDeleteKeyRecursive regRoot, strKeyPath & "\" & strSubkey
+ Next
+ End If
+ objRegistry.DeleteKey regRoot, strKeyPath
+End Function
+
+Function RegistryListSubkeys(regRoot, strKeyPath)
+ Set objRegistry = GetObject(strObjRegistry)
+ objRegistry.EnumKey regRoot, strKeyPath, arrSubkeys
+ RegistryListSubkeys = arrSubkeys
+End Function
+
+Function GetUserSID()
+ Dim objWshNetwork, objUserAccount
+
+ Set objWshNetwork = CreateObject("WScript.Network")
+
+ Set objUserAccount = GetObject("winmgmts://" & objWshNetwork.UserDomain & "/root/cimv2").Get("Win32_UserAccount.Domain='" & objWshNetwork.ComputerName & "',Name='" & objWshNetwork.UserName & "'")
+ GetUserSID = objUserAccount.SID
+End Function
+
+Function RegistryCleanupSyncRootManager()
+ strSyncRootManagerKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager"
+
+ arrSubKeys = RegistryListSubkeys(HKEY_LOCAL_MACHINE, strSyncRootManagerKeyPath)
+
+ If IsArray(arrSubkeys) Then
+ arrSubkeys=Filter(arrSubkeys, Session.Property("APPNAME"))
+ End If
+ If IsArray(arrSubkeys) Then
+ arrSubkeys=Filter(arrSubkeys, GetUserSID())
+ End If
+
+ If IsArray(arrSubkeys) Then
+ For Each strSubkey In arrSubkeys
+ RegistryDeleteKeyRecursive HKEY_LOCAL_MACHINE, strSyncRootManagerKeyPath & "\" & strSubkey
+ Next
+ End If
+End Function
+
+Function RegistryCleanup()
+ RegistryCleanupSyncRootManager()
+End Function
if %ERRORLEVEL% neq 0 exit %ERRORLEVEL%
Rem Compile en-US (https://www.firegiant.com/wix/tutorial/transforms/morphing-installers/)
-"%WIX%\bin\candle.exe" -dcodepage=1252 -dPlatform=%BuildArch% -arch %BuildArch% -dHarvestAppDir="%HarvestAppDir%" -ext WixUtilExtension NCMsiHelper.wxs WinShellExt.wxs collect.wxs Nextcloud.wxs
+"%WIX%\bin\candle.exe" -dcodepage=1252 -dPlatform=%BuildArch% -arch %BuildArch% -dHarvestAppDir="%HarvestAppDir%" -ext WixUtilExtension NCMsiHelper.wxs WinShellExt.wxs collect.wxs Nextcloud.wxs RegistryCleanupCustomAction.wxs
if %ERRORLEVEL% neq 0 exit %ERRORLEVEL%
Rem Link MSI package
-"%WIX%\bin\light.exe" -sw1076 -ext WixUIExtension -ext WixUtilExtension -cultures:en-us NCMsiHelper.wixobj WinShellExt.wixobj collect.wixobj Nextcloud.wixobj -out "@MSI_INSTALLER_FILENAME@"
+"%WIX%\bin\light.exe" -sw1076 -ext WixUIExtension -ext WixUtilExtension -cultures:en-us NCMsiHelper.wixobj WinShellExt.wixobj collect.wixobj Nextcloud.wixobj RegistryCleanupCustomAction.wixobj -out "@MSI_INSTALLER_FILENAME@"
exit %ERRORLEVEL%