diff -prudN e:\Wine\dlls\urlmon/bindprot.c e:\reactos\dll\win32\urlmon/bindprot.c --- e:\Wine\dlls\urlmon/bindprot.c 2014-04-04 14:12:42.439519600 +0100 +++ e:\reactos\dll\win32\urlmon/bindprot.c 2014-04-11 16:18:48.958227500 +0100 @@ -83,36 +80,14 @@ static LRESULT WINAPI notif_wnd_proc(HWN return DefWindowProcW(hwnd, msg, wParam, lParam); } -static const WCHAR wszURLMonikerNotificationWindow[] = - {'U','R','L',' ','M','o','n','i','k','e','r',' ', - 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0}; - -static ATOM notif_wnd_class; - -static BOOL WINAPI register_notif_wnd_class(INIT_ONCE *once, void *param, void **context) -{ - static WNDCLASSEXW wndclass = { - sizeof(wndclass), 0, notif_wnd_proc, 0, 0, - NULL, NULL, NULL, NULL, NULL, - wszURLMonikerNotificationWindow, NULL - }; - - wndclass.hInstance = hProxyDll; - notif_wnd_class = RegisterClassExW(&wndclass); - return TRUE; -} - -void unregister_notif_wnd_class(void) -{ - if(notif_wnd_class) - UnregisterClassW(MAKEINTRESOURCEW(notif_wnd_class), hProxyDll); -} - HWND get_notif_hwnd(void) { + static ATOM wnd_class = 0; tls_data_t *tls_data; - static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; + static const WCHAR wszURLMonikerNotificationWindow[] = + {'U','R','L',' ','M','o','n','i','k','e','r',' ', + 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0}; tls_data = get_tls_data(); if(!tls_data) @@ -123,11 +98,23 @@ HWND get_notif_hwnd(void) return tls_data->notif_hwnd; } - InitOnceExecuteOnce(&init_once, register_notif_wnd_class, NULL, NULL); - if(!notif_wnd_class) - return NULL; + if(!wnd_class) { + static WNDCLASSEXW wndclass = { + sizeof(wndclass), 0, + notif_wnd_proc, 0, 0, + NULL, NULL, NULL, NULL, NULL, + wszURLMonikerNotificationWindow, + NULL + }; - tls_data->notif_hwnd = CreateWindowExW(0, MAKEINTRESOURCEW(notif_wnd_class), + wndclass.hInstance = hProxyDll; + + wnd_class = RegisterClassExW(&wndclass); + if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS) + wnd_class = 1; + } + + tls_data->notif_hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow, wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, hProxyDll, NULL); if(tls_data->notif_hwnd) diff -prudN e:\Wine\dlls\urlmon/urlmon_main.c e:\reactos\dll\win32\urlmon/urlmon_main.c --- e:\Wine\dlls\urlmon/urlmon_main.c 2014-04-04 14:12:42.460533100 +0100 +++ e:\reactos\dll\win32\urlmon/urlmon_main.c 2014-04-11 16:19:12.473179000 +0100 @@ -139,7 +127,6 @@ static void process_detach(void) free_session(); free_tls_list(); - unregister_notif_wnd_class(); } /*********************************************************************** diff -prudN e:\Wine\dlls\urlmon/urlmon_main.h e:\reactos\dll\win32\urlmon/urlmon_main.h --- e:\Wine\dlls\urlmon/urlmon_main.h 2014-04-04 14:12:42.461533700 +0100 +++ e:\reactos\dll\win32\urlmon/urlmon_main.h 2014-04-11 16:19:21.822446700 +0100 @@ -225,7 +236,6 @@ typedef struct { tls_data_t *get_tls_data(void) DECLSPEC_HIDDEN; -void unregister_notif_wnd_class(void) DECLSPEC_HIDDEN; HWND get_notif_hwnd(void) DECLSPEC_HIDDEN; void release_notif_hwnd(HWND) DECLSPEC_HIDDEN;