|
45 | 45 | <RegistrySearch Id="RegistryInstallDir" Type="raw" Root="HKLM" Key="Software\$(var.AppVendor)\$(var.AppName)" Win64="no" /> |
46 | 46 | </Property> |
47 | 47 |
|
| 48 | + <Property Id="OLDCLIENTDIR">C:\Windows\System32\</Property> |
| 49 | + |
48 | 50 | <!-- Detect legacy NSIS installation --> |
49 | 51 | <Property Id="NSIS_UNINSTALLEXE"> |
50 | 52 | <RegistrySearch Id="RegistryLegacyUninstallString" Type="file" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\$(var.AppName)" Name="UninstallString" Win64="no"> |
|
62 | 64 | <SetProperty Id="ExecNsisUninstaller" Value=""$(var.AppShortName)" "[NSIS_UNINSTALLEXE]"" Before="ExecNsisUninstaller" Sequence="execute" /> |
63 | 65 | <SetProperty Id="RemoveNavigationPaneEntries" Value=""$(var.AppName)"" Before="RemoveNavigationPaneEntries" Sequence="execute" /> |
64 | 66 |
|
| 67 | + <CustomAction Id="UninstallOldClient" |
| 68 | + Script="vbscript" |
| 69 | + Execute="immediate"> |
| 70 | + <![CDATA[ |
| 71 | + const HKEY_CLASSES_ROOT = &H80000000 |
| 72 | + const HKEY_CURRENT_USER = &H80000001 |
| 73 | + const HKEY_LOCAL_MACHINE = &H80000002 |
| 74 | + const HKEY_USERS = &H80000003 |
| 75 | + const HKEY_CURRENT_CONFIG = &H80000004 |
| 76 | + const HKEY_DYN_DATA = &H80000005 |
| 77 | + strComputer = "." |
| 78 | + oldClientExists = False |
| 79 | + userName = CreateObject("WScript.Network").UserName |
| 80 | + configPath = "C:\Users\"& userName &"\AppData\Roaming\MagentaCLOUD" |
| 81 | + configFile = configPath & "\magentacloud.cfg" |
| 82 | + jsonPath = "C:\Users\"& userName &"\AppData\Local\MagentaCLOUD" |
| 83 | + jsonFile = jsonFile & "\magentacloud.cfg" |
| 84 | + set oWsh = createobject("wscript.shell") |
| 85 | + Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _ |
| 86 | + & strComputer & "\root\default:StdRegProv") |
| 87 | + strKeyPath = "software\WOW6432Node\microsoft\windows\currentversion\uninstall" ' Root level |
| 88 | + oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys |
| 89 | + For Each subkey In arrSubKeys |
| 90 | + on error resume next |
| 91 | + sDisplayName = oWsh.Regread("HKLM\" & strKeyPath & "\" & subkey & "\DisplayName") |
| 92 | + if err.number = 0 then |
| 93 | + on error goto 0 |
| 94 | + if sDisplayName = "MagentaCLOUD Software" then |
| 95 | + oldClientExists = True |
| 96 | + sUninstall = oWsh.Regread("HKLM\" & strKeyPath & "\" & subkey & "\UnInstallString") |
| 97 | + End If |
| 98 | + End If |
| 99 | + Next |
| 100 | + on error goto 0 |
| 101 | + if oldClientExists Then |
| 102 | + sUninstall = sUnInstall & " /qn" |
| 103 | + command = "/k " & sUninstall |
| 104 | + Set objShell = CreateObject("Shell.Application") |
| 105 | + objShell.ShellExecute "cmd.exe", command, "", "runas", 0 |
| 106 | + End If |
| 107 | + ]]> |
| 108 | + </CustomAction> |
| 109 | + |
65 | 110 | <!-- Ensure ACLs --> |
66 | 111 | <Binary Id="EnsureACL" SourceFile="EnsureACL.js" /> |
67 | 112 | <SetProperty Id="EnsureACL" Before="EnsureACL" Value="[INSTALLDIR]" Sequence="execute" /> |
|
110 | 155 | --> |
111 | 156 |
|
112 | 157 | <!-- Custom license --> |
113 | | - <!-- |
114 | 158 | <WixVariable Id="WixUILicenseRtf" Value="$(var.AppLicenseRtf)" /> |
115 | | - --> |
116 | 159 |
|
117 | 160 | <UI> |
118 | 161 | <UIRef Id="WixUI_FeatureTree" /> |
119 | 162 | <UIRef Id="WixUI_ErrorProgressText" /> |
120 | 163 |
|
121 | | - <!-- Skip the license page --> |
122 | | - <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg" Order="3">1</Publish> |
123 | | - <!-- Skip the page on the way back too --> |
124 | | - <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">1</Publish> |
| 164 | + <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg" Order="3">1</Publish> |
| 165 | + <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg" Order="3">1</Publish> |
| 166 | + <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg" Order="3">1</Publish> |
| 167 | + |
| 168 | + <UIRef Id="MigrationDialogUI"/> |
| 169 | + |
| 170 | + <Publish Dialog="MigrationDialog" Control="Weiter" Event="DoAction" Value="UninstallOldClient">Not Installed</Publish> |
| 171 | + <Publish Dialog="MigrationDialog" Control="Weiter" Event="EndDialog" Value="Return">1</Publish> |
125 | 172 |
|
126 | 173 | <!-- https://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/run_program_after_install.html --> |
127 | 174 | <Publish Dialog="ExitDialog" |
|
137 | 184 | <!-- "Launch" checkbox --> |
138 | 185 | <Property Id="WixShellExecTarget" Value="[#MainExecutable]" /> |
139 | 186 | <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" /> |
140 | | - <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.AppName)" /> |
| 187 | + <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="$(var.AppName) starten" /> |
141 | 188 | <SetProperty Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" Before="CostInitialize">NOT (LAUNCH=0)</SetProperty> |
142 | 189 |
|
143 | 190 | <!-- Components --> |
144 | 191 | <Directory Id="TARGETDIR" Name="SourceDir"> |
145 | 192 | <Directory Id="$(var.PlatformProgramFilesFolder)" Name="PFiles"> |
146 | 193 | <Directory Id="INSTALLDIR" Name="$(var.AppName)"> |
147 | 194 | <!-- Shell Extensions --> |
148 | | - <Directory Id="ShellExtDir" /> |
| 195 | + <Directory Id="OLDCLIENTDIR" Name="UninstallString"> |
| 196 | + <!-- Shell Extensions --> |
| 197 | + <Directory Id="ShellExtDir" Name="shellext" /> |
| 198 | + </Directory> |
149 | 199 | </Directory> |
150 | 200 | </Directory> |
151 | 201 |
|
|
0 commit comments