ntdll: unload modules based on inter-module dependencies

Lei Zhang thestig at google.com
Fri Nov 30 15:50:41 CST 2007


I've been trying to use xvid on Wine. Xvid works fine, but when I exit
the application, I get a memory access error. What happens is the

- winmm.dll gets loaded
- when trying to use xvid, xvidvfw.dll gets loaded
- when the application exits, ExitProcess() calls LdrShutdownProcess()
which calls process_detach() with bForceDetach set to TRUE
- xvidvfw.dll gets unloaded before winmm.dll
- while winmm.dll is getting unloaded, it sends DRV_CLOSE to xvid,
which has already been unloaded, causing a memory violation.

This patch changes process_detach() so that it will only detach a
module when that module has no dependencies. After a module gets
detached, process_detach() scans through all the modules and update
the dependencies. I'm assuming there's no circular dependencies
between modules.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-ntdll-unload-modules-based-on-inter-module-dependencies.txt
Url: http://www.winehq.org/pipermail/wine-patches/attachments/20071130/f720ab03/attachment.txt 

More information about the wine-patches mailing list