From 85e59b5583ee0da9997075eaa344152823459bbe Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 2 Feb 2012 07:39:14 +0000 Subject: [PATCH] New plugin API: Added rm parameter to Initialize. --- Library/MeasurePlugin.cpp | 2 +- Library/MeasurePlugin.h | 2 +- Plugins/PluginCoreTemp/PluginCoreTemp.cpp | 2 +- Plugins/PluginNowPlaying/NowPlaying.cpp | 2 +- Plugins/PluginPing/Ping.cpp | 2 +- Plugins/PluginPower/PowerPlugin.cpp | 2 +- Plugins/PluginProcess/PluginProcess.cpp | 9 ++++++++- Plugins/PluginQuote/Quote.cpp | 2 +- Plugins/PluginRecycleManager/RecycleManager.cpp | 2 +- Plugins/PluginResMon/ResMon.cpp | 2 +- Plugins/PluginSpeedFan/SpeedFanPlugin.cpp | 2 +- Plugins/PluginWindowMessage/WindowMessagePlugin.cpp | 2 +- 12 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Library/MeasurePlugin.cpp b/Library/MeasurePlugin.cpp index 08ec8201..aef5ab99 100644 --- a/Library/MeasurePlugin.cpp +++ b/Library/MeasurePlugin.cpp @@ -180,7 +180,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section) if (initializeFunc) { - ((NEWINITIALIZE)initializeFunc)(&m_PluginData); + ((NEWINITIALIZE)initializeFunc)(&m_PluginData, this); } ((NEWRELOAD)m_ReloadFunc)(m_PluginData, this, &m_MaxValue); diff --git a/Library/MeasurePlugin.h b/Library/MeasurePlugin.h index efc79dd3..51a8554b 100644 --- a/Library/MeasurePlugin.h +++ b/Library/MeasurePlugin.h @@ -29,7 +29,7 @@ typedef double (*UPDATE2)(UINT); typedef LPCTSTR (*GETSTRING)(UINT, UINT); typedef void (*EXECUTEBANG)(LPCWSTR, UINT); -typedef void (*NEWINITIALIZE)(void*); +typedef void (*NEWINITIALIZE)(void*, void*); typedef void (*NEWRELOAD)(void*, void*, double*); typedef void (*NEWFINALIZE)(void*); typedef double (*NEWUPDATE)(void*); diff --git a/Plugins/PluginCoreTemp/PluginCoreTemp.cpp b/Plugins/PluginCoreTemp/PluginCoreTemp.cpp index 010e39eb..41f139af 100644 --- a/Plugins/PluginCoreTemp/PluginCoreTemp.cpp +++ b/Plugins/PluginCoreTemp/PluginCoreTemp.cpp @@ -49,7 +49,7 @@ eMeasureType convertStringToMeasureType(LPCWSTR i_String); bool areStringsEqual(LPCWSTR i_String1, LPCWSTR i_Strting2); float getHighestTemp(); -PLUGIN_EXPORT void Initialize(void** data) +PLUGIN_EXPORT void Initialize(void** data, void* rm) { MeasureData* measure = new MeasureData; *data = measure; diff --git a/Plugins/PluginNowPlaying/NowPlaying.cpp b/Plugins/PluginNowPlaying/NowPlaying.cpp index 49a083e6..879f9ad9 100644 --- a/Plugins/PluginNowPlaying/NowPlaying.cpp +++ b/Plugins/PluginNowPlaying/NowPlaying.cpp @@ -47,7 +47,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } -PLUGIN_EXPORT void Initialize(void** data) +PLUGIN_EXPORT void Initialize(void** data, void* rm) { Measure* measure = new Measure; *data = measure; diff --git a/Plugins/PluginPing/Ping.cpp b/Plugins/PluginPing/Ping.cpp index afeefba5..e5e56c5c 100644 --- a/Plugins/PluginPing/Ping.cpp +++ b/Plugins/PluginPing/Ping.cpp @@ -48,7 +48,7 @@ struct MeasureData static CRITICAL_SECTION g_CriticalSection; static UINT g_Instances = 0; -PLUGIN_EXPORT void Initialize(void** data) +PLUGIN_EXPORT void Initialize(void** data, void* rm) { MeasureData* measure = new MeasureData; *data = measure; diff --git a/Plugins/PluginPower/PowerPlugin.cpp b/Plugins/PluginPower/PowerPlugin.cpp index 8e91eca5..63d9fa5d 100644 --- a/Plugins/PluginPower/PowerPlugin.cpp +++ b/Plugins/PluginPower/PowerPlugin.cpp @@ -62,7 +62,7 @@ void NullCRTInvalidParameterHandler(const wchar_t* expression, const wchar_t* fu // Do nothing. } -PLUGIN_EXPORT void Initialize(void** data) +PLUGIN_EXPORT void Initialize(void** data, void* rm) { MeasureData* measure = new MeasureData; *data = measure; diff --git a/Plugins/PluginProcess/PluginProcess.cpp b/Plugins/PluginProcess/PluginProcess.cpp index 572b7260..b6898021 100644 --- a/Plugins/PluginProcess/PluginProcess.cpp +++ b/Plugins/PluginProcess/PluginProcess.cpp @@ -37,7 +37,7 @@ static std::vector g_Measures; void CheckProcesses(); -PLUGIN_EXPORT void Initialize(void** data) +PLUGIN_EXPORT void Initialize(void** data, void* rm) { MeasureData* measure = new MeasureData; g_Measures.push_back(measure); @@ -77,6 +77,13 @@ PLUGIN_EXPORT void Finalize(void* data) delete measure; } +PLUGIN_EXPORT void ExecuteBang(void* data, LPCWSTR params[], int count) +{ + if (count >= 1) MessageBox(NULL, params[0], NULL, MB_OK | MB_TOPMOST); + if (count >= 2) MessageBox(NULL, params[1], NULL, MB_OK | MB_TOPMOST); + if (count >= 3) MessageBox(NULL, params[2], NULL, MB_OK | MB_TOPMOST); +} + void CheckProcesses() { // Set everything to false diff --git a/Plugins/PluginQuote/Quote.cpp b/Plugins/PluginQuote/Quote.cpp index 15ac8257..b6a28b05 100644 --- a/Plugins/PluginQuote/Quote.cpp +++ b/Plugins/PluginQuote/Quote.cpp @@ -112,7 +112,7 @@ void ScanFolder(std::vector& files, std::vector& fil while (FindNextFile(hSearch, &fileData)); } -PLUGIN_EXPORT void Initialize(void** data) +PLUGIN_EXPORT void Initialize(void** data, void* rm) { MeasureData* measure = new MeasureData; *data = measure; diff --git a/Plugins/PluginRecycleManager/RecycleManager.cpp b/Plugins/PluginRecycleManager/RecycleManager.cpp index 3b6ea1a2..1edcd511 100644 --- a/Plugins/PluginRecycleManager/RecycleManager.cpp +++ b/Plugins/PluginRecycleManager/RecycleManager.cpp @@ -38,7 +38,7 @@ struct MeasureData MeasureData() : type(NUMRECYCLE) {} }; -PLUGIN_EXPORT void Initialize(void** data) +PLUGIN_EXPORT void Initialize(void** data, void* rm) { MeasureData* measure = new MeasureData; *data = measure; diff --git a/Plugins/PluginResMon/ResMon.cpp b/Plugins/PluginResMon/ResMon.cpp index d97c9ae6..ace848f1 100644 --- a/Plugins/PluginResMon/ResMon.cpp +++ b/Plugins/PluginResMon/ResMon.cpp @@ -59,7 +59,7 @@ BOOL CALLBACK EnumWindowProc(HWND hWnd, LPARAM lParam) return TRUE; } -PLUGIN_EXPORT void Initialize(void** data) +PLUGIN_EXPORT void Initialize(void** data, void* rm) { MeasureData* measure = new MeasureData; *data = measure; diff --git a/Plugins/PluginSpeedFan/SpeedFanPlugin.cpp b/Plugins/PluginSpeedFan/SpeedFanPlugin.cpp index bc099f02..0df7536e 100644 --- a/Plugins/PluginSpeedFan/SpeedFanPlugin.cpp +++ b/Plugins/PluginSpeedFan/SpeedFanPlugin.cpp @@ -65,7 +65,7 @@ struct MeasureData void ReadSharedData(SensorType type, ScaleType scale, UINT number, double* value); -PLUGIN_EXPORT void Initialize(void** data) +PLUGIN_EXPORT void Initialize(void** data, void* rm) { MeasureData* measure = new MeasureData; *data = measure; diff --git a/Plugins/PluginWindowMessage/WindowMessagePlugin.cpp b/Plugins/PluginWindowMessage/WindowMessagePlugin.cpp index b3749a0c..4597382f 100644 --- a/Plugins/PluginWindowMessage/WindowMessagePlugin.cpp +++ b/Plugins/PluginWindowMessage/WindowMessagePlugin.cpp @@ -34,7 +34,7 @@ struct MeasureData MeasureData() : wParam(), lParam(), uMsg() {} }; -PLUGIN_EXPORT void Initialize(void** data) +PLUGIN_EXPORT void Initialize(void** data, void* rm) { MeasureData* measure = new MeasureData; *data = measure;