Skip to content

bpo-46744: Move Windows ARM64 installation directory to correct ProgramFiles folder #31677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The default all users install directory for ARM64 is now under the native
``Program Files`` folder, rather than ``Program Files (Arm)`` which is
intended for ARM (32-bit) files.
34 changes: 0 additions & 34 deletions Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1501,9 +1501,6 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
hr = UpdateUIStrings(_command.action);
BalExitOnFailure(hr, "Failed to load UI strings.");

hr = FindProgramFilesArm();
BalExitOnFailure(hr, "Fatal error locating Program Files (Arm)");

GetBundleFileVersion();
// don't fail if we couldn't get the version info; best-effort only
LExit:
Expand Down Expand Up @@ -2184,37 +2181,6 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
return hr;
}

HRESULT FindProgramFilesArm() {
wchar_t buffer[MAX_PATH + 1];
DWORD bufferLen = MAX_PATH;
LSTATUS res = RegGetValueW(
HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
L"ProgramFilesDir (Arm)",
RRF_RT_REG_SZ | RRF_RT_REG_EXPAND_SZ | RRF_SUBKEY_WOW6464KEY,
NULL,
buffer,
&bufferLen
);
if (res != ERROR_SUCCESS) {
// ProgramFilesArmFolder will default to ProgramFilesFolder. We only report
// an error if the value existed, as it will simply just be absent on non-ARM
// devices.
if (res != ERROR_FILE_NOT_FOUND) {
BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Failed to query 'ProgramFilesDir (Arm)': error code %d", res);
}
return S_OK;
}
if (buffer[0]) {
wchar_t *p = &buffer[bufferLen / sizeof(wchar_t) - 1];
while (*p == L'\\' || *p == L'\0') { p -= 1; }
*++p = L'\\';
*++p = L'\0';
_engine->SetVariableString(L"ProgramFilesArmFolder", buffer);
}
return S_OK;
}

//
// OnPlan - plan the detected changes.
//
Expand Down
5 changes: 1 addition & 4 deletions Tools/msi/bundle/bundle.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
<Variable Name="WinVer" Value="$(var.MajorVersionNumber).$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)" />
<Variable Name="WinVerNoDot" Value="$(var.MajorVersionNumber)$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)" />

<!-- A more accurate value may be calculated by the bootstrapper -->
<Variable Name="ProgramFilesArmFolder" Value="[ProgramFilesFolder]" bal:Overridable="yes" />

<Variable Name="InstallAllUsers" Value="0" bal:Overridable="yes" />
<?if "$(var.PyTestExt)"="" ?>
<Variable Name="InstallLauncherAllUsers" Value="1" bal:Overridable="yes" />
Expand All @@ -40,7 +37,7 @@
<Variable Name="DefaultAllUsersTargetDir" Value="[ProgramFiles64Folder]Python[WinVerNoDot]" bal:Overridable="yes" />
<Variable Name="TargetPlatform" Value="x64" />
<?elseif $(var.Platform)~="ARM64" ?>
<Variable Name="DefaultAllUsersTargetDir" Value="[ProgramFilesArmFolder]Python[WinVerNoDot]" bal:Overridable="yes" />
<Variable Name="DefaultAllUsersTargetDir" Value="[ProgramFiles64Folder]Python[WinVerNoDot]" bal:Overridable="yes" />
<Variable Name="TargetPlatform" Value="ARM64" />
<?else ?>
<Variable Name="DefaultAllUsersTargetDir" Value="[ProgramFilesFolder]Python[WinVerNoDot]" bal:Overridable="yes" />
Expand Down