bpo-32507: Change Windows install to include app-local UCRT (#5119)

diff --git a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
index e88981f..2e468b7 100644
--- a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
+++ b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
@@ -281,10 +281,6 @@
         case ID_INSTALL_BUTTON:
             SavePageSettings();
 
-            if (!WillElevate() && !QueryElevateForCrtInstall()) {
-                break;
-            }
-
             hr = BalGetNumericVariable(L"InstallAllUsers", &installAllUsers);
             ExitOnFailure(hr, L"Failed to get install scope");
 
@@ -332,10 +328,6 @@
                 ReleaseStr(targetDir);
             }
 
-            if (!WillElevate() && !QueryElevateForCrtInstall()) {
-                break;
-            }
-
             OnPlan(_command.action);
             break;
 
@@ -2642,30 +2634,6 @@
         return result;
     }
 
-    BOOL QueryElevateForCrtInstall() {
-        // Called to prompt the user that even though they think they won't need
-        // to elevate, they actually will because of the CRT install.
-        if (IsCrtInstalled()) {
-            // CRT is already installed - no need to prompt
-            return TRUE;
-        }
-        
-        LONGLONG elevated;
-        HRESULT hr = BalGetNumericVariable(L"WixBundleElevated", &elevated);
-        if (SUCCEEDED(hr) && elevated) {
-            // Already elevated - no need to prompt
-            return TRUE;
-        }
-
-        LOC_STRING *locStr;
-        hr = LocGetString(_wixLoc, L"#(loc.ElevateForCRTInstall)", &locStr);
-        if (FAILED(hr)) {
-            BalLogError(hr, "Failed to get ElevateForCRTInstall string");
-            return FALSE;
-        }
-        return ::MessageBoxW(_hWnd, locStr->wzText, _theme->sczCaption, MB_YESNO) != IDNO;
-    }
-
     HRESULT EvaluateConditions() {
         HRESULT hr = S_OK;
         BOOL result = FALSE;
diff --git a/Tools/msi/bundle/bundle.targets b/Tools/msi/bundle/bundle.targets
index e0dae21..f882d2e 100644
--- a/Tools/msi/bundle/bundle.targets
+++ b/Tools/msi/bundle/bundle.targets
@@ -71,6 +71,7 @@
         <Package Include="..\tcltk\tcltk*.wixproj" />
         <Package Include="..\test\test*.wixproj" />
         <Package Include="..\tools\tools*.wixproj" />
+        <Package Include="..\ucrt\ucrt*.wixproj" />
     </ItemGroup>
     
     <PropertyGroup>
diff --git a/Tools/msi/bundle/packagegroups/crt.wxs b/Tools/msi/bundle/packagegroups/crt.wxs
index dc40475..61b756f 100644
--- a/Tools/msi/bundle/packagegroups/crt.wxs
+++ b/Tools/msi/bundle/packagegroups/crt.wxs
@@ -2,48 +2,22 @@
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
     <Fragment>
         <PackageGroup Id="crt">
-            <PackageGroupRef Id="crt_14.0_v6.0" />
-            <PackageGroupRef Id="crt_14.0_v6.1" />
-            <PackageGroupRef Id="crt_14.0_v6.2" />
-            <PackageGroupRef Id="crt_14.0_v6.3" />
-        </PackageGroup>
-    </Fragment>
-
-    <?foreach ver in v6.0;v6.1;v6.2;v6.3 ?>
-    <?if "$(var.ver)" = "v6.0" ?>
-    <?define msuver=6.0 ?>
-    <?elseif "$(var.ver)" = "v6.1" ?>
-    <?define msuver=6.1 ?>
-    <?elseif "$(var.ver)" = "v6.2" ?>
-    <?define msuver=8-RT ?>
-    <?elseif "$(var.ver)" = "v6.3" ?>
-    <?define msuver=8.1 ?>
-    <?else ?>
-    <?error unknown version $(var.ver) ?>
-    <?endif ?>
-
-    <Fragment>
-        <PackageGroup Id="crt_14.0_$(var.ver)">
-            <MsuPackage Id="crt_14.0_$(var.ver)_x86"
-                        KB="2999226"
-                        SourceFile="!(bindpath.redist)\Windows$(var.msuver)-KB2999226-x86.msu"
-                        DisplayName="!(loc.CRTDescription)"
-                        Description="!(loc.CRTDescription)"
+            <MsiPackage Id="ucrt_AllUsers"
+                        SourceFile="ucrt.msi"
                         Compressed="$(var.CompressMSI)"
                         DownloadUrl="$(var.DownloadUrl)"
-                        InstallCondition="not CRTInstalled and VersionNT = $(var.ver) and not VersionNT64 and (Include_core or Include_exe or Include_launcher or Include_pip) and not LauncherOnly" />
-
-            <MsuPackage Id="crt_14.0_$(var.ver)_x64"
-                        KB="2999226"
-                        SourceFile="!(bindpath.redist)\Windows$(var.msuver)-KB2999226-x64.msu"
-                        DisplayName="!(loc.CRTDescription)"
-                        Description="!(loc.CRTDescription)"
+                        ForcePerMachine="yes"
+                        InstallCondition="InstallAllUsers and not CRTInstalled and (Include_core or Include_exe or Include_pip) and not LauncherOnly">
+                <MsiProperty Name="TARGETDIR" Value="[TargetDir]" />
+            </MsiPackage>
+            <MsiPackage Id="ucrt_JustForMe"
+                        SourceFile="ucrt.msi"
                         Compressed="$(var.CompressMSI)"
                         DownloadUrl="$(var.DownloadUrl)"
-                        InstallCondition="not CRTInstalled and VersionNT64 = $(var.ver) and (Include_core or Include_exe or Include_launcher or Include_pip) and not LauncherOnly" />
+                        ForcePerMachine="no"
+                        InstallCondition="not InstallAllUsers and not CRTInstalled and (Include_core or Include_exe or Include_pip) and not LauncherOnly">
+                <MsiProperty Name="TARGETDIR" Value="[TargetDir]" />
+            </MsiPackage>
         </PackageGroup>
     </Fragment>
-
-    <?undef msuver ?>
-    <?endforeach ?>
 </Wix>
\ No newline at end of file