diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-03 09:40:07 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-03 09:40:07 +0300 |
commit | 848d632ce9e1bc7ae076c1ea561d997641ae2b87 (patch) | |
tree | 13808eb078e6213b30729666e95136a155954fd7 /core | |
parent | f2fd1ea7fd8b51a1792b463fb0406e3c9262eb48 (diff) |
service creation/calling working (at least for test service)
Diffstat (limited to 'core')
-rw-r--r-- | core/main.cpp | 24 | ||||
-rw-r--r-- | core/service.h | 6 |
2 files changed, 20 insertions, 10 deletions
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 |