summaryrefslogtreecommitdiffstats
path: root/PC/dl_nt.c
diff options
context:
space:
mode:
authorBrian Curtin <brian@python.org>2012-05-13 16:19:23 (GMT)
committerBrian Curtin <brian@python.org>2012-05-13 16:19:23 (GMT)
commit401f9f3d32dcebf5ead8079d46a83fe7c7631581 (patch)
tree899600f4dad86565fd3585499e2332d2a3599d42 /PC/dl_nt.c
parent708d88c33441b29760b9246d61844eb59c1d0f3a (diff)
downloadcpython-401f9f3d32dcebf5ead8079d46a83fe7c7631581.zip
cpython-401f9f3d32dcebf5ead8079d46a83fe7c7631581.tar.gz
cpython-401f9f3d32dcebf5ead8079d46a83fe7c7631581.tar.bz2
Fix #13210. Port the Windows build from VS2008 to VS2010.
Diffstat (limited to 'PC/dl_nt.c')
-rw-r--r--PC/dl_nt.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/PC/dl_nt.c b/PC/dl_nt.c
index ef1ce09..ae10fb5 100644
--- a/PC/dl_nt.c
+++ b/PC/dl_nt.c
@@ -18,7 +18,8 @@ char dllVersionBuffer[16] = ""; // a private buffer
HMODULE PyWin_DLLhModule = NULL;
const char *PyWin_DLLVersionString = dllVersionBuffer;
-// Windows "Activation Context" work:
+#if HAVE_SXS
+// Windows "Activation Context" work.
// Our .pyd extension modules are generally built without a manifest (ie,
// those included with Python and those built with a default distutils.
// This requires we perform some "activation context" magic when loading our
@@ -29,6 +30,8 @@ const char *PyWin_DLLVersionString = dllVersionBuffer;
// As an added complication, this magic only works on XP or later - we simply
// use the existence (or not) of the relevant function pointers from kernel32.
// See bug 4566 (http://python.org/sf/4566) for more details.
+// In Visual Studio 2010, side by side assemblies are no longer used by
+// default.
typedef BOOL (WINAPI * PFN_GETCURRENTACTCTX)(HANDLE *);
typedef BOOL (WINAPI * PFN_ACTIVATEACTCTX)(HANDLE, ULONG_PTR *);
@@ -75,6 +78,7 @@ void _Py_DeactivateActCtx(ULONG_PTR cookie)
if (!(*pfnDeactivateActCtx)(0, cookie))
OutputDebugString("Python failed to de-activate the activation context\n");
}
+#endif /* HAVE_SXS */
BOOL WINAPI DllMain (HANDLE hInst,
ULONG ul_reason_for_call,
@@ -87,17 +91,21 @@ BOOL WINAPI DllMain (HANDLE hInst,
// 1000 is a magic number I picked out of the air. Could do with a #define, I spose...
LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer));
+#if HAVE_SXS
// and capture our activation context for use when loading extensions.
_LoadActCtxPointers();
if (pfnGetCurrentActCtx && pfnAddRefActCtx)
if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext))
if (!(*pfnAddRefActCtx)(PyWin_DLLhActivationContext))
OutputDebugString("Python failed to load the default activation context\n");
+#endif
break;
case DLL_PROCESS_DETACH:
+#if HAVE_SXS
if (pfnReleaseActCtx)
(*pfnReleaseActCtx)(PyWin_DLLhActivationContext);
+#endif
break;
}
return TRUE;