diff --git a/PC/dl_nt.c b/PC/dl_nt.c
index ae10fb56231..c87c51eb559 100644
--- a/PC/dl_nt.c
+++ b/PC/dl_nt.c
@@ -12,7 +12,12 @@ forgotten) from the programmer.
#include "windows.h"
#ifdef Py_ENABLE_SHARED
+#ifdef MS_DLL_ID
+// The string is available at build, so fill the buffer immediately
+char dllVersionBuffer[16] = MS_DLL_ID;
+#else
char dllVersionBuffer[16] = ""; // a private buffer
+#endif
// Python Globals
HMODULE PyWin_DLLhModule = NULL;
@@ -88,8 +93,11 @@ BOOL WINAPI DllMain (HANDLE hInst,
{
case DLL_PROCESS_ATTACH:
PyWin_DLLhModule = hInst;
+#ifndef MS_DLL_ID
+ // If we have MS_DLL_ID, we don't need to load the string.
// 1000 is a magic number I picked out of the air. Could do with a #define, I spose...
LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer));
+#endif
#if HAVE_SXS
// and capture our activation context for use when loading extensions.
diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props
index 85aebebe2f4..33570d78426 100644
--- a/PCbuild/pyproject.props
+++ b/PCbuild/pyproject.props
@@ -87,7 +87,7 @@
diff --git a/PCbuild/python.props b/PCbuild/python.props
index 99eebf0fe28..788df56bddd 100644
--- a/PCbuild/python.props
+++ b/PCbuild/python.props
@@ -1,7 +1,7 @@
-
+
- Win32
+ Win32
Release
.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32
.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64
+
+
+ $(MajorVersionNumber).$(MinorVersionNumber)
+ $(SysWinVer)-32
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index 4ecfd102c16..479f68df554 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -67,7 +67,7 @@
/Zm200 %(AdditionalOptions)
$(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)
- _USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;%(PreprocessorDefinitions)
+ _USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)
ws2_32.lib;%(AdditionalDependencies)
@@ -335,7 +335,6 @@
-
@@ -386,6 +385,9 @@
+
+
+
@@ -393,7 +395,7 @@
-
+