diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-14 01:22:55 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-14 01:22:55 +0300 |
commit | d3cb19278d60ac6f7963379254546cdca36a90e2 (patch) | |
tree | f2fa018b343d5460419c1b323f5f3ce04a393d00 /protocols/IcqOscarJ/src | |
parent | d5a6c0666a8d8d2055a3f4402f67f91e8548ec3a (diff) |
separate handle types for HNETLIBCONN & HNETLIBBIND
Diffstat (limited to 'protocols/IcqOscarJ/src')
-rw-r--r-- | protocols/IcqOscarJ/src/cookies.h | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/fam_01service.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/guids.h | 6 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_avatar.cpp | 10 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_avatar.h | 4 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_direct.cpp | 8 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_direct.h | 4 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_http.cpp | 8 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_http.h | 8 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_proto.h | 8 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_server.cpp | 5 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_server.h | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/oscar_filetransfer.cpp | 10 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/oscar_filetransfer.h | 4 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/stdpackets.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/utilities.cpp | 12 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/utilities.h | 6 |
17 files changed, 52 insertions, 49 deletions
diff --git a/protocols/IcqOscarJ/src/cookies.h b/protocols/IcqOscarJ/src/cookies.h index 37f85c214c..012488bff4 100644 --- a/protocols/IcqOscarJ/src/cookies.h +++ b/protocols/IcqOscarJ/src/cookies.h @@ -56,7 +56,7 @@ struct icq_cookie_info : public MZeroedObject struct cookie_family_request
{
WORD wFamily;
- void (CIcqProto::*familyHandler)(HANDLE hConn, char* cookie, size_t cookieLen);
+ void (CIcqProto::*familyHandler)(HNETLIBCONN hConn, char* cookie, size_t cookieLen);
};
struct cookie_offline_messages
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index 72640bb168..7e225f7af8 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -363,7 +363,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_heade nloc.szHost = pServer;
nloc.wPort = wPort;
- HANDLE hConnection = NetLib_OpenConnection(m_hNetlibUser, wFamily == ICQ_AVATAR_FAMILY ? "Avatar " : NULL, &nloc);
+ HNETLIBCONN hConnection = NetLib_OpenConnection(m_hNetlibUser, wFamily == ICQ_AVATAR_FAMILY ? "Avatar " : NULL, &nloc);
if (hConnection == NULL)
debugLogA("Unable to connect to ICQ new family server.");
diff --git a/protocols/IcqOscarJ/src/guids.h b/protocols/IcqOscarJ/src/guids.h index 3625b7281e..c690367ec0 100644 --- a/protocols/IcqOscarJ/src/guids.h +++ b/protocols/IcqOscarJ/src/guids.h @@ -58,14 +58,12 @@ static const plugin_guid MGTYPE_CHAT = {MGTYPE_CHAT_s}; static const plugin_guid MGTYPE_SMS_MESSAGE = {MGTYPE_SMS_MESSAGE_s};
static const plugin_guid MGTYPE_XTRAZ_SCRIPT = {MGTYPE_XTRAZ_SCRIPT_s};
-
// make GUID checks easy
-static BOOL CompareGUIDs(DWORD q1,DWORD q2,DWORD q3,DWORD q4, const plugin_guid guid)
+__forceinline bool CompareGUIDs(DWORD q1, DWORD q2, DWORD q3, DWORD q4, const plugin_guid guid)
{
- return ((q1 == guid[0]) && (q2 == guid[1]) && (q3 == guid[2]) && (q4 == guid[3]))?TRUE:FALSE;
+ return ((q1 == guid[0]) && (q2 == guid[1]) && (q3 == guid[2]) && (q4 == guid[3])) ? true : false;
}
-
// pack entire GUID into icq packet
static __inline void packGUID(icq_packet *packet, const plugin_guid guid)
{
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index ad93fb8065..25f214acbb 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -170,7 +170,7 @@ int CIcqProto::IsAvatarChanged(MCONTACT hContact, const BYTE *pHash, size_t nHas return ret;
}
-void CIcqProto::StartAvatarThread(HANDLE hConn, char *cookie, size_t cookieLen) // called from event
+void CIcqProto::StartAvatarThread(HNETLIBCONN hConn, char *cookie, size_t cookieLen) // called from event
{
if (!hConn) {
mir_cslock l(m_avatarsMutex); // place avatars lock
@@ -688,7 +688,7 @@ void __cdecl CIcqProto::AvatarThread(avatars_server_connection *pInfo) debugLogA("%s thread ended.", "Avatar");
}
-avatars_server_connection::avatars_server_connection(CIcqProto *_ppro, HANDLE _hConnection, char *_pCookie, size_t _wCookieLen) :
+avatars_server_connection::avatars_server_connection(CIcqProto *_ppro, HNETLIBCONN _hConnection, char *_pCookie, size_t _wCookieLen) :
isLoggedIn(false), stopThread(false), isActive(false),
ppro(_ppro),
pCookie(_pCookie),
@@ -712,8 +712,10 @@ void avatars_server_connection::closeConnection() stopThread = TRUE;
mir_cslock l(localSeqMutex);
- if (hConnection)
- NetLib_SafeCloseHandle(&hConnection);
+ if (hConnection) {
+ Netlib_CloseHandle(hConnection);
+ hConnection = NULL;
+ }
}
void avatars_server_connection::shutdownConnection()
diff --git a/protocols/IcqOscarJ/src/icq_avatar.h b/protocols/IcqOscarJ/src/icq_avatar.h index d0346b229b..e08564c4d4 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.h +++ b/protocols/IcqOscarJ/src/icq_avatar.h @@ -42,7 +42,7 @@ struct CIcqProto; class avatars_server_connection : public MZeroedObject
{
CIcqProto *ppro;
- HANDLE hConnection; // handle to the connection
+ HNETLIBCONN hConnection; // handle to the connection
HANDLE hPacketRecver;
WORD wLocalSequence;
mir_cs localSeqMutex, connMutex;
@@ -73,7 +73,7 @@ class avatars_server_connection : public MZeroedObject void checkRequestQueue();
public:
- avatars_server_connection(CIcqProto *ppro, HANDLE hConnection, char *pCookie, size_t wCookieLen);
+ avatars_server_connection(CIcqProto *ppro, HNETLIBCONN hConnection, char *pCookie, size_t wCookieLen);
virtual ~avatars_server_connection();
void connectionThread();
diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp index d87b215704..f7d0ea13fb 100644 --- a/protocols/IcqOscarJ/src/icq_direct.cpp +++ b/protocols/IcqOscarJ/src/icq_direct.cpp @@ -29,7 +29,7 @@ struct directthreadstartinfo {
int type; // Only valid for outgoing connections
int incoming; // 1=incoming, 0=outgoing
- HANDLE hConnection; // only valid for incoming connections, handle to the connection
+ HNETLIBCONN hConnection; // only valid for incoming connections, handle to the connection
MCONTACT hContact; // Only valid for outgoing connections
void* pvExtra; // Only valid for outgoing connections
};
@@ -50,7 +50,7 @@ void CIcqProto::CloseContactDirectConns(MCONTACT hContact) for (int i = 0; i < directConns.getCount(); i++) {
if (!hContact || directConns[i]->hContact == hContact) {
- HANDLE hConnection = directConns[i]->hConnection;
+ HNETLIBCONN hConnection = directConns[i]->hConnection;
directConns[i]->hConnection = NULL; // do not allow reuse
NetLib_CloseConnection(&hConnection, FALSE);
@@ -105,7 +105,7 @@ int CIcqProto::sendDirectPacket(directconnect* dc, icq_packet* pkt) return nResult;
}
-directthreadstartinfo* CreateDTSI(MCONTACT hContact, HANDLE hConnection, int type)
+directthreadstartinfo* CreateDTSI(MCONTACT hContact, HNETLIBCONN hConnection, int type)
{
directthreadstartinfo *dtsi = (directthreadstartinfo*)SAFE_MALLOC(sizeof(directthreadstartinfo));
dtsi->hContact = hContact;
@@ -159,7 +159,7 @@ BOOL CIcqProto::IsDirectConnectionOpen(MCONTACT hContact, int type, int bPassive // This function is called from the Netlib when someone is connecting to
// one of our incomming DC ports
-void icq_newConnectionReceived(HANDLE hNewConnection, DWORD, void *pExtra)
+void icq_newConnectionReceived(HNETLIBCONN hNewConnection, DWORD, void *pExtra)
{
// Start a new thread for the incomming connection
CIcqProto* ppro = (CIcqProto*)pExtra;
diff --git a/protocols/IcqOscarJ/src/icq_direct.h b/protocols/IcqOscarJ/src/icq_direct.h index 7a412ced11..4b3da88a79 100644 --- a/protocols/IcqOscarJ/src/icq_direct.h +++ b/protocols/IcqOscarJ/src/icq_direct.h @@ -49,7 +49,7 @@ struct filetransfer: public basic_filetransfer DWORD dwTransferSpeed;
DWORD dwBytesDone, dwFileBytesDone;
int fileId;
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
DWORD dwLastNotify;
int nVersion; // Was this sent with a v7 or a v8 packet?
BOOL bDC; // Was this received over a DC or through server?
@@ -65,7 +65,7 @@ struct filetransfer: public basic_filetransfer struct directconnect
{
MCONTACT hContact;
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
DWORD dwConnectionCookie;
int type;
WORD wVersion;
diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp index 20d63bf75d..15fb8f8c6e 100644 --- a/protocols/IcqOscarJ/src/icq_http.cpp +++ b/protocols/IcqOscarJ/src/icq_http.cpp @@ -29,7 +29,7 @@ #include "stdafx.h"
-int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST *nlhr)
+int icq_httpGatewayInit(HNETLIBCONN hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST *nlhr)
{
// initial response from ICQ http gateway
size_t wLen, wVersion, wType;
@@ -79,7 +79,7 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST * -int icq_httpGatewayBegin(HANDLE hConn, NETLIBOPENCONNECTION* nloc)
+int icq_httpGatewayBegin(HNETLIBCONN hConn, NETLIBOPENCONNECTION* nloc)
{ // open our "virual data connection"
icq_packet packet;
size_t serverNameLen;
@@ -99,7 +99,7 @@ int icq_httpGatewayBegin(HANDLE hConn, NETLIBOPENCONNECTION* nloc) -int icq_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags)
+int icq_httpGatewayWrapSend(HNETLIBCONN hConn, PBYTE buf, int len, int flags)
{
PBYTE sendBuf = buf;
int sendLen = len;
@@ -192,7 +192,7 @@ PBYTE icq_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST*, PBYTE buf, int len, int* out -int icq_httpGatewayWalkTo(HANDLE hConn, NETLIBOPENCONNECTION* nloc)
+int icq_httpGatewayWalkTo(HNETLIBCONN hConn, NETLIBOPENCONNECTION* nloc)
{ // this is bad simplification - for avatars to work we need to handle
// two "virtual connections" at the same time
icq_packet packet;
diff --git a/protocols/IcqOscarJ/src/icq_http.h b/protocols/IcqOscarJ/src/icq_http.h index 0f2eb6a394..3df6511b08 100644 --- a/protocols/IcqOscarJ/src/icq_http.h +++ b/protocols/IcqOscarJ/src/icq_http.h @@ -35,10 +35,10 @@ #define HTTP_PACKETTYPE_CLOSE 6 /* contains no data */
#define HTTP_PACKETTYPE_CLOSEREPLY 7 /* contains 1 byte: 0 */
-int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr);
-int icq_httpGatewayBegin(HANDLE hConn, NETLIBOPENCONNECTION *nloc);
-int icq_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags);
+int icq_httpGatewayInit(HNETLIBCONN hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr);
+int icq_httpGatewayBegin(HNETLIBCONN hConn, NETLIBOPENCONNECTION *nloc);
+int icq_httpGatewayWrapSend(HNETLIBCONN hConn, PBYTE buf, int len, int flags);
PBYTE icq_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST *nlhr, PBYTE buf, int bufLen, int *outBufLen, void *(*NetlibRealloc)(void *, size_t));
-int icq_httpGatewayWalkTo(HANDLE hConn, NETLIBOPENCONNECTION* nloc);
+int icq_httpGatewayWalkTo(HNETLIBCONN hConn, NETLIBOPENCONNECTION* nloc);
#endif /* __ICQ_HTTP_H */
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 7fa039a78b..b15b3cd210 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -400,7 +400,7 @@ struct CIcqProto : public PROTO<CIcqProto> int GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid, const BYTE *hash, size_t hashlen, const wchar_t *file);
int SetAvatarData(MCONTACT hContact, WORD wRef, const BYTE *data, size_t datalen);
- void StartAvatarThread(HANDLE hConn, char* cookie, size_t cookieLen);
+ void StartAvatarThread(HNETLIBCONN hConn, char* cookie, size_t cookieLen);
void StopAvatarThread();
//----| icq_clients.cpp |-------------------------------------------------------------
@@ -533,7 +533,7 @@ struct CIcqProto : public PROTO<CIcqProto> int handleRateItem(rates_queue_item *item, int nQueueType = RQT_DEFAULT, int nMinDelay = 0, BOOL bAllowDelay = TRUE);
//----| icq_server.cpp |--------------------------------------------------------------
- HANDLE hServerConn;
+ HNETLIBCONN hServerConn;
WORD wListenPort;
WORD wLocalSequence;
UINT serverThreadId;
@@ -679,7 +679,7 @@ struct CIcqProto : public PROTO<CIcqProto> //----| stdpackets.cpp |----------------------------------------------------------
void icq_sendCloseConnection();
- void icq_requestnewfamily(WORD wFamily, void (CIcqProto::*familyhandler)(HANDLE hConn, char* cookie, size_t cookieLen));
+ void icq_requestnewfamily(WORD wFamily, void (CIcqProto::*familyhandler)(HNETLIBCONN hConn, char* cookie, size_t cookieLen));
void icq_setidle(int bAllow);
void icq_setstatus(WORD wStatus, const char *szStatusNote = NULL);
@@ -876,7 +876,7 @@ struct CIcqProto : public PROTO<CIcqProto> void AddToSpammerList(DWORD dwUIN);
BOOL IsOnSpammerList(DWORD dwUIN);
- HANDLE NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam, WORD *pwPort, DWORD *pdwIntIP);
+ HNETLIBBIND NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam, WORD *pwPort, DWORD *pdwIntIP);
MCONTACT HandleFromCacheByUid(DWORD dwUin, const char *szUid);
MCONTACT HContactFromUIN(DWORD dwUin, int *Added);
diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp index 732c251ec3..27e72224b0 100644 --- a/protocols/IcqOscarJ/src/icq_server.cpp +++ b/protocols/IcqOscarJ/src/icq_server.cpp @@ -29,7 +29,7 @@ #include "stdafx.h"
-void icq_newConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pExtra);
+void icq_newConnectionReceived(HNETLIBCONN hNewConnection, DWORD dwRemoteIP, void *pExtra);
/////////////////////////////////////////////////////////////////////////////////////////
// ICQ Server thread
@@ -152,7 +152,8 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) NetLib_SafeCloseHandle(&info.hPacketRecver);
// Close DC port
- NetLib_SafeCloseHandle(&info.hDirectBoundPort);
+ Netlib_CloseHandle(info.hDirectBoundPort);
+ info.hDirectBoundPort = NULL;
// disable auto info-update thread
icq_EnableUserLookup(FALSE);
diff --git a/protocols/IcqOscarJ/src/icq_server.h b/protocols/IcqOscarJ/src/icq_server.h index c3b18d3b8c..aed7013755 100644 --- a/protocols/IcqOscarJ/src/icq_server.h +++ b/protocols/IcqOscarJ/src/icq_server.h @@ -56,7 +56,7 @@ struct serverthread_info bool bMyAvatarInited;
HANDLE hPacketRecver;
- HANDLE hDirectBoundPort;
+ HNETLIBBIND hDirectBoundPort;
};
#endif /* __ICQ_SERVER_H */
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index 69ca05538a..d563474330 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -34,7 +34,7 @@ struct oscarthreadstartinfo int type;
int incoming;
MCONTACT hContact;
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
DWORD dwRemoteIP;
oscar_filetransfer *ft;
oscar_listener *listener;
@@ -308,8 +308,10 @@ void CIcqProto::ReleaseOscarListener(oscar_listener **pListener) {
oscar_listener *listener = *pListener;
if (listener) { // Close listening port
- if (listener->hBoundPort)
- NetLib_SafeCloseHandle(&listener->hBoundPort);
+ if (listener->hBoundPort) {
+ Netlib_CloseHandle(listener->hBoundPort);
+ listener->hBoundPort = NULL;
+ }
NetLog_Direct("Oscar listener on port %d released.", listener->wPort);
}
@@ -675,7 +677,7 @@ void CIcqProto::handleRecvServResponseOFT(BYTE *buf, size_t wLen, DWORD dwUin, c }
// This function is called from the Netlib when someone is connecting to our oscar_listener
-static void oft_newConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pExtra)
+static void oft_newConnectionReceived(HNETLIBCONN hNewConnection, DWORD dwRemoteIP, void *pExtra)
{
oscarthreadstartinfo *otsi = (oscarthreadstartinfo*)SAFE_MALLOC(sizeof(oscarthreadstartinfo));
oscar_listener *listener = (oscar_listener*)pExtra;
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.h b/protocols/IcqOscarJ/src/oscar_filetransfer.h index 948bc1714d..b01dabd2b0 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.h +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.h @@ -123,7 +123,7 @@ void SafeReleaseFileTransfer(void **ft); struct oscar_connection
{
MCONTACT hContact;
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
int status;
DWORD dwUin;
uid_str szUid;
@@ -154,7 +154,7 @@ struct oscar_listener {
CIcqProto *ppro;
WORD wPort;
- HANDLE hBoundPort;
+ HNETLIBBIND hBoundPort;
oscar_filetransfer *ft;
};
diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp index 8a66eeb085..835cd5e26f 100644 --- a/protocols/IcqOscarJ/src/stdpackets.cpp +++ b/protocols/IcqOscarJ/src/stdpackets.cpp @@ -196,7 +196,7 @@ void CIcqProto::icq_sendCloseConnection() sendServPacket(&packet);
}
-void CIcqProto::icq_requestnewfamily(WORD wFamily, void (CIcqProto::*familyhandler)(HANDLE hConn, char* cookie, size_t cookieLen))
+void CIcqProto::icq_requestnewfamily(WORD wFamily, void (CIcqProto::*familyhandler)(HNETLIBCONN hConn, char* cookie, size_t cookieLen))
{
int bRequestSSL = m_bSecureConnection && (wFamily != ICQ_AVATAR_FAMILY); // Avatar servers does not support SSL
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 85a34e4238..d4d7c0a885 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -1361,7 +1361,7 @@ DWORD ICQWaitForSingleObject(HANDLE hObject, DWORD dwMilliseconds, int bWaitAlwa }
-HANDLE NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc)
+HNETLIBCONN NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc)
{
Netlib_Logf(hUser, "%sConnecting to %s:%u", szIdent ? szIdent : "", nloc->szHost, nloc->wPort);
@@ -1371,15 +1371,14 @@ HANDLE NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENC }
-HANDLE CIcqProto::NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam, WORD* pwPort, DWORD* pdwIntIP)
+HNETLIBBIND CIcqProto::NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam, WORD* pwPort, DWORD* pdwIntIP)
{
NETLIBBIND nlb = {};
- nlb.cbSize = sizeof(NETLIBBIND);
nlb.pfnNewConnectionV2 = pFunc;
nlb.pExtra = lParam;
SetLastError(ERROR_INVALID_PARAMETER); // this must be here - NetLib does not set any error :((
- HANDLE hBoundPort = Netlib_BindPort(m_hDirectNetlibUser, &nlb);
+ HNETLIBBIND hBoundPort = Netlib_BindPort(m_hDirectNetlibUser, &nlb);
if (pwPort) *pwPort = nlb.wPort;
if (pdwIntIP) *pdwIntIP = nlb.dwInternalIP;
@@ -1388,10 +1387,11 @@ HANDLE CIcqProto::NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam }
-void NetLib_CloseConnection(HANDLE *hConnection, int bServerConn)
+void NetLib_CloseConnection(HNETLIBCONN *hConnection, int bServerConn)
{
if (*hConnection) {
- NetLib_SafeCloseHandle(hConnection);
+ Netlib_CloseHandle(*hConnection);
+ *hConnection = NULL;
if (bServerConn)
FreeGatewayIndex(*hConnection);
diff --git a/protocols/IcqOscarJ/src/utilities.h b/protocols/IcqOscarJ/src/utilities.h index ad5907c1bb..fcdcf9a6d8 100644 --- a/protocols/IcqOscarJ/src/utilities.h +++ b/protocols/IcqOscarJ/src/utilities.h @@ -95,9 +95,9 @@ __inline static void SAFE_FREE(WCHAR** str) { SAFE_FREE((void**)str); } DWORD ICQWaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds, int bWaitAlways = FALSE);
-HANDLE NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc);
-void NetLib_CloseConnection(HANDLE *hConnection, int bServerConn);
-void NetLib_SafeCloseHandle(HANDLE *hConnection);
+HNETLIBCONN NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc);
+void NetLib_CloseConnection(HNETLIBCONN *hConnection, int bServerConn);
+void NetLib_SafeCloseHandle(HANDLE *);
char* __fastcall ICQTranslateUtf(const char *src);
char* __fastcall ICQTranslateUtfStatic(const char *src, char *buf, size_t bufsize);
|