diff --git a/Misc/NEWS b/Misc/NEWS
index 4dd67ecc683..f81b0844502 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -235,6 +235,8 @@ Library
Windows
-------
+- Issue #28402: Adds signed catalog files for stdlib on Windows.
+
- Issue #28333: Enables Unicode for ps1/ps2 and input() prompts. (Patch by
Eryk Sun)
diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props
index 543b4ca2080..7012170e0c7 100644
--- a/PCbuild/pyproject.props
+++ b/PCbuild/pyproject.props
@@ -147,11 +147,13 @@ foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses
Targets="CleanAll" />
-
- $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86\signtool.exe
- $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86\signtool.exe
- $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\signtool.exe
- <_SignCommand Condition="Exists($(SignToolPath))">"$(SignToolPath)" sign /q /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)"
+
+ $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)\bin\x86
+ $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86
+ $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86
+ $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\
+ <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificate)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /q /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)"
+ <_MakeCatCommand Condition="Exists($(SdkBinPath))">"$(SdkBinPath)\makecat.exe"
diff --git a/Tools/msi/common.wxs b/Tools/msi/common.wxs
index 1949e81c046..398d94a24d5 100644
--- a/Tools/msi/common.wxs
+++ b/Tools/msi/common.wxs
@@ -63,7 +63,9 @@
-
+
+
+
diff --git a/Tools/msi/lib/lib.wixproj b/Tools/msi/lib/lib.wixproj
index 64e58787b88..26311ea3272 100644
--- a/Tools/msi/lib/lib.wixproj
+++ b/Tools/msi/lib/lib.wixproj
@@ -27,6 +27,7 @@
$(PySourcePath)Lib
Lib\
lib_py
+ true
diff --git a/Tools/msi/lib/lib.wxs b/Tools/msi/lib/lib.wxs
index 2b04bcb3049..2a3b9ecfeef 100644
--- a/Tools/msi/lib/lib.wxs
+++ b/Tools/msi/lib/lib.wxs
@@ -11,6 +11,7 @@
+
diff --git a/Tools/msi/lib/lib_files.wxs b/Tools/msi/lib/lib_files.wxs
index 804ab0146d3..eb26f8d29d9 100644
--- a/Tools/msi/lib/lib_files.wxs
+++ b/Tools/msi/lib/lib_files.wxs
@@ -70,4 +70,11 @@
+
+
+
+
+
+
+
diff --git a/Tools/msi/msi.props b/Tools/msi/msi.props
index 745fc541175..60abba1f7be 100644
--- a/Tools/msi/msi.props
+++ b/Tools/msi/msi.props
@@ -11,6 +11,7 @@
Release
x86
perUser
+ <_MakeCatCommand Condition="'$(_MakeCatCommand)' == ''">makecat
@@ -103,6 +104,7 @@
generated_filelist
+ false
false
diff --git a/Tools/msi/msi.targets b/Tools/msi/msi.targets
index 86be35badb7..9283a1ed6c3 100644
--- a/Tools/msi/msi.targets
+++ b/Tools/msi/msi.targets
@@ -12,8 +12,10 @@
<_Source>%(Source)$([msbuild]::MakeRelative(%(SourceBase), %(FullPath)))
<_Target>%(Target_)$([msbuild]::MakeRelative(%(TargetBase), %(FullPath)))
+
+ <_CatalogFiles Include="@(InstallFiles)" Condition="%(InstallFiles.IncludeInCat) and ''!=$([System.IO.File]::ReadAllText(%(InstallFiles.FullPath)))" />
-
+
@@ -24,6 +26,35 @@
+
+
+ <_CatFileSourceTarget>$(IntermediateOutputPath)$(MSBuildProjectName).cdf
+ <_CatFileTarget>$(IntermediateOutputPath)python_$(MSBuildProjectName).cat
+ <_CatFile>[CatalogHeader]
+Name=$([System.IO.Path]::GetFileName($(_CatFileTarget)))
+ResultDir=$([System.IO.Path]::GetDirectoryName($(_CatFileTarget)))
+PublicVersion=1
+CatalogVersion=2
+HashAlgorithms=SHA256
+PageHashes=false
+EncodingType=
+
+[CatalogFiles]
+@(_CatalogFiles->'<HASH>%(Filename)%(Extension)=%(FullPath)','
+')
+
+
+
+
+
+
+
+
+
+
+
+
<_Content>$([System.IO.File]::ReadAllText(%(WxlTemplate.FullPath)).Replace(`{{ShortVersion}}`, `$(MajorVersionNumber).$(MinorVersionNumber)$(PyTestExt)`).Replace(`{{LongVersion}}`, `$(PythonVersion)$(PyTestExt)`).Replace(`{{Bitness}}`, `$(Bitness)`))
diff --git a/Tools/msi/tools/tools.wixproj b/Tools/msi/tools/tools.wixproj
index f43cf3309e9..b7fc41ee92e 100644
--- a/Tools/msi/tools/tools.wixproj
+++ b/Tools/msi/tools/tools.wixproj
@@ -36,6 +36,7 @@
$(PySourcePath)
tools_py
+ true
diff --git a/Tools/msi/tools/tools.wxs b/Tools/msi/tools/tools.wxs
index 8f8418a46c2..7a805d0612e 100644
--- a/Tools/msi/tools/tools.wxs
+++ b/Tools/msi/tools/tools.wxs
@@ -9,6 +9,7 @@
+
diff --git a/Tools/msi/tools/tools_files.wxs b/Tools/msi/tools/tools_files.wxs
index 3ae0db2e1fd..9c76b1b4446 100644
--- a/Tools/msi/tools/tools_files.wxs
+++ b/Tools/msi/tools/tools_files.wxs
@@ -13,4 +13,11 @@
+
+
+
+
+
+
+