From f34c2e508eeaba527009e2b86bf6ef7a09a496bb Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 26 Sep 2013 18:36:45 +0000 Subject: plugins cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@6243 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../StatusPlugins/KeepStatus/KeepStatus_10.vcxproj | 8 +++---- .../StatusPlugins/KeepStatus/KeepStatus_11.vcxproj | 8 +++---- plugins/StatusPlugins/KeepStatus/keepstatus.cpp | 24 +++----------------- plugins/StatusPlugins/KeepStatus/keepstatus.h | 2 ++ plugins/StatusPlugins/StartupStatus/options.cpp | 26 +--------------------- 5 files changed, 14 insertions(+), 54 deletions(-) (limited to 'plugins/StatusPlugins') diff --git a/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj b/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj index 0ae73ed1d0..8923d4a812 100644 --- a/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj +++ b/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj @@ -88,7 +88,7 @@ ..\..\..\include\msapi - ws2_32.lib;wininet.lib;UxTheme.lib;%(AdditionalDependencies) + ws2_32.lib;wininet.lib;UxTheme.lib;Iphlpapi.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib @@ -120,7 +120,7 @@ ..\..\..\include\msapi - ws2_32.lib;wininet.lib;UxTheme.lib;%(AdditionalDependencies) + ws2_32.lib;wininet.lib;UxTheme.lib;Iphlpapi.lib;%(AdditionalDependencies) true true true @@ -155,7 +155,7 @@ true - ws2_32.lib;wininet.lib;UxTheme.lib;%(AdditionalDependencies) + ws2_32.lib;wininet.lib;UxTheme.lib;Iphlpapi.lib;%(AdditionalDependencies) true $(IntDir)$(TargetName).lib Windows @@ -183,7 +183,7 @@ false - ws2_32.lib;wininet.lib;UxTheme.lib;%(AdditionalDependencies) + ws2_32.lib;wininet.lib;UxTheme.lib;Iphlpapi.lib;%(AdditionalDependencies) true $(IntDir)$(TargetName).lib Windows diff --git a/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj b/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj index bd4aa6fec1..a14674c4d1 100644 --- a/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj +++ b/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj @@ -92,7 +92,7 @@ ..\..\..\include\msapi - ws2_32.lib;wininet.lib;UxTheme.lib;%(AdditionalDependencies) + ws2_32.lib;wininet.lib;UxTheme.lib;Iphlpapi.lib;%(AdditionalDependencies) true false $(IntDir)$(TargetName).lib @@ -125,7 +125,7 @@ ..\..\..\include\msapi - ws2_32.lib;wininet.lib;UxTheme.lib;%(AdditionalDependencies) + ws2_32.lib;wininet.lib;UxTheme.lib;Iphlpapi.lib;%(AdditionalDependencies) true true true @@ -159,7 +159,7 @@ true - ws2_32.lib;wininet.lib;UxTheme.lib;%(AdditionalDependencies) + ws2_32.lib;wininet.lib;UxTheme.lib;Iphlpapi.lib;%(AdditionalDependencies) true $(IntDir)$(TargetName).lib Windows @@ -186,7 +186,7 @@ false - ws2_32.lib;wininet.lib;UxTheme.lib;%(AdditionalDependencies) + ws2_32.lib;wininet.lib;UxTheme.lib;Iphlpapi.lib;%(AdditionalDependencies) true $(IntDir)$(TargetName).lib Windows diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 743e664a1c..5e9ad4e953 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -55,7 +55,6 @@ static UINT_PTR checkContinTimerId = 0; static UINT_PTR checkConnectingTimerId = 0; static int retryCount = 0; static BOOL bLastPingResult = TRUE; -static HMODULE hICMP = NULL; // variables (options) static int maxRetries = 0; static int initDelay = 0; @@ -121,7 +120,6 @@ int LoadMainOptions() if (IsWindow(hMessageWindow)) DestroyWindow(hMessageWindow); if (StartTimer(IDT_CHECKCONTIN, -1, FALSE)) { - FreeLibrary(hICMP); WSACleanup(); } StopTimer(IDT_CHECKCONN|IDT_PROCESSACK|IDT_AFTERCHECK|IDT_CHECKCONTIN|IDT_CHECKCONNECTING); @@ -132,12 +130,7 @@ int LoadMainOptions() if ( db_get_b(NULL, MODULENAME, SETTING_CONTCHECK, FALSE)) { if ( db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE)) { WSADATA wsaData; - WSAStartup(MAKEWORD(2, 2), &wsaData); - hICMP = LoadLibraryA("ICMP.DLL"); - if (hICMP == NULL) { - log_infoA("KeepStatus: icmp.dll not found, ping disabled"); - } } StartTimer(IDT_CHECKCONTIN, 0, FALSE); } @@ -768,10 +761,6 @@ static VOID CALLBACK AfterCheckTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWO StopChecking(); } -typedef HANDLE ( WINAPI *pfnIcmpCreateFile )( void ); -typedef BOOL ( WINAPI *pfnIcmpCloseHandle )( HANDLE ); -typedef DWORD ( WINAPI *pfnIcmpSendEcho )( HANDLE, DWORD, int, int, void*, char*, int, int ); - static void CheckContinueslyFunction(void *arg) { static int pingFailures = 0; @@ -815,14 +804,7 @@ static void CheckContinueslyFunction(void *arg) char reply[sizeof(ICMP_ECHO_REPLY)+8]; bLastPingResult = FALSE; - pfnIcmpCreateFile lpfnIcmpCreateFile = (pfnIcmpCreateFile)GetProcAddress(hICMP,"IcmpCreateFile"); - pfnIcmpCloseHandle lpfnIcmpCloseHandle = (pfnIcmpCloseHandle)GetProcAddress(hICMP,"IcmpCloseHandle"); - pfnIcmpSendEcho lpfnIcmpSendEcho = (pfnIcmpSendEcho)GetProcAddress(hICMP,"IcmpSendEcho"); - if ((hICMP == NULL) || (lpfnIcmpCreateFile == NULL) || (lpfnIcmpCloseHandle == NULL) || (lpfnIcmpSendEcho == NULL)) { - bLastPingResult = TRUE; - log_infoA("KeepStatus: icmp.dll error (1)"); - } - HANDLE hICMPFile = (HANDLE) lpfnIcmpCreateFile(); + HANDLE hICMPFile = (HANDLE)IcmpCreateFile(); if (hICMPFile == INVALID_HANDLE_VALUE) { bLastPingResult = TRUE; log_infoA("KeepStatus: icmp.dll error (2)"); @@ -838,7 +820,7 @@ static void CheckContinueslyFunction(void *arg) hostent = gethostbyname(host); if (hostent != NULL) { addr = (DWORD *)( *hostent->h_addr_list ); - bLastPingResult = (lpfnIcmpSendEcho(hICMPFile, *addr, 0,0,NULL, reply,sizeof(ICMP_ECHO_REPLY)+8,5000) != 0); + bLastPingResult = (IcmpSendEcho(hICMPFile, *addr, 0,0,NULL, reply,sizeof(ICMP_ECHO_REPLY)+8,5000) != 0); if (bLastPingResult) pingFailures = 0; @@ -854,7 +836,7 @@ static void CheckContinueslyFunction(void *arg) start++; } } - lpfnIcmpCloseHandle(hICMPFile); + IcmpCloseHandle(hICMPFile); } db_free(&dbv); } diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.h b/plugins/StatusPlugins/KeepStatus/keepstatus.h index 2bb79a2f22..0bcadaa66a 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.h +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.h @@ -24,6 +24,8 @@ #include #include #include +#include + #include #include #include diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index c2ecff2710..63394872ca 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -29,7 +29,6 @@ INT_PTR CALLBACK CmdlOptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l INT_PTR CALLBACK OptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam); INT_PTR CALLBACK addProfileDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam); -BOOL MyGetSpecialFolderPath(HWND hwndOwner, LPTSTR lpszPath, int nFolder, BOOL fCreate); static int CountSettings(const char *szSetting,LPARAM lParam); static int DeleteSetting(const char *szSetting,LPARAM lParam); static int ClearDatabase(char* filter); @@ -173,7 +172,7 @@ HRESULT CreateLink(TSettingsList& protoSettings) char *args = GetCMDLArguments(protoSettings); char *desc = GetLinkDescription(protoSettings); - if (MyGetSpecialFolderPath(NULL, savePath, 0x10, FALSE)) + if (SHGetSpecialFolderPath(NULL, savePath, 0x10, FALSE)) _tcscat(savePath, _T(SHORTCUT_FILENAME)); else mir_sntprintf(savePath, SIZEOF(savePath), _T(".\\%s"), _T(SHORTCUT_FILENAME)); @@ -925,29 +924,6 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) return 0; } -// from: http://www.codeproject.com/winhelp/msdnintegrator/ - - static const CHAR _szSpecialFolderPath[] = "SHGetSpecialFolderPathW"; - -BOOL MyGetSpecialFolderPath(HWND hwndOwner, LPTSTR lpszPath, int nFolder, BOOL fCreate) -{ - typedef int (WINAPI* _SHGET)(HWND, LPTSTR, int, BOOL); - - // Get a function pointer to SHGetSpecialFolderPath(...) from - // Shell32.dll, if this returns NULL then check ShFolder.dll... - _SHGET pfn = (_SHGET)GetProcAddress( LoadLibraryA( "Shell32.dll" ), _szSpecialFolderPath); - if (pfn == NULL) { - // Try to get the function pointer from ShFolder.dll, if pfn is still - // NULL then we have bigger problems... - pfn = (_SHGET)GetProcAddress( LoadLibraryA("ShFolder.dll"), _szSpecialFolderPath); - if (pfn == NULL) - return FALSE; - } - - return pfn(hwndOwner, lpszPath, nFolder, fCreate); -} - -// end: from: http://www.codeproject.com/winhelp/msdnintegrator/ static int ClearDatabase(char* filter) { DBCONTACTENUMSETTINGS dbces; -- cgit v1.2.3