diff options
Diffstat (limited to 'PC/dl_nt.c')
-rw-r--r-- | PC/dl_nt.c | 33 |
1 files changed, 11 insertions, 22 deletions
@@ -12,19 +12,13 @@ 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; const char *PyWin_DLLVersionString = dllVersionBuffer; -#if HAVE_SXS -// Windows "Activation Context" work. +// 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 @@ -35,14 +29,12 @@ 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 *); typedef BOOL (WINAPI * PFN_DEACTIVATEACTCTX)(DWORD, ULONG_PTR); -typedef BOOL (WINAPI * PFN_ADDREFACTCTX)(HANDLE); -typedef BOOL (WINAPI * PFN_RELEASEACTCTX)(HANDLE); +typedef void (WINAPI * PFN_ADDREFACTCTX)(HANDLE); +typedef void (WINAPI * PFN_RELEASEACTCTX)(HANDLE); // locals and function pointers for this activation context magic. static HANDLE PyWin_DLLhActivationContext = NULL; // one day it might be public @@ -83,7 +75,6 @@ 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, @@ -93,27 +84,25 @@ 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. _LoadActCtxPointers(); if (pfnGetCurrentActCtx && pfnAddRefActCtx) - if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext)) - if (!(*pfnAddRefActCtx)(PyWin_DLLhActivationContext)) - OutputDebugString("Python failed to load the default activation context\n"); -#endif + if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext)) { + (*pfnAddRefActCtx)(PyWin_DLLhActivationContext); + } + else { + OutputDebugString("Python failed to load the default " + "activation context\n"); + return FALSE; + } break; case DLL_PROCESS_DETACH: -#if HAVE_SXS if (pfnReleaseActCtx) (*pfnReleaseActCtx)(PyWin_DLLhActivationContext); -#endif break; } return TRUE; |