Failing MODULE_DllProcessAttach causes other module left uninitialized
Hallo, in loader/module.c:MODULE_DllProcessAttach the recursion to attach ends as soon as _one_ initialization fails. This leaves other modules uninitialized. I had this problem with xnview and native shell (without native shfolder). The missing SHGetFolderPathA caused COMDLG32_DllEntryPoint to return FALSE and in cause WSVFW32_LibMain wasn't called. Later this caused MULTIMEDIA_GetIData to not find it's IData and cause a crash. The missing HGetFolderPathA wasn't the culprit. I think the original error was obscured to much here. Either we judge a failing InitDLL as error and abort there, or in MODULE_DllProcessAttach we should recurse without looking at the result. What about appended patch? -- Uwe Bonnes bon(a)elektron.ikp.physik.tu-darmstadt.de Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ---------- Index: wine/loader/module.c =================================================================== RCS file: /home/wine/wine/loader/module.c,v retrieving revision 1.150 diff -u -r1.150 module.c --- wine/loader/module.c 2 Apr 2002 19:47:30 -0000 1.150 +++ wine/loader/module.c 9 Apr 2002 14:06:26 -0000 @@ -212,17 +212,14 @@ wm->flags |= WINE_MODREF_MARKER; /* Recursively attach all DLLs this one depends on */ - for ( i = 0; retv && i < wm->nDeps; i++ ) + for ( i = 0; i < wm->nDeps; i++ ) if ( wm->deps[i] ) - retv = MODULE_DllProcessAttach( wm->deps[i], lpReserved ); + MODULE_DllProcessAttach( wm->deps[i], lpReserved ); /* Call DLL entry point */ + retv = MODULE_InitDLL( wm, DLL_PROCESS_ATTACH, lpReserved ); if ( retv ) - { - retv = MODULE_InitDLL( wm, DLL_PROCESS_ATTACH, lpReserved ); - if ( retv ) - wm->flags |= WINE_MODREF_PROCESS_ATTACHED; - } + wm->flags |= WINE_MODREF_PROCESS_ATTACHED; /* Re-insert MODREF at head of list */ if ( retv && wm->prev )
Uwe Bonnes <bon(a)elektron.ikp.physik.tu-darmstadt.de> writes:
I think the original error was obscured to much here. Either we judge a failing InitDLL as error and abort there, or in MODULE_DllProcessAttach we should recurse without looking at the result.
A failed InitDLL is an error, we can't simply ignore it and continue. We have to unload the dll and its dependencies in that case; but that's not entirely trivial to do. -- Alexandre Julliard julliard(a)winehq.com
participants (2)
-
Alexandre Julliard -
Uwe Bonnes