diff options
-rw-r--r-- | api/pluginapi.h | 2 | ||||
-rw-r--r-- | core/main.cpp | 24 | ||||
-rw-r--r-- | core/service.h | 6 |
3 files changed, 21 insertions, 11 deletions
diff --git a/api/pluginapi.h b/api/pluginapi.h index 9e3a161..cce9605 100644 --- a/api/pluginapi.h +++ b/api/pluginapi.h @@ -8,7 +8,7 @@ typedef INT_PTR (*SERVICE)(WPARAM,LPARAM); typedef struct tagPLUGINLINK { - HANDLE (*CreateServiceFunction)(const char *,SERVICE*); + HANDLE (*CreateServiceFunction)(const char *,SERVICE); INT_PTR (*CallService)(const char *,WPARAM,LPARAM); int (*ServiceExists)(const char *); } PLUGINLINK; diff --git a/core/main.cpp b/core/main.cpp index 32e066c..db901c3 100644 --- a/core/main.cpp +++ b/core/main.cpp @@ -15,9 +15,10 @@ list<service*> services; int LoadModules(); INT_PTR CallService(const char *name, WPARAM w, LPARAM l); -HANDLE CreateServiceFunction(const char *name, SERVICE *pService); +HANDLE CreateServiceFunction(const char *name, SERVICE pService); int ServiceExists(const char *name); -int GetPluginInfoList(WPARAM, LPARAM); +SERVICE GetPluginInfoList(WPARAM, LPARAM); +SERVICE Test(WPARAM, LPARAM); PLUGINLINK link = {&CreateServiceFunction, &CallService, &ServiceExists}; @@ -34,7 +35,10 @@ int main(int argc, char *argv[]) if((*p)->getFuncs().loaded) (*p)->getFuncs().loaded(); } - CreateServiceFunction("GetPluginInfoList", (INT_PTR (**)(WPARAM, LPARAM))&GetPluginInfoList); + CreateServiceFunction("GetPluginInfoList", (SERVICE)GetPluginInfoList); + CreateServiceFunction("Test", (SERVICE)Test); + CallService("GetPluginInfoList", 0, 0); + CallService("Test", 0, 0); for(;;) Sleep(1000); return 0; @@ -115,7 +119,7 @@ plugin::~plugin() FreeLibrary(hModule); free(szPluginName); } -service::service(const char *name, SERVICE *service) +service::service(const char *name, SERVICE service) { szName = new char [strlen(name)+1]; strcpy(szName, name); @@ -125,7 +129,7 @@ const char *service::getName() { return szName; } -const SERVICE *service::getService() +const SERVICE service::getService() { return pService; } @@ -141,7 +145,7 @@ INT_PTR CallService(const char *name, WPARAM w, LPARAM l) } return 0; } -HANDLE CreateServiceFunction(const char *name, SERVICE *pService) +HANDLE CreateServiceFunction(const char *name, SERVICE pService) { services.push_back(new service(name, pService)); } @@ -152,10 +156,16 @@ int ServiceExists(const char *name) return 1; return 0; } -int GetPluginInfoList(WPARAM, LPARAM) +SERVICE GetPluginInfoList(WPARAM, LPARAM) { list<PLUGININFO> *pluginInfoList = new list<PLUGININFO>; for(list<plugin*>::iterator p = plugins.begin(); p != plugins.end(); p++) pluginInfoList->push_back((*p)->getPluginInfo()); + return 0; } +SERVICE Test(WPARAM, LPARAM) +{ + MessageBoxA(0, "Test service working", "INFO", MB_OK); + return 0; +} diff --git a/core/service.h b/core/service.h index 5c90929..8f624e8 100644 --- a/core/service.h +++ b/core/service.h @@ -4,12 +4,12 @@ class service { public: const char *getName(); - const SERVICE *getService(); - service(const char *name, SERVICE *service); + const SERVICE getService(); + service(const char *name, SERVICE service); ~service(); private: char *szName; - SERVICE *pService; + SERVICE pService; }; #endif |