bool PluginDll::init(IPluginContextEx * pluginCtx) { HINSTANCE h = getInstance(); assertex(h != (HINSTANCE) -1); EclPluginSetCtxEx pSetCtxEx = (EclPluginSetCtxEx) GetSharedProcedure(h,"setPluginContextEx"); if (pSetCtxEx) pSetCtxEx(pluginCtx); else { // Older plugins may only support setPluginContext - fall back to that EclPluginSetCtx pSetCtx = (EclPluginSetCtx) GetSharedProcedure(h,"setPluginContext"); if (pSetCtx) pSetCtx(pluginCtx); } EclPluginDefinition p= (EclPluginDefinition) GetSharedProcedure(h,"getECLPluginDefinition"); if (!p) return false; pb.size = sizeof(ECLPluginDefinitionBlockEx); if (!p(&pb)) { pb.compatibleVersions = NULL; pb.size = sizeof(ECLPluginDefinitionBlock); if (!p(&pb)) return false; } return true; }
static ISecManager* loadSecManager(const char* model_name, const char* servicename, IPropertyTree* cfg) { if (!model_name || !*model_name) throw MakeStringExceptionDirect(-1, "Security model not specified"); StringBuffer realName; if(stricmp(model_name, "LdapSecurity") == 0) { realName.append(SharedObjectPrefix).append(LDAPSECLIB).append(SharedObjectExtension); HINSTANCE ldapseclib = LoadSharedObject(realName.str(), true, false); if(ldapseclib == NULL) throw MakeStringException(-1, "can't load library %s", realName.str()); newSecManager_t_ xproc = NULL; xproc = (newSecManager_t_)GetSharedProcedure(ldapseclib, "newLdapSecManager"); if (xproc) return xproc(servicename, *cfg); else throw MakeStringException(-1, "procedure newLdapSecManager of %s can't be loaded", realName.str()); } else throw MakeStringException(-1, "Security model %s not supported", model_name); }
/// /// Method: loadPluggableSecManager /// /// Using the given configuration property trees, this method loads the specified /// Security Manager DLL/SO implemented in the specified library file and calls /// its instance factory to create and return an ISecManager security manager instance /// for the given ESP service /// /// @param bindingName Binding name ie 'WsTopology_smc_myesp' /// @param bindingCfg 'Binding' IPropertyTree associated with ESPService /// @param secMgrCfg 'SecurityManager' IPropertyTree from component config file /// /// @return an ISecManager Security Manager instance /// static ISecManager* loadPluggableSecManager(const char * bindingName, IPropertyTree* bindingCfg, IPropertyTree* secMgrCfg) { const char * lsm = "Load Security Manager :"; StringBuffer libName, instFactory; secMgrCfg->getProp("@LibName", libName); if (libName.isEmpty()) throw MakeStringException(-1, "%s library name not specified for %s", lsm, bindingName); //TODO Search for LibName in plugins folder, or in specified location instFactory.set(secMgrCfg->queryProp("@InstanceFactoryName")); if (instFactory.isEmpty()) instFactory.set("createInstance"); //Load the DLL/SO HINSTANCE pluggableSecLib = LoadSharedObject(libName.str(), true, false); if(pluggableSecLib == NULL) throw MakeStringException(-1, "%s can't load library %s for %s", lsm, libName.str(), bindingName); //Retrieve address of exported ISecManager instance factory newPluggableSecManager_t_ xproc = NULL; xproc = (newPluggableSecManager_t_)GetSharedProcedure(pluggableSecLib, instFactory.str()); if (xproc == NULL) throw MakeStringException(-1, "%s cannot locate procedure %s of '%s'", lsm, instFactory.str(), libName.str()); //Call ISecManager instance factory and return the new instance DBGLOG("Calling '%s' in pluggable security manager '%s'", instFactory.str(), libName.str()); return xproc(bindingName, *secMgrCfg, *bindingCfg); }
static ISecManager* loadSecManager(const char* model_name, const char* servicename, IPropertyTree* cfg) { if(model_name && stricmp(model_name, "LdapSecurity") == 0) { HINSTANCE ldapseclib = LoadSharedObject(LDAPSECLIB, true, false); if(ldapseclib == NULL) throw MakeStringException(-1, "can't load library %s", LDAPSECLIB); newSecManager_t_ xproc = NULL; xproc = (newSecManager_t_)GetSharedProcedure(ldapseclib, "newLdapSecManager"); if (xproc) return xproc(servicename, *cfg); else throw MakeStringException(-1, "procedure newLdapSecManager of %s can't be loaded", LDAPSECLIB); } else if(model_name && stricmp(model_name, "Local") == 0) { HINSTANCE ldapseclib = LoadSharedObject(LDAPSECLIB, true, false); if(ldapseclib == NULL) throw MakeStringException(-1, "can't load library %s", LDAPSECLIB); newSecManager_t_ xproc = NULL; xproc = (newSecManager_t_)GetSharedProcedure(ldapseclib, "newLocalSecManager"); if (xproc) return xproc(servicename, *cfg); else throw MakeStringException(-1, "procedure newLocalSecManager of %s can't be loaded", LDAPSECLIB); } else if(model_name && stricmp(model_name, "Default") == 0) { HINSTANCE ldapseclib = LoadSharedObject(LDAPSECLIB, true, false); if(ldapseclib == NULL) throw MakeStringException(-1, "can't load library %s", LDAPSECLIB); newSecManager_t_ xproc = NULL; xproc = (newSecManager_t_)GetSharedProcedure(ldapseclib, "newDefaultSecManager"); if (xproc) return xproc(servicename, *cfg); else throw MakeStringException(-1, "procedure newDefaultSecManager of %s can't be loaded", LDAPSECLIB); } else throw MakeStringException(-1, "Security model %s not supported", model_name?model_name:"UNKNOWN"); }
static IAuthMap* loadTheDefaultAuthMap(IPropertyTree* cfg) { HINSTANCE seclib = LoadSharedObject(LDAPSECLIB, true, false); // ,false,true may actually be more helpful. if(seclib == NULL) throw MakeStringException(-1, "can't load library %s", LDAPSECLIB); createDefaultAuthMap_t_ xproc = NULL; xproc = (createDefaultAuthMap_t_)GetSharedProcedure(seclib, "newDefaultAuthMap"); if (xproc) return xproc(cfg); else throw MakeStringException(-1, "procedure newDefaultAuthMap of %s can't be loaded", LDAPSECLIB); }
IEspLogAgent* CLoggingManager::loadLoggingAgent(const char* name, const char* dll, const char* service, IPropertyTree* cfg) { StringBuffer plugin; plugin.append(SharedObjectPrefix).append(dll).append(SharedObjectExtension); HINSTANCE loggingAgentLib = LoadSharedObject(plugin.str(), true, false); if(!loggingAgentLib) throw MakeStringException(EspLoggingErrors::LoadLoggingLibraryError, "can't load library %s", plugin.str()); newLoggingAgent_t_ xproc = (newLoggingAgent_t_)GetSharedProcedure(loggingAgentLib, "newLoggingAgent"); if (!xproc) throw MakeStringException(EspLoggingErrors::LoadLoggingLibraryError, "procedure newLoggingAgent of %s can't be loaded", plugin.str()); return (IEspLogAgent*) xproc(); }
IEspLogAgent* CWsLoggingServiceEx::loadLoggingAgent(const char* name, const char* dll) { StringBuffer realName; // add suffix and prefix if needed realName.append(SharedObjectPrefix).append(dll).append(SharedObjectExtension); HINSTANCE loggingAgentLib = LoadSharedObject(realName.str(), true, false); if(!loggingAgentLib) throw MakeStringException(EspLoggingErrors::LoadLoggingLibraryError, "can't load library %s", realName.str()); newLogAgent_t_ xproc = (newLogAgent_t_)GetSharedProcedure(loggingAgentLib, "newLoggingAgent"); if (!xproc) throw MakeStringException(EspLoggingErrors::LoadLoggingLibraryError, "procedure newLoggingAgent of %s can't be loaded", realName.str()); return (IEspLogAgent*) xproc(); }
CEspApplicationPort::CEspApplicationPort(bool viewcfg) : bindingCount(0), defBinding(-1), viewConfig(viewcfg), rootAuth(false), navWidth(165), navResize(false), navScroll(false) { build_ver = getBuildVersion(); hxsl = LoadSharedObject(SharedObjectPrefix "xmllib" SharedObjectExtension, true, false); if (!hxsl) DBGLOG("Loading xmllib shared library failed!"); else { getXslProcessor_func xslfactory = (getXslProcessor_func) GetSharedProcedure(hxsl, "getXslProcessor"); if (!xslfactory) DBGLOG("Loading procedure from xmllib shared library failed!"); else xslp.setown(xslfactory()); } }
ILoggingManager* loadLogggingManager() { StringBuffer realName; realName.append(SharedObjectPrefix).append(LOGGINGMANAGERLIB).append(SharedObjectExtension); HINSTANCE loggingManagerLib = LoadSharedObject(realName.str(), true, false); if(loggingManagerLib == NULL) { printf("can't load library %s\n", realName.str()); return NULL; } newLoggingManager_t_ xproc = NULL; xproc = (newLoggingManager_t_)GetSharedProcedure(loggingManagerLib, "newLoggingManager"); if (!xproc) { printf("procedure newLogggingManager of %s can't be loaded\n", realName.str()); return NULL; } return (ILoggingManager*) xproc(); }
void * HelperDll::getEntry(const char * name) const { return GetSharedProcedure(so.getInstanceHandle(), name); }