HWND get_notif_hwnd(void) { tls_data_t *tls_data; static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; tls_data = get_tls_data(); if(!tls_data) return NULL; if(tls_data->notif_hwnd_cnt) { tls_data->notif_hwnd_cnt++; return tls_data->notif_hwnd; } InitOnceExecuteOnce(&init_once, register_notif_wnd_class, NULL, NULL); if(!notif_wnd_class) return NULL; tls_data->notif_hwnd = CreateWindowExW(0, MAKEINTRESOURCEW(notif_wnd_class), wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, hProxyDll, NULL); if(tls_data->notif_hwnd) tls_data->notif_hwnd_cnt++; TRACE("hwnd = %p\n", tls_data->notif_hwnd); return tls_data->notif_hwnd; }
HWND get_notif_hwnd(void) { #ifdef __REACTOS__ static ATOM wnd_class = 0; #endif tls_data_t *tls_data; #ifdef __REACTOS__ 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}; #else static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; #endif tls_data = get_tls_data(); if(!tls_data) return NULL; if(tls_data->notif_hwnd_cnt) { tls_data->notif_hwnd_cnt++; return tls_data->notif_hwnd; } #ifndef __REACTOS__ InitOnceExecuteOnce(&init_once, register_notif_wnd_class, NULL, NULL); if(!notif_wnd_class) return NULL; #else if(!wnd_class) { static WNDCLASSEXW wndclass = { sizeof(wndclass), 0, notif_wnd_proc, 0, 0, NULL, NULL, NULL, NULL, NULL, wszURLMonikerNotificationWindow, NULL }; wndclass.hInstance = hProxyDll; wnd_class = RegisterClassExW(&wndclass); if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS) wnd_class = 1; } #endif #ifndef __REACTOS__ tls_data->notif_hwnd = CreateWindowExW(0, MAKEINTRESOURCEW(notif_wnd_class), #else tls_data->notif_hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow, #endif wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, hProxyDll, NULL); if(tls_data->notif_hwnd) tls_data->notif_hwnd_cnt++; TRACE("hwnd = %p\n", tls_data->notif_hwnd); return tls_data->notif_hwnd; }
void release_notif_hwnd(HWND hwnd) { tls_data_t *data = get_tls_data(); if(!data) return; if(data->notif_hwnd != hwnd) { PostMessageW(data->notif_hwnd, WM_MK_RELEASE, 0, 0); return; } if(!--data->notif_hwnd_cnt) { DestroyWindow(data->notif_hwnd); data->notif_hwnd = NULL; } }
HWND get_notif_hwnd(void) { static ATOM wnd_class = 0; tls_data_t *tls_data; 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) return NULL; if(tls_data->notif_hwnd_cnt) { tls_data->notif_hwnd_cnt++; return tls_data->notif_hwnd; } if(!wnd_class) { static WNDCLASSEXW wndclass = { sizeof(wndclass), 0, notif_wnd_proc, 0, 0, NULL, NULL, NULL, NULL, NULL, wszURLMonikerNotificationWindow, NULL }; 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) tls_data->notif_hwnd_cnt++; TRACE("hwnd = %p\n", tls_data->notif_hwnd); return tls_data->notif_hwnd; }
static LRESULT WINAPI notif_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_MK_CONTINUE: { BindProtocol *This = (BindProtocol*)lParam; task_header_t *task; while(1) { EnterCriticalSection(&This->section); task = This->task_queue_head; if(task) { This->task_queue_head = task->next; if(!This->task_queue_head) This->task_queue_tail = NULL; } LeaveCriticalSection(&This->section); if(!task) break; This->continue_call++; task->proc(This, task); This->continue_call--; } IInternetProtocol_Release(PROTOCOL(This)); return 0; } case WM_MK_RELEASE: { tls_data_t *data = get_tls_data(); if(!--data->notif_hwnd_cnt) { DestroyWindow(hwnd); data->notif_hwnd = NULL; } } } return DefWindowProcW(hwnd, msg, wParam, lParam); }
static LRESULT WINAPI notif_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_MK_CONTINUE: { BindProtocol *This = (BindProtocol*)lParam; process_tasks(This); IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); return 0; } case WM_MK_RELEASE: { tls_data_t *data = get_tls_data(); if(!--data->notif_hwnd_cnt) { DestroyWindow(hwnd); data->notif_hwnd = NULL; } } } return DefWindowProcW(hwnd, msg, wParam, lParam); }