@@ -724,6 +724,8 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
724
724
auto hr = LoadAssociateFilesStateFromKey (_engine, fPerMachine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER);
725
725
if (hr == S_OK) {
726
726
_engine->SetVariableNumeric (L" AssociateFiles" , 1 );
727
+ } else if (hr == S_FALSE) {
728
+ _engine->SetVariableNumeric (L" AssociateFiles" , 0 );
727
729
} else if (FAILED (hr)) {
728
730
BalLog (BOOTSTRAPPER_LOG_LEVEL_ERROR, " Failed to load AssociateFiles state: error code 0x%08X" , hr);
729
731
}
@@ -817,6 +819,8 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
817
819
auto hr = LoadAssociateFilesStateFromKey (_engine, hkey);
818
820
if (hr == S_OK) {
819
821
_engine->SetVariableNumeric (L" AssociateFiles" , 1 );
822
+ } else if (hr == S_FALSE) {
823
+ _engine->SetVariableNumeric (L" AssociateFiles" , 0 );
820
824
} else if (FAILED (hr)) {
821
825
BalLog (BOOTSTRAPPER_LOG_LEVEL_ERROR, " Failed to load AssociateFiles state: error code 0x%08X" , hr);
822
826
}
@@ -834,7 +838,17 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
834
838
LONGLONG includeLauncher;
835
839
if (SUCCEEDED (BalGetNumericVariable (L" Include_launcher" , &includeLauncher))
836
840
&& includeLauncher == -1 ) {
837
- _engine->SetVariableNumeric (L" Include_launcher" , 1 );
841
+ if (BOOTSTRAPPER_ACTION_LAYOUT == _command.action ||
842
+ (BOOTSTRAPPER_ACTION_INSTALL == _command.action && !_upgrading)) {
843
+ // When installing/downloading, we want to include the launcher
844
+ // by default.
845
+ _engine->SetVariableNumeric (L" Include_launcher" , 1 );
846
+ } else {
847
+ // Any other action, if we didn't detect the MSI then we want to
848
+ // keep it excluded
849
+ _engine->SetVariableNumeric (L" Include_launcher" , 0 );
850
+ _engine->SetVariableNumeric (L" AssociateFiles" , 0 );
851
+ }
838
852
}
839
853
}
840
854
@@ -2812,6 +2826,17 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
2812
2826
return ::CompareStringW (LOCALE_NEUTRAL, 0 , platform, -1 , L" x64" , -1 ) == CSTR_EQUAL;
2813
2827
}
2814
2828
2829
+ static bool IsTargetPlatformARM64 (__in IBootstrapperEngine* pEngine) {
2830
+ WCHAR platform[8 ];
2831
+ DWORD platformLen = 8 ;
2832
+
2833
+ if (FAILED (pEngine->GetVariableString (L" TargetPlatform" , platform, &platformLen))) {
2834
+ return S_FALSE;
2835
+ }
2836
+
2837
+ return ::CompareStringW (LOCALE_NEUTRAL, 0 , platform, -1 , L" ARM64" , -1 ) == CSTR_EQUAL;
2838
+ }
2839
+
2815
2840
static HRESULT LoadOptionalFeatureStatesFromKey (
2816
2841
__in IBootstrapperEngine* pEngine,
2817
2842
__in HKEY hkHive,
@@ -2820,7 +2845,7 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
2820
2845
HKEY hKey;
2821
2846
LRESULT res;
2822
2847
2823
- if (IsTargetPlatformx64 (pEngine)) {
2848
+ if (IsTargetPlatformx64 (pEngine) || IsTargetPlatformARM64 (pEngine) ) {
2824
2849
res = RegOpenKeyExW (hkHive, subkey, 0 , KEY_READ | KEY_WOW64_64KEY, &hKey);
2825
2850
} else {
2826
2851
res = RegOpenKeyExW (hkHive, subkey, 0 , KEY_READ | KEY_WOW64_32KEY, &hKey);
@@ -2859,7 +2884,7 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
2859
2884
BYTE buffer[1024 ];
2860
2885
DWORD bufferLen = sizeof (buffer);
2861
2886
2862
- if (IsTargetPlatformx64 (pEngine)) {
2887
+ if (IsTargetPlatformx64 (pEngine) || IsTargetPlatformARM64 (pEngine) ) {
2863
2888
res = RegOpenKeyExW (hkHive, subkey, 0 , KEY_READ | KEY_WOW64_64KEY, &hKey);
2864
2889
} else {
2865
2890
res = RegOpenKeyExW (hkHive, subkey, 0 , KEY_READ | KEY_WOW64_32KEY, &hKey);
@@ -2917,12 +2942,7 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
2917
2942
HRESULT hr;
2918
2943
HKEY hkHive;
2919
2944
2920
- // The launcher installation is separate from the Python install, so we
2921
- // check its state later. For now, assume we don't want the launcher or
2922
- // file associations, and if they have already been installed then
2923
- // loading the state will reactivate these settings.
2924
- pEngine->SetVariableNumeric (L" Include_launcher" , 0 );
2925
- pEngine->SetVariableNumeric (L" AssociateFiles" , 0 );
2945
+ BalLog (BOOTSTRAPPER_LOG_LEVEL_STANDARD, " Loading state of optional features" );
2926
2946
2927
2947
// Get the registry key from the bundle, to save having to duplicate it
2928
2948
// in multiple places.
0 commit comments