New plugin API: Added rm parameter to Initialize.

This commit is contained in:
Birunthan Mohanathas 2012-02-02 07:39:14 +00:00
parent b65b26c2b7
commit 85e59b5583
12 changed files with 19 additions and 12 deletions

View File

@ -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);

View File

@ -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*);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -37,7 +37,7 @@ static std::vector<MeasureData*> 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

View File

@ -112,7 +112,7 @@ void ScanFolder(std::vector<std::wstring>& files, std::vector<std::wstring>& 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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;