http://bugs.winehq.org/show_bug.cgi?id=20711
--- Comment #23 from Markus mst@collogia.de 2010-03-30 08:52:19 --- Another try with GetModuleHandleEx. I checked it with balanced an unbalanced calls to LoadLibrary/FreeLibrary. In the normal and the error case it should work as expected.
@Wylda: Maybe you could test the following patch in compobj.c. Sorry for not having a git-diff so changes only marked with an asterisk
static void apartment_freeunusedlibraries(struct apartment *apt, DWORD delay) { struct apartment_loaded_dll *entry, *next; * BOOL res;
...
* res = GetModuleHandleExW(0, entry->dll->library_name, &entry->dll->library); * if ( res && entry->dll->DllCanUnloadNow && (entry->dll->DllCanUnloadNow() == S_OK)) {
...
} else if (entry->unload_time) entry->unload_time = 0;
* if (res) FreeLibrary(entry->dll->library);
@Henri: Do we need tastcases for that?