[issue4566] 2.6.1 breaks many applications that embed Python on Windows

Mark Hammond report at bugs.python.org
Fri Jan 2 10:15:32 CET 2009


Mark Hammond <mhammond at users.sourceforge.net> added the comment:

I've hacked together something that fixes the problem.  I'm working on
making it a real patch, but the basis is:

* In DllMain (dl_nt.c), we call:
  case DLL_PROCESS_ATTACH:
    GetCurrentActCtx(&PyWin_DLLhActivationContext);
    AddRefActCtx(PyWin_DLLhActivationContext);
  case DLL_PROCESS_DETACH:
    ReleaseActCtx(PyWin_DLLhActivationContext);

  (where PyWin_DLLhActivationContext is a module level HANDLE global)

* The LoadLibraryEx (in dynload_win.c) changes to:

    ActivateActCtx(PyWin_DLLhActivationContext, &cookie);
    /* XXX This call doesn't exist in Windows CE */
    hDLL = LoadLibraryEx(... as currently ...);
    DeactivateActCtx(0, cookie);

This makes the "import socket" test case work for me.  I'm not sure what
the impact will be should the .pyd file reference other assemblies. 
Also, the calls above all need to move to function pointer calls as the
functions only exist on Vista and later (hence the slight delay in
making a real patch)

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4566>
_______________________________________


More information about the Python-bugs-list mailing list