[PATCH 1/2] user32: Introduced ThreadDetach driver entry point.

Jacek Caban jacek at codeweavers.com
Thu Aug 25 07:33:45 CDT 2016


The problem was diagnosed by Ken Thomases.

Currently drivers use DllMain(DLL_THREAD_DETACH) to release thread data.
The problem is that DLLs (like native urlmon.dll, esp. reproducible in
IE8) may still do user32 calls after driver detaches thread. Loader
ensures that since user32.dll was loaded before dependent DLLs, user32's
DllMain will be called in the right moment. Due to lazy loading of
drivers, we have no control over them. We may use a new entry point to
make sure that we detach user32 and driver at the same time.

It's especially useful for Mac driver, which currently attempts to
recreate thread data, but fails with ExitProcess(), but X11 driver can
also benefit from this (it leaks ATM).

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
---
 dlls/user32/driver.c       | 13 +++++++++++--
 dlls/user32/user_main.c    |  1 +
 dlls/user32/user_private.h |  2 ++
 3 files changed, 14 insertions(+), 2 deletions(-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-user32-Introduced-ThreadDetach-driver-entry-point.diff
Type: text/x-patch
Size: 2295 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20160825/fdf0ab17/attachment.bin>


More information about the wine-patches mailing list