user32: Introduced ThreadDetach driver entry point.

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.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-08-25 14:33:45 +02:00 committed by Alexandre Julliard
parent 505406fc83
commit f0e7bd248e
3 changed files with 14 additions and 2 deletions

View File

@ -155,6 +155,7 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(WindowPosChanging);
GET_USER_FUNC(WindowPosChanged);
GET_USER_FUNC(SystemParametersInfo);
GET_USER_FUNC(ThreadDetach);
#undef GET_USER_FUNC
}
@ -512,6 +513,10 @@ static BOOL CDECL nulldrv_SystemParametersInfo( UINT action, UINT int_param, voi
return FALSE;
}
static void CDECL nulldrv_ThreadDetach( void )
{
}
static USER_DRIVER null_driver =
{
/* keyboard functions */
@ -572,7 +577,9 @@ static USER_DRIVER null_driver =
nulldrv_WindowPosChanging,
nulldrv_WindowPosChanged,
/* system parameters */
nulldrv_SystemParametersInfo
nulldrv_SystemParametersInfo,
/* thread management */
nulldrv_ThreadDetach
};
@ -827,5 +834,7 @@ static USER_DRIVER lazy_load_driver =
nulldrv_WindowPosChanging,
nulldrv_WindowPosChanged,
/* system parameters */
nulldrv_SystemParametersInfo
nulldrv_SystemParametersInfo,
/* thread management */
nulldrv_ThreadDetach
};

View File

@ -303,6 +303,7 @@ static void thread_detach(void)
exiting_thread_id = GetCurrentThreadId();
WDML_NotifyThreadDetach();
USER_Driver->pThreadDetach();
if (thread_info->top_window) WIN_DestroyThreadWindows( thread_info->top_window );
if (thread_info->msg_window) WIN_DestroyThreadWindows( thread_info->msg_window );

View File

@ -117,6 +117,8 @@ typedef struct tagUSER_DRIVER {
void (CDECL *pWindowPosChanged)(HWND,HWND,UINT,const RECT *,const RECT *,const RECT *,const RECT *,struct window_surface*);
/* system parameters */
BOOL (CDECL *pSystemParametersInfo)(UINT,UINT,void*,UINT);
/* thread management */
void (CDECL *pThreadDetach)(void);
} USER_DRIVER;
extern const USER_DRIVER *USER_Driver DECLSPEC_HIDDEN;