diff --git a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
--- a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
+++ b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
@@ -656,7 +656,8 @@
if (BOOTSTRAPPER_RELATED_OPERATION_DOWNGRADE == operation) {
_downgradingOtherVersion = TRUE;
} else if (BOOTSTRAPPER_RELATED_OPERATION_MAJOR_UPGRADE == operation) {
- _upgradingOldVersion = TRUE;
+ BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Detected previous version - planning upgrade");
+ _upgrading = TRUE;
// Assume we don't want the launcher or file associations, and if
// they have already been installed then loading the state will
@@ -716,32 +717,7 @@
if (SUCCEEDED(hrStatus)) {
// Ensure the default path has been set
- LONGLONG installAll;
- LPWSTR targetDir = nullptr;
- LPWSTR defaultTargetDir = nullptr;
-
- hrStatus = BalGetStringVariable(L"TargetDir", &targetDir);
- if (FAILED(hrStatus) || !targetDir || !targetDir[0]) {
- ReleaseStr(targetDir);
- targetDir = nullptr;
-
- if (FAILED(BalGetNumericVariable(L"InstallAllUsers", &installAll))) {
- installAll = 0;
- }
-
- hrStatus = BalGetStringVariable(
- installAll ? L"DefaultAllUsersTargetDir" : L"DefaultJustForMeTargetDir",
- &defaultTargetDir
- );
-
- if (SUCCEEDED(hrStatus) && defaultTargetDir) {
- if (defaultTargetDir[0] && SUCCEEDED(BalFormatString(defaultTargetDir, &targetDir))) {
- hrStatus = _engine->SetVariableString(L"TargetDir", targetDir);
- ReleaseStr(targetDir);
- }
- ReleaseStr(defaultTargetDir);
- }
- }
+ hrStatus = EnsureTargetDir();
}
SetState(PYBA_STATE_DETECTED, hrStatus);
@@ -1906,27 +1882,6 @@
for (DWORD i = 0; i < _theme->cControls; ++i) {
THEME_CONTROL* pControl = _theme->rgControls + i;
LPWSTR text = nullptr;
- LPWSTR name = nullptr;
- LOC_STRING *locText = nullptr;
-
- // If a command link has a note, then add it.
- if ((pControl->dwStyle & BS_TYPEMASK) == BS_COMMANDLINK ||
- (pControl->dwStyle & BS_TYPEMASK) == BS_DEFCOMMANDLINK) {
- hr = StrAllocFormatted(&name, L"#(loc.%lsNote)", pControl->sczName);
- if (SUCCEEDED(hr)) {
- hr = LocGetString(_wixLoc, name, &locText);
- ReleaseStr(name);
- if (SUCCEEDED(hr) && locText && locText->wzText && locText->wzText[0]) {
- hr = BalFormatString(locText->wzText, &text);
- if (SUCCEEDED(hr) && text && text[0]) {
- ThemeSendControlMessage(_theme, pControl->wId, BCM_SETNOTE, 0, (LPARAM)text);
- ReleaseStr(text);
- text = nullptr;
- }
- }
- }
- hr = S_OK;
- }
if (!pControl->wPageId && pControl->sczText && *pControl->sczText) {
HRESULT hrFormat;
@@ -2270,6 +2225,30 @@
StrFree(controlState);
}
StrFree(controlName);
+ controlName = nullptr;
+
+
+ // If a command link has a note, then add it.
+ if ((pControl->dwStyle & BS_TYPEMASK) == BS_COMMANDLINK ||
+ (pControl->dwStyle & BS_TYPEMASK) == BS_DEFCOMMANDLINK) {
+ hr = StrAllocFormatted(&controlName, L"#(loc.%lsNote)", pControl->sczName);
+ if (SUCCEEDED(hr)) {
+ LOC_STRING *locText = nullptr;
+ hr = LocGetString(_wixLoc, controlName, &locText);
+ if (SUCCEEDED(hr) && locText && locText->wzText && locText->wzText[0]) {
+ LPWSTR text = nullptr;
+ hr = BalFormatString(locText->wzText, &text);
+ if (SUCCEEDED(hr) && text && text[0]) {
+ ThemeSendControlMessage(_theme, pControl->wId, BCM_SETNOTE, 0, (LPARAM)text);
+ ReleaseStr(text);
+ text = nullptr;
+ }
+ }
+ ReleaseStr(controlName);
+ controlName = nullptr;
+ }
+ hr = S_OK;
+ }
}
ThemeControlEnable(_theme, pControl->wId, enableControl);
@@ -2515,9 +2494,8 @@
if (_installPage == PAGE_LOADING) {
switch (_command.action) {
case BOOTSTRAPPER_ACTION_INSTALL:
- if (_upgradingOldVersion) {
+ if (_upgrading) {
_installPage = PAGE_UPGRADE;
- _upgrading = TRUE;
} else if (SUCCEEDED(BalGetNumericVariable(L"SimpleInstall", &simple)) && simple) {
_installPage = PAGE_SIMPLE_INSTALL;
} else {
@@ -2560,9 +2538,9 @@
static BAL_CONDITION WILL_ELEVATE_CONDITION = {
L"not WixBundleElevated and ("
/*Elevate when installing for all users*/
- L"InstallAllUsers or"
+ L"InstallAllUsers or "
/*Elevate when installing the launcher for all users and it was not detected*/
- L"(InstallLauncherAllUsers and Include_launcher and not DetectedLauncher) or"
+ L"(InstallLauncherAllUsers and Include_launcher and not DetectedLauncher) or "
/*Elevate when the launcher was installed for all users and it is being removed*/
L"(DetectedLauncher and DetectedLauncherAllUsers and not Include_launcher)"
L")",
@@ -2875,11 +2853,7 @@
HKEY hKey;
LRESULT res;
- if (IsTargetPlatformx64(pEngine)) {
- res = RegOpenKeyExW(hkHive, subkey, 0, KEY_READ | KEY_WOW64_64KEY, &hKey);
- } else {
- res = RegOpenKeyExW(hkHive, subkey, 0, KEY_READ | KEY_WOW64_32KEY, &hKey);
- }
+ res = RegOpenKeyExW(hkHive, subkey, 0, KEY_READ | KEY_WOW64_32KEY, &hKey);
if (res == ERROR_FILE_NOT_FOUND) {
return S_FALSE;
@@ -3089,7 +3063,6 @@
_hrFinal = hrHostInitialization;
_downgradingOtherVersion = FALSE;
- _upgradingOldVersion = FALSE;
_restartResult = BOOTSTRAPPER_APPLY_RESTART_NONE;
_restartRequired = FALSE;
_allowRestart = FALSE;
@@ -3113,8 +3086,6 @@
_hBAFModule = nullptr;
_baFunction = nullptr;
-
- EnsureTargetDir();
}
@@ -3174,7 +3145,6 @@
DWORD _calculatedExecuteProgress;
BOOL _downgradingOtherVersion;
- BOOL _upgradingOldVersion;
BOOTSTRAPPER_APPLY_RESTART _restartResult;
BOOL _restartRequired;
BOOL _allowRestart;
diff --git a/Tools/msi/bundle/bundle.wxs b/Tools/msi/bundle/bundle.wxs
--- a/Tools/msi/bundle/bundle.wxs
+++ b/Tools/msi/bundle/bundle.wxs
@@ -51,7 +51,7 @@
-->
-
+