Author eryksun
Recipients brett.cannon, eric.snow, eryksun, jkloth, ncoghlan, paul.moore, steve.dower, tim.golden, zach.ware
Date 2019-02-23.06:49:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550904582.87.0.841444607614.issue36085@roundup.psfhosted.org>
In-reply-to
Content
> I'm very against doing magic to extract the names from the DLL, but 
> but maybe we could have a search path in the parent package? Then 
> add/remove it around importing the module.

That works, too. I'm happy either way.

We still can't load multiple DLLs with the same name with this technique. That requires private assembly packages, which is doable (in Windows 7+), but a bit complex and requires modifying the embedded #2 manifest of the extension module. The alternative is to rewrite the PE import tables of all DLLs to reference unique DLL names. Neither is necessary if everything is built against unique, versioned DLL names.

> I think you're right that we just need to update the LoadLibrary
> flags, but will those also apply to dependencies of the loaded 
> module? 

The DLL search path is computed once per LoadLibraryExW call based on either the call flags or the process default flags. We shouldn't mess with the process default, since there's no way to restore the legacy DLL search path, in particular this includes the Windows directory (%SystemRoot%), 16-bit System directory (%SystemRoot%\System), current directory, and PATH. 

Should we support a convenient syntax for including the current value of PATH at extension-module load time? This could be an entry that's exactly equal to "<PATH>". (Less-than and greater-than are reserved as wildcard characters by all Windows file systems that I can think of.) It would iterate over PATH, adding each directory via AddDllDirectory. Of course, all added directories would subsequently be removed via RemoveDllDirectory after the LoadLibraryExW call.
History
Date User Action Args
2019-02-23 06:49:42eryksunsetrecipients: + eryksun, brett.cannon, paul.moore, ncoghlan, tim.golden, jkloth, eric.snow, zach.ware, steve.dower
2019-02-23 06:49:42eryksunsetmessageid: <1550904582.87.0.841444607614.issue36085@roundup.psfhosted.org>
2019-02-23 06:49:42eryksunlinkissue36085 messages
2019-02-23 06:49:42eryksuncreate