From 43fc7b251649ff90ff72994c097f8b1f7b8f0b48 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 11 Aug 2015 09:54:09 +0000 Subject: fix for strange SSL API structure name git-svn-id: http://svn.miranda-ng.org/main/trunk@14905 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_app/src/netlib.cpp | 8 ++++---- src/mir_app/src/netlib.h | 2 ++ src/mir_app/src/netlibhttp.cpp | 2 +- src/mir_app/src/netlibopenconn.cpp | 2 +- src/mir_app/src/netlibpktrecver.cpp | 2 +- src/mir_app/src/netlibsock.cpp | 11 +++++------ src/mir_app/src/newplugins.cpp | 33 +++++++++++++++++---------------- 7 files changed, 31 insertions(+), 29 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp index 5cd39c0e68..8151b71e12 100644 --- a/src/mir_app/src/netlib.cpp +++ b/src/mir_app/src/netlib.cpp @@ -42,7 +42,7 @@ static int CompareNetlibUser(const NetlibUser* p1, const NetlibUser* p2) LIST netlibUser(5, CompareNetlibUser); mir_cs csNetlibUser; -SSL_API si; +SSL_API sslApi; void NetlibFreeUserSettingsStruct(NETLIBUSERSETTINGS *settings) { @@ -236,8 +236,8 @@ void NetlibDoClose(NetlibConnection *nlc, bool noShutdown) NetlibLogf(nlc->nlu, "(%p:%u) Connection closed internal", nlc, nlc->s); if (nlc->hSsl) { - if (!noShutdown) si.shutdown(nlc->hSsl); - si.sfree(nlc->hSsl); + if (!noShutdown) sslApi.shutdown(nlc->hSsl); + sslApi.sfree(nlc->hSsl); nlc->hSsl = NULL; } closesocket(nlc->s); @@ -391,7 +391,7 @@ INT_PTR NetlibShutdown(WPARAM wParam, LPARAM) { NetlibConnection *nlc = (NetlibConnection*)wParam; if (!nlc->termRequested) { - if (nlc->hSsl) si.shutdown(nlc->hSsl); + if (nlc->hSsl) sslApi.shutdown(nlc->hSsl); if (nlc->s != INVALID_SOCKET) shutdown(nlc->s, 2); if (nlc->s2 != INVALID_SOCKET) shutdown(nlc->s2, 2); nlc->termRequested = true; diff --git a/src/mir_app/src/netlib.h b/src/mir_app/src/netlib.h index 949d1755b2..096ed9f3a7 100644 --- a/src/mir_app/src/netlib.h +++ b/src/mir_app/src/netlib.h @@ -29,6 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define NLH_PACKETRECVER 'PCKT' int GetNetlibHandleType(void*); +extern struct SSL_API sslApi; + struct NetlibUser { int handleType; diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp index f06438c306..5c520f5ec5 100644 --- a/src/mir_app/src/netlibhttp.cpp +++ b/src/mir_app/src/netlibhttp.cpp @@ -109,7 +109,7 @@ static int RecvWithTimeoutTime(NetlibConnection *nlc, unsigned dwTimeoutTime, ch { DWORD dwTimeNow; - if (!si.pending(nlc->hSsl)) { + if (!sslApi.pending(nlc->hSsl)) { while ((dwTimeNow = GetTickCount()) < dwTimeoutTime) { unsigned dwDeltaTime = min(dwTimeoutTime - dwTimeNow, 1000); int res = WaitUntilReadable(nlc->s, dwDeltaTime); diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp index d20a2d670b..5ffbce24ed 100644 --- a/src/mir_app/src/netlibopenconn.cpp +++ b/src/mir_app/src/netlibopenconn.cpp @@ -882,7 +882,7 @@ INT_PTR NetlibStartSsl(WPARAM wParam, LPARAM lParam) const char *szHost = sp ? sp->host : nlc->nloc.szHost; NetlibLogf(nlc->nlu, "(%d %s) Starting SSL negotiation", nlc->s, szHost); - nlc->hSsl = si.connect(nlc->s, szHost, nlc->nlu->settings.validateSSL); + nlc->hSsl = sslApi.connect(nlc->s, szHost, nlc->nlu->settings.validateSSL); if (nlc->hSsl == NULL) NetlibLogf(nlc->nlu, "(%d %s) Failure to negotiate SSL connection", nlc->s, szHost); diff --git a/src/mir_app/src/netlibpktrecver.cpp b/src/mir_app/src/netlibpktrecver.cpp index ca23de0327..a793218d3a 100644 --- a/src/mir_app/src/netlibpktrecver.cpp +++ b/src/mir_app/src/netlibpktrecver.cpp @@ -75,7 +75,7 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam) } if (nlprParam->dwTimeout != INFINITE) { - if (!si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s, nlprParam->dwTimeout) <= 0) { + if (!sslApi.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s, nlprParam->dwTimeout) <= 0) { *nlprParam = nlpr->packetRecver; return SOCKET_ERROR; } diff --git a/src/mir_app/src/netlibsock.cpp b/src/mir_app/src/netlibsock.cpp index 0cbec573fc..6ef069a290 100644 --- a/src/mir_app/src/netlibsock.cpp +++ b/src/mir_app/src/netlibsock.cpp @@ -31,8 +31,6 @@ INT_PTR NetlibSend(WPARAM wParam, LPARAM lParam) { NetlibConnection *nlc = (NetlibConnection*)wParam; NETLIBBUFFER *nlb = (NETLIBBUFFER*)lParam; - INT_PTR result; - if (nlb == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return SOCKET_ERROR; @@ -41,6 +39,7 @@ INT_PTR NetlibSend(WPARAM wParam, LPARAM lParam) if (!NetlibEnterNestedCS(nlc, NLNCS_SEND)) return SOCKET_ERROR; + int result; if (nlc->usingHttpGateway && !(nlb->flags & MSG_RAW)) { if (!(nlb->flags & MSG_NOHTTPGATEWAYWRAP) && nlc->nlu->user.pfnHttpGatewayWrapSend) { NetlibDumpData(nlc, (PBYTE)nlb->buf, nlb->len, 1, nlb->flags); @@ -51,7 +50,7 @@ INT_PTR NetlibSend(WPARAM wParam, LPARAM lParam) else { NetlibDumpData(nlc, (PBYTE)nlb->buf, nlb->len, 1, nlb->flags); if (nlc->hSsl) - result = si.write(nlc->hSsl, nlb->buf, nlb->len); + result = sslApi.write(nlc->hSsl, nlb->buf, nlb->len); else result = send(nlc->s, nlb->buf, nlb->len, nlb->flags & 0xFFFF); } @@ -81,7 +80,7 @@ INT_PTR NetlibRecv(WPARAM wParam, LPARAM lParam) recvResult = NetlibHttpGatewayRecv(nlc, nlb->buf, nlb->len, nlb->flags); else { if (nlc->hSsl) - recvResult = si.read(nlc->hSsl, nlb->buf, nlb->len, (nlb->flags & MSG_PEEK) != 0); + recvResult = sslApi.read(nlc->hSsl, nlb->buf, nlb->len, (nlb->flags & MSG_PEEK) != 0); else recvResult = recv(nlc->s, nlb->buf, nlb->len, nlb->flags & 0xFFFF); } @@ -108,7 +107,7 @@ static int ConnectionListToSocketList(HANDLE *hConns, fd_set *fd, int& pending) return 0; } FD_SET(nlcCheck->s, fd); - if (si.pending(nlcCheck->hSsl)) + if (sslApi.pending(nlcCheck->hSsl)) pending++; } return 1; @@ -179,7 +178,7 @@ INT_PTR NetlibSelectEx(WPARAM, LPARAM lParam) conn = (NetlibConnection*)nls->hReadConns[j]; if (conn == NULL || conn == INVALID_HANDLE_VALUE) break; - if (si.pending(conn->hSsl)) + if (sslApi.pending(conn->hSsl)) nls->hReadStatus[j] = TRUE; if (conn->usingHttpGateway && conn->nlhpi.szHttpGetUrl == NULL && conn->dataBuffer == NULL) nls->hReadStatus[j] = (conn->pHttpProxyPacketQueue != NULL); diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index ffbc7f3be0..7858dfe27d 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "plugins.h" #include "profilemanager.h" #include "langpack.h" +#include "netlib.h" void LoadExtraIconsModule(); @@ -200,7 +201,7 @@ MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE hInstance) return NULL; } -MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int hLangpack) +MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int _hLang) { if (equalUUID(uuid, miid_last)) return --sttFakeID; @@ -211,7 +212,7 @@ MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int hLangpack) continue; if (equalUUID(p->bpi.pluginInfo->uuid, uuid)) - return p->hLangpack = (hLangpack) ? hLangpack : --sttFakeID; + return p->hLangpack = (_hLang) ? _hLang : --sttFakeID; } return 0; @@ -246,7 +247,7 @@ static int checkPI(BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi) return TRUE; } -int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, int checkTypeAPI) +int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD dwMirVer, int checkTypeAPI) { HINSTANCE h = LoadLibrary(plugin); if (h == NULL) @@ -272,7 +273,7 @@ LBL_Error: bpi->Interfaces = pFunc(); } - PLUGININFOEX* pi = bpi->InfoEx(mirandaVersion); + PLUGININFOEX* pi = bpi->InfoEx(dwMirVer); if (!checkPI(bpi, pi)) goto LBL_Error; @@ -333,17 +334,17 @@ int Plugin_UnloadDyn(pluginEntry *p) KillModuleServices(p->bpi.hInst); } - int hLangpack = p->hLangpack; - if (hLangpack != 0) { - KillModuleMenus(hLangpack); - KillModuleFonts(hLangpack); - KillModuleColours(hLangpack); - KillModuleEffects(hLangpack); - KillModuleIcons(hLangpack); - KillModuleHotkeys(hLangpack); - KillModuleSounds(hLangpack); - KillModuleExtraIcons(hLangpack); - KillModuleSrmmIcons(hLangpack); + int _hLang = p->hLangpack; + if (_hLang != 0) { + KillModuleMenus(_hLang); + KillModuleFonts(_hLang); + KillModuleColours(_hLang); + KillModuleEffects(_hLang); + KillModuleIcons(_hLang); + KillModuleHotkeys(_hLang); + KillModuleSounds(_hLang); + KillModuleExtraIcons(_hLang); + KillModuleSrmmIcons(_hLang); } NotifyFastHook(hevUnloadModule, (WPARAM)p->bpi.pluginInfo, (LPARAM)p->bpi.hInst); @@ -733,7 +734,7 @@ int LoadSslModule(void) return 1; } - mir_getSI(&si); + mir_getSI(&sslApi); return 0; } -- cgit v1.2.3