diff options
-rw-r--r-- | include/m_ssl.h | 5 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg.cpp | 4 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg.h | 2 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/libgadu/events.cpp | 4 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/libgadu/libgadu.cpp | 10 | ||||
-rw-r--r-- | src/mir_app/src/netlib.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/netlib.h | 2 | ||||
-rw-r--r-- | src/mir_app/src/netlibhttp.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/netlibopenconn.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/netlibpktrecver.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/netlibsock.cpp | 11 | ||||
-rw-r--r-- | src/mir_app/src/newplugins.cpp | 33 |
12 files changed, 45 insertions, 40 deletions
diff --git a/include/m_ssl.h b/include/m_ssl.h index eb177b4ef2..744274621b 100644 --- a/include/m_ssl.h +++ b/include/m_ssl.h @@ -50,9 +50,6 @@ struct SSL_API pfnSfree sfree;
};
-/* every protocol should declare this variable to use the SSL API */
-extern SSL_API si;
-
/*
a service to obtain the SSL API
@@ -64,7 +61,7 @@ returns TRUE if all is Ok, and FALSE otherwise #define MS_SYSTEM_GET_SI "Miranda/System/GetSslApi"
-__forceinline INT_PTR mir_getSI(SSL_API* dest)
+__forceinline INT_PTR mir_getSI(SSL_API *dest)
{
dest->cbSize = sizeof(*dest);
return CallService(MS_SYSTEM_GET_SI, 0, (LPARAM)dest);
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index cf9f0aad10..af3bd97329 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -41,7 +41,7 @@ PLUGININFOEX pluginInfo = { // Other variables
HINSTANCE hInstance;
-SSL_API si;
+SSL_API sslApi;
CLIST_INTERFACE *pcli;
int hLangpack;
LIST<GGPROTO> g_Instances(1, PtrKeySortT);
@@ -181,7 +181,7 @@ void GGPROTO::cleanuplastplugin(DWORD version) static int gg_modulesloaded(WPARAM wParam, LPARAM lParam)
{
// Get SSL API
- mir_getSI(&si);
+ mir_getSI(&sslApi);
// File Association Manager support
gg_links_init();
diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h index b0c567ada9..9fb6394bf0 100644 --- a/protocols/Gadu-Gadu/src/gg.h +++ b/protocols/Gadu-Gadu/src/gg.h @@ -338,4 +338,6 @@ const char *ggdebug_eventtype(gg_event *e); #include "gg_proto.h"
+extern SSL_API sslApi;
+
#endif
diff --git a/protocols/Gadu-Gadu/src/libgadu/events.cpp b/protocols/Gadu-Gadu/src/libgadu/events.cpp index 2a24b77e3c..44bfa73cab 100644 --- a/protocols/Gadu-Gadu/src/libgadu/events.cpp +++ b/protocols/Gadu-Gadu/src/libgadu/events.cpp @@ -63,6 +63,8 @@ #endif #endif +extern SSL_API sslApi;
+ /** * Zwalnia pamięć zajmowaną przez informację o zdarzeniu. * @@ -2433,7 +2435,7 @@ struct gg_event *gg_watch_fd(struct gg_session *sess) { gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_TLS_NEGOTIATION\n"); - sess->ssl = si.connect(sess->fd, 0, 0); + sess->ssl = sslApi.connect(sess->fd, 0, 0); if (sess->ssl == NULL) { gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() TLS negotiation failed\n"); diff --git a/protocols/Gadu-Gadu/src/libgadu/libgadu.cpp b/protocols/Gadu-Gadu/src/libgadu/libgadu.cpp index a827b261e1..197c6093d3 100644 --- a/protocols/Gadu-Gadu/src/libgadu/libgadu.cpp +++ b/protocols/Gadu-Gadu/src/libgadu/libgadu.cpp @@ -69,6 +69,8 @@ # include <openssl/rand.h>
#endif
+extern SSL_API sslApi;
+
/**
* Poziom rejestracji informacji odpluskwiających. Zmienna jest maską bitową
* składającą się ze stałych \c GG_DEBUG_...
@@ -323,7 +325,7 @@ int gg_read(struct gg_session *sess, char *buf, int length) {
#ifdef GG_CONFIG_MIRANDA
if (sess->ssl != NULL)
- return si.read(sess->ssl, buf, length, 0);
+ return sslApi.read(sess->ssl, buf, length, 0);
#elif GG_CONFIG_HAVE_OPENSSL
if (sess->ssl != NULL) {
for (;;) {
@@ -373,7 +375,7 @@ static int gg_write_common(struct gg_session *sess, const char *buf, int length) {
#ifdef GG_CONFIG_MIRANDA
if (sess->ssl != NULL)
- return si.write(sess->ssl, buf, length);
+ return sslApi.write(sess->ssl, buf, length);
#elif GG_CONFIG_HAVE_OPENSSL
if (sess->ssl != NULL) {
for (;;) {
@@ -1064,7 +1066,7 @@ void gg_logoff(struct gg_session *sess) #ifdef GG_CONFIG_MIRANDA
if (sess->ssl != NULL)
- si.shutdown(sess->ssl);
+ sslApi.shutdown(sess->ssl);
#elif GG_CONFIG_HAVE_OPENSSL
if (sess->ssl != NULL)
SSL_shutdown(sess->ssl);
@@ -1110,7 +1112,7 @@ void gg_free_session(struct gg_session *sess) #ifdef GG_CONFIG_MIRANDA
if (sess->ssl != NULL)
- si.sfree(sess->ssl);
+ sslApi.sfree(sess->ssl);
#elif GG_CONFIG_HAVE_OPENSSL
if (sess->ssl != NULL)
SSL_free(sess->ssl);
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> 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;
}
|