bpo-37025: AddRefActCtx() shouldn't be checked for failure by ZackerySpytz · Pull Request #16579 · python/cpython

Expand Up @@ -41,8 +41,8 @@ const char *PyWin_DLLVersionString = dllVersionBuffer; 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 Expand Down Expand Up @@ -103,9 +103,14 @@ BOOL WINAPI DllMain (HANDLE hInst, // 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"); if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext)) { (*pfnAddRefActCtx)(PyWin_DLLhActivationContext); } else { OutputDebugString("Python failed to load the default " "activation context\n"); return FALSE; } #endif break;
Expand Down