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/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 ++++---- 7 files changed, 19 insertions(+), 77 deletions(-) (limited to 'protocols/Xfire') 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