From 52824c91bac6d6cc0f04e242b07d9031477b6362 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 21 Sep 2013 20:23:22 +0000 Subject: protocols cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@6170 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IRCG/src/options.cpp | 40 ++++++++----------------- protocols/IcqOscarJ/src/changeinfo/editlist.cpp | 9 +----- protocols/IcqOscarJ/src/utilities.cpp | 20 ++++--------- protocols/JabberG/jabber_10.vcxproj | 8 ++--- protocols/JabberG/jabber_11.vcxproj | 8 ++--- protocols/JabberG/src/jabber_iq_handlers.cpp | 11 ++----- protocols/JabberG/src/jabber_rc.cpp | 11 +------ protocols/JabberG/src/jabber_thread.cpp | 21 ++----------- protocols/MSN/src/msn_lists.cpp | 4 +-- protocols/Xfire/src/Xfire_voicechat.cpp | 26 ++++------------ protocols/Xfire/src/Xfire_voicechat.h | 4 --- protocols/Xfire/src/baseProtocol.h | 19 ------------ protocols/Xfire/src/main.cpp | 8 +---- protocols/Xfire/src/tools.cpp | 23 +++----------- protocols/Xfire/xfire_10.vcxproj | 8 ++--- protocols/Xfire/xfire_11.vcxproj | 8 ++--- 16 files changed, 52 insertions(+), 176 deletions(-) (limited to 'protocols') diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 344df3c89d..fcca7bbc3f 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -273,32 +273,22 @@ struct { UINT cpId; TCHAR *cpName; } static cpTable[] = static CCtrlCombo* sttCombo; -typedef BOOL ( WINAPI *pfnGetCPInfoEx )( UINT, DWORD, LPCPINFOEX ); -static pfnGetCPInfoEx fnGetCPInfoEx = NULL; - -static BOOL CALLBACK sttLangAddCallback( CHAR* str ) +static BOOL CALLBACK sttLangAddCallback(CHAR *str) { UINT cp = atoi(str); - if ( fnGetCPInfoEx == NULL ) { - int i; - for ( i=0; i < SIZEOF(cpTable) && cpTable[i].cpId != cp; i++ ); - if ( i < SIZEOF(cpTable)) - sttCombo->AddString( TranslateTS( cpTable[i].cpName ), cp ); - } - else { - CPINFOEX cpinfo; - if ( fnGetCPInfoEx( cp, 0, &cpinfo )) { - TCHAR* b = _tcschr( cpinfo.CodePageName, '(' ); - if ( b ) { - TCHAR* e = _tcsrchr( cpinfo.CodePageName, ')' ); - if ( e ) { - *e = 0; - sttCombo->AddString( b+1, cp ); - } - else sttCombo->AddString( cpinfo.CodePageName, cp ); + CPINFOEX cpinfo; + if (GetCPInfoEx(cp, 0, &cpinfo)) { + TCHAR* b = _tcschr( cpinfo.CodePageName, '(' ); + if ( b ) { + TCHAR* e = _tcsrchr( cpinfo.CodePageName, ')' ); + if ( e ) { + *e = 0; + sttCombo->AddString( b+1, cp ); } else sttCombo->AddString( cpinfo.CodePageName, cp ); - } } + } + else sttCombo->AddString( cpinfo.CodePageName, cp ); + } return TRUE; } @@ -1058,11 +1048,7 @@ void COtherPrefsDlg::OnInitDialog() m_add.Enable( m_proto->m_perform ); m_delete.Enable( m_proto->m_perform ); - fnGetCPInfoEx = ( pfnGetCPInfoEx )GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetCPInfoExW" ); - - m_codepage.AddString( TranslateT("Default ANSI codepage"), CP_ACP ); - if ( fnGetCPInfoEx == NULL ) - m_codepage.AddString( TranslateT("UTF-8"), CP_UTF8 ); + m_codepage.AddString(TranslateT("Default ANSI codepage"), CP_ACP); sttCombo = &m_codepage; EnumSystemCodePagesA(sttLangAddCallback, CP_INSTALLED); diff --git a/protocols/IcqOscarJ/src/changeinfo/editlist.cpp b/protocols/IcqOscarJ/src/changeinfo/editlist.cpp index acaa15d861..c4ba1157c0 100644 --- a/protocols/IcqOscarJ/src/changeinfo/editlist.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/editlist.cpp @@ -30,7 +30,6 @@ static ChangeInfoData *dataListEdit = NULL; static HWND hwndListEdit = NULL; -static BOOL (WINAPI *MyAnimateWindow)(HWND,DWORD,DWORD); static LRESULT CALLBACK ListEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) { @@ -129,13 +128,7 @@ void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey if (itemHeight * listCount < 150) SetWindowPos(hwndListEdit, 0, 0, 0, rc->right - rc->left, itemHeight * listCount + GetSystemMetrics(SM_CYBORDER) * 2, SWP_NOZORDER|SWP_NOMOVE); mir_subclassWindow(hwndListEdit, ListEditSubclassProc); - if (MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(GetModuleHandleA("user32"), "AnimateWindow")) - { - BOOL enabled; - - SystemParametersInfo(SPI_GETCOMBOBOXANIMATION, 0, &enabled, FALSE); - if (enabled) MyAnimateWindow(hwndListEdit, 200, AW_SLIDE|AW_ACTIVATE|AW_VER_POSITIVE); - } + AnimateWindow(hwndListEdit, 200, AW_SLIDE|AW_ACTIVATE|AW_VER_POSITIVE); ShowWindow(hwndListEdit, SW_SHOW); SetFocus(hwndListEdit); if (wVKey) diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index a3fb13398c..9f212cd271 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -1888,22 +1888,12 @@ const char* ExtractFileName(const char *fullname) char* FileNameToUtf(const TCHAR *filename) { - // reasonable only on NT systems - HINSTANCE hKernel = GetModuleHandle(_T("KERNEL32")); - DWORD (CALLBACK *RealGetLongPathName)(LPCWSTR, LPWSTR, DWORD); + WCHAR *usFileName = NULL; + int wchars = GetLongPathName(filename, usFileName, 0); + usFileName = (WCHAR*)_alloca((wchars + 1) * sizeof(WCHAR)); + GetLongPathName(filename, usFileName, wchars); - *(FARPROC *)&RealGetLongPathName = GetProcAddress(hKernel, "GetLongPathNameW"); - - if (RealGetLongPathName) - { // the function is available (it is not on old NT systems) - WCHAR *usFileName = NULL; - int wchars = RealGetLongPathName(filename, usFileName, 0); - usFileName = (WCHAR*)_alloca((wchars + 1) * sizeof(WCHAR)); - RealGetLongPathName(filename, usFileName, wchars); - - return make_utf8_string(usFileName); - } - return make_utf8_string(filename); + return make_utf8_string(usFileName); } diff --git a/protocols/JabberG/jabber_10.vcxproj b/protocols/JabberG/jabber_10.vcxproj index e9d51ee5e9..8f99e8ab51 100644 --- a/protocols/JabberG/jabber_10.vcxproj +++ b/protocols/JabberG/jabber_10.vcxproj @@ -92,7 +92,7 @@ /PDBALTPATH:%_PDB% - ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;%(AdditionalDependencies) + ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;Dnsapi.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true @@ -127,7 +127,7 @@ /PDBALTPATH:%_PDB% - ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;%(AdditionalDependencies) + ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;Dnsapi.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true @@ -160,7 +160,7 @@ ..\..\include;..\..\include\msapi - ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;%(AdditionalDependencies) + ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;Dnsapi.lib;%(AdditionalDependencies) true 0x32500000 false @@ -190,7 +190,7 @@ ..\..\include;..\..\include\msapi - ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;%(AdditionalDependencies) + ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;Dnsapi.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true 0x32500000 diff --git a/protocols/JabberG/jabber_11.vcxproj b/protocols/JabberG/jabber_11.vcxproj index 74bf78b9a1..e75dcc9bf5 100644 --- a/protocols/JabberG/jabber_11.vcxproj +++ b/protocols/JabberG/jabber_11.vcxproj @@ -95,7 +95,7 @@ ..\..\include;..\..\include\msapi - ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;%(AdditionalDependencies) + ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;Dnsapi.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true @@ -129,7 +129,7 @@ ..\..\include;..\..\include\msapi - ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;%(AdditionalDependencies) + ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;Dnsapi.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true @@ -162,7 +162,7 @@ ..\..\include;..\..\include\msapi - ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;%(AdditionalDependencies) + ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;Dnsapi.lib;%(AdditionalDependencies) true 0x32500000 false @@ -193,7 +193,7 @@ ..\..\include;..\..\include\msapi - ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;%(AdditionalDependencies) + ws2_32.lib;comctl32.lib;UxTheme.lib;Secur32.lib;Dnsapi.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true 0x32500000 diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index aa00846287..d0acf58696 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -113,7 +113,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PRODUCT_UNLICENSED 0xABCDABCD #endif -typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); #define StringCchCopy(x,y,z) lstrcpyn((x),(z),(y)) @@ -124,7 +123,6 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) { OSVERSIONINFOEX osvi; SYSTEM_INFO si; - PGNSI pGNSI; PGPI pGPI; DWORD dwType; @@ -142,13 +140,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) return FALSE; } - // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. - HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll")); - pGNSI = (PGNSI) GetProcAddress(hKernel, "GetNativeSystemInfo"); - if (pGNSI != NULL) - pGNSI(&si); - else - GetSystemInfo(&si); + GetNativeSystemInfo(&si); // Some code from Crash Dumper Plugin :-) if (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId && osvi.dwMajorVersion > 4) @@ -182,6 +174,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) break; } + HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll")); pGPI = (PGPI) GetProcAddress(hKernel, "GetProductInfo"); if (pGPI != NULL) pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType); diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 5990dad83b..9cfc9aceb3 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -624,18 +624,9 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSe return JABBER_ADHOC_HANDLER_STATUS_CANCEL; } -typedef BOOL (WINAPI *LWS)(VOID); - int CJabberProto::AdhocLockWSHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession) { - BOOL bOk = FALSE; - HMODULE hLibrary = LoadLibrary(_T("user32.dll")); - if (hLibrary) { - LWS pLws = (LWS)GetProcAddress(hLibrary, "LockWorkStation"); - if (pLws) - bOk = pLws(); - FreeLibrary(hLibrary); - } + BOOL bOk = LockWorkStation(); TCHAR szMsg[ 1024 ]; if (bOk) diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 1f68a2eee7..420544d65c 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -146,9 +146,6 @@ void CJabberProto::OnPingReply(HXML, CJabberIqInfo* pInfo) ///////////////////////////////////////////////////////////////////////////////////////// -typedef DNS_STATUS (WINAPI *DNSQUERYA)(IN PCSTR pszName, IN WORD wType, IN DWORD Options, IN PIP4_ARRAY aipServers OPTIONAL, IN OUT PDNS_RECORDA *ppQueryResults OPTIONAL, IN OUT PVOID *pReserved OPTIONAL); -typedef void (WINAPI *DNSFREELIST)(IN OUT PDNS_RECORDA pRecordList, IN DNS_FREE_TYPE FreeType); - static int CompareDNS(const DNS_SRV_DATAA* dns1, const DNS_SRV_DATAA* dns2) { return (int)dns1->wPriority - (int)dns2->wPriority; @@ -159,23 +156,11 @@ void ThreadData::xmpp_client_query(void) if (inet_addr(server) != INADDR_NONE) return; - HMODULE hDnsapi = LoadLibraryA("dnsapi.dll"); - if (hDnsapi == NULL) - return; - - DNSQUERYA pDnsQuery = (DNSQUERYA)GetProcAddress(hDnsapi, "DnsQuery_A"); - DNSFREELIST pDnsRecordListFree = (DNSFREELIST)GetProcAddress(hDnsapi, "DnsRecordListFree"); - if (pDnsQuery == NULL) { - //dnsapi.dll is not the needed dnsapi ;) - FreeLibrary(hDnsapi); - return; - } - char temp[256]; mir_snprintf(temp, SIZEOF(temp), "_xmpp-client._tcp.%s", server); DNS_RECORDA *results = NULL; - DNS_STATUS status = pDnsQuery(temp, DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &results, NULL); + DNS_STATUS status = DnsQuery_A(temp, DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, (PDNS_RECORD *)&results, NULL); if (SUCCEEDED(status) && results) { LIST dnsList(5, CompareDNS); @@ -196,12 +181,10 @@ void ThreadData::xmpp_client_query(void) break; } } dnsList.destroy(); - pDnsRecordListFree(results, DnsFreeRecordList); + DnsRecordListFree(results, DnsFreeRecordList); } else proto->Log("%s not resolved", temp); - - FreeLibrary(hDnsapi); } void CJabberProto::xmlStreamInitialize(char *szWhich) diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index 02eb12c80d..c9a2d0e013 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -570,9 +570,7 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - HIMAGELIST hIml = ImageList_Create( - GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), - ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 5, 5); + HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR32, 5, 5); HICON hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT); ImageList_AddIcon(hIml, hIcon); diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp index 7a3ce804d2..b11f280975 100644 --- a/protocols/Xfire/src/Xfire_voicechat.cpp +++ b/protocols/Xfire/src/Xfire_voicechat.cpp @@ -6,39 +6,25 @@ Xfire_voicechat::Xfire_voicechat() { this->resetCurrentvoicestatus(); ipport=NULL; tsrDLL=NULL; - IpHlpApiDLL=NULL; tsrGetServerInfo=NULL; - GetExtendedTcpTable=NULL; pid=0; } //dekonstruktor -Xfire_voicechat::~Xfire_voicechat() { +Xfire_voicechat::~Xfire_voicechat() +{ //geladene tsr remote dll freigeben if(tsrDLL) { FreeLibrary(tsrDLL); tsrDLL=NULL; } - //geladene iphlper freigeben - if(IpHlpApiDLL) { - FreeLibrary(IpHlpApiDLL); - IpHlpApiDLL=NULL; - } } //init -void Xfire_voicechat::initVoicechat() { +void Xfire_voicechat::initVoicechat() +{ //tsremotedll laden tsrDLL=this->loadTSR(); - //weitere dll's laden - IpHlpApiDLL=LoadLibraryA("IpHlpApi.dll"); - if(IpHlpApiDLL) { - GetExtendedTcpTable=(pGetExtendedTcpTable)GetProcAddress(IpHlpApiDLL,"GetExtendedTcpTable"); - } - else - { - XFireLog("IpHlpApi.dll load failed!"); - } } //prüft ob das paket schonmal versendet wurde, soll unnötigen nwtraffic reduzieren, *ÜBERLEGUNG* ob wirklich notwendig @@ -343,12 +329,12 @@ BOOL Xfire_voicechat::checkforMumble(SendGameStatus2Packet* packet) { DWORD size=0; MIB_TCPTABLE_OWNER_PID* ptab=NULL; //tcptabelle holen - this->GetExtendedTcpTable(NULL,&size,FALSE, AF_INET, TCP_TABLE_OWNER_PID_CONNECTIONS, 0); + GetExtendedTcpTable(NULL, &size, FALSE, AF_INET, TCP_TABLE_OWNER_PID_CONNECTIONS, 0); //überhaupt was drin? if(size) { ptab=(MIB_TCPTABLE_OWNER_PID*)malloc(size); //liste auslesen - if(GetExtendedTcpTable(ptab,&size,FALSE, AF_INET, TCP_TABLE_OWNER_PID_CONNECTIONS, 0)==NO_ERROR) + if(GetExtendedTcpTable(ptab, &size, FALSE, AF_INET, TCP_TABLE_OWNER_PID_CONNECTIONS, 0) == NO_ERROR) { for(unsigned int i=0;idwNumEntries;i++) { diff --git a/protocols/Xfire/src/Xfire_voicechat.h b/protocols/Xfire/src/Xfire_voicechat.h index 1b70f3f456..5240c389a4 100644 --- a/protocols/Xfire/src/Xfire_voicechat.h +++ b/protocols/Xfire/src/Xfire_voicechat.h @@ -87,12 +87,8 @@ private: HMODULE tsrDLL; //tsrGetServerInfo funktion vom tsremotedll LPtsrGetServerInfo tsrGetServerInfo; - //GetExtendedTcpTable für mumble - pGetExtendedTcpTable GetExtendedTcpTable; //pid für mumble DWORD pid; - //IpHlperApi Module - HMODULE IpHlpApiDLL; public: Xfire_voicechat(); ~Xfire_voicechat(); diff --git a/protocols/Xfire/src/baseProtocol.h b/protocols/Xfire/src/baseProtocol.h index d7ba459cc8..cadb8c446e 100644 --- a/protocols/Xfire/src/baseProtocol.h +++ b/protocols/Xfire/src/baseProtocol.h @@ -87,25 +87,6 @@ //======================================================= #define protocolname "XFire" //no spaces here :) -/* */ -typedef DWORD (*pGetExtendedTcpTable)( - __out_bcount_opt(*pdwSize) PVOID pTcpTable, - __inout PDWORD pdwSize, - __in BOOL bOrder, - __in ULONG ulAf, - __in TCP_TABLE_CLASS TableClass, - __in ULONG Reserved - ); - -typedef DWORD (*pGetExtendedUdpTable)( - __out_bcount_opt(*pdwSize) PVOID pUdpTable, - __inout PDWORD pdwSize, - __in BOOL bOrder, - __in ULONG ulAf, - __in UDP_TABLE_CLASS TableClass, - __in ULONG Reserved - ); - //======================================================= // Defines //======================================================= diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index f2d80d8d1e..f75e74f5e7 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -121,7 +121,6 @@ HANDLE hookgamestart = NULL; char statusmessage[2][1024]; BOOL sendonrecieve=FALSE; HANDLE hNetlib=NULL; -pGetExtendedUdpTable _GetExtendedUdpTable=NULL; extern LPtsrGetServerInfo tsrGetServerInfo; //eventhandles @@ -1064,8 +1063,6 @@ extern "C" __declspec(dllexport) int Load(void) Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); - //void* init = GetProcAddress(LoadLibrary("atl"),"AtlAxWinInit"); _asm call init; - //keine protoversion in der db, dann wohl der erste start von xfire if(db_get_b(NULL,protocolname,"protover",0)==0) { @@ -1338,10 +1335,7 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent( ME_CLIST_PREBUILDCONTACTMENU, RebuildContactMenu ); - //lade GetExtendedUdpTable Funktion - HMODULE hmod=LoadLibraryA("IpHlpApi.dll"); - _GetExtendedUdpTable=(pGetExtendedUdpTable)GetProcAddress(hmod,"GetExtendedUdpTable"); - if(_GetExtendedUdpTable==NULL&&db_get_b(NULL,protocolname,"ipportdetec",0)) + if(db_get_b(NULL,protocolname,"ipportdetec",0)) { //MessageBoxA(0,"GetExtendedUdpTable not found. ServerIP/Port detection feature will be disabled.","Miranda XFire Protocol Plugin",MB_OK|MB_ICONINFORMATION); db_set_b(NULL,protocolname,"ipportdetec",0); diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp index e662defe91..dea108bbc7 100644 --- a/protocols/Xfire/src/tools.cpp +++ b/protocols/Xfire/src/tools.cpp @@ -328,10 +328,6 @@ BOOL FindTeamSpeak(DWORD*pid,int*vid) { return found; } -//funktion wird in main gesetzt -extern pGetExtendedUdpTable _GetExtendedUdpTable; - - #include #define maxuppackets 4 @@ -347,13 +343,6 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, //DUMP("***Suche IP/Port***",""); - //wenn die funktion nicht initialisiert werden konnte, könne wir nicht serverip und port rausbekommen - if(_GetExtendedUdpTable==NULL) - { - XFireLog("no GetExtendedUdpTable function"); - return FALSE; - } - if(pid!=lastpid) { lastip=lastport=0; @@ -363,9 +352,9 @@ BOOL GetServerIPPort(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1, DWORD size=0; MIB_UDPTABLE_OWNER_PID * ptab=NULL; - _GetExtendedUdpTable(NULL,&size,FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0); + GetExtendedUdpTable(NULL, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0); ptab=(MIB_UDPTABLE_OWNER_PID*)malloc(size); - int ret=_GetExtendedUdpTable(ptab,&size,FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0); + int ret = GetExtendedUdpTable(ptab, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0); //alle grad geöffnet updverb nach der pid vom spiel suchen, um an den port ranzukommen if(ret==NO_ERROR) { @@ -563,10 +552,6 @@ BOOL GetServerIPPort2(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1 static int lastpid=0; static int lastport=0; - //wenn die funktion nicht initialisiert werden konnte, könne wir nicht serverip und port rausbekommen - if(_GetExtendedUdpTable==NULL) - return FALSE; - if(pid!=lastpid) { lastip=lastport=0; @@ -576,9 +561,9 @@ BOOL GetServerIPPort2(DWORD pid,char*localaddrr,unsigned long localaddr,char*ip1 DWORD size=0; MIB_UDPTABLE_OWNER_PID * ptab=NULL; - _GetExtendedUdpTable(NULL,&size,FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0); + GetExtendedUdpTable(NULL, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0); ptab=(MIB_UDPTABLE_OWNER_PID*)malloc(size); - int ret=_GetExtendedUdpTable(ptab,&size,FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0); + int ret = GetExtendedUdpTable(ptab, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0); //alle grad geöffnet updverb nach der pid vom spiel suchen, um an den port ranzukommen if(ret==NO_ERROR) { diff --git a/protocols/Xfire/xfire_10.vcxproj b/protocols/Xfire/xfire_10.vcxproj index 1354b9e9b4..266a224686 100644 --- a/protocols/Xfire/xfire_10.vcxproj +++ b/protocols/Xfire/xfire_10.vcxproj @@ -90,13 +90,13 @@ ../../include;../../plugins/ExternalAPI;%(AdditionalIncludeDirectories) - kernel32.lib $(OutDir)XFire.dll true Windows MachineX86 $(ProfileDir)..\..\bin10\lib $(IntDir)$(TargetName).lib + Iphlpapi.lib;%(AdditionalDependencies) ..\..\include\msapi @@ -115,12 +115,12 @@ ../../include;../../plugins/ExternalAPI;%(AdditionalIncludeDirectories) - kernel32.lib $(OutDir)XFire.dll true Windows $(ProfileDir)..\..\bin10\lib $(IntDir)$(TargetName).lib + Iphlpapi.lib;%(AdditionalDependencies) ..\..\include\msapi @@ -145,7 +145,6 @@ ../../include;../../plugins/ExternalAPI;%(AdditionalIncludeDirectories) - kernel32.lib $(OutDir)XFire.dll true Windows @@ -157,6 +156,7 @@ MachineX86 $(ProfileDir)..\..\bin10\lib /PDBALTPATH:%_PDB% %(AdditionalOptions) + Iphlpapi.lib;%(AdditionalDependencies) ..\..\include\msapi @@ -181,7 +181,6 @@ ../../include;../../plugins/ExternalAPI;%(AdditionalIncludeDirectories) - kernel32.lib $(OutDir)XFire.dll true Windows @@ -192,6 +191,7 @@ $(IntDir)$(TargetName).lib $(ProfileDir)..\..\bin10\lib /PDBALTPATH:%_PDB% %(AdditionalOptions) + Iphlpapi.lib;%(AdditionalDependencies) ..\..\include\msapi diff --git a/protocols/Xfire/xfire_11.vcxproj b/protocols/Xfire/xfire_11.vcxproj index c4e554deb6..c423b007d0 100644 --- a/protocols/Xfire/xfire_11.vcxproj +++ b/protocols/Xfire/xfire_11.vcxproj @@ -94,7 +94,6 @@ ../../include;../../plugins/ExternalAPI;%(AdditionalIncludeDirectories) - kernel32.lib $(OutDir)XFire.dll true Windows @@ -102,6 +101,7 @@ $(ProfileDir)..\..\bin11\lib $(IntDir)$(TargetName).lib false + Iphlpapi.lib;%(AdditionalDependencies) ..\..\include\msapi @@ -120,12 +120,12 @@ ../../include;../../plugins/ExternalAPI;%(AdditionalIncludeDirectories) - kernel32.lib $(OutDir)XFire.dll true Windows $(ProfileDir)..\..\bin11\lib $(IntDir)$(TargetName).lib + Iphlpapi.lib;%(AdditionalDependencies) ..\..\include\msapi @@ -150,7 +150,6 @@ ../../include;../../plugins/ExternalAPI;%(AdditionalIncludeDirectories) - kernel32.lib $(OutDir)XFire.dll true Windows @@ -162,6 +161,7 @@ MachineX86 $(ProfileDir)..\..\bin11\lib /PDBALTPATH:%_PDB% %(AdditionalOptions) + Iphlpapi.lib;%(AdditionalDependencies) ..\..\include\msapi @@ -186,7 +186,6 @@ ../../include;../../plugins/ExternalAPI;%(AdditionalIncludeDirectories) - kernel32.lib $(OutDir)XFire.dll true Windows @@ -197,6 +196,7 @@ $(IntDir)$(TargetName).lib $(ProfileDir)..\..\bin11\lib /PDBALTPATH:%_PDB% %(AdditionalOptions) + Iphlpapi.lib;%(AdditionalDependencies) ..\..\include\msapi -- cgit v1.2.3