From a204b71769f168f4ece750e0faf369f4b91f7ce2 Mon Sep 17 00:00:00 2001
From: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
Date: Fri, 2 Dec 2022 12:41:30 -0300
Subject: [PATCH] windows: update SDK required version to 10.0.18362.0

Change-Id: Ic3c0a52dce9ace78f8c3288c8326cc41da809fad
---
 compat/msvc/winmake.py                       |   4 +-
 contrib/src/ffmpeg/package.json              |   2 +-
 contrib/src/jsoncpp/jsoncpp-vs2017.patch     |   2 +-
 contrib/src/libarchive/0002-win-vs2019.patch |  44 ++++----
 contrib/src/pthreads/pthreads-vs2017.patch   |  22 ++--
 contrib/src/secp256k1/secp256k1-vs2017.patch | 100 +++++++++----------
 contrib/src/upnp/libupnp-windows.patch       |   4 +-
 7 files changed, 89 insertions(+), 89 deletions(-)

diff --git a/compat/msvc/winmake.py b/compat/msvc/winmake.py
index e96fcc9bf0..24d817ec48 100644
--- a/compat/msvc/winmake.py
+++ b/compat/msvc/winmake.py
@@ -15,7 +15,7 @@ A package can be defined with a json like this:
     "patches": ["some_patch.patch"],
     "win_patches": ["some_windows_line_ending_patch.patch"],
     "project_paths": ["mylibrary-static.vcxproj"],
-    "with_env" : "10.0.16299.0",
+    "with_env" : "10.0.18362.0",
     "custom_scripts": { "pre_build": [], "build": [], "post_build": [] }
 }
 """
@@ -66,7 +66,7 @@ git_apply_args = ['apply', '--reject',
 patch_args = ['-flp1', '-i']
 
 # vs help
-win_sdk_default = '10.0.16299.0'
+win_sdk_default = '10.0.18362.0'
 win_toolset_default = '142'
 
 vs_where_path = os.path.join(
diff --git a/contrib/src/ffmpeg/package.json b/contrib/src/ffmpeg/package.json
index aaf7bde0bb..c6c9bc4a06 100644
--- a/contrib/src/ffmpeg/package.json
+++ b/contrib/src/ffmpeg/package.json
@@ -21,7 +21,7 @@
     "win_patches": [
     ],
     "project_paths": [],
-    "with_env" : "10.0.16299.0",
+    "with_env" : "10.0.18362.0",
     "custom_scripts": {
         "pre_build": [],
         "build": [
diff --git a/contrib/src/jsoncpp/jsoncpp-vs2017.patch b/contrib/src/jsoncpp/jsoncpp-vs2017.patch
index c586c8635a..079971b632 100644
--- a/contrib/src/jsoncpp/jsoncpp-vs2017.patch
+++ b/contrib/src/jsoncpp/jsoncpp-vs2017.patch
@@ -35,7 +35,7 @@
 +    <ProjectGuid>{1E6C2C1C-6453-4129-AE3F-0EE8E6599C89}</ProjectGuid>
 +    <Keyword>Win32Proj</Keyword>
 +    <RootNamespace>jsoncpp</RootNamespace>
-+    <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
++    <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
 +  </PropertyGroup>
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
diff --git a/contrib/src/libarchive/0002-win-vs2019.patch b/contrib/src/libarchive/0002-win-vs2019.patch
index 0ee430fb8a..d465a00455 100644
--- a/contrib/src/libarchive/0002-win-vs2019.patch
+++ b/contrib/src/libarchive/0002-win-vs2019.patch
@@ -1,19 +1,19 @@
-From 261240c41e3011830eacc917587c98d40428ff4e Mon Sep 17 00:00:00 2001
-From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
-Date: Thu, 20 Aug 2020 17:41:31 -0400
-Subject: [PATCH] win vs2019
-
----
- msvc/libarchive/archive_static.vcxproj | 240 +++++++++++++++++++++++++
- 1 file changed, 240 insertions(+)
- create mode 100644 msvc/libarchive/archive_static.vcxproj
-
-diff --git a/msvc/libarchive/archive_static.vcxproj b/msvc/libarchive/archive_static.vcxproj
-new file mode 100644
-index 0000000..f820489
---- /dev/null
-+++ b/msvc/libarchive/archive_static.vcxproj
-@@ -0,0 +1,240 @@
+From 261240c41e3011830eacc917587c98d40428ff4e Mon Sep 17 00:00:00 2001
+From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
+Date: Thu, 20 Aug 2020 17:41:31 -0400
+Subject: [PATCH] win vs2019
+
+---
+ msvc/libarchive/archive_static.vcxproj | 240 +++++++++++++++++++++++++
+ 1 file changed, 240 insertions(+)
+ create mode 100644 msvc/libarchive/archive_static.vcxproj
+
+diff --git a/msvc/libarchive/archive_static.vcxproj b/msvc/libarchive/archive_static.vcxproj
+new file mode 100644
+index 0000000..f820489
+--- /dev/null
++++ b/msvc/libarchive/archive_static.vcxproj
+@@ -0,0 +1,240 @@
 +<?xml version="1.0" encoding="utf-8"?>
 +<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 +  <PropertyGroup>
@@ -27,7 +27,7 @@ index 0000000..f820489
 +  </ItemGroup>
 +  <PropertyGroup Label="Globals">
 +    <ProjectGuid>{EC42C425-F492-3C2E-8CF5-C02DBC0AE100}</ProjectGuid>
-+    <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
++    <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
 +    <Keyword>Win32Proj</Keyword>
 +    <Platform>x64</Platform>
 +    <ProjectName>archive_static</ProjectName>
@@ -253,8 +253,8 @@ index 0000000..f820489
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 +  <ImportGroup Label="ExtensionTargets">
 +  </ImportGroup>
-+</Project>
-\ No newline at end of file
--- 
-2.17.1
-
++</Project>
+\ No newline at end of file
+-- 
+2.17.1
+
diff --git a/contrib/src/pthreads/pthreads-vs2017.patch b/contrib/src/pthreads/pthreads-vs2017.patch
index 96fcb3c0cb..68dfdaf2c2 100644
--- a/contrib/src/pthreads/pthreads-vs2017.patch
+++ b/contrib/src/pthreads/pthreads-vs2017.patch
@@ -1,6 +1,6 @@
---- /dev/null
-+++ b/MSVC/pthreads.vcxproj
-@@ -0,0 +1,166 @@
+--- /dev/null
++++ b/MSVC/pthreads.vcxproj
+@@ -0,0 +1,166 @@
 +<?xml version="1.0" encoding="utf-8"?>
 +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 +  <ItemGroup Label="ProjectConfigurations">
@@ -24,7 +24,7 @@
 +  <PropertyGroup Label="Globals">
 +    <ProjectGuid>{CC0B570C-7F2D-4809-98F4-57D97E2E7317}</ProjectGuid>
 +    <RootNamespace>pthreads</RootNamespace>
-+    <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
++    <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
 +  </PropertyGroup>
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -124,7 +124,7 @@
 +      <Command>mkdir "$(OutDir)"\include
 +xcopy /S /Y $(ProjectDir)..\sched.h "$(OutDir)"\include
 +xcopy /S /Y $(ProjectDir)..\semaphore.h "$(OutDir)"\include
-+xcopy /S /Y $(ProjectDir)..\pthread.h "$(OutDir)"\include
++xcopy /S /Y $(ProjectDir)..\pthread.h "$(OutDir)"\include
 +xcopy /S /Y $(ProjectDir)..\_ptw32.h "$(OutDir)"\include</Command>
 +    </PostBuildEvent>
 +  </ItemDefinitionGroup>
@@ -147,7 +147,7 @@
 +      <Command>mkdir "$(OutDir)"\include
 +xcopy /S /Y $(ProjectDir)..\sched.h "$(OutDir)"\include
 +xcopy /S /Y $(ProjectDir)..\semaphore.h "$(OutDir)"\include
-+xcopy /S /Y $(ProjectDir)..\pthread.h "$(OutDir)"\include
++xcopy /S /Y $(ProjectDir)..\pthread.h "$(OutDir)"\include
 +xcopy /S /Y $(ProjectDir)..\_ptw32.h "$(OutDir)"\include</Command>
 +    </PostBuildEvent>
 +    <Lib>
@@ -166,8 +166,8 @@
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 +  <ImportGroup Label="ExtensionTargets">
 +  </ImportGroup>
-+</Project>
-\ No newline at end of file
--- 
-2.10.2.windows.1
-
++</Project>
+\ No newline at end of file
+-- 
+2.10.2.windows.1
+
diff --git a/contrib/src/secp256k1/secp256k1-vs2017.patch b/contrib/src/secp256k1/secp256k1-vs2017.patch
index d5018bc6b9..2cdedfde26 100644
--- a/contrib/src/secp256k1/secp256k1-vs2017.patch
+++ b/contrib/src/secp256k1/secp256k1-vs2017.patch
@@ -1,6 +1,6 @@
---- /dev/null
-+++ b/MSVC/secp256k1.vcxproj
-@@ -0,0 +1,252 @@
+--- /dev/null
++++ b/MSVC/secp256k1.vcxproj
+@@ -0,0 +1,252 @@
 +<?xml version="1.0" encoding="utf-8"?>
 +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 +  <ItemGroup Label="ProjectConfigurations">
@@ -24,7 +24,7 @@
 +  <PropertyGroup Label="Globals">
 +    <ProjectGuid>{F9B2C8DE-71B0-401B-84FB-57EA34E9CB6C}</ProjectGuid>
 +    <RootNamespace>secp256k1</RootNamespace>
-+    <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
++    <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
 +  </PropertyGroup>
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -98,10 +98,10 @@
 +      <OutputFile>$(OutDir)\lib\x86\$(TargetName)$(TargetExt)</OutputFile>
 +    </Lib>
 +    <PostBuildEvent>
-+      <Command>mkdir "$(OutDir)"include
-+
-+xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
-+
++      <Command>mkdir "$(OutDir)"include
++
++xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
++
 +</Command>
 +    </PostBuildEvent>
 +  </ItemDefinitionGroup>
@@ -120,10 +120,10 @@
 +      <OutputFile>$(OutDir)\lib\x64\$(TargetName)$(TargetExt)</OutputFile>
 +    </Lib>
 +    <PostBuildEvent>
-+      <Command>mkdir "$(OutDir)"include
-+
-+xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
-+
++      <Command>mkdir "$(OutDir)"include
++
++xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
++
 +</Command>
 +    </PostBuildEvent>
 +  </ItemDefinitionGroup>
@@ -148,10 +148,10 @@
 +      <OutputFile>$(OutDir)\lib\x86\$(TargetName)$(TargetExt)</OutputFile>
 +    </Lib>
 +    <PostBuildEvent>
-+      <Command>mkdir "$(OutDir)"include
-+
-+xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
-+
++      <Command>mkdir "$(OutDir)"include
++
++xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
++
 +</Command>
 +    </PostBuildEvent>
 +  </ItemDefinitionGroup>
@@ -173,10 +173,10 @@
 +      <OptimizeReferences>true</OptimizeReferences>
 +    </Link>
 +    <PostBuildEvent>
-+      <Command>mkdir "$(OutDir)"include
-+
-+xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
-+
++      <Command>mkdir "$(OutDir)"include
++
++xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
++
 +</Command>
 +    </PostBuildEvent>
 +    <Lib>
@@ -252,15 +252,15 @@
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 +  <ImportGroup Label="ExtensionTargets">
 +  </ImportGroup>
-+</Project>
-\ No newline at end of file
---- a/src/bench.h
-+++ b/src/bench.h
-@@ -9,7 +9,46 @@
- 
- #include <stdio.h>
- #include <math.h>
-+#ifdef _WIN32
++</Project>
+\ No newline at end of file
+--- a/src/bench.h
++++ b/src/bench.h
+@@ -9,7 +9,46 @@
+ 
+ #include <stdio.h>
+ #include <math.h>
++#ifdef _WIN32
 +#include <time.h>
 +#include <winsock2.h>
 +
@@ -296,24 +296,24 @@
 +		tzp->tz_dsttime = _daylight;
 +	}
 +	return 0;
-+}
-+#else
- #include "sys/time.h"
-+#endif
- 
- static double gettimedouble(void) {
-     struct timeval tv;
---- a/src/gen_context.c
-+++ b/src/gen_context.c
-@@ -33,7 +33,7 @@ int main(int argc, char **argv) {
-     (void)argc;
-     (void)argv;
- 
--    fp = fopen("src/ecmult_static_context.h","w");
-+    fopen_s(&fp, "src/ecmult_static_context.h","w");
-     if (fp == NULL) {
-         fprintf(stderr, "Could not open src/ecmult_static_context.h for writing!\n");
-         return -1;
--- 
-2.10.2.windows.1
-
++}
++#else
+ #include "sys/time.h"
++#endif
+ 
+ static double gettimedouble(void) {
+     struct timeval tv;
+--- a/src/gen_context.c
++++ b/src/gen_context.c
+@@ -33,7 +33,7 @@ int main(int argc, char **argv) {
+     (void)argc;
+     (void)argv;
+ 
+-    fp = fopen("src/ecmult_static_context.h","w");
++    fopen_s(&fp, "src/ecmult_static_context.h","w");
+     if (fp == NULL) {
+         fprintf(stderr, "Could not open src/ecmult_static_context.h for writing!\n");
+         return -1;
+-- 
+2.10.2.windows.1
+
diff --git a/contrib/src/upnp/libupnp-windows.patch b/contrib/src/upnp/libupnp-windows.patch
index 8db50d6b73..5f03c8d0b9 100644
--- a/contrib/src/upnp/libupnp-windows.patch
+++ b/contrib/src/upnp/libupnp-windows.patch
@@ -96,7 +96,7 @@ Subject: [PATCH] Windows patch.
 +  <PropertyGroup Label="Globals">
 +    <ProjectGuid>{9C2C266D-35A3-465F-A297-0E21D54E5C89}</ProjectGuid>
 +    <RootNamespace>ixml</RootNamespace>
-+    <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
++    <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
 +  </PropertyGroup>
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
@@ -445,7 +445,7 @@ Subject: [PATCH] Windows patch.
 +  <PropertyGroup Label="Globals">
 +    <ProjectGuid>{6227F51A-1498-4C4A-B213-F6FDED605125}</ProjectGuid>
 +    <RootNamespace>libupnp</RootNamespace>
-+    <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
++    <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
 +  </PropertyGroup>
 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-- 
GitLab