From d3cb19278d60ac6f7963379254546cdca36a90e2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 14 Jan 2017 01:22:55 +0300 Subject: separate handle types for HNETLIBCONN & HNETLIBBIND --- plugins/HTTPServer/src/FileShareNode.cpp | 2 +- plugins/HTTPServer/src/FileShareNode.h | 4 ++-- plugins/HTTPServer/src/HttpUser.cpp | 2 +- plugins/HTTPServer/src/HttpUser.h | 2 +- plugins/HTTPServer/src/main.cpp | 3 +-- plugins/NewsAggregator/Src/Utils.cpp | 2 +- plugins/Ping/src/utils.cpp | 2 +- plugins/PluginUpdater/src/DlgListNew.cpp | 2 +- plugins/PluginUpdater/src/DlgUpdate.cpp | 4 ++-- plugins/PluginUpdater/src/Utils.cpp | 4 ++-- plugins/PluginUpdater/src/stdafx.h | 2 +- plugins/SmileyAdd/src/download.cpp | 4 ++-- plugins/Watrack_MPD/src/main.cpp | 4 +--- plugins/Weather/src/stdafx.h | 3 ++- plugins/Weather/src/weather_http.cpp | 2 +- plugins/YAMN/src/proto/netlib.cpp | 4 ++-- plugins/YAMN/src/proto/netlib.h | 6 +++--- 17 files changed, 25 insertions(+), 27 deletions(-) (limited to 'plugins') diff --git a/plugins/HTTPServer/src/FileShareNode.cpp b/plugins/HTTPServer/src/FileShareNode.cpp index fbc2d43af6..a23f0c6fe4 100644 --- a/plugins/HTTPServer/src/FileShareNode.cpp +++ b/plugins/HTTPServer/src/FileShareNode.cpp @@ -36,7 +36,7 @@ mir_cs csFileShareListAccess; // Developer : KN ///////////////////////////////////////////////////////////////////// -CLShareUser::CLShareUser(HANDLE hCon, in_addr stAdd) +CLShareUser::CLShareUser(HNETLIBCONN hCon, in_addr stAdd) { hConnection = hCon; stAddr = stAdd; diff --git a/plugins/HTTPServer/src/FileShareNode.h b/plugins/HTTPServer/src/FileShareNode.h index bea6bf9d49..7c40bcced1 100644 --- a/plugins/HTTPServer/src/FileShareNode.h +++ b/plugins/HTTPServer/src/FileShareNode.h @@ -23,7 +23,7 @@ class CLShareUser { public: - CLShareUser(HANDLE hCon, in_addr stAdd); + CLShareUser(HNETLIBCONN hCon, in_addr stAdd); virtual ~CLShareUser(); CLShareUser * pclNext; in_addr stAddr; @@ -35,7 +35,7 @@ public: virtual const char * pszCustomInfo() = NULL; void CloseSocket(); protected: - HANDLE hConnection; + HNETLIBCONN hConnection; DWORD dwSpeed; }; diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index ede33c5722..3ceb656f77 100644 --- a/plugins/HTTPServer/src/HttpUser.cpp +++ b/plugins/HTTPServer/src/HttpUser.cpp @@ -142,7 +142,7 @@ static int nUnescapedURI(char * pszURI) // Developer : KN ///////////////////////////////////////////////////////////////////// -CLHttpUser::CLHttpUser(HANDLE hCon, in_addr stAdd) : CLShareUser(hCon, stAdd) +CLHttpUser::CLHttpUser(HNETLIBCONN hCon, in_addr stAdd) : CLShareUser(hCon, stAdd) { memset(apszParam, 0, sizeof(apszParam)); hFile = INVALID_HANDLE_VALUE; diff --git a/plugins/HTTPServer/src/HttpUser.h b/plugins/HTTPServer/src/HttpUser.h index 00b43a76eb..a5a7b2d24c 100644 --- a/plugins/HTTPServer/src/HttpUser.h +++ b/plugins/HTTPServer/src/HttpUser.h @@ -45,7 +45,7 @@ static char * szParmStr[eLastParam] = { class CLHttpUser : public CLShareUser { public: - CLHttpUser(HANDLE hCon, in_addr stAdd); + CLHttpUser(HNETLIBCONN hCon, in_addr stAdd); virtual ~CLHttpUser(); bool bReadGetParameters(char * pszRequest); diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index c9f69a61a6..2670c256f0 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -582,7 +582,7 @@ void HandleNewConnection(void *ch) // Developer : KN ///////////////////////////////////////////////////////////////////// -void ConnectionOpen(HANDLE hNewConnection, DWORD dwRemoteIP) +void ConnectionOpen(HNETLIBCONN hNewConnection, DWORD dwRemoteIP) { in_addr stAddr; stAddr.S_un.S_addr = htonl(dwRemoteIP); @@ -639,7 +639,6 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) Netlib_GetUserSettings(hNetlibUser, &nus); NETLIBBIND nlb = {}; - nlb.cbSize = sizeof(NETLIBBIND); nlb.pfnNewConnection = ConnectionOpen; if (nus.specifyIncomingPorts && nus.szIncomingPorts && nus.szIncomingPorts[0]) nlb.wPort = 0; diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index d2d02635dc..242218e4c1 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h" HNETLIBUSER hNetlibUser = NULL; -HANDLE hNetlibHttp; +HNETLIBCONN hNetlibHttp; bool UpdateListFlag = FALSE; bool IsMyContact(MCONTACT hContact) diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index e643b2423a..8bdaa385a2 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -93,7 +93,7 @@ INT_PTR PluginPing(WPARAM, LPARAM lParam) conn.wPort = pa->port; conn.timeout = options.ping_timeout; - HANDLE s = Netlib_OpenConnection(hNetlibUser, &conn); + HNETLIBCONN s = Netlib_OpenConnection(hNetlibUser, &conn); mir_free((void*)conn.szHost); clock_t end_tcp = clock(); diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 9706ea2af1..5ac1a40eb1 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -63,7 +63,7 @@ static void ApplyDownloads(void *param) VARSW tszMirandaPath(L"%miranda_path%"); - HANDLE nlc = NULL; + HNETLIBCONN nlc = NULL; for (int i=0; i < todo.getCount(); ++i) { ListView_EnsureVisible(hwndList, i, FALSE); if (todo[i].bEnabled) { diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 3cc172fca8..60e91a4057 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -67,7 +67,7 @@ static void ApplyUpdates(void *param) SafeCreateDirectory(tszFileTemp); // 2) Download all plugins - HANDLE nlc = NULL; + HNETLIBCONN nlc = NULL; for (int i=0; i < todo.getCount(); i++) { ListView_EnsureVisible(hwndList, i, FALSE); if (!todo[i].bEnabled) { @@ -419,7 +419,7 @@ static void DlgUpdateSilent(void *param) SafeCreateDirectory(tszFileTemp); // 2) Download all plugins - HANDLE nlc = NULL; + HNETLIBCONN nlc = NULL; // Count all updates that have been enabled int count = 0; for (int i = 0; i < UpdateFiles.getCount(); i++) { diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 186cf9dc34..73d8036345 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -156,7 +156,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) mir_snwprintf(pFileUrl.tszDiskPath, L"%s\\hashes.zip", g_tszTempPath); pFileUrl.CRCsum = 0; - HANDLE nlc; + HNETLIBCONN nlc; bool ret = DownloadFile(&pFileUrl, nlc); Netlib_CloseHandle(nlc); @@ -229,7 +229,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes) } -bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) +bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc) { NETLIBHTTPREQUEST nlhr = {0}; #if MIRANDA_VER < 0x0A00 diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 182ba3d22f..dae531b4ca 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -230,7 +230,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes); int CompareHashes(const ServListEntry *p1, const ServListEntry *p2); wchar_t* GetDefaultUrl(); -bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc); +bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc); void ShowPopup(LPCTSTR Title, LPCTSTR Text, int Number); void __stdcall RestartMe(void*); diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 66d938a506..04df9baf8a 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -39,7 +39,7 @@ static OBJLIST dlQueue(10); static wchar_t cachepath[MAX_PATH]; static bool threadRunning; -bool InternetDownloadFile(const char *szUrl, char *szDest, HANDLE &hHttpDwnl) +bool InternetDownloadFile(const char *szUrl, char *szDest, HNETLIBCONN &hHttpDwnl) { int result = 0xBADBAD; char *szRedirUrl = NULL; @@ -127,7 +127,7 @@ void __cdecl SmileyDownloadThread(void*) Thread_SetName("SmileyAdd: SmileyDownloadThread"); bool needext = false; - HANDLE hHttpDwnl = NULL; + HNETLIBCONN hHttpDwnl = NULL; WaitForSingleObject(g_hDlMutex, 3000); while (!Miranda_IsTerminated() && dlQueue.getCount()) { ReleaseMutex(g_hDlMutex); diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp index a923777982..5bedeb0101 100755 --- a/plugins/Watrack_MPD/src/main.cpp +++ b/plugins/Watrack_MPD/src/main.cpp @@ -16,7 +16,7 @@ #include "stdafx.h" -HANDLE ghConnection; +HNETLIBCONN ghConnection; HANDLE ghPacketReciever; BOOL Connected; int gbState; @@ -262,8 +262,6 @@ void Stop() Netlib_CloseHandle(ghPacketReciever); if(ghConnection) Netlib_CloseHandle(ghConnection); - if(ghNetlibUser && (ghNetlibUser != INVALID_HANDLE_VALUE)) - Netlib_Shutdown(ghNetlibUser); } int Init() diff --git a/plugins/Weather/src/stdafx.h b/plugins/Weather/src/stdafx.h index 677cca67d1..6c4a8082bb 100644 --- a/plugins/Weather/src/stdafx.h +++ b/plugins/Weather/src/stdafx.h @@ -358,7 +358,8 @@ extern unsigned status, old_status; extern MWindowList hDataWindowList, hWindowList; extern HNETLIBUSER hNetlibUser; -extern HANDLE hNetlibHttp, hHookWeatherUpdated, hHookWeatherError, hTBButton, hUpdateMutex; +extern HNETLIBCONN hNetlibHttp; +extern HANDLE hHookWeatherUpdated, hHookWeatherError, hTBButton, hUpdateMutex; extern UINT_PTR timerId; extern HGENMENU hMwinMenu; diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp index cdc9656082..e1dde203ea 100644 --- a/plugins/Weather/src/weather_http.cpp +++ b/plugins/Weather/src/weather_http.cpp @@ -26,7 +26,7 @@ from the web using netlib #include "stdafx.h" HNETLIBUSER hNetlibUser; -HANDLE hNetlibHttp; +HNETLIBCONN hNetlibHttp; static int findHeader(const NETLIBHTTPREQUEST *nlhrReply, const char *hdr) { diff --git a/plugins/YAMN/src/proto/netlib.cpp b/plugins/YAMN/src/proto/netlib.cpp index 64da34ed8d..b737dc89e2 100644 --- a/plugins/YAMN/src/proto/netlib.cpp +++ b/plugins/YAMN/src/proto/netlib.cpp @@ -116,7 +116,7 @@ void CNLClient::Connect(const char* servername, const int port) throw(DWORD) //Performs a simple query // query- command to send -int CNLClient::LocalNetlib_Send(HANDLE hConn, const char *buf, int len, int flags) +int CNLClient::LocalNetlib_Send(HNETLIBCONN hConn, const char *buf, int len, int flags) { return Netlib_Send(hConn, buf, len, flags); } @@ -156,7 +156,7 @@ void CNLClient::Send(const char *query) throw(DWORD) //You need free() returned buffer, which can be allocated in this function //if not success, exception is throwed -int CNLClient::LocalNetlib_Recv(HANDLE hConn, char *buf, int len, int flags) +int CNLClient::LocalNetlib_Recv(HNETLIBCONN hConn, char *buf, int len, int flags) { int iReturn = Netlib_Recv(hConn, buf, len, flags); if (isTLSed) { diff --git a/plugins/YAMN/src/proto/netlib.h b/plugins/YAMN/src/proto/netlib.h index 17259cf219..de41a6ad04 100644 --- a/plugins/YAMN/src/proto/netlib.h +++ b/plugins/YAMN/src/proto/netlib.h @@ -14,10 +14,10 @@ public: inline BOOL Connected() {return hConnection!=NULL;} protected: - HANDLE hConnection; + HNETLIBCONN hConnection; BOOL isTLSed; - int LocalNetlib_Send(HANDLE hConn,const char *buf,int len,int flags); - int LocalNetlib_Recv(HANDLE hConn,char *buf,int len,int flags); + int LocalNetlib_Send(HNETLIBCONN hConn, const char *buf, int len, int flags); + int LocalNetlib_Recv(HNETLIBCONN hConn, char *buf, int len, int flags); }; void SSL_DebugLog(const char *fmt, ...); -- cgit v1.2.3