Commit 009a6928 authored by Zackery Spytz's avatar Zackery Spytz Committed by Steve Dower

bpo-37025: AddRefActCtx() shouldn't be checked for failure (GH-16897)

AddRefActCtx() does not return a value.
parent 9978a955
``AddRefActCtx()`` was needlessly being checked for failure in
``PC/dl_nt.c``.
...@@ -33,8 +33,8 @@ const char *PyWin_DLLVersionString = dllVersionBuffer; ...@@ -33,8 +33,8 @@ const char *PyWin_DLLVersionString = dllVersionBuffer;
typedef BOOL (WINAPI * PFN_GETCURRENTACTCTX)(HANDLE *); typedef BOOL (WINAPI * PFN_GETCURRENTACTCTX)(HANDLE *);
typedef BOOL (WINAPI * PFN_ACTIVATEACTCTX)(HANDLE, ULONG_PTR *); typedef BOOL (WINAPI * PFN_ACTIVATEACTCTX)(HANDLE, ULONG_PTR *);
typedef BOOL (WINAPI * PFN_DEACTIVATEACTCTX)(DWORD, ULONG_PTR); typedef BOOL (WINAPI * PFN_DEACTIVATEACTCTX)(DWORD, ULONG_PTR);
typedef BOOL (WINAPI * PFN_ADDREFACTCTX)(HANDLE); typedef void (WINAPI * PFN_ADDREFACTCTX)(HANDLE);
typedef BOOL (WINAPI * PFN_RELEASEACTCTX)(HANDLE); typedef void (WINAPI * PFN_RELEASEACTCTX)(HANDLE);
// locals and function pointers for this activation context magic. // locals and function pointers for this activation context magic.
static HANDLE PyWin_DLLhActivationContext = NULL; // one day it might be public static HANDLE PyWin_DLLhActivationContext = NULL; // one day it might be public
...@@ -90,9 +90,14 @@ BOOL WINAPI DllMain (HANDLE hInst, ...@@ -90,9 +90,14 @@ BOOL WINAPI DllMain (HANDLE hInst,
// and capture our activation context for use when loading extensions. // and capture our activation context for use when loading extensions.
_LoadActCtxPointers(); _LoadActCtxPointers();
if (pfnGetCurrentActCtx && pfnAddRefActCtx) if (pfnGetCurrentActCtx && pfnAddRefActCtx)
if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext)) if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext)) {
if (!(*pfnAddRefActCtx)(PyWin_DLLhActivationContext)) (*pfnAddRefActCtx)(PyWin_DLLhActivationContext);
OutputDebugString("Python failed to load the default activation context\n"); }
else {
OutputDebugString("Python failed to load the default "
"activation context\n");
return FALSE;
}
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment