8000 [2.7] bpo-37025: AddRefActCtx() shouldn't be checked for failure by ZackerySpytz · Pull Request #16897 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[2.7] bpo-37025: AddRefA 8000 ctCtx() shouldn't be checked for failure #16897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
``AddRefActCtx()`` was needlessly being checked for failure in
``PC/dl_nt.c``.
15 changes: 10 additions & 5 deletions PC/dl_nt.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,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 @@ -90,9 +90,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;
}
break;

case DLL_PROCESS_DETACH:
Expand Down
0