Skip to content

Commit 8f31bf4

Browse files
authored
bpo-46744: Move Windows ARM64 installation directory to correct ProgramFiles (GH-31677)
1 parent ec4a580 commit 8f31bf4

File tree

3 files changed

+4
-38
lines changed

3 files changed

+4
-38
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The default all users install directory for ARM64 is now under the native
2+
``Program Files`` folder, rather than ``Program Files (Arm)`` which is
3+
intended for ARM (32-bit) files.

Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp

-34
Original file line numberDiff line numberDiff line change
@@ -1501,9 +1501,6 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
15011501
hr = UpdateUIStrings(_command.action);
15021502
BalExitOnFailure(hr, "Failed to load UI strings.");
15031503

1504-
hr = FindProgramFilesArm();
1505-
BalExitOnFailure(hr, "Fatal error locating Program Files (Arm)");
1506-
15071504
GetBundleFileVersion();
15081505
// don't fail if we couldn't get the version info; best-effort only
15091506
LExit:
@@ -2184,37 +2181,6 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
21842181
return hr;
21852182
}
21862183

2187-
HRESULT FindProgramFilesArm() {
2188-
wchar_t buffer[MAX_PATH + 1];
2189-
DWORD bufferLen = MAX_PATH;
2190-
LSTATUS res = RegGetValueW(
2191-
HKEY_LOCAL_MACHINE,
2192-
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
2193-
L"ProgramFilesDir (Arm)",
2194-
RRF_RT_REG_SZ | RRF_RT_REG_EXPAND_SZ | RRF_SUBKEY_WOW6464KEY,
2195-
NULL,
2196-
buffer,
2197-
&bufferLen
2198-
);
2199-
if (res != ERROR_SUCCESS) {
2200-
// ProgramFilesArmFolder will default to ProgramFilesFolder. We only report
2201-
// an error if the value existed, as it will simply just be absent on non-ARM
2202-
// devices.
2203-
if (res != ERROR_FILE_NOT_FOUND) {
2204-
BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Failed to query 'ProgramFilesDir (Arm)': error code %d", res);
2205-
}
2206-
return S_OK;
2207-
}
2208-
if (buffer[0]) {
2209-
wchar_t *p = &buffer[bufferLen / sizeof(wchar_t) - 1];
2210-
while (*p == L'\\' || *p == L'\0') { p -= 1; }
2211-
*++p = L'\\';
2212-
*++p = L'\0';
2213-
_engine->SetVariableString(L"ProgramFilesArmFolder", buffer);
2214-
}
2215-
return S_OK;
2216-
}
2217-
22182184
//
22192185
// OnPlan - plan the detected changes.
22202186
//

Tools/msi/bundle/bundle.wxs

+1-4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
<Variable Name="WinVer" Value="$(var.MajorVersionNumber).$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)" />
2727
<Variable Name="WinVerNoDot" Value="$(var.MajorVersionNumber)$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)" />
2828

29-
<!-- A more accurate value may be calculated by the bootstrapper -->
30-
<Variable Name="ProgramFilesArmFolder" Value="[ProgramFilesFolder]" bal:Overridable="yes" />
31-
3229
<Variable Name="InstallAllUsers" Value="0" bal:Overridable="yes" />
3330
<?if "$(var.PyTestExt)"="" ?>
3431
<Variable Name="InstallLauncherAllUsers" Value="1" bal:Overridable="yes" />
@@ -40,7 +37,7 @@
4037
<Variable Name="DefaultAllUsersTargetDir" Value="[ProgramFiles64Folder]Python[WinVerNoDot]" bal:Overridable="yes" />
4138
<Variable Name="TargetPlatform" Value="x64" />
4239
<?elseif $(var.Platform)~="ARM64" ?>
43-
<Variable Name="DefaultAllUsersTargetDir" Value="[ProgramFilesArmFolder]Python[WinVerNoDot]" bal:Overridable="yes" />
40+
<Variable Name="DefaultAllUsersTargetDir" Value="[ProgramFiles64Folder]Python[WinVerNoDot]" bal:Overridable="yes" />
4441
<Variable Name="TargetPlatform" Value="ARM64" />
4542
<?else ?>
4643
<Variable Name="DefaultAllUsersTargetDir" Value="[ProgramFilesFolder]Python[WinVerNoDot]" bal:Overridable="yes" />

0 commit comments

Comments
 (0)