Commit f0e7bd24 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 505406fc
......@@ -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
};
......@@ -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 );
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment