diff options
-rw-r--r-- | api/pluginapi.h | 9 | ||||
-rw-r--r-- | core/main.cpp | 19 | ||||
-rw-r--r-- | core/plugin.h | 3 | ||||
-rw-r--r-- | modules/example/main.cpp | 6 |
4 files changed, 32 insertions, 5 deletions
diff --git a/api/pluginapi.h b/api/pluginapi.h index 432b2d2..cce9605 100644 --- a/api/pluginapi.h +++ b/api/pluginapi.h @@ -5,6 +5,15 @@ #define GLOBAL_ACCESS_FLAG 0x0010 +typedef INT_PTR (*SERVICE)(WPARAM,LPARAM); + +typedef struct tagPLUGINLINK { + HANDLE (*CreateServiceFunction)(const char *,SERVICE); + INT_PTR (*CallService)(const char *,WPARAM,LPARAM); + int (*ServiceExists)(const char *); +} PLUGINLINK; + + typedef struct { int cbSize; diff --git a/core/main.cpp b/core/main.cpp index 54b446c..bcb0e74 100644 --- a/core/main.cpp +++ b/core/main.cpp @@ -6,12 +6,19 @@ #include <pluginapi.h> #include "plugin.h" +#include "service.h" using namespace std; list<plugin*> plugins; +list<service*> services; int LoadModules(); +INT_PTR CallService(const char *name, WPARAM w, LPARAM l); +HANDLE CreateServiceFunction(const char *name, SERVICE pService); +int ServiceExists(const char *name); + +PLUGINLINK link = {&CreateServiceFunction, &CallService, &ServiceExists}; int main(int argc, char *argv[]) { @@ -20,7 +27,7 @@ int main(int argc, char *argv[]) for(list<plugin*>::iterator p = plugins.begin(); p != plugins.end(); p++) { cout<<"Loaded plugin: "<<(*p)->getName()<<'\n'; - (*p)->getFuncs().load(); + (*p)->getFuncs().load(&link); } for(;;) Sleep(1000); @@ -97,4 +104,12 @@ plugin::~plugin() FreeLibrary(hModule); free(szPluginName); } - +INT_PTR CallService(const char *name, WPARAM w, LPARAM l) +{ +} +HANDLE CreateServiceFunction(const char *name, SERVICE pService) +{ +} +int ServiceExists(const char *name) +{ +} diff --git a/core/plugin.h b/core/plugin.h index cf2b33c..893b445 100644 --- a/core/plugin.h +++ b/core/plugin.h @@ -5,8 +5,7 @@ typedef PLUGININFO * (__cdecl * SetPluginInfo) (); -typedef int (__cdecl * Load) (); - +typedef int (__cdecl * Load) (PLUGINLINK *link); class plugin { diff --git a/modules/example/main.cpp b/modules/example/main.cpp index a38f44f..ab6ff64 100644 --- a/modules/example/main.cpp +++ b/modules/example/main.cpp @@ -1,6 +1,9 @@ #include <windows.h> #include <pluginapi.h> +#include <plugin_helper.h> + +PLUGINLINK *pluginLink; HINSTANCE hInst; BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) //default dll entry point @@ -25,8 +28,9 @@ extern "C" __declspec(dllexport) PLUGININFO* SetPluginInfo() return &pluginInfo; } -extern "C" int __declspec(dllexport) Load() +extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { + pluginLink = link; MessageBoxA(0, "Plugin Example Succesful loaded", "INFO", MB_OK); return 0; //all ok, retrun 0 } |