summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/main.cpp31
-rw-r--r--modules/example/main.cpp2
2 files changed, 31 insertions, 2 deletions
diff --git a/core/main.cpp b/core/main.cpp
index bcb0e74..44add56 100644
--- a/core/main.cpp
+++ b/core/main.cpp
@@ -104,12 +104,41 @@ plugin::~plugin()
FreeLibrary(hModule);
free(szPluginName);
}
+service::service(const char *name, const SERVICE &service)
+{
+ szName = new char [strlen(name)+1];
+ strcpy(szName, name);
+ *pService = service;
+}
+const char *service::getName()
+{
+ return szName;
+}
+const SERVICE *service::getService()
+{
+ return pService;
+}
INT_PTR CallService(const char *name, WPARAM w, LPARAM l)
{
+ for(list<service*>::iterator p = services.begin(); p != services.end(); p++)
+ {
+ if(!strcmp((*p)->getName(), name))
+ {
+ SERVICE s = *(*p)->getService();
+ return s(w, l);
+ }
+ }
+ return 0;
}
-HANDLE CreateServiceFunction(const char *name, SERVICE pService)
+HANDLE CreateServiceFunction(const char *name, const SERVICE pService)
{
+ services.push_back(new service(name, pService));
}
int ServiceExists(const char *name)
{
+ for(list<service*>::iterator p = services.begin(); p != services.end(); p++)
+ if(!strcmp((*p)->getName(), name))
+ return 1;
+ return 0;
}
+
diff --git a/modules/example/main.cpp b/modules/example/main.cpp
index ab6ff64..f765cab 100644
--- a/modules/example/main.cpp
+++ b/modules/example/main.cpp
@@ -30,7 +30,7 @@ extern "C" __declspec(dllexport) PLUGININFO* SetPluginInfo()
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
- pluginLink = link;
+ pluginLink = link; //necessary
MessageBoxA(0, "Plugin Example Succesful loaded", "INFO", MB_OK);
return 0; //all ok, retrun 0
}