ole32: Don't try to unregister window class if it was never registered.

UnregisterClass may load display driver, which is may be problematic
inside DLL_PROCESS_DETACH (esp. in Android drivers, which imports ole32
itself).

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-06-01 20:51:24 +02:00 committed by Alexandre Julliard
parent 7c57461d29
commit fd67e394e6

View file

@ -479,6 +479,8 @@ struct apartment_loaded_dll
static const WCHAR wszAptWinClass[] = {'O','l','e','M','a','i','n','T','h','r','e','a','d','W','n','d','C','l','a','s','s',0};
static ATOM apt_win_class;
/*****************************************************************************
* This section contains OpenDllList implementation
*/
@ -1695,7 +1697,7 @@ static BOOL WINAPI register_class( INIT_ONCE *once, void *param, void **context
wclass.lpfnWndProc = apartment_wndproc;
wclass.hInstance = hProxyDll;
wclass.lpszClassName = wszAptWinClass;
RegisterClassW(&wclass);
apt_win_class = RegisterClassW(&wclass);
return TRUE;
}
@ -5270,7 +5272,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID reserved)
case DLL_PROCESS_DETACH:
if (reserved) break;
release_std_git();
UnregisterClassW( wszAptWinClass, hProxyDll );
if(apt_win_class)
UnregisterClassW( (const WCHAR*)MAKEINTATOM(apt_win_class), hProxyDll );
RPC_UnregisterAllChannelHooks();
COMPOBJ_DllList_Free();
DeleteCriticalSection(&csRegisteredClassList);