"Alexandre" == Alexandre Julliard julliard@winehq.com writes:
Alexandre> Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de writes: >> This seems to happen, because during MODULE_InitDLL of the dll it >> calls a Loadlibrary on itself. As MODULE_InitDLL sets >> WINE_MODREF_MARKER, and the flow of execution in LoadLibrary checks >> for WINE_MODREF_MARKER before incrementing the RefCount, the refcount >> gets wrong and the application unloaded. Forcing the increment of >> RefCount in MODULE_LoadLibraryExA unconditional of WINE_MODREF_MARKER >> makes the application continue. >> >> Do we need the check for WINE_MODREF_MARKER in MODULE_LoadLibraryEx?
Alexandre> Yes, this is needed for circular dependencies. But maybe we Alexandre> need to differentiate an explicit LoadLibrary from the Alexandre> implicit loading of dependencies.
Is appended patch appropriate?
If it finds WINE_MODREF_MARKER set in LoadLibraryEx, it corrects the Refcount and it allows decrementing the Refcounter to 1 (but not to 0) in MODULE_DecRefCount. At least xilinx webpack ise.exe now comes over thw first hurdle.
Changelog: wine/loader/module.c: LoadLibraryExA, MODULE_DecRefCount Handle Refcounting for LoadLibrary/FreeLibrary Calls during MODULE_DllProcessAttach