From 9987485f63c98df5b04848f9a0f5eceaa794261f Mon Sep 17 00:00:00 2001
From: atraczyk <andreastraczyk@gmail.com>
Date: Fri, 17 Feb 2017 18:15:54 -0500
Subject: [PATCH] clean up solution

---
 MSVC/.gitignore                               |   1 -
 MSVC/contrib/src/fetch_and_patch.bat          |  20 +
 MSVC/contrib/src/gmp/fetch_and_patch.bat      |  22 +
 MSVC/contrib/src/gmp/gmp-uwp.patch            | 110 +++++
 MSVC/contrib/src/gnutls/fetch_and_patch.bat   |  24 +
 MSVC/contrib/src/gnutls/gnutls-no-egd.patch   | 107 +++++
 MSVC/contrib/src/gnutls/gnutls-uwp.patch      | 445 ++++++++++++++++++
 .../src/gnutls/read-file-limits.h.patch       |  12 +
 MSVC/contrib/src/iconv/fetch_and_patch.bat    |  22 +
 MSVC/contrib/src/iconv/libiconv-uwp.patch     |  99 ++++
 MSVC/contrib/src/msgpack/fetch_and_patch.bat  |  22 +
 MSVC/contrib/src/msgpack/msgpack-uwp.patch    | 221 +++++++++
 MSVC/contrib/src/nettle/fetch_and_patch.bat   |  22 +
 MSVC/contrib/src/nettle/nettle-uwp.patch      | 228 +++++++++
 MSVC/contrib/src/zlib/fetch_and_patch.bat     |  22 +
 MSVC/contrib/src/zlib/zlib-uwp.patch          |  97 ++++
 MSVC/dhtchat.vcxproj                          |   4 +-
 MSVC/dhtnode.vcxproj                          |   4 +-
 MSVC/dhtscanner.vcxproj                       |   4 +-
 MSVC/opendht.vcxproj                          |   3 +-
 MSVC/opendht.vcxproj.filters                  |   3 +
 MSVC/opendht_deps.sln                         |  27 +-
 MSVC/project_get_dependencies.bat             |  79 ----
 23 files changed, 1491 insertions(+), 107 deletions(-)
 create mode 100644 MSVC/contrib/src/fetch_and_patch.bat
 create mode 100644 MSVC/contrib/src/gmp/fetch_and_patch.bat
 create mode 100644 MSVC/contrib/src/gmp/gmp-uwp.patch
 create mode 100644 MSVC/contrib/src/gnutls/fetch_and_patch.bat
 create mode 100644 MSVC/contrib/src/gnutls/gnutls-no-egd.patch
 create mode 100644 MSVC/contrib/src/gnutls/gnutls-uwp.patch
 create mode 100644 MSVC/contrib/src/gnutls/read-file-limits.h.patch
 create mode 100644 MSVC/contrib/src/iconv/fetch_and_patch.bat
 create mode 100644 MSVC/contrib/src/iconv/libiconv-uwp.patch
 create mode 100644 MSVC/contrib/src/msgpack/fetch_and_patch.bat
 create mode 100644 MSVC/contrib/src/msgpack/msgpack-uwp.patch
 create mode 100644 MSVC/contrib/src/nettle/fetch_and_patch.bat
 create mode 100644 MSVC/contrib/src/nettle/nettle-uwp.patch
 create mode 100644 MSVC/contrib/src/zlib/fetch_and_patch.bat
 create mode 100644 MSVC/contrib/src/zlib/zlib-uwp.patch
 create mode 100644 MSVC/opendht.vcxproj.filters
 delete mode 100644 MSVC/project_get_dependencies.bat

diff --git a/MSVC/.gitignore b/MSVC/.gitignore
index 5a687e53..ee16880e 100644
--- a/MSVC/.gitignore
+++ b/MSVC/.gitignore
@@ -15,7 +15,6 @@ Release/
 *.VC.VC.opendb
 *.VC.db
 *.db
-*.filters
 
 # User-specific files (MonoDevelop/Xamarin Studio)
 *.userprefs
diff --git a/MSVC/contrib/src/fetch_and_patch.bat b/MSVC/contrib/src/fetch_and_patch.bat
new file mode 100644
index 00000000..3aeb1d3f
--- /dev/null
+++ b/MSVC/contrib/src/fetch_and_patch.bat
@@ -0,0 +1,20 @@
+@echo OFF
+SETLOCAL EnableDelayedExpansion
+
+set SRC=%~dp0
+
+set USE_CACHE=0
+
+set DEPENDENCIES=( ^
+gmp, ^
+gnutls, ^
+iconv, ^
+msgpack, ^
+nettle, ^
+opendht, ^
+zlib ^
+)
+
+for %%I in %DEPENDENCIES% do (
+    call %SRC%\%%I\fetch_and_patch.bat
+)
\ No newline at end of file
diff --git a/MSVC/contrib/src/gmp/fetch_and_patch.bat b/MSVC/contrib/src/gmp/fetch_and_patch.bat
new file mode 100644
index 00000000..1fb83c76
--- /dev/null
+++ b/MSVC/contrib/src/gmp/fetch_and_patch.bat
@@ -0,0 +1,22 @@
+set BUILD=%SRC%..\build
+
+set GMP_VERSION=3c8f5a0ae0c2ac9ff0ea31b27f71b152979b556d
+set GMP_URL=https://github.com/ShiftMediaProject/gmp/archive/%GMP_VERSION%.tar.gz
+
+mkdir %BUILD%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%GMP_VERSION%.tar.gz %cd%
+) else (
+    wget %GMP_URL%
+)
+
+7z -y x %GMP_VERSION%.tar.gz && 7z -y x %GMP_VERSION%.tar -o%BUILD%
+del %GMP_VERSION%.tar && del %GMP_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\gmp-%GMP_VERSION% gmp
+
+cd %BUILD%\gmp
+
+git apply --reject --whitespace=fix %SRC%\gmp\gmp-uwp.patch
+
+cd %SRC%
\ No newline at end of file
diff --git a/MSVC/contrib/src/gmp/gmp-uwp.patch b/MSVC/contrib/src/gmp/gmp-uwp.patch
new file mode 100644
index 00000000..e32ef9ae
--- /dev/null
+++ b/MSVC/contrib/src/gmp/gmp-uwp.patch
@@ -0,0 +1,110 @@
+--- a/SMP/libgmp.vcxproj
++++ b/SMP/libgmp.vcxproj
+@@ -1248,6 +1248,7 @@
+     <ProjectGuid>{02B94302-23D6-43EF-8865-95CDE99D5DC2}</ProjectGuid>
+     <RootNamespace>libgmp</RootNamespace>
+     <ProjectName>libgmp</ProjectName>
++    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+   </PropertyGroup>
+   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+@@ -1368,65 +1369,65 @@
+   </ImportGroup>
+   <PropertyGroup Label="UserMacros" />
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgmpd</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgmpd</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gmpd</TargetName>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gmpd</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgmp</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgmp</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgmp</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgmp</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gmp</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gmp</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+--- a/SMP/config.h
++++ b/SMP/config.h
+@@ -202,7 +202,7 @@
+ /* #undef HAVE_NATIVE_mpn_add_n_sub_n */
+ #define HAVE_NATIVE_mpn_add_nc 1
+ #if defined(__x86_64) || defined(_M_X64)
+-#define HAVE_NATIVE_mpn_addaddmul_1msb0 1
++#define HAVE_NATIVE_mpn_addaddmul_1msb0 0
+ #define HAVE_NATIVE_mpn_addlsh1_n 1
+ #define HAVE_NATIVE_mpn_addlsh2_n 1
+ #define HAVE_NATIVE_mpn_addlsh_n 1
+-- 
+2.8.1.windows.1
+
diff --git a/MSVC/contrib/src/gnutls/fetch_and_patch.bat b/MSVC/contrib/src/gnutls/fetch_and_patch.bat
new file mode 100644
index 00000000..5c25b52e
--- /dev/null
+++ b/MSVC/contrib/src/gnutls/fetch_and_patch.bat
@@ -0,0 +1,24 @@
+set BUILD=%SRC%..\build
+
+set GNUTLS_VERSION=f2d0ade53ff644da55244aed79d05eca78d11a2f
+set GNUTLS_URL=https://github.com/ShiftMediaProject/gnutls/archive/%GNUTLS_VERSION%.tar.gz
+
+mkdir %BUILD%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%GNUTLS_VERSION%.tar.gz %cd%
+) else (
+    wget %GNUTLS_URL%
+)
+
+7z -y x %GNUTLS_VERSION%.tar.gz && 7z -y x %GNUTLS_VERSION%.tar -o%BUILD%
+del %GNUTLS_VERSION%.tar && del %GNUTLS_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\gnutls-%GNUTLS_VERSION% gnutls
+
+cd %BUILD%\gnutls
+
+git apply --reject --whitespace=fix %SRC%\gnutls\gnutls-no-egd.patch
+git apply --reject --whitespace=fix %SRC%\gnutls\read-file-limits.h.patch
+git apply --reject --whitespace=fix %SRC%\gnutls\gnutls-uwp.patch
+
+cd %SRC%
\ No newline at end of file
diff --git a/MSVC/contrib/src/gnutls/gnutls-no-egd.patch b/MSVC/contrib/src/gnutls/gnutls-no-egd.patch
new file mode 100644
index 00000000..d4b5f093
--- /dev/null
+++ b/MSVC/contrib/src/gnutls/gnutls-no-egd.patch
@@ -0,0 +1,107 @@
+ {a => b}/lib/nettle/Makefile.am  |  2 +-
+ {a => b}/lib/nettle/Makefile.in  | 11 +++++------
+ {a => b}/lib/nettle/rnd-common.c |  7 +++++--
+ 3 files changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/lib/nettle/Makefile.am b/lib/nettle/Makefile.am
+index e84ed1f..4767663 100644
+--- a/lib/nettle/Makefile.am
++++ b/lib/nettle/Makefile.am
+@@ -38,7 +38,7 @@ endif
+ 
+ noinst_LTLIBRARIES = libcrypto.la
+ 
+-libcrypto_la_SOURCES = pk.c mpi.c mac.c cipher.c init.c egd.c egd.h \
++libcrypto_la_SOURCES = pk.c mpi.c mac.c cipher.c init.c \
+ 	gnettle.h rnd-common.h rnd-common.c \
+ 	rnd.c
+ 
+diff --git a/lib/nettle/Makefile.in b/lib/nettle/Makefile.in
+index 88ae7cf..6ddd536 100644
+--- a/lib/nettle/Makefile.in
++++ b/lib/nettle/Makefile.in
+@@ -221,8 +221,8 @@ CONFIG_CLEAN_FILES =
+ CONFIG_CLEAN_VPATH_FILES =
+ LTLIBRARIES = $(noinst_LTLIBRARIES)
+ libcrypto_la_LIBADD =
+-am__libcrypto_la_SOURCES_DIST = pk.c mpi.c mac.c cipher.c init.c egd.c \
+-	egd.h gnettle.h rnd-common.h rnd-common.c rnd.c rnd-fips.c \
++am__libcrypto_la_SOURCES_DIST = pk.c mpi.c mac.c cipher.c init.c \
++	gnettle.h rnd-common.h rnd-common.c rnd.c rnd-fips.c \
+ 	int/drbg-aes-self-test.c int/dsa-fips.h \
+ 	int/dsa-keygen-fips186.c int/dsa-validate.c \
+ 	int/provable-prime.c int/drbg-aes.c int/drbg-aes.h \
+@@ -233,7 +233,7 @@ am__dirstamp = $(am__leading_dot)dirstamp
+ @ENABLE_FIPS140_TRUE@	int/dsa-keygen-fips186.lo \
+ @ENABLE_FIPS140_TRUE@	int/dsa-validate.lo int/provable-prime.lo \
+ @ENABLE_FIPS140_TRUE@	int/drbg-aes.lo int/rsa-keygen-fips186.lo
+-am_libcrypto_la_OBJECTS = pk.lo mpi.lo mac.lo cipher.lo init.lo egd.lo \
++am_libcrypto_la_OBJECTS = pk.lo mpi.lo mac.lo cipher.lo init.lo \
+ 	rnd-common.lo rnd.lo $(am__objects_1)
+ libcrypto_la_OBJECTS = $(am_libcrypto_la_OBJECTS)
+ AM_V_lt = $(am__v_lt_@AM_V@)
+@@ -1279,8 +1279,8 @@ AM_CPPFLAGS = -I$(srcdir)/int -I$(srcdir)/../../gl \
+ 	-I$(builddir)/../includes -I$(builddir)/../../gl \
+ 	-I$(srcdir)/.. $(am__append_1)
+ noinst_LTLIBRARIES = libcrypto.la
+-libcrypto_la_SOURCES = pk.c mpi.c mac.c cipher.c init.c egd.c egd.h \
+-	gnettle.h rnd-common.h rnd-common.c rnd.c $(am__append_2)
++libcrypto_la_SOURCES = pk.c mpi.c mac.c cipher.c init.c gnettle.h \
++	rnd-common.h rnd-common.c rnd.c $(am__append_2)
+ all: all-am
+ 
+ .SUFFIXES:
+@@ -1355,7 +1355,6 @@ distclean-compile:
+ 	-rm -f *.tab.c
+ 
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cipher.Plo@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/egd.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mac.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpi.Plo@am__quote@
+diff --git a/lib/nettle/rnd-common.c b/lib/nettle/rnd-common.c
+index c69ff3b..80b5f32 100644
+--- a/lib/nettle/rnd-common.c
++++ b/lib/nettle/rnd-common.c
+@@ -139,7 +139,7 @@ void _rnd_system_entropy_deinit(void)
+ #include <sys/time.h>
+ #include <fcntl.h>
+ #include <locks.h>
+-#include "egd.h"
++//#include "egd.h"
+ 
+ static int _gnutls_urandom_fd = -1;
+ static mode_t _gnutls_urandom_fd_mode = 0;
+@@ -208,6 +208,7 @@ static int _rnd_get_system_entropy_urandom(void* _rnd, size_t size)
+ 	return 0;
+ }
+ 
++#if 0
+ static
+ int _rnd_get_system_entropy_egd(void* _rnd, size_t size)
+ {
+@@ -232,6 +233,7 @@ int _rnd_get_system_entropy_egd(void* _rnd, size_t size)
+ 
+ 	return 0;
+ }
++#endif
+ 
+ int _rnd_system_entropy_check(void)
+ {
+@@ -268,6 +270,7 @@ int _rnd_system_entropy_init(void)
+ 
+ 	return 0;
+ fallback:
++#if 0
+ 	_gnutls_urandom_fd = _rndegd_connect_socket();
+ 	if (_gnutls_urandom_fd < 0) {
+ 		_gnutls_debug_log("Cannot open egd socket!\n");
+@@ -281,7 +284,7 @@ fallback:
+ 	}
+ 
+ 	_rnd_get_system_entropy = _rnd_get_system_entropy_egd;
+-	
++#endif
+ 	return 0;
+ }
+ 
diff --git a/MSVC/contrib/src/gnutls/gnutls-uwp.patch b/MSVC/contrib/src/gnutls/gnutls-uwp.patch
new file mode 100644
index 00000000..60850279
--- /dev/null
+++ b/MSVC/contrib/src/gnutls/gnutls-uwp.patch
@@ -0,0 +1,445 @@
+--- a/SMP/libgnutls.vcxproj
++++ b/SMP/libgnutls.vcxproj
+@@ -743,91 +744,91 @@
+   </ImportGroup>
+   <PropertyGroup Label="UserMacros" />
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgnutlsd</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgnutlsd</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gnutlsd</TargetName>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLLStaticDeps|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gnutlsd</TargetName>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gnutlsd</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLLStaticDeps|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gnutlsd</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgnutls</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgnutls</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgnutls</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libgnutls</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gnutls</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLLStaticDeps|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gnutls</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gnutls</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLLStaticDeps|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>gnutls</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+@@ -1834,7 +1834,7 @@ del /f /q $(OutDir)\licenses\gnutls.txt
+       <BufferSecurityCheck>false</BufferSecurityCheck>
+       <FloatingPointModel>Fast</FloatingPointModel>
+       <FloatingPointExceptions>false</FloatingPointExceptions>
+-      <PreprocessorDefinitions>HAVE_CONFIG_H;inline=__inline;ASN1_BUILDING;ASN1_STATIC;LOCALEDIR=".";__func__=__FUNCTION__;ASM_X86;ASM_X86_64;_WIN32_WINNT=0x0600;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
++      <PreprocessorDefinitions>RING_UWP;HAVE_WIN32_LOCKS;HAVE_CONFIG_H;inline=__inline;ASN1_BUILDING;ASN1_STATIC;LOCALEDIR=".";__func__=__FUNCTION__;ASM_X86_64;_WIN32_WINNT=0x0600;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+       <AdditionalIncludeDirectories>.\;.\lib;..\lib;..\lib\accelerated;..\lib\auth;..\lib\ext;..\lib\extras;..\lib\minitasn1;..\lib\nettle;..\lib\nettle\int;..\lib\openpgp;..\lib\opencdk;..\lib\x509;..\lib\includes;..\gl;$(OutDir)\include;..\lib\accelerated\x86;$(ProjectDir)\..\..\prebuilt\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+       <ExceptionHandling>false</ExceptionHandling>
+       <DisableSpecificWarnings>4996;4244;4018;4146;4267;4028;4101;4020;4047;4024;4005;4311;4312;4334;4116;4090;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+@@ -1850,7 +1850,7 @@ del /f /q $(OutDir)\licenses\gnutls.txt
+       <OutputFile>$(OutDir)\lib\x64\$(TargetName)$(TargetExt)</OutputFile>
+       <TargetMachine>MachineX64</TargetMachine>
+       <SubSystem>Windows</SubSystem>
+-      <AdditionalDependencies>Crypt32.lib;Ws2_32.lib;libzlib.lib;libiconv.lib;libhogweed.lib;libgmp.lib;libnettle.lib;%(AdditionalDependencies)</AdditionalDependencies>
++      <AdditionalDependencies>bcrypt.lib;Ws2_32.lib;libzlib.lib;libiconv.lib;libhogweed.lib;libgmp.lib;libnettle.lib;%(AdditionalDependencies)</AdditionalDependencies>
+       <AdditionalLibraryDirectories>$(OutDir)\lib\x64\;$(ProjectDir)\..\..\prebuilt\lib\x64\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+       <AdditionalOptions>/IGNORE:4006,4221,4042 %(AdditionalOptions)</AdditionalOptions>
+     </Lib>
+--- a/lib/nettle/rnd-common.c
++++ b/lib/nettle/rnd-common.c
+@@ -45,6 +45,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
++#include <bcrypt.h>
+ 
+ /* gnulib wants to claim strerror even if it cannot provide it. WTF */
+ #undef strerror
+@@ -88,16 +89,25 @@ void _rnd_get_event(struct event_st *e)
+ #include <wincrypt.h>
+ 
+ static HCRYPTPROV device_fd = 0;
++static BCRYPT_ALG_HANDLE bdevice_fd = 0;
+ 
+ static
+ int _rnd_get_system_entropy_win32(void* rnd, size_t size)
+ {
++#ifndef RING_UWP
+ 	if (!CryptGenRandom(device_fd, (DWORD) size, rnd)) {
+ 		_gnutls_debug_log("Error in CryptGenRandom: %d\n",
+ 					(int)GetLastError());
+ 		return GNUTLS_E_RANDOM_DEVICE_ERROR;
+ 	}
+-
++#else
++    NTSTATUS ret = BCryptGenRandom(bdevice_fd, rnd, (ULONG) size, 0);
++    if (!(BCRYPT_SUCCESS(ret))) {
++		_gnutls_debug_log("Error in BCryptGenRandom: %d\n",
++					(int)GetLastError());
++		return GNUTLS_E_RANDOM_DEVICE_ERROR;
++	}
++#endif
+ 	return 0;
+ }
+ 
+@@ -111,7 +121,7 @@ int _rnd_system_entropy_check(void)
+ int _rnd_system_entropy_init(void)
+ {
+ 	int old;
+-
++#ifndef RING_UWP
+ 	if (!CryptAcquireContext
+ 		(&device_fd, NULL, NULL, PROV_RSA_FULL,
+ 		 CRYPT_SILENT | CRYPT_VERIFYCONTEXT)) {
+@@ -119,13 +129,26 @@ int _rnd_system_entropy_init(void)
+ 			("error in CryptAcquireContext!\n");
+ 		return GNUTLS_E_RANDOM_DEVICE_ERROR;
+ 	}
+-	
++#else
++	NTSTATUS ret = BCryptOpenAlgorithmProvider(&bdevice_fd,
++        BCRYPT_RNG_ALGORITHM, MS_PRIMITIVE_PROVIDER,
++        0);
++	if (!(BCRYPT_SUCCESS(ret))) {
++		_gnutls_debug_log
++			("error in BCryptOpenAlgorithmProvider!\n");
++		return GNUTLS_E_RANDOM_DEVICE_ERROR;
++	}
++#endif
+ 	return 0;
+ }
+ 
+ void _rnd_system_entropy_deinit(void)
+ {
++#ifndef RING_UWP
+ 	CryptReleaseContext(device_fd, 0);
++#else
++    BCryptCloseAlgorithmProvider(bdevice_fd, 0);
++#endif
+ }
+ 
+ #else /* POSIX */
+--- a/lib/opencdk/misc.c
++++ b/lib/opencdk/misc.c
+@@ -34,7 +34,6 @@
+ #include <gnutls_int.h>
+ #include <gnutls_str.h>
+ 
+-
+ u32 _cdk_buftou32(const byte * buf)
+ {
+ 	u32 u;
+@@ -149,6 +148,13 @@ int _cdk_check_args(int overwrite, const char *in, const char *out)
+ }
+ 
+ #ifdef _WIN32
++#if (_WIN32_WINNT >= 0x0600)
++FILE *_cdk_tmpfile(void)
++{
++	return NULL;
++}
++#else
++
+ #include <io.h>
+ #include <fcntl.h>
+ 
+@@ -183,6 +189,7 @@ FILE *_cdk_tmpfile(void)
+ 	_close(fd);
+ 	return NULL;
+ }
++#endif /*_WIN32*/
+ #else
+ FILE *_cdk_tmpfile(void)
+ {
+--- a/lib/system-keys-win.c
++++ b/lib/system-keys-win.c
+@@ -20,9 +20,10 @@
+ 
+ // Before including any Windows header we need to set _WIN32_WINNT to Vista
+ // (or higher) so that the NCRYPT stuff can be used.
+-#if _WIN32_WINNT < 0x600
++#define _WIN32_WINNT 0x0A00
++#if _WIN32_WINNT < 0x0600
+ #undef _WIN32_WINNT
+-#define _WIN32_WINNT 0x600
++#define _WIN32_WINNT 0x0600
+ #endif
+ 
+ 
+@@ -1075,7 +1076,11 @@ int _gnutls_system_key_init(void)
+ 	int ret;
+ 
+ #ifdef DYN_NCRYPT
+-	ncrypt_lib = LoadLibraryA("ncrypt.dll");
++#if (_WIN32_WINNT < 0x0A00)
++	ncrypt_lib = LoadLibrary("ncrypt.dll");
++#else
++    ncrypt_lib = LoadPackagedLibrary("ncrypt.dll", 0);
++#endif
+ 	if (ncrypt_lib == NULL) {
+ 		return gnutls_assert_val(GNUTLS_E_CRYPTO_INIT_FAILED);
+ 	}
+--- a/lib/system-keys-win.c
++++ b/lib/system-keys-win.c
+@@ -396,7 +396,11 @@ _gnutls_privkey_import_system_url(gnutls_privkey_t pkey,
+ 	blob.cbData = id_size;
+ 	blob.pbData = id;
+ 
+-	store = CertOpenSystemStore(0, "MY");
++	store = CertOpenStore(  CERT_STORE_PROV_SYSTEM_A,
++                        X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
++                        0,
++                        CERT_SYSTEM_STORE_CURRENT_USER,
++                        (const void*)"MY");
+ 	if (store == NULL) {
+ 		gnutls_assert();
+ 		ret = GNUTLS_E_FILE_ERROR;
+@@ -535,7 +539,11 @@ _gnutls_x509_crt_import_system_url(gnutls_x509_crt_t crt, const char *url)
+ 	blob.cbData = id_size;
+ 	blob.pbData = id;
+ 
+-	store = CertOpenSystemStore(0, "MY");
++	store = CertOpenStore(  CERT_STORE_PROV_SYSTEM_A,
++                        X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
++                        0,
++                        CERT_SYSTEM_STORE_CURRENT_USER,
++                        (const void*)"MY");
+ 	if (store == NULL) {
+ 		gnutls_assert();
+ 		ret = GNUTLS_E_FILE_ERROR;
+@@ -776,7 +784,11 @@ gnutls_system_key_iter_get_info(gnutls_system_key_iter_t *iter,
+ 		if (*iter == NULL)
+ 			return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
+ 
+-		(*iter)->store = CertOpenSystemStore(0, "MY");
++		(*iter)->store = CertOpenStore(  CERT_STORE_PROV_SYSTEM_A,
++                        X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
++                        0,
++                        CERT_SYSTEM_STORE_CURRENT_USER,
++                        (const void*)"MY");
+ 		if ((*iter)->store == NULL) {
+ 			gnutls_free(*iter);
+ 			*iter = NULL;
+@@ -841,7 +853,11 @@ int gnutls_system_key_delete(const char *cert_url, const char *key_url)
+ 	blob.cbData = id_size;
+ 	blob.pbData = id;
+ 
+-	store = CertOpenSystemStore(0, "MY");
++	store = CertOpenStore(  CERT_STORE_PROV_SYSTEM_A,
++                        X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
++                        0,
++                        CERT_SYSTEM_STORE_CURRENT_USER,
++                        (const void*)"MY");
+ 	if (store != NULL) {
+ 		do {
+ 			cert = CertFindCertificateInStore(store,
+--- a/lib/system.c
++++ b/lib/system.c
+@@ -446,9 +446,17 @@ int add_system_trust(gnutls_x509_trust_list_t list, unsigned int tl_flags,
+ 		gnutls_datum_t data;
+ 
+ 		if (i == 0)
+-			store = CertOpenSystemStore(0, "ROOT");
++            store = CertOpenStore(  CERT_STORE_PROV_SYSTEM_A,
++                        X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
++                        0,
++                        CERT_SYSTEM_STORE_CURRENT_USER,
++                        (const void*)"ROOT");
+ 		else
+-			store = CertOpenSystemStore(0, "CA");
++			store = CertOpenStore(  CERT_STORE_PROV_SYSTEM_A,
++                        X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
++                        0,
++                        CERT_SYSTEM_STORE_CURRENT_USER,
++                        (const void*)"CA");
+ 
+ 		if (store == NULL)
+ 			return GNUTLS_E_FILE_ERROR;
+--- a/lib/accelerated/x86/x86-common.c
++++ b/lib/accelerated/x86/x86-common.c
+@@ -652,6 +652,7 @@ void register_x86_intel_crypto(unsigned capabilities)
+ 
+ void register_x86_crypto(void)
+ {
++#ifndef RING_UWP
+ 	unsigned capabilities = 0;
+ 	char *p;
+ 	p = secure_getenv("GNUTLS_CPUID_OVERRIDE");
+@@ -663,5 +664,7 @@ void register_x86_crypto(void)
+ #ifdef ENABLE_PADLOCK
+ 	register_x86_padlock_crypto(capabilities);
+ #endif
++#endif
++    register_x86_intel_crypto(0);
+ }
+ 
+--- a/lib/gnutls_global.c
++++ b/lib/gnutls_global.c
+@@ -240,7 +240,9 @@ int gnutls_global_init(void)
+ 
+ 	_gnutls_switch_lib_state(LIB_STATE_INIT);
+ 
++#ifndef RING_UWP
+ 	e = secure_getenv("GNUTLS_DEBUG_LEVEL");
++#endif
+ 	if (e != NULL) {
+ 		level = atoi(e);
+ 		gnutls_global_set_log_level(level);
+@@ -473,8 +475,10 @@ const char *e;
+ 	if (_gnutls_global_init_skip() != 0)
+ 		return;
+ 
++#ifndef RING_UWP
+ 	e = secure_getenv("GNUTLS_NO_EXPLICIT_INIT");
+-	if (e != NULL) {
++#endif
++    if (e != NULL) {
+ 		ret = atoi(e);
+ 		if (ret == 1)
+ 			return;
+@@ -494,7 +498,9 @@ static void _DESTRUCTOR lib_deinit(void)
+ 	if (_gnutls_global_init_skip() != 0)
+ 		return;
+ 
++#ifndef RING_UWP
+ 	e = secure_getenv("GNUTLS_NO_EXPLICIT_INIT");
++#endif
+ 	if (e != NULL) {
+ 		int ret = atoi(e);
+ 		if (ret == 1)
+--- a/lib/gnutls_kx.c
++++ b/lib/gnutls_kx.c
+@@ -105,7 +105,9 @@ static void write_nss_key_log(gnutls_session_t session, const gnutls_datum_t *pr
+ 
+ 	if (!checked_env) {
+ 		checked_env = 1;
++#ifndef RING_UWP
+ 		keylogfile = secure_getenv("SSLKEYLOGFILE");
++#endif
+ 	}
+ 
+ 	if (keylogfile == NULL)
+--- a/lib/system.c
++++ b/lib/system.c
+@@ -340,7 +340,11 @@ void gnutls_system_global_deinit(void)
+  */
+ int _gnutls_find_config_path(char *path, size_t max_size)
+ {
+-	const char *home_dir = secure_getenv("HOME");
++#ifndef RING_UWP
++    const char *home_dir = secure_getenv("HOME");
++#else
++    const char *home_dir = NULL;
++#endif
+ 
+ 	if (home_dir != NULL && home_dir[0] != 0) {
+ 		snprintf(path, max_size, "%s/" CONFIG_PATH, home_dir);
+@@ -349,8 +353,13 @@ int _gnutls_find_config_path(char *path, size_t max_size)
+ 
+ #ifdef _WIN32
+ 	if (home_dir == NULL || home_dir[0] == '\0') {
++#ifndef RING_UWP
+ 		const char *home_drive = getenv("HOMEDRIVE");
+ 		const char *home_path = getenv("HOMEPATH");
++#else
++        const char *home_drive = NULL;
++		const char *home_path = NULL;
++#endif
+ 
+ 		if (home_drive != NULL && home_path != NULL) {
+ 			snprintf(path, max_size, "%s%s\\" CONFIG_PATH, home_drive, home_path);
+2.8.1.windows.1
+
diff --git a/MSVC/contrib/src/gnutls/read-file-limits.h.patch b/MSVC/contrib/src/gnutls/read-file-limits.h.patch
new file mode 100644
index 00000000..b13b1a88
--- /dev/null
+++ b/MSVC/contrib/src/gnutls/read-file-limits.h.patch
@@ -0,0 +1,12 @@
+--- gnutls/gl/read-file.c.orig	2012-03-06 20:59:29.600593329 -0500
++++ gnutls/gl/read-file.c	2012-03-06 20:59:44.568593328 -0500
+@@ -35,6 +35,9 @@
+ /* Get errno. */
+ #include <errno.h>
+ 
++/* Get SIZE_MAX */
++#include <limits.h>
++
+ /* Read a STREAM and return a newly allocated string with the content,
+    and set *LENGTH to the length of the string.  The string is
+    zero-terminated, but the terminating zero byte is not counted in
diff --git a/MSVC/contrib/src/iconv/fetch_and_patch.bat b/MSVC/contrib/src/iconv/fetch_and_patch.bat
new file mode 100644
index 00000000..b7503aa3
--- /dev/null
+++ b/MSVC/contrib/src/iconv/fetch_and_patch.bat
@@ -0,0 +1,22 @@
+set BUILD=%SRC%..\build
+
+set ICONV_VERSION=65ab92f7a1699ecc39e37fb81f66e5a42aaa35c4
+set ICONV_URL=https://github.com/ShiftMediaProject/libiconv/archive/%ICONV_VERSION%.tar.gz
+
+mkdir %BUILD%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%ICONV_VERSION%.tar.gz %cd%
+) else (
+    wget %ICONV_URL%
+)
+
+7z -y x %ICONV_VERSION%.tar.gz && 7z -y x %ICONV_VERSION%.tar -o%BUILD%
+del %ICONV_VERSION%.tar && del %ICONV_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\libiconv-%ICONV_VERSION% libiconv
+
+cd %BUILD%\libiconv
+
+git apply --reject --whitespace=fix %SRC%\iconv\libiconv-uwp.patch
+
+cd %SRC%
\ No newline at end of file
diff --git a/MSVC/contrib/src/iconv/libiconv-uwp.patch b/MSVC/contrib/src/iconv/libiconv-uwp.patch
new file mode 100644
index 00000000..233cdfc7
--- /dev/null
+++ b/MSVC/contrib/src/iconv/libiconv-uwp.patch
@@ -0,0 +1,99 @@
+--- a/SMP/libiconv.vcxproj
++++ b/SMP/libiconv.vcxproj
+@@ -45,6 +45,7 @@
+   <PropertyGroup Label="Globals">
+     <ProjectGuid>{CB8BB76F-D3FF-434E-A85E-7FFC0893EC9B}</ProjectGuid>
+     <RootNamespace>libiconv</RootNamespace>
++    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+   </PropertyGroup>
+   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+@@ -164,65 +165,65 @@
+   </ImportGroup>
+   <PropertyGroup Label="UserMacros" />
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libiconvd</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libiconvd</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>iconvd</TargetName>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>iconvd</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libiconv</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libiconv</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libiconv</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libiconv</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>iconv</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>iconv</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+-- 
+2.8.1.windows.1
+
diff --git a/MSVC/contrib/src/msgpack/fetch_and_patch.bat b/MSVC/contrib/src/msgpack/fetch_and_patch.bat
new file mode 100644
index 00000000..424c36f1
--- /dev/null
+++ b/MSVC/contrib/src/msgpack/fetch_and_patch.bat
@@ -0,0 +1,22 @@
+set BUILD=%SRC%..\build
+
+set MSGPACK_VERSION=1df97bc37b363a340c5ad06c5cbcc53310aaff80
+set MSGPACK_URL=https://github.com/msgpack/msgpack-c/archive/%MSGPACK_VERSION%.tar.gz
+
+mkdir %BUILD%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%MSGPACK_VERSION%.tar.gz %cd%
+) else (
+    wget %MSGPACK_URL%
+)
+
+7z -y x %MSGPACK_VERSION%.tar.gz && 7z -y x %MSGPACK_VERSION%.tar -o%BUILD%
+del %MSGPACK_VERSION%.tar && del %MSGPACK_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\msgpack-c-%MSGPACK_VERSION% msgpack-c
+
+cd %BUILD%\msgpack-c
+
+git apply --reject --whitespace=fix %SRC%\msgpack\msgpack-uwp.patch
+
+cd %SRC%
\ No newline at end of file
diff --git a/MSVC/contrib/src/msgpack/msgpack-uwp.patch b/MSVC/contrib/src/msgpack/msgpack-uwp.patch
new file mode 100644
index 00000000..d79e9ef9
--- /dev/null
+++ b/MSVC/contrib/src/msgpack/msgpack-uwp.patch
@@ -0,0 +1,221 @@
+--- /dev/null
++++ b/msgpack_vc8.vcxproj
+@@ -0,0 +1,214 @@
++<?xml version="1.0" encoding="utf-8"?>
++<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
++  <ItemGroup Label="ProjectConfigurations">
++    <ProjectConfiguration Include="Debug|Win32">
++      <Configuration>Debug</Configuration>
++      <Platform>Win32</Platform>
++    </ProjectConfiguration>
++    <ProjectConfiguration Include="Debug|x64">
++      <Configuration>Debug</Configuration>
++      <Platform>x64</Platform>
++    </ProjectConfiguration>
++    <ProjectConfiguration Include="Release|Win32">
++      <Configuration>Release</Configuration>
++      <Platform>Win32</Platform>
++    </ProjectConfiguration>
++    <ProjectConfiguration Include="Release|x64">
++      <Configuration>Release</Configuration>
++      <Platform>x64</Platform>
++    </ProjectConfiguration>
++  </ItemGroup>
++  <PropertyGroup Label="Globals">
++    <ProjectName>MessagePack</ProjectName>
++    <ProjectGuid>{122A2EA4-B283-4241-9655-786DE78283B2}</ProjectGuid>
++    <RootNamespace>MessagePack</RootNamespace>
++    <Keyword>Win32Proj</Keyword>
++    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
++  </PropertyGroup>
++  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
++  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
++    <ConfigurationType>StaticLibrary</ConfigurationType>
++    <PlatformToolset>v140</PlatformToolset>
++    <CharacterSet>Unicode</CharacterSet>
++    <WholeProgramOptimization>false</WholeProgramOptimization>
++  </PropertyGroup>
++  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
++    <ConfigurationType>StaticLibrary</ConfigurationType>
++    <PlatformToolset>v140</PlatformToolset>
++    <CharacterSet>Unicode</CharacterSet>
++    <WholeProgramOptimization>false</WholeProgramOptimization>
++  </PropertyGroup>
++  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
++    <ConfigurationType>StaticLibrary</ConfigurationType>
++    <PlatformToolset>v140</PlatformToolset>
++    <CharacterSet>Unicode</CharacterSet>
++  </PropertyGroup>
++  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
++    <ConfigurationType>StaticLibrary</ConfigurationType>
++    <PlatformToolset>v140</PlatformToolset>
++    <CharacterSet>Unicode</CharacterSet>
++  </PropertyGroup>
++  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
++  <ImportGroup Label="ExtensionSettings">
++  </ImportGroup>
++  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
++    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
++  </ImportGroup>
++  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
++    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
++  </ImportGroup>
++  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
++    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
++  </ImportGroup>
++  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
++    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
++  </ImportGroup>
++  <PropertyGroup Label="UserMacros" />
++  <PropertyGroup>
++    <_ProjectFileVersion>14.0.25123.0</_ProjectFileVersion>
++  </PropertyGroup>
++  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
++    <OutDir>$(ProjectDir)..\</OutDir>
++    <IntDir>$(Configuration)\</IntDir>
++    <TargetName>msgpackd</TargetName>
++  </PropertyGroup>
++  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
++    <TargetName>msgpackd</TargetName>
++    <OutDir>$(ProjectDir)..\</OutDir>
++    <IntDir>$(Configuration)\</IntDir>
++  </PropertyGroup>
++  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
++    <OutDir>$(ProjectDir)..\</OutDir>
++    <IntDir>$(Configuration)\</IntDir>
++    <TargetName>msgpack</TargetName>
++  </PropertyGroup>
++  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
++    <TargetName>msgpack</TargetName>
++    <OutDir>$(ProjectDir)..\</OutDir>
++    <IntDir>$(Configuration)\</IntDir>
++  </PropertyGroup>
++  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
++    <ClCompile>
++      <Optimization>Disabled</Optimization>
++      <AdditionalIncludeDirectories>.;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
++      <PreprocessorDefinitions>WIN32_NATIVE;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
++      <MinimalRebuild>true</MinimalRebuild>
++      <BasicRuntimeChecks>StackFrameRuntimeCheck</BasicRuntimeChecks>
++      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
++      <PrecompiledHeader />
++      <WarningLevel>Level3</WarningLevel>
++      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
++    </ClCompile>
++    <Lib>
++      <OutputFile>$(OutDir)\lib\x86\$(TargetName)$(TargetExt)</OutputFile>
++    </Lib>
++    <PostBuildEvent>
++      <Command>mkdir $(OutDir)\include
++
++mkdir $(OutDir)\include\msgpack
++
++copy include\*.h $(OutDir)\include\
++
++copy include\*.hpp $(OutDir)\include\
++xcopy /S /Y include\msgpack\*.h $(OutDir)\include\msgpack
++xcopy /S /Y include\msgpack\*.hpp $(OutDir)\include\msgpack
++</Command>
++    </PostBuildEvent>
++  </ItemDefinitionGroup>
++  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
++    <ClCompile>
++      <Optimization>Disabled</Optimization>
++      <AdditionalIncludeDirectories>.;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
++      <PreprocessorDefinitions>WIN32_NATIVE;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
++      <BasicRuntimeChecks>StackFrameRuntimeCheck</BasicRuntimeChecks>
++      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
++      <PrecompiledHeader>
++      </PrecompiledHeader>
++      <WarningLevel>Level3</WarningLevel>
++      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
++    </ClCompile>
++    <Lib>
++      <OutputFile>$(OutDir)\lib\x64\$(TargetName)$(TargetExt)</OutputFile>
++    </Lib>
++    <PostBuildEvent>
++      <Command>mkdir $(OutDir)\include
++
++mkdir $(OutDir)\include\msgpack
++
++copy include\*.h $(OutDir)\include\
++
++copy include\*.hpp $(OutDir)\include\
++xcopy /S /Y include\msgpack\*.h $(OutDir)\include\msgpack
++xcopy /S /Y include\msgpack\*.hpp $(OutDir)\include\msgpack
++</Command>
++    </PostBuildEvent>
++  </ItemDefinitionGroup>
++  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
++    <ClCompile>
++      <AdditionalIncludeDirectories>.;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
++      <PreprocessorDefinitions>WIN32_NATIVE;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
++      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++      <PrecompiledHeader />
++      <WarningLevel>Level3</WarningLevel>
++      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
++      <ProgramDataBaseFileName>$(OutDir)\lib\x86\$(TargetName).pdb</ProgramDataBaseFileName>
++    </ClCompile>
++    <Lib>
++      <OutputFile>$(OutDir)\lib\x86\$(TargetName)$(TargetExt)</OutputFile>
++      <LinkTimeCodeGeneration />
++    </Lib>
++    <PostBuildEvent>
++      <Command>mkdir $(OutDir)\include
++
++mkdir $(OutDir)\include\msgpack
++
++copy include\*.h $(OutDir)\include\
++
++copy include\*.hpp $(OutDir)\include\
++xcopy /S /Y include\msgpack\*.h $(OutDir)\include\msgpack
++xcopy /S /Y include\msgpack\*.hpp $(OutDir)\include\msgpack
++</Command>
++    </PostBuildEvent>
++  </ItemDefinitionGroup>
++  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
++    <ClCompile>
++      <AdditionalIncludeDirectories>.;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
++      <PreprocessorDefinitions>MSGPACK_USE_CPP03;WIN32_NATIVE;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
++      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++      <PrecompiledHeader>
++      </PrecompiledHeader>
++      <WarningLevel>Level3</WarningLevel>
++      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
++      <ProgramDataBaseFileName>$(OutDir)\lib\x64\$(TargetName).pdb</ProgramDataBaseFileName>
++    </ClCompile>
++    <Lib>
++      <OutputFile>$(OutDir)\lib\x64\$(TargetName)$(TargetExt)</OutputFile>
++      <LinkTimeCodeGeneration />
++    </Lib>
++    <PostBuildEvent>
++      <Command>mkdir $(OutDir)\include
++
++mkdir $(OutDir)\include\msgpack
++
++copy include\*.h $(OutDir)\include\
++
++copy include\*.hpp $(OutDir)\include\
++xcopy /S /Y include\msgpack\*.h $(OutDir)\include\msgpack
++xcopy /S /Y include\msgpack\*.hpp $(OutDir)\include\msgpack
++</Command>
++    </PostBuildEvent>
++  </ItemDefinitionGroup>
++  <ItemGroup>
++    <ClCompile Include="src\objectc.c" />
++    <ClCompile Include="src\unpack.c" />
++    <ClCompile Include="src\version.c" />
++    <ClCompile Include="src\vrefbuffer.c" />
++    <ClCompile Include="src\zone.c" />
++  </ItemGroup>
++  <ItemGroup>
++    <ClInclude Include="include\msgpack.hpp" />
++  </ItemGroup>
++  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
++  <ImportGroup Label="ExtensionTargets">
++  </ImportGroup>
++</Project>
+\ No newline at end of file
+-- 
+2.8.1.windows.1
+
diff --git a/MSVC/contrib/src/nettle/fetch_and_patch.bat b/MSVC/contrib/src/nettle/fetch_and_patch.bat
new file mode 100644
index 00000000..6146062f
--- /dev/null
+++ b/MSVC/contrib/src/nettle/fetch_and_patch.bat
@@ -0,0 +1,22 @@
+set BUILD=%SRC%..\build
+
+set NETTLE_VERSION=4e0b2723b76d4163fa37b2b456d41534154ec97c
+set NETTLE_URL=https://github.com/ShiftMediaProject/nettle/archive/%NETTLE_VERSION%.tar.gz
+
+mkdir %BUILD%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%NETTLE_VERSION%.tar.gz %cd%
+) else (
+    wget %NETTLE_URL%
+)
+
+7z -y x %NETTLE_VERSION%.tar.gz && 7z -y x %NETTLE_VERSION%.tar -o%BUILD%
+del %NETTLE_VERSION%.tar && del %NETTLE_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\nettle-%NETTLE_VERSION% nettle
+
+cd %BUILD%\nettle
+
+git apply --reject --whitespace=fix %SRC%\nettle\nettle-uwp.patch
+
+cd %SRC%
\ No newline at end of file
diff --git a/MSVC/contrib/src/nettle/nettle-uwp.patch b/MSVC/contrib/src/nettle/nettle-uwp.patch
new file mode 100644
index 00000000..bca04dba
--- /dev/null
+++ b/MSVC/contrib/src/nettle/nettle-uwp.patch
@@ -0,0 +1,228 @@
+--- a/SMP/libhogweed.vcxproj
++++ b/SMP/libhogweed.vcxproj
+@@ -242,6 +242,7 @@
+   <PropertyGroup Label="Globals">
+     <ProjectGuid>{200F3D3C-8B84-46D8-953A-6C0EBD283B5C}</ProjectGuid>
+     <RootNamespace>libhogweed</RootNamespace>
++    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+   </PropertyGroup>
+   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+@@ -405,91 +406,91 @@
+   </ImportGroup>
+   <PropertyGroup Label="UserMacros" />
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libhogweedd</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libhogweedd</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>hogweedd</TargetName>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLLStaticDeps|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>hogweedd</TargetName>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>hogweedd</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLLStaticDeps|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>hogweedd</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libhogweed</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libhogweed</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libhogweed</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libhogweed</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>hogweed</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLLStaticDeps|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>hogweed</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>hogweed</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLLStaticDeps|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>hogweed</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+--- a/SMP/libnettle.vcxproj
++++ b/SMP/libnettle.vcxproj
+@@ -278,6 +278,7 @@
+   <PropertyGroup Label="Globals">
+     <ProjectGuid>{070FEF2B-0C3F-4F33-9D3C-53C7330BF518}</ProjectGuid>
+     <RootNamespace>libnettle</RootNamespace>
++    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+   </PropertyGroup>
+   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+@@ -397,65 +398,65 @@
+   </ImportGroup>
+   <PropertyGroup Label="UserMacros" />
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libnettled</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libnettled</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>nettled</TargetName>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>nettled</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libnettle</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libnettle</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libnettle</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libnettle</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>nettle</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|x64'">
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>nettle</TargetName>
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+-- 
+2.8.1.windows.1
diff --git a/MSVC/contrib/src/zlib/fetch_and_patch.bat b/MSVC/contrib/src/zlib/fetch_and_patch.bat
new file mode 100644
index 00000000..59f25a96
--- /dev/null
+++ b/MSVC/contrib/src/zlib/fetch_and_patch.bat
@@ -0,0 +1,22 @@
+set BUILD=%SRC%..\build
+
+set ZLIB_VERSION=3a062eb61d0c3d4aa30851cd1a6597b977b56597
+set ZLIB_URL=https://github.com/ShiftMediaProject/zlib/archive/%ZLIB_VERSION%.tar.gz
+
+mkdir %BUILD%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%ZLIB_VERSION%.tar.gz %cd%
+) else (
+    wget %ZLIB_URL%
+)
+
+7z -y x %ZLIB_VERSION%.tar.gz && 7z -y x %ZLIB_VERSION%.tar -o%BUILD%
+del %ZLIB_VERSION%.tar && del %ZLIB_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\zlib-%ZLIB_VERSION% zlib
+
+cd %BUILD%\zlib
+
+git apply --reject --whitespace=fix %SRC%\zlib\zlib-uwp.patch
+
+cd %SRC%
\ No newline at end of file
diff --git a/MSVC/contrib/src/zlib/zlib-uwp.patch b/MSVC/contrib/src/zlib/zlib-uwp.patch
new file mode 100644
index 00000000..c559cdcb
--- /dev/null
+++ b/MSVC/contrib/src/zlib/zlib-uwp.patch
@@ -0,0 +1,97 @@
+--- a/SMP/libzlib.vcxproj
++++ b/SMP/libzlib.vcxproj
+@@ -45,6 +45,7 @@
+   <PropertyGroup Label="Globals">
+     <ProjectGuid>{CA9A4A38-CC63-4BDB-8CFB-E058965DDA32}</ProjectGuid>
+     <RootNamespace>libzlib</RootNamespace>
++    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+   </PropertyGroup>
+   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+@@ -165,63 +166,63 @@
+   </ImportGroup>
+   <PropertyGroup Label="UserMacros" />
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libzlibd</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libzlib</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libzlib</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>zlib</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|Win32'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>zlibd</TargetName>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libzlibd</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libzlib</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseLTO|x64'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>libzlib</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDLL|x64'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>zlib</TargetName>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   </PropertyGroup>
+   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDLL|x64'">
+-    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+-    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
++    <OutDir>$(ProjectDir)..\..\</OutDir>
++    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
+     <TargetName>zlibd</TargetName>
+     <LinkIncremental>false</LinkIncremental>
+     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+-- 
+2.8.1.windows.1
+
diff --git a/MSVC/dhtchat.vcxproj b/MSVC/dhtchat.vcxproj
index 96243267..97dc0307 100644
--- a/MSVC/dhtchat.vcxproj
+++ b/MSVC/dhtchat.vcxproj
@@ -139,7 +139,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <SDLCheck>true</SDLCheck>
-      <AdditionalIncludeDirectories>..\..\include;..\..\msgpack-c\include;$(ProjectDir)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\include;$(ProjectDir)contrib\build\include;$(ProjectDir)contrib\build\msgpack-c\include;$(ProjectDir)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_NATIVE;WIN32_LEAN_AND_MEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <DisableSpecificWarnings>4804;4267;4244;4800;4273;</DisableSpecificWarnings>
       <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
@@ -148,7 +148,7 @@
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <AdditionalDependencies>crypt32.lib;blake.lib;argon.lib;libgnutls.lib;opendht.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(ProjectDir)..\..\lib\x64</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(ProjectDir)contrib\build\lib\x64;$(ProjectDir)..\..\lib\x64</AdditionalLibraryDirectories>
       <AdditionalOptions>/ignore:4049 %(AdditionalOptions)</AdditionalOptions>
     </Link>
   </ItemDefinitionGroup>
diff --git a/MSVC/dhtnode.vcxproj b/MSVC/dhtnode.vcxproj
index 1331486b..c0840773 100644
--- a/MSVC/dhtnode.vcxproj
+++ b/MSVC/dhtnode.vcxproj
@@ -139,7 +139,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <SDLCheck>true</SDLCheck>
-      <AdditionalIncludeDirectories>..\..\include;..\..\msgpack-c\include;$(ProjectDir)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\include;$(ProjectDir)contrib\build\include;$(ProjectDir)contrib\build\msgpack-c\include;$(ProjectDir)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>WIN32_NATIVE;WIN32_LEAN_AND_MEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <DisableSpecificWarnings>4804;4267;4244;4800;4273;4101;</DisableSpecificWarnings>
       <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
@@ -148,7 +148,7 @@
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <AdditionalDependencies>crypt32.lib;blake.lib;argon.lib;libgnutls.lib;opendht.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(ProjectDir)..\..\lib\x64</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(ProjectDir)contrib\build\lib\x64;$(ProjectDir)..\..\lib\x64</AdditionalLibraryDirectories>
       <AdditionalOptions>/ignore:4049 %(AdditionalOptions)</AdditionalOptions>
     </Link>
   </ItemDefinitionGroup>
diff --git a/MSVC/dhtscanner.vcxproj b/MSVC/dhtscanner.vcxproj
index 77ed2d6d..d14dd5aa 100644
--- a/MSVC/dhtscanner.vcxproj
+++ b/MSVC/dhtscanner.vcxproj
@@ -139,7 +139,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <SDLCheck>true</SDLCheck>
-      <AdditionalIncludeDirectories>..\..\include;..\..\msgpack-c\include;$(ProjectDir)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\include;$(ProjectDir)contrib\build\include;$(ProjectDir)contrib\build\msgpack-c\include;$(ProjectDir)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_NATIVE;WIN32_LEAN_AND_MEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <DisableSpecificWarnings>4804;4267;4244;4800;4273;4101;</DisableSpecificWarnings>
       <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
@@ -148,7 +148,7 @@
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <AdditionalDependencies>crypt32.lib;blake.lib;argon.lib;libgnutls.lib;opendht.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>$(ProjectDir)..\..\lib\x64</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(ProjectDir)contrib\build\lib\x64;$(ProjectDir)..\..\lib\x64</AdditionalLibraryDirectories>
       <AdditionalOptions>/ignore:4049 %(AdditionalOptions)</AdditionalOptions>
     </Link>
   </ItemDefinitionGroup>
diff --git a/MSVC/opendht.vcxproj b/MSVC/opendht.vcxproj
index 85d058e3..ca6a0313 100644
--- a/MSVC/opendht.vcxproj
+++ b/MSVC/opendht.vcxproj
@@ -26,6 +26,7 @@
     <ClCompile Include="..\src\dhtrunner.cpp" />
     <ClCompile Include="..\src\indexation\pht.cpp" />
     <ClCompile Include="..\src\infohash.cpp" />
+    <ClCompile Include="..\src\log.cpp" />
     <ClCompile Include="..\src\network_engine.cpp" />
     <ClCompile Include="..\src\node.cpp" />
     <ClCompile Include="..\src\node_cache.cpp" />
@@ -207,7 +208,7 @@ copy ..\include\opendht.h $(OutDir)\include\</Command>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <SDLCheck>true</SDLCheck>
-      <AdditionalIncludeDirectories>..\..\include;..\include;..\include\opendht;..\..\msgpack-c\include;</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)contrib\build\include;$(ProjectDir)..\include;$(ProjectDir)..\include\opendht;$(ProjectDir)contrib\build\msgpack-c\include</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_NATIVE;WIN32_LEAN_AND_MEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <DisableSpecificWarnings>4804;4800;4101;4267;4244;4503;</DisableSpecificWarnings>
       <AdditionalOptions>-D_SCL_SECURE_NO_WARNINGS %(AdditionalOptions)</AdditionalOptions>
diff --git a/MSVC/opendht.vcxproj.filters b/MSVC/opendht.vcxproj.filters
new file mode 100644
index 00000000..53b551a5
--- /dev/null
+++ b/MSVC/opendht.vcxproj.filters
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+</Project>
\ No newline at end of file
diff --git a/MSVC/opendht_deps.sln b/MSVC/opendht_deps.sln
index 4ef618ba..ddcd5ded 100644
--- a/MSVC/opendht_deps.sln
+++ b/MSVC/opendht_deps.sln
@@ -13,9 +13,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opendht", "opendht.vcxproj"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dependencies", "dependencies", "{71A1A9EC-1104-4335-A87E-AF8749FD5B34}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgmp", "..\..\gmp\SMP\libgmp.vcxproj", "{02B94302-23D6-43EF-8865-95CDE99D5DC2}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgmp", "contrib\build\gmp\SMP\libgmp.vcxproj", "{02B94302-23D6-43EF-8865-95CDE99D5DC2}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgnutls", "..\..\gnutls\SMP\libgnutls.vcxproj", "{6F610EE8-7F59-4191-AB88-F63843267C02}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgnutls", "contrib\build\gnutls\SMP\libgnutls.vcxproj", "{6F610EE8-7F59-4191-AB88-F63843267C02}"
 	ProjectSection(ProjectDependencies) = postProject
 		{02B94302-23D6-43EF-8865-95CDE99D5DC2} = {02B94302-23D6-43EF-8865-95CDE99D5DC2}
 		{070FEF2B-0C3F-4F33-9D3C-53C7330BF518} = {070FEF2B-0C3F-4F33-9D3C-53C7330BF518}
@@ -24,18 +24,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgnutls", "..\..\gnutls\S
 		{CB8BB76F-D3FF-434E-A85E-7FFC0893EC9B} = {CB8BB76F-D3FF-434E-A85E-7FFC0893EC9B}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libiconv", "..\..\libiconv\SMP\libiconv.vcxproj", "{CB8BB76F-D3FF-434E-A85E-7FFC0893EC9B}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libiconv", "contrib\build\libiconv\SMP\libiconv.vcxproj", "{CB8BB76F-D3FF-434E-A85E-7FFC0893EC9B}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhogweed", "..\..\nettle\SMP\libhogweed.vcxproj", "{200F3D3C-8B84-46D8-953A-6C0EBD283B5C}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhogweed", "contrib\build\nettle\SMP\libhogweed.vcxproj", "{200F3D3C-8B84-46D8-953A-6C0EBD283B5C}"
 	ProjectSection(ProjectDependencies) = postProject
 		{02B94302-23D6-43EF-8865-95CDE99D5DC2} = {02B94302-23D6-43EF-8865-95CDE99D5DC2}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnettle", "..\..\nettle\SMP\libnettle.vcxproj", "{070FEF2B-0C3F-4F33-9D3C-53C7330BF518}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnettle", "contrib\build\nettle\SMP\libnettle.vcxproj", "{070FEF2B-0C3F-4F33-9D3C-53C7330BF518}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzlib", "..\..\zlib\SMP\libzlib.vcxproj", "{CA9A4A38-CC63-4BDB-8CFB-E058965DDA32}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzlib", "contrib\build\zlib\SMP\libzlib.vcxproj", "{CA9A4A38-CC63-4BDB-8CFB-E058965DDA32}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MessagePack", "..\..\msgpack-c\msgpack_vc8.vcxproj", "{122A2EA4-B283-4241-9655-786DE78283B2}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MessagePack", "contrib\build\msgpack-c\msgpack_vc8.vcxproj", "{122A2EA4-B283-4241-9655-786DE78283B2}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "argon", "argon.vcxproj", "{2B85EA05-086B-4DF6-A140-DF52BDAEEEEA}"
 	ProjectSection(ProjectDependencies) = postProject
@@ -63,20 +63,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dhtchat", "dhtchat.vcxproj"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|x64 = Debug|x64
-		Debug|x86 = Debug|x86
-		DebugDLL|x64 = DebugDLL|x64
-		DebugDLL|x86 = DebugDLL|x86
-		DebugDLLStaticDeps|x64 = DebugDLLStaticDeps|x64
-		DebugDLLStaticDeps|x86 = DebugDLLStaticDeps|x86
 		Release|x64 = Release|x64
-		Release|x86 = Release|x86
-		ReleaseDLL|x64 = ReleaseDLL|x64
-		ReleaseDLL|x86 = ReleaseDLL|x86
-		ReleaseDLLStaticDeps|x64 = ReleaseDLLStaticDeps|x64
-		ReleaseDLLStaticDeps|x86 = ReleaseDLLStaticDeps|x86
-		ReleaseLTO|x64 = ReleaseLTO|x64
-		ReleaseLTO|x86 = ReleaseLTO|x86
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{711397CE-E5D5-467D-9457-8716C047E50C}.Debug|x64.ActiveCfg = Debug|x64
diff --git a/MSVC/project_get_dependencies.bat b/MSVC/project_get_dependencies.bat
deleted file mode 100644
index 28a7c28b..00000000
--- a/MSVC/project_get_dependencies.bat
+++ /dev/null
@@ -1,79 +0,0 @@
-@ECHO OFF
-SETLOCAL EnableDelayedExpansion
-
-SET UPSTREAMURL=https://github.com/ShiftMediaProject
-SET DEPENDENCIES=( ^
-gmp, ^
-gnutls, ^
-nettle ^
-)
-
-SET PASSDEPENDENCIES=%~1
-
-git status >NUL 2>&1
-IF %ERRORLEVEL% EQU 128 (
-    git init
-) ELSE (
-    IF %ERRORLEVEL% EQU 9009 (
-        ECHO git not installed.
-        EXIT /B 1
-    )
-)
-
-SET CURRDIR=%~dp1
-
-cd ..\..
-set MSGPACK_VERSION=1df97bc37b363a340c5ad06c5cbcc53310aaff80
-set MSGPACK_URL="https://github.com/msgpack/msgpack-c.git"
-ECHO Cloning msgpack-c...
-git clone %MSGPACK_URL% --quiet
-cd msgpack-c
-git checkout %MSGPACK_VERSION%
-git apply --reject --whitespace=fix ..\opendht\MSVC\msgpack-msvc.patch
-cd ..
-
-FOR %%I IN %DEPENDENCIES% DO (
-    ECHO !PASSDEPENDENCIES! | FINDSTR /C:"%%I" >NUL 2>&1 || (
-        CALL :cloneOrUpdateRepo "%%I" )
-)
-cd %CURRDIR% >NUL
-GOTO exit
-
-:cloneOrUpdateRepo
-SET REPONAME=%~1
-IF NOT EXIST "%REPONAME%" (
-    ECHO %REPONAME%: Existing folder not found. Cloning repository...
-    SET REPOURL=%UPSTREAMURL%/%REPONAME%.git
-    git clone !REPOURL! --quiet
-    cd %REPONAME%
-    git config --local core.autocrlf false
-    git rm --cached -r . --quiet
-    git reset --hard --quiet
-    cd ..\
-)
-
-SET PASSDEPENDENCIES=%PASSDEPENDENCIES% %REPONAME%
-
-IF EXIST "%REPONAME%\SMP\project_get_dependencies.bat" (
-    ECHO %REPONAME%: Found additional dependencies...
-    ECHO.
-    cd %REPONAME%\SMP
-    project_get_dependencies.bat "!PASSDEPENDENCIES!" || GOTO exitOnError
-    cd ..\..
-)
-ECHO.
-EXIT /B %ERRORLEVEL%
-
-:exitOnError
-cd %CURRDIR%
-
-:exit
-(
-    ENDLOCAL
-    SET PASSDEPENDENCIES=%PASSDEPENDENCIES%
-)
-    
-ECHO %CMDCMDLINE% | FINDSTR /L %COMSPEC% >NUL 2>&1
-IF %ERRORLEVEL% == 0 IF "%~1"=="" PAUSE
-
-EXIT /B 0
\ No newline at end of file
-- 
GitLab