From 1019387a8f6ccc087a113f138c5237146492a356 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 26 Jul 2018 21:40:50 +0300 Subject: fixes #1527 (Remove obsolete g_hMainThread and QueueUSerAPC from plugins) --- plugins/HTTPServer/src/GuiElements.cpp | 36 +++++----------------------------- plugins/HTTPServer/src/GuiElements.h | 1 - plugins/HTTPServer/src/main.cpp | 3 --- 3 files changed, 5 insertions(+), 35 deletions(-) (limited to 'plugins/HTTPServer/src') diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 726f5947da..5b0cd2d32a 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -32,7 +32,6 @@ static HANDLE hEventOptionsInitialize = nullptr; HWND hwndStatsticView = nullptr; bool bLastAutoRefress = false; -HANDLE hMainThread; bool bShowPopups = true; @@ -1357,9 +1356,9 @@ int OptionsInitialize(WPARAM wParam, LPARAM /*lParam*/) // Developer : KN ///////////////////////////////////////////////////////////////////// -void CALLBACK MainThreadCallback(ULONG_PTR dwParam) +void CALLBACK MainThreadCallback(void *param) { - POPUPDATAT *pclData = (POPUPDATAT*)dwParam; + POPUPDATAT *pclData = (POPUPDATAT*)param; if (db_get_b(NULL, MODULENAME, "WriteLogFile", 0) != 0) LogEvent(pclData->lpzContactName, pclData->lpzText); @@ -1383,7 +1382,7 @@ void CALLBACK MainThreadCallback(ULONG_PTR dwParam) // Developer : KN, Houdini ///////////////////////////////////////////////////////////////////// -void CALLBACK OpenStatisticViewFromPopupProc(ULONG_PTR /* dwParam */) +static void CALLBACK OpenStatisticViewFromPopupProc(void*) { nShowStatisticsView(0, 0); } @@ -1394,7 +1393,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM switch (message) { case WM_LBUTTONDOWN: - QueueUserAPC(OpenStatisticViewFromPopupProc, hMainThread, 0); + CallFunctionAsync(OpenStatisticViewFromPopupProc, 0); PUDeletePopup(hWnd); return 0; @@ -1429,12 +1428,8 @@ void ShowPopupWindow(const char * pszName, const char * pszText, COLORREF ColorB strncpy(pclData->lpzContactName, pszName, sizeof(pclData->lpzContactName) - 1); // -1 so that there aways will be a null termination !! strncpy(pclData->lpzText, pszText, sizeof(pclData->lpzText) - 1); pclData->colorBack = ColorBack; - //ppd.colorText = colorText; pclData->PluginWindowProc = PopupWindowProc; - //Now that every field has been filled, we want to see the popup. - - //CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0); - QueueUserAPC(MainThreadCallback, hMainThread, (ULONG_PTR)pclData); + CallFunctionAsync(MainThreadCallback, pclData); } ///////////////////////////////////////////////////////////////////// @@ -1457,9 +1452,6 @@ void InitGuiElements() stInitCom.dwICC = ICC_INTERNET_CLASSES; InitCommonControlsEx(&stInitCom); - //hMainThread = GetCurrentThread(); - DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0); - sUrlAddress = DBGetString(NULL, MODULENAME, "UrlAddress", szDefaultUrlAddress); sPageKeyword = DBGetString(NULL, MODULENAME, "PageKeyword", szDefaultPageKeyword); @@ -1489,21 +1481,3 @@ void InitGuiElements() bShowPopups = db_get_b(NULL, MODULENAME, "ShowPopups", bShowPopups) != 0; } - -///////////////////////////////////////////////////////////////////// -// Member Function : UninitGuiElements -// Type : Global -// Parameters : None -// Returns : void -// Description : -// -// References : - -// Remarks : - -// Created : 031011, 11 oktober 2003 -// Developer : KN -///////////////////////////////////////////////////////////////////// - -void UnInitGuiElements() -{ - CloseHandle(hMainThread); -} diff --git a/plugins/HTTPServer/src/GuiElements.h b/plugins/HTTPServer/src/GuiElements.h index 0ce1d11814..23ca03d032 100644 --- a/plugins/HTTPServer/src/GuiElements.h +++ b/plugins/HTTPServer/src/GuiElements.h @@ -21,7 +21,6 @@ #include void InitGuiElements(); -void UnInitGuiElements(); void UpdateStatisticsView(); void ShowPopupWindow(const char * pszName, const char * pszText, COLORREF ColorBack = 0); void SendLinkToUser(WPARAM wParam, char *pszSrvPath); // Add By Sergio Vieira Rolanski diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index e951994a83..159b763bd3 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -790,11 +790,8 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) } pclFirstNode = nullptr; - UnInitGuiElements(); - db_set_b(NULL, MODULENAME, "IndexCreationMode", (BYTE)indexCreationMode); FreeIndexHTMLTemplate(); - return 0; } -- cgit v1.2.3