From fffcd98b6f25af8d7a7895302e3b1ff64344d526 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Sun, 26 Jul 2015 11:49:19 +0000 Subject: Ping: common project git-svn-id: http://svn.miranda-ng.org/main/trunk@14723 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Ping/ping.vcxproj | 33 +++++ plugins/Ping/ping.vcxproj.filters | 4 + plugins/Ping/ping_10.vcxproj | 225 ---------------------------------- plugins/Ping/ping_10.vcxproj.filters | 101 --------------- plugins/Ping/ping_12.vcxproj | 230 ----------------------------------- plugins/Ping/ping_12.vcxproj.filters | 101 --------------- plugins/Ping/ping_14.vcxproj | 230 ----------------------------------- plugins/Ping/ping_14.vcxproj.filters | 101 --------------- plugins/Ping/src/common.h | 137 --------------------- plugins/Ping/src/icmp.cpp | 2 +- plugins/Ping/src/log.cpp | 2 +- plugins/Ping/src/menu.cpp | 2 +- plugins/Ping/src/options.cpp | 4 +- plugins/Ping/src/ping.cpp | 8 +- plugins/Ping/src/pinggraph.cpp | 2 +- plugins/Ping/src/pinglist.cpp | 12 +- plugins/Ping/src/pingthread.cpp | 16 +-- plugins/Ping/src/rawping.cpp | 2 +- plugins/Ping/src/stdafx.cpp | 18 --- plugins/Ping/src/stdafx.cxx | 18 +++ plugins/Ping/src/stdafx.h | 131 ++++++++++++++++++++ plugins/Ping/src/utils.cpp | 12 +- 22 files changed, 217 insertions(+), 1174 deletions(-) create mode 100644 plugins/Ping/ping.vcxproj create mode 100644 plugins/Ping/ping.vcxproj.filters delete mode 100644 plugins/Ping/ping_10.vcxproj delete mode 100644 plugins/Ping/ping_10.vcxproj.filters delete mode 100644 plugins/Ping/ping_12.vcxproj delete mode 100644 plugins/Ping/ping_12.vcxproj.filters delete mode 100644 plugins/Ping/ping_14.vcxproj delete mode 100644 plugins/Ping/ping_14.vcxproj.filters delete mode 100644 plugins/Ping/src/common.h delete mode 100644 plugins/Ping/src/stdafx.cpp create mode 100644 plugins/Ping/src/stdafx.cxx create mode 100644 plugins/Ping/src/stdafx.h (limited to 'plugins/Ping') diff --git a/plugins/Ping/ping.vcxproj b/plugins/Ping/ping.vcxproj new file mode 100644 index 0000000000..63d8260a15 --- /dev/null +++ b/plugins/Ping/ping.vcxproj @@ -0,0 +1,33 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + Ping + {F31BD1B6-EE9D-4F76-A047-F8AEADC26086} + + + + + + + Sync + + + \ No newline at end of file diff --git a/plugins/Ping/ping.vcxproj.filters b/plugins/Ping/ping.vcxproj.filters new file mode 100644 index 0000000000..de5ad9f66c --- /dev/null +++ b/plugins/Ping/ping.vcxproj.filters @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/plugins/Ping/ping_10.vcxproj b/plugins/Ping/ping_10.vcxproj deleted file mode 100644 index eca2eafbe9..0000000000 --- a/plugins/Ping/ping_10.vcxproj +++ /dev/null @@ -1,225 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - Ping - {F31BD1B6-EE9D-4F76-A047-F8AEADC26086} - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Use - common.h - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin10\lib - Windows - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - - - - - Full - OnlyExplicitInline - Size - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - true - Use - common.h - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - true - true - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin10\lib - /PDBALTPATH:%_PDB% %(AdditionalOptions) - Windows - - - - - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - EnableFastChecks - Use - common.h - Level3 - MultiThreadedDebugDLL - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin10\lib - Windows - - - - - Full - OnlyExplicitInline - Size - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - false - true - Use - common.h - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - true - true - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin10\lib - /PDBALTPATH:%_PDB% %(AdditionalOptions) - Windows - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - - - - - - - \ No newline at end of file diff --git a/plugins/Ping/ping_10.vcxproj.filters b/plugins/Ping/ping_10.vcxproj.filters deleted file mode 100644 index d20de68fd7..0000000000 --- a/plugins/Ping/ping_10.vcxproj.filters +++ /dev/null @@ -1,101 +0,0 @@ - - - - - {ee28df87-65f4-4762-acba-155d7607d5ab} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {c454feba-dfe0-4f93-ba62-c6b5b8fc96b7} - h;hpp;hxx;hm;inl - - - {392f6369-40fa-4873-974f-0a09e3ad62f0} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - - - Resource Files - - - Resource Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/plugins/Ping/ping_12.vcxproj b/plugins/Ping/ping_12.vcxproj deleted file mode 100644 index 6ab6d0c8e4..0000000000 --- a/plugins/Ping/ping_12.vcxproj +++ /dev/null @@ -1,230 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - Ping - {F31BD1B6-EE9D-4F76-A047-F8AEADC26086} - - - - DynamicLibrary - Unicode - true - v120_xp - - - DynamicLibrary - Unicode - v120_xp - - - DynamicLibrary - Unicode - true - v120_xp - - - DynamicLibrary - Unicode - v120_xp - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Use - common.h - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin12\lib - Windows - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - false - - - - - Full - OnlyExplicitInline - Size - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - true - Use - common.h - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - true - true - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin12\lib - /PDBALTPATH:%_PDB% %(AdditionalOptions) - Windows - - - - - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - EnableFastChecks - Use - common.h - Level3 - MultiThreadedDebugDLL - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin12\lib - Windows - - - - - Full - OnlyExplicitInline - Size - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - false - true - Use - common.h - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - true - true - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin12\lib - /PDBALTPATH:%_PDB% %(AdditionalOptions) - Windows - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - - - - - - - \ No newline at end of file diff --git a/plugins/Ping/ping_12.vcxproj.filters b/plugins/Ping/ping_12.vcxproj.filters deleted file mode 100644 index d20de68fd7..0000000000 --- a/plugins/Ping/ping_12.vcxproj.filters +++ /dev/null @@ -1,101 +0,0 @@ - - - - - {ee28df87-65f4-4762-acba-155d7607d5ab} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {c454feba-dfe0-4f93-ba62-c6b5b8fc96b7} - h;hpp;hxx;hm;inl - - - {392f6369-40fa-4873-974f-0a09e3ad62f0} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - - - Resource Files - - - Resource Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/plugins/Ping/ping_14.vcxproj b/plugins/Ping/ping_14.vcxproj deleted file mode 100644 index 3cf01370e9..0000000000 --- a/plugins/Ping/ping_14.vcxproj +++ /dev/null @@ -1,230 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - Ping - {F31BD1B6-EE9D-4F76-A047-F8AEADC26086} - - - - DynamicLibrary - Unicode - true - v140_xp - - - DynamicLibrary - Unicode - v140_xp - - - DynamicLibrary - Unicode - true - v140_xp - - - DynamicLibrary - Unicode - v140_xp - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Use - common.h - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin14\lib - Windows - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - false - - - - - Full - OnlyExplicitInline - Size - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - true - Use - common.h - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - true - true - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin14\lib - /PDBALTPATH:%_PDB% %(AdditionalOptions) - Windows - - - - - Disabled - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - EnableFastChecks - Use - common.h - Level3 - MultiThreadedDebugDLL - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin14\lib - Windows - - - - - Full - OnlyExplicitInline - Size - true - ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - false - true - Use - common.h - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) - true - true - true - 0x22040000 - false - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin14\lib - /PDBALTPATH:%_PDB% %(AdditionalOptions) - Windows - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - - - - - - - \ No newline at end of file diff --git a/plugins/Ping/ping_14.vcxproj.filters b/plugins/Ping/ping_14.vcxproj.filters deleted file mode 100644 index d20de68fd7..0000000000 --- a/plugins/Ping/ping_14.vcxproj.filters +++ /dev/null @@ -1,101 +0,0 @@ - - - - - {ee28df87-65f4-4762-acba-155d7607d5ab} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {c454feba-dfe0-4f93-ba62-c6b5b8fc96b7} - h;hpp;hxx;hm;inl - - - {392f6369-40fa-4873-974f-0a09e3ad62f0} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - - - Resource Files - - - Resource Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/plugins/Ping/src/common.h b/plugins/Ping/src/common.h deleted file mode 100644 index 0329e3491e..0000000000 --- a/plugins/Ping/src/common.h +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef _COMMON_H -#define _COMMON_H - -#define _CRT_SECURE_NO_DEPRECATE -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "resource.h" -#include "collection.h" -#include "Version.h" -#include "icmp.h" -#include "log.h" -#include "menu.h" -#include "pinggraph.h" -#include "pinglist.h" -#include "pingthread.h" -#include "rawping.h" -#include "utils.h" - -#define MAX_HISTORY (1440) // 12 hrs at 30 sec intervals - -#define PLUG "PING" - -#define DEFAULT_PING_PERIOD 30 -#define DEFAULT_PING_TIMEOUT 2 -#define DEFAULT_SHOW_POPUP true -#define DEFAULT_SHOW_POPUP2 false -#define DEFAULT_BLOCK_REPS true -#define DEFAULT_LOGGING_ENABLED false -#define DEFAULT_LOG_FILENAME _T("ping_log.txt") -#define DEFAULT_NO_TEST_ICON true -#define DEFAULT_ATTACH_TO_CLIST false - -#define MAX_PINGADDRESS_STRING_LENGTH 256 - - -typedef struct { - int ping_period, ping_timeout; - bool show_popup, show_popup2, block_reps, logging; - TCHAR log_filename[MAX_PATH]; - bool no_test_icon; - int row_height; - int indent; - int retries; - bool attach_to_clist; - bool log_csv; -} PingOptions; - -// a deque of pairs - ping time and timestamp -struct HistPair { - short first; - time_t second; - - const bool operator==(const HistPair &other) const { return first == other.first && second == other.second; } -}; -typedef LinkedList< HistPair > HistoryList; - - -#define PS_RESPONDING 1 -#define PS_NOTRESPONDING 2 -#define PS_TESTING 3 -#define PS_DISABLED 4 - -struct PINGADDRESS { - int cbSize; //size in bytes of this structure - DWORD item_id; - TCHAR pszName[MAX_PINGADDRESS_STRING_LENGTH]; //IP address or domain name - TCHAR pszLabel[MAX_PINGADDRESS_STRING_LENGTH]; - bool responding; - int status; - short round_trip_time; - int miss_count; - int port; // -1 for ICMP, non-zero for TCP - char pszProto[MAX_PINGADDRESS_STRING_LENGTH]; - TCHAR pszCommand[MAX_PATH]; - TCHAR pszParams[MAX_PATH]; - unsigned int get_status; // on success, if status equals this - unsigned int set_status; // set it to this - int index; - - const bool operator==(const PINGADDRESS &b) const; - const bool operator<(const PINGADDRESS &b) const; -}; - -#include "options.h" -typedef Map HistoryMap; -typedef std::list PINGLIST; -typedef std::list::iterator pinglist_it; - - -extern HANDLE hNetlibUser; -extern HINSTANCE hInst; - -extern bool use_raw_ping; - -// wake event for ping thread -extern HANDLE hWakeEvent; - -extern PingOptions options; -extern PINGADDRESS add_edit_addr; -extern HistoryMap history_map; -extern PINGLIST list_items; -extern HANDLE reload_event_handle; -extern mir_cs list_cs; -extern HANDLE mainThread; -extern HANDLE hWakeEvent; -extern mir_cs thread_finished_cs, list_changed_cs, data_list_cs; - -extern PINGLIST data_list; - -int ReloadIcons(WPARAM, LPARAM); - -#endif diff --git a/plugins/Ping/src/icmp.cpp b/plugins/Ping/src/icmp.cpp index 88d7dfcf87..c8b8fbdb21 100644 --- a/plugins/Ping/src/icmp.cpp +++ b/plugins/Ping/src/icmp.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" char data[] = "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHH"; ICMP *ICMP::instance = 0; diff --git a/plugins/Ping/src/log.cpp b/plugins/Ping/src/log.cpp index c6cc40a66f..cce8d2e61c 100644 --- a/plugins/Ping/src/log.cpp +++ b/plugins/Ping/src/log.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" INT_PTR Log(WPARAM wParam, LPARAM) { diff --git a/plugins/Ping/src/menu.cpp b/plugins/Ping/src/menu.cpp index ad5a466e62..dfbf76cbaa 100644 --- a/plugins/Ping/src/menu.cpp +++ b/plugins/Ping/src/menu.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" HANDLE hMenuDisable, hMenuGraph, hMenuEdit; HANDLE hEventMenuBuild; diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp index ad5d93ee68..467bd008bb 100644 --- a/plugins/Ping/src/options.cpp +++ b/plugins/Ping/src/options.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" PingOptions options; @@ -164,7 +164,7 @@ PINGLIST temp_list; PINGADDRESS add_edit_addr; // host edit -INT_PTR CALLBACK DlgProcDestEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { +INT_PTR CALLBACK DlgProcDestEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp index 261b959ada..c179d52a12 100644 --- a/plugins/Ping/src/ping.cpp +++ b/plugins/Ping/src/ping.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" CLIST_INTERFACE *pcli; HINSTANCE hInst; @@ -24,13 +24,13 @@ PLUGININFOEX pluginInfo = { { 0x760ea901, 0xc0c2, 0x446c, { 0x80, 0x29, 0x94, 0xc3, 0xbc, 0x47, 0xc4, 0x5e } } }; -extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) { hInst = hinstDLL; return TRUE; } -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; } @@ -66,7 +66,7 @@ void CreatePluginServices() } -int OnShutdown(WPARAM wParam, LPARAM lParam) { +int OnShutdown(WPARAM, LPARAM) { graphs_cleanup(); UnhookEvent(hFillListEvent); diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp index 8e0b7d0846..00e0402f53 100644 --- a/plugins/Ping/src/pinggraph.cpp +++ b/plugins/Ping/src/pinggraph.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" HistoryMap history_map; diff --git a/plugins/Ping/src/pinglist.cpp b/plugins/Ping/src/pinglist.cpp index 51aa6f73a3..c08d279610 100644 --- a/plugins/Ping/src/pinglist.cpp +++ b/plugins/Ping/src/pinglist.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" PINGLIST list_items; mir_cs list_cs; @@ -183,7 +183,7 @@ void read_ping_addresses() } -INT_PTR LoadPingList(WPARAM wParam, LPARAM lParam) +INT_PTR LoadPingList(WPARAM, LPARAM) { mir_cslock lck(list_cs); read_ping_addresses(); @@ -193,7 +193,7 @@ INT_PTR LoadPingList(WPARAM wParam, LPARAM lParam) // wParam is zero // lParam is zero -INT_PTR SavePingList(WPARAM wParam, LPARAM lParam) +INT_PTR SavePingList(WPARAM, LPARAM) { mir_cslock lck(list_cs); write_ping_addresses(); @@ -203,7 +203,7 @@ INT_PTR SavePingList(WPARAM wParam, LPARAM lParam) // wParam is address of a PINGLIST structure to replace the current one // lParam is zero -INT_PTR SetPingList(WPARAM wParam, LPARAM lParam) +INT_PTR SetPingList(WPARAM wParam, LPARAM) { PINGLIST *pli = (PINGLIST *)wParam; @@ -216,7 +216,7 @@ INT_PTR SetPingList(WPARAM wParam, LPARAM lParam) // wParam is address of a PINGLIST structure to replace the current one // lParam is zero -INT_PTR SetAndSavePingList(WPARAM wParam, LPARAM lParam) +INT_PTR SetAndSavePingList(WPARAM wParam, LPARAM) { PINGLIST *pli = (PINGLIST *)wParam; @@ -231,7 +231,7 @@ INT_PTR SetAndSavePingList(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR ClearPingList(WPARAM wParam, LPARAM lParam) +INT_PTR ClearPingList(WPARAM, LPARAM) { mir_cslock lck(list_cs); list_items.clear(); diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 859383a892..c9b6e87421 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" int upCount, total = 0; @@ -75,7 +75,7 @@ void SetProtoStatus(TCHAR *pszLabel, char *pszProto, int if_status, int new_stat } } -void __cdecl sttCheckStatusThreadProc(void *vp) +void __cdecl sttCheckStatusThreadProc(void*) { clock_t start_t = clock(), end_t; while (!get_thread_finished()) @@ -258,7 +258,7 @@ bool FrameIsFloating() { return (CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLOATING, frame_id), 0) != 0); } -int FillList(WPARAM wParam, LPARAM lParam) { +int FillList(WPARAM, LPARAM) { if (options.logging) CallService(PLUG "/Log", (WPARAM)_T("ping address list reload"), 0); @@ -293,7 +293,7 @@ int FillList(WPARAM wParam, LPARAM lParam) { return 0; } -INT_PTR PingPlugShowWindow(WPARAM wParam, LPARAM lParam) +INT_PTR PingPlugShowWindow(WPARAM, LPARAM) { if (hpwnd) { @@ -307,10 +307,10 @@ INT_PTR PingPlugShowWindow(WPARAM wParam, LPARAM lParam) #define TIMER_ID 11042 void CALLBACK TimerProc( - HWND hwnd, // handle to window - UINT uMsg, // WM_TIMER message - UINT_PTR idEvent, // timer identifier - DWORD dwTime // current system time + HWND , // handle to window + UINT, // WM_TIMER message + UINT_PTR, // timer identifier + DWORD // current system time ) { if (frame_id != -1 && ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) diff --git a/plugins/Ping/src/rawping.cpp b/plugins/Ping/src/rawping.cpp index aad13b220e..2382aa9030 100644 --- a/plugins/Ping/src/rawping.cpp +++ b/plugins/Ping/src/rawping.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" USHORT ip_checksum(USHORT* buffer, int size) { diff --git a/plugins/Ping/src/stdafx.cpp b/plugins/Ping/src/stdafx.cpp deleted file mode 100644 index c5fe5abaad..0000000000 --- a/plugins/Ping/src/stdafx.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "common.h" \ No newline at end of file diff --git a/plugins/Ping/src/stdafx.cxx b/plugins/Ping/src/stdafx.cxx new file mode 100644 index 0000000000..6fb37564b7 --- /dev/null +++ b/plugins/Ping/src/stdafx.cxx @@ -0,0 +1,18 @@ +/* +Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation version 2 +of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include "stdafx.h" \ No newline at end of file diff --git a/plugins/Ping/src/stdafx.h b/plugins/Ping/src/stdafx.h new file mode 100644 index 0000000000..bfa39fbd0c --- /dev/null +++ b/plugins/Ping/src/stdafx.h @@ -0,0 +1,131 @@ +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "resource.h" +#include "collection.h" +#include "Version.h" +#include "icmp.h" +#include "log.h" +#include "menu.h" +#include "pinggraph.h" +#include "pinglist.h" +#include "pingthread.h" +#include "rawping.h" +#include "utils.h" + +#define MAX_HISTORY (1440) // 12 hrs at 30 sec intervals + +#define PLUG "PING" + +#define DEFAULT_PING_PERIOD 30 +#define DEFAULT_PING_TIMEOUT 2 +#define DEFAULT_SHOW_POPUP true +#define DEFAULT_SHOW_POPUP2 false +#define DEFAULT_BLOCK_REPS true +#define DEFAULT_LOGGING_ENABLED false +#define DEFAULT_LOG_FILENAME _T("ping_log.txt") +#define DEFAULT_NO_TEST_ICON true +#define DEFAULT_ATTACH_TO_CLIST false + +#define MAX_PINGADDRESS_STRING_LENGTH 256 + + +typedef struct { + int ping_period, ping_timeout; + bool show_popup, show_popup2, block_reps, logging; + TCHAR log_filename[MAX_PATH]; + bool no_test_icon; + int row_height; + int indent; + int retries; + bool attach_to_clist; + bool log_csv; +} PingOptions; + +// a deque of pairs - ping time and timestamp +struct HistPair { + short first; + time_t second; + + const bool operator==(const HistPair &other) const { return first == other.first && second == other.second; } +}; +typedef LinkedList< HistPair > HistoryList; + + +#define PS_RESPONDING 1 +#define PS_NOTRESPONDING 2 +#define PS_TESTING 3 +#define PS_DISABLED 4 + +struct PINGADDRESS { + int cbSize; //size in bytes of this structure + DWORD item_id; + TCHAR pszName[MAX_PINGADDRESS_STRING_LENGTH]; //IP address or domain name + TCHAR pszLabel[MAX_PINGADDRESS_STRING_LENGTH]; + bool responding; + int status; + short round_trip_time; + int miss_count; + int port; // -1 for ICMP, non-zero for TCP + char pszProto[MAX_PINGADDRESS_STRING_LENGTH]; + TCHAR pszCommand[MAX_PATH]; + TCHAR pszParams[MAX_PATH]; + unsigned int get_status; // on success, if status equals this + unsigned int set_status; // set it to this + int index; + + const bool operator==(const PINGADDRESS &b) const; + const bool operator<(const PINGADDRESS &b) const; +}; + +#include "options.h" +typedef Map HistoryMap; +typedef std::list PINGLIST; +typedef std::list::iterator pinglist_it; + + +extern HANDLE hNetlibUser; +extern HINSTANCE hInst; + +extern bool use_raw_ping; + +// wake event for ping thread +extern HANDLE hWakeEvent; + +extern PingOptions options; +extern PINGADDRESS add_edit_addr; +extern HistoryMap history_map; +extern PINGLIST list_items; +extern HANDLE reload_event_handle; +extern mir_cs list_cs; +extern HANDLE mainThread; +extern HANDLE hWakeEvent; +extern mir_cs thread_finished_cs, list_changed_cs, data_list_cs; + +extern PINGLIST data_list; + +int ReloadIcons(WPARAM, LPARAM); diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index 3040e69270..5421275577 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "stdafx.h" LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { @@ -134,7 +134,7 @@ INT_PTR PluginPing(WPARAM, LPARAM lParam) return 0; } -INT_PTR PingDisableAll(WPARAM wParam, LPARAM lParam) { +INT_PTR PingDisableAll(WPARAM, LPARAM) { PINGLIST pl; CallService(PLUG "/GetPingList", 0, (LPARAM)&pl); for (pinglist_it i = pl.begin(); i != pl.end(); ++i) { @@ -145,7 +145,7 @@ INT_PTR PingDisableAll(WPARAM wParam, LPARAM lParam) { return 0; } -INT_PTR PingEnableAll(WPARAM wParam, LPARAM lParam) { +INT_PTR PingEnableAll(WPARAM, LPARAM) { PINGLIST pl; CallService(PLUG "/GetPingList", 0, (LPARAM)&pl); for (pinglist_it i = pl.begin(); i != pl.end(); ++i) { @@ -158,7 +158,7 @@ INT_PTR PingEnableAll(WPARAM wParam, LPARAM lParam) { } -INT_PTR ToggleEnabled(WPARAM wParam, LPARAM lParam) { +INT_PTR ToggleEnabled(WPARAM wParam, LPARAM) { int retval = 0; PINGLIST pl; CallService(PLUG "/GetPingList", 0, (LPARAM)&pl); @@ -178,7 +178,7 @@ INT_PTR ToggleEnabled(WPARAM wParam, LPARAM lParam) { return 0; } -INT_PTR EditContact(WPARAM wParam, LPARAM lParam) +INT_PTR EditContact(WPARAM wParam, LPARAM) { PINGLIST pl; HWND hwndList = pcli->hwndContactList; @@ -200,7 +200,7 @@ INT_PTR EditContact(WPARAM wParam, LPARAM lParam) return 1; } -INT_PTR DblClick(WPARAM wParam, LPARAM lParam) { +INT_PTR DblClick(WPARAM wParam, LPARAM) { PINGLIST pl; CallService(PLUG "/GetPingList", 0, (LPARAM)&pl); for (pinglist_it i = pl.begin(); i != pl.end(); ++i) { -- cgit v1.2.3