示例#1
0
int GWEN_Init(void) {
  int err;

  if (gwen_is_initialized==0) {
    err=GWEN_Memory_ModuleInit();
    if (err)
      return err;
    err=GWEN_Logger_ModuleInit();
    if (err)
      return err;

    gnutls_global_init();

    if (gwen_binreloc_initialized==0) {
#ifdef ENABLE_BINRELOC
      BrInitError br_error;

      /* Init binreloc. Note: It is not totally clear whether the correct
       function might still be br_init() instead of br_init_lib(). */
      if (!br_init_lib(&br_error)) {
        DBG_INFO(GWEN_LOGDOMAIN, "Error on br_init: %d\n", br_error);
        gwen_binreloc_initialized=-1;
      }
      else
        gwen_binreloc_initialized=1;
#else
      gwen_binreloc_initialized=1;
#endif
    }

    GWEN_Error_ModuleInit();

    err=GWEN_PathManager_ModuleInit();
    if (err)
      return err;

    /* Define some paths used by gwenhywfar; add the windows
       registry entries first, because on Unix those functions
       simply do nothing and on windows they will ensure that the
       most valid paths (which are those from the registry) are
       first in the path lists. */

    /* ---------------------------------------------------------------------
     * $sysconfdir e.g. "/etc" */
    GWEN_PathManager_DefinePath(GWEN_PM_LIBNAME, GWEN_PM_SYSCONFDIR);
    GWEN_PathManager_AddPathFromWinReg(GWEN_PM_LIBNAME,
                                       GWEN_PM_LIBNAME,
                                       GWEN_PM_SYSCONFDIR,
                                       GWEN_REGKEY_PATHS,
                                       GWEN_REGNAME_SYSCONFDIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
    /* add folder relative to EXE */
    GWEN_PathManager_AddRelPath(GWEN_PM_LIBNAME,
                                GWEN_PM_LIBNAME,
                                GWEN_PM_SYSCONFDIR,
                                GWEN_SYSCONF_DIR,
                                GWEN_PathManager_RelModeExe);
#else
    /* add absolute folder */
    GWEN_PathManager_AddPath(GWEN_PM_LIBNAME,
                             GWEN_PM_LIBNAME,
                             GWEN_PM_SYSCONFDIR,
                             GWEN_SYSCONF_DIR);
#endif

    /* ---------------------------------------------------------------------
     * $localedir e.g. "/usr/share/locale" */
    GWEN_PathManager_DefinePath(GWEN_PM_LIBNAME, GWEN_PM_LOCALEDIR);
    GWEN_PathManager_AddPathFromWinReg(GWEN_PM_LIBNAME,
                                       GWEN_PM_LIBNAME,
                                       GWEN_PM_LOCALEDIR,
                                       GWEN_REGKEY_PATHS,
                                       GWEN_REGNAME_LOCALEDIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
    /* add folder relative to EXE */
    GWEN_PathManager_AddRelPath(GWEN_PM_LIBNAME,
                                GWEN_PM_LIBNAME,
                                GWEN_PM_LOCALEDIR,
                                LOCALEDIR,
                                GWEN_PathManager_RelModeExe);
#else
    /* add absolute folder */
    GWEN_PathManager_AddPath(GWEN_PM_LIBNAME,
                             GWEN_PM_LIBNAME,
                             GWEN_PM_LOCALEDIR,
                             LOCALEDIR);
#endif

    /* ---------------------------------------------------------------------
     * $plugindir e.g. "/usr/lib/gwenhywfar/plugins/0" */
    GWEN_PathManager_DefinePath(GWEN_PM_LIBNAME, GWEN_PM_PLUGINDIR);
    GWEN_PathManager_AddPathFromWinReg(GWEN_PM_LIBNAME,
                                       GWEN_PM_LIBNAME,
                                       GWEN_PM_PLUGINDIR,
                                       GWEN_REGKEY_PATHS,
                                       GWEN_REGNAME_PLUGINDIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
    /* add folder relative to EXE */
    GWEN_PathManager_AddRelPath(GWEN_PM_LIBNAME,
                                GWEN_PM_LIBNAME,
                                GWEN_PM_PLUGINDIR,
                                PLUGINDIR,
                                GWEN_PathManager_RelModeExe);
#else
    /* add absolute folder */
    GWEN_PathManager_AddPath(GWEN_PM_LIBNAME,
                             GWEN_PM_LIBNAME,
                             GWEN_PM_PLUGINDIR,
                             PLUGINDIR);
#endif

    /* ---------------------------------------------------------------------
     * datadir e.g. "/usr/share/gwenhywfar" */
    GWEN_PathManager_DefinePath(GWEN_PM_LIBNAME, GWEN_PM_DATADIR);
    GWEN_PathManager_AddPathFromWinReg(GWEN_PM_LIBNAME,
                                       GWEN_PM_LIBNAME,
                                       GWEN_PM_DATADIR,
                                       GWEN_REGKEY_PATHS,
                                       GWEN_REGNAME_DATADIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
    /* add folder relative to EXE */
    GWEN_PathManager_AddRelPath(GWEN_PM_LIBNAME,
                                GWEN_PM_LIBNAME,
                                GWEN_PM_DATADIR,
                                GWEN_DATADIR,
                                GWEN_PathManager_RelModeExe);
#else
    /* add absolute folder */
    GWEN_PathManager_AddPath(GWEN_PM_LIBNAME,
                             GWEN_PM_LIBNAME,
                             GWEN_PM_DATADIR,
                             GWEN_DATADIR);
#endif

    /* ---------------------------------------------------------------------
     * system datadir e.g. "/usr/share" */
    GWEN_PathManager_DefinePath(GWEN_PM_LIBNAME, GWEN_PM_SYSDATADIR);
    GWEN_PathManager_AddPathFromWinReg(GWEN_PM_LIBNAME,
                                       GWEN_PM_LIBNAME,
                                       GWEN_PM_SYSDATADIR,
                                       GWEN_REGKEY_PATHS,
                                       GWEN_REGNAME_SYSDATADIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
    /* add folder relative to EXE */
    GWEN_PathManager_AddRelPath(GWEN_PM_LIBNAME,
                                GWEN_PM_LIBNAME,
                                GWEN_PM_SYSDATADIR,
                                GWEN_SYSDATADIR,
                                GWEN_PathManager_RelModeExe);
#else
    /* add absolute folder */
    GWEN_PathManager_AddPath(GWEN_PM_LIBNAME,
                             GWEN_PM_LIBNAME,
                             GWEN_PM_SYSDATADIR,
                             GWEN_SYSDATADIR);
#endif

    /* Initialize other modules. */
    DBG_DEBUG(GWEN_LOGDOMAIN, "Initializing I18N module");
    err=GWEN_I18N_ModuleInit();
    if (err)
      return err;
    DBG_DEBUG(GWEN_LOGDOMAIN, "Initializing InetAddr module");
    err=GWEN_InetAddr_ModuleInit();
    if (err)
      return err;
    DBG_DEBUG(GWEN_LOGDOMAIN, "Initializing Socket module");
    err=GWEN_Socket_ModuleInit();
    if (err)
      return err;
    DBG_DEBUG(GWEN_LOGDOMAIN, "Initializing Libloader module");
    err=GWEN_LibLoader_ModuleInit();
    if (err)
      return err;
    DBG_DEBUG(GWEN_LOGDOMAIN, "Initializing Crypt3 module");
    err=GWEN_Crypt3_ModuleInit();
    if (err)
      return err;
    DBG_DEBUG(GWEN_LOGDOMAIN, "Initializing Process module");
    err=GWEN_Process_ModuleInit();
    if (err)
      return err;
    DBG_DEBUG(GWEN_LOGDOMAIN, "Initializing Plugin module");
    err=GWEN_Plugin_ModuleInit();
    if (err)
      return err;
    DBG_DEBUG(GWEN_LOGDOMAIN, "Initializing DataBase IO module");
    err=GWEN_DBIO_ModuleInit();
    if (err)
      return err;
    DBG_DEBUG(GWEN_LOGDOMAIN, "Initializing ConfigMgr module");
    err=GWEN_ConfigMgr_ModuleInit();
    if (err)
      return err;
    DBG_DEBUG(GWEN_LOGDOMAIN, "Initializing CryptToken2 module");
    err=GWEN_Crypt_Token_ModuleInit();
    if (err)
      return err;
    /* add more modules here */

  }
  gwen_is_initialized++;

  return 0;

}
示例#2
0
文件: client.c 项目: rhvall/SmartCard
int LC_Client_InitCommon() {
  if (lc_client__initcounter==0) {
    int rv;
    GWEN_STRINGLIST *paths;

    rv=GWEN_Init();
    if (rv) {
      DBG_ERROR_ERR(LC_LOGDOMAIN, rv);
      return rv;
    }

    if (!GWEN_Logger_IsOpen(LC_LOGDOMAIN)) {
      const char *s;

      /* only set our logger if it not already has been */
      GWEN_Logger_Open(LC_LOGDOMAIN, "chipcard3-client", 0,
		       GWEN_LoggerType_Console,
                       GWEN_LoggerFacility_User);
      GWEN_Logger_SetLevel(LC_LOGDOMAIN, GWEN_LoggerLevel_Warning);

      s=getenv("LC_LOGLEVEL");
      if (s) {
        GWEN_LOGGER_LEVEL ll;

        ll=GWEN_Logger_Name2Level(s);
        if (ll!=GWEN_LoggerLevel_Unknown) {
          GWEN_Logger_SetLevel(LC_LOGDOMAIN, ll);
	  DBG_WARN(LC_LOGDOMAIN,
                   "Overriding loglevel for Libchipcard-Client with \"%s\"",
                   s);
        }
        else {
	  DBG_ERROR(0, "Unknown loglevel \"%s\"", s);
        }
      }
      else {
        GWEN_Logger_SetLevel(LC_LOGDOMAIN, GWEN_LoggerLevel_Warning);
      }
    }

    /* define sysconf path */
    GWEN_PathManager_DefinePath(LCC_PM_LIBNAME, LCC_PM_SYSCONFDIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
    /* add folder relative to EXE */
    GWEN_PathManager_AddRelPath(LCC_PM_LIBNAME,
				LCC_PM_LIBNAME,
				LCC_PM_SYSCONFDIR,
				LC_CLIENT_CONFIG_DIR,
				GWEN_PathManager_RelModeExe);
#else
    /* add absolute folder */
    GWEN_PathManager_AddPath(LCC_PM_LIBNAME,
			     LCC_PM_LIBNAME,
			     LCC_PM_SYSCONFDIR,
			     LC_CLIENT_CONFIG_DIR);
#endif

    /* define data path */
    GWEN_PathManager_DefinePath(LCC_PM_LIBNAME, LCC_PM_DATADIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
    /* add folder relative to EXE */
    GWEN_PathManager_AddRelPath(LCC_PM_LIBNAME,
				LCC_PM_LIBNAME,
				LCC_PM_DATADIR,
				LC_CLIENT_XML_DIR,
				GWEN_PathManager_RelModeExe);
#else
    /* add absolute folder */
    GWEN_PathManager_AddPath(LCC_PM_LIBNAME,
			     LCC_PM_LIBNAME,
			     LCC_PM_DATADIR,
			     LC_CLIENT_XML_DIR);
#endif

    /* load configuration file */
#if 0
    paths=GWEN_PathManager_GetPaths(LCC_PM_LIBNAME, LCC_PM_SYSCONFDIR);
    if (paths) {
      GWEN_DB_NODE *db;
      GWEN_BUFFER *fbuf;

      db=GWEN_DB_Group_new("config");
      fbuf=GWEN_Buffer_new(0, 256, 0, 1);
      rv=GWEN_Directory_FindFileInPaths(paths,
					LC_CLIENT_CONFIG_FILE,
					fbuf);
      if (rv) {
	DBG_INFO(LC_LOGDOMAIN,
		 "Trying config file with suffix \".default\"");
	rv=GWEN_Directory_FindFileInPaths(paths,
					  LC_CLIENT_CONFIG_FILE".default",
					  fbuf);
      }
      GWEN_StringList_free(paths);
      if (rv) {
	DBG_WARN(LC_LOGDOMAIN,
		 "No configuration file found, using defaults");
      }
      else {
	DBG_INFO(LC_LOGDOMAIN,
		 "Reading configuration file \"%s\"",
		 GWEN_Buffer_GetStart(fbuf));
	rv=GWEN_DB_ReadFile(db, GWEN_Buffer_GetStart(fbuf),
			    GWEN_DB_FLAGS_DEFAULT |
			    GWEN_PATH_FLAGS_CREATE_GROUP);
	if (rv<0) {
	  DBG_ERROR(LC_LOGDOMAIN,
		    "Error in configuration file \"%s\" (%d)",
		    GWEN_Buffer_GetStart(fbuf), rv);
	  GWEN_Buffer_free(fbuf);
	  /* undo all init stuff so far */
	  GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_DATADIR);
	  GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_SYSCONFDIR);
	  return rv;
	}
      }
      GWEN_Buffer_free(fbuf);
      lc_client__config=db;
    }
    else {
      DBG_ERROR(LC_LOGDOMAIN, "Internal error: Paths not found");
      return GWEN_ERROR_INTERNAL;
    }
#else
    lc_client__config=GWEN_DB_Group_new("config");
#endif

    /* load XML files */
    paths=GWEN_PathManager_GetPaths(LCC_PM_LIBNAME, LCC_PM_DATADIR);
    if (paths) {
      GWEN_XMLNODE *n;
      GWEN_DB_NODE *db;
      GWEN_BUFFER *fbuf;
      uint32_t bpos;

      fbuf=GWEN_Buffer_new(0, 256, 0, 1);
      rv=GWEN_Directory_FindPathForFile(paths,
					"cards/README",
					fbuf);
      GWEN_StringList_free(paths);
      if (rv) {
	DBG_ERROR(LC_LOGDOMAIN, "Data files not found (%d)", rv);
        /* undo all init stuff so far */
	GWEN_Buffer_free(fbuf);
	GWEN_DB_Group_free(lc_client__config);
        lc_client__config=NULL;
	GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_DATADIR);
	GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_SYSCONFDIR);
        return rv;
      }

      /* load card files */
      n=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "cards");
      if (LC_Client_ReadXmlFiles(n,
				 GWEN_Buffer_GetStart(fbuf),
				 "cards", "card")) {
	DBG_ERROR(LC_LOGDOMAIN, "Could not read card files");
	GWEN_XMLNode_free(n);
	/* undo all init stuff so far */
	GWEN_Buffer_free(fbuf);
	GWEN_DB_Group_free(lc_client__config);
        lc_client__config=NULL;
	GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_DATADIR);
	GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_SYSCONFDIR);
	return GWEN_ERROR_GENERIC;
      }
      lc_client__card_nodes=n;

      /* load app files */
      n=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "apps");
      if (LC_Client_ReadXmlFiles(n,
				 GWEN_Buffer_GetStart(fbuf),
				 "apps", "app")) {
	DBG_ERROR(LC_LOGDOMAIN, "Could not read app files");
	GWEN_XMLNode_free(n);
	/* undo all init stuff so far */
	GWEN_XMLNode_free(lc_client__card_nodes);
	lc_client__card_nodes=NULL;
	GWEN_Buffer_free(fbuf);
	GWEN_DB_Group_free(lc_client__config);
        lc_client__config=NULL;
	GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_DATADIR);
	GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_SYSCONFDIR);
	return GWEN_ERROR_GENERIC;
      }
      lc_client__app_nodes=n;
      /*GWEN_XMLNode_WriteFile(n, "/tmp/apps", GWEN_XML_FLAGS_DEFAULT);*/

      /* load driver files (if any) */
      bpos=GWEN_Buffer_GetPos(fbuf);
      GWEN_Buffer_AppendString(fbuf, DIRSEP "drivers");
      db=GWEN_DB_Group_new("drivers");
      rv=LC_DriverInfo_ReadDrivers(GWEN_Buffer_GetStart(fbuf), db, 0, 1);
      if (rv) {
        DBG_INFO(LC_LOGDOMAIN, "here (%d)", rv);
        GWEN_DB_Group_free(db);
	/* undo all init stuff so far */
	GWEN_XMLNode_free(lc_client__app_nodes);
	lc_client__app_nodes=NULL;
	GWEN_XMLNode_free(lc_client__card_nodes);
	lc_client__card_nodes=NULL;
	GWEN_Buffer_free(fbuf);
	GWEN_DB_Group_free(lc_client__config);
	lc_client__config=NULL;
	GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_DATADIR);
	GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_SYSCONFDIR);
	return rv;
      }
      lc_client__driver_db=db;
      GWEN_Buffer_Crop(fbuf, 0, bpos);

      /* insert more loading here */
      GWEN_Buffer_free(fbuf);
    }
    else {
      DBG_ERROR(LC_LOGDOMAIN, "No data files found.");
      /* undo all init stuff so far */
      GWEN_DB_Group_free(lc_client__config);
      lc_client__config=NULL;
      GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_DATADIR);
      GWEN_PathManager_UndefinePath(LCC_PM_LIBNAME, LCC_PM_SYSCONFDIR);
      return GWEN_ERROR_GENERIC;
    }
  }

  lc_client__initcounter++;
  return 0;
}
示例#3
0
int AB_Banking_PluginSystemInit(void) {
    if (ab_plugin_init_count==0) {
        const char *s;
        GWEN_PLUGIN_MANAGER *pm;
        int rv;

        rv=GWEN_Init();
        if (rv) {
            DBG_ERROR_ERR(AQBANKING_LOGDOMAIN, rv);
            return rv;
        }
        if (!GWEN_Logger_IsOpen(AQBANKING_LOGDOMAIN)) {
            GWEN_Logger_Open(AQBANKING_LOGDOMAIN,
                             "aqbanking", 0,
                             GWEN_LoggerType_Console,
                             GWEN_LoggerFacility_User);
            GWEN_Logger_SetLevel(AQBANKING_LOGDOMAIN, GWEN_LoggerLevel_Notice);
        }

        s=getenv("AQBANKING_LOGLEVEL");
        if (s && *s) {
            GWEN_LOGGER_LEVEL ll;

            ll=GWEN_Logger_Name2Level(s);
            GWEN_Logger_SetLevel(AQBANKING_LOGDOMAIN, ll);
        }

        DBG_INFO(AQBANKING_LOGDOMAIN,
                 "AqBanking v"
                 AQBANKING_VERSION_FULL_STRING
                 " (compiled at "
                 COMPILE_DATETIME
                 "): initialising");

        /* define locale paths */
        GWEN_PathManager_DefinePath(AB_PM_LIBNAME, AB_PM_LOCALEDIR);
        GWEN_PathManager_AddPathFromWinReg(AB_PM_LIBNAME,
                                           AB_PM_LIBNAME,
                                           AB_PM_LOCALEDIR,
                                           AB_BANKING_REGKEY_PATHS,
                                           AB_BANKING_REGKEY_LOCALEDIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
        /* add folder relative to EXE */
        GWEN_PathManager_AddRelPath(AB_PM_LIBNAME,
                                    AB_PM_LIBNAME,
                                    AB_PM_LOCALEDIR,
                                    LOCALEDIR,
                                    GWEN_PathManager_RelModeExe);
#else
        /* add absolute folder */
        GWEN_PathManager_AddPath(AB_PM_LIBNAME,
                                 AB_PM_LIBNAME,
                                 AB_PM_LOCALEDIR,
                                 LOCALEDIR);
#endif



        if (1) {
            GWEN_STRINGLIST *sl=GWEN_PathManager_GetPaths(AB_PM_LIBNAME,
                                AB_PM_LOCALEDIR);
            const char *localedir=GWEN_StringList_FirstString(sl);

            rv=GWEN_I18N_BindTextDomain_Dir(PACKAGE, localedir);
            if (rv) {
                DBG_ERROR(AQBANKING_LOGDOMAIN, "Could not bind textdomain (%d)", rv);
            }
            else {
                rv=GWEN_I18N_BindTextDomain_Codeset(PACKAGE, "UTF-8");
                if (rv) {
                    DBG_ERROR(AQBANKING_LOGDOMAIN, "Could not set codeset (%d)", rv);
                }
            }

            GWEN_StringList_free(sl);
        }


        /* define sysconf paths */
        GWEN_PathManager_DefinePath(AB_PM_LIBNAME, AB_PM_SYSCONFDIR);
        GWEN_PathManager_AddPathFromWinReg(AB_PM_LIBNAME,
                                           AB_PM_LIBNAME,
                                           AB_PM_SYSCONFDIR,
                                           AB_BANKING_REGKEY_PATHS,
                                           AB_BANKING_REGKEY_SYSCONFDIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
        /* add folder relative to EXE */
        GWEN_PathManager_AddRelPath(AB_PM_LIBNAME,
                                    AB_PM_LIBNAME,
                                    AB_PM_SYSCONFDIR,
                                    AQBANKING_SYSCONF_DIR,
                                    GWEN_PathManager_RelModeExe);
#else
        /* add absolute folder */
        GWEN_PathManager_AddPath(AB_PM_LIBNAME,
                                 AB_PM_LIBNAME,
                                 AB_PM_SYSCONFDIR,
                                 AQBANKING_SYSCONF_DIR);
#endif

        /* define data paths */
        GWEN_PathManager_DefinePath(AB_PM_LIBNAME, AB_PM_DATADIR);
        GWEN_PathManager_AddPathFromWinReg(AB_PM_LIBNAME,
                                           AB_PM_LIBNAME,
                                           AB_PM_DATADIR,
                                           AB_BANKING_REGKEY_PATHS,
                                           AB_BANKING_REGKEY_DATADIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
        /* add folder relative to EXE */
        GWEN_PathManager_AddRelPath(AB_PM_LIBNAME,
                                    AB_PM_LIBNAME,
                                    AB_PM_DATADIR,
                                    AQBANKING_DATA_DIR,
                                    GWEN_PathManager_RelModeExe);
#else
        /* add absolute folder */
        GWEN_PathManager_AddPath(AB_PM_LIBNAME,
                                 AB_PM_LIBNAME,
                                 AB_PM_DATADIR,
                                 AQBANKING_DATA_DIR);
#endif

        /* define wizard paths */
        GWEN_PathManager_DefinePath(AB_PM_LIBNAME, AB_PM_WIZARDDIR);
        GWEN_PathManager_AddPathFromWinReg(AB_PM_LIBNAME,
                                           AB_PM_LIBNAME,
                                           AB_PM_WIZARDDIR,
                                           AB_BANKING_REGKEY_PATHS,
                                           AB_BANKING_REGKEY_WIZARDDIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
        /* add folder relative to EXE */
        GWEN_PathManager_AddRelPath(AB_PM_LIBNAME,
                                    AB_PM_LIBNAME,
                                    AB_PM_WIZARDDIR,
                                    AQBANKING_PLUGINS
                                    DIRSEP
                                    AB_WIZARD_FOLDER,
                                    GWEN_PathManager_RelModeExe);
#else
        /* add absolute folder */
        GWEN_PathManager_AddPath(AB_PM_LIBNAME,
                                 AB_PM_LIBNAME,
                                 AB_PM_WIZARDDIR,
                                 AQBANKING_PLUGINS
                                 DIRSEP
                                 AB_WIZARD_FOLDER);
#endif

        /* create bankinfo plugin manager */
        DBG_INFO(AQBANKING_LOGDOMAIN, "Registering bankinfo plugin manager");
        pm=GWEN_PluginManager_new("bankinfo", AB_PM_LIBNAME);
        if (GWEN_PluginManager_Register(pm)) {
            DBG_ERROR(AQBANKING_LOGDOMAIN,
                      "Could not register bankinfo plugin manager");
            return GWEN_ERROR_GENERIC;
        }

        GWEN_PluginManager_AddPathFromWinReg(pm,
                                             AB_PM_LIBNAME,
                                             AB_BANKING_REGKEY_PATHS,
                                             AB_BANKING_REGKEY_BANKINFODIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
        /* add folder relative to EXE */
        GWEN_PluginManager_AddRelPath(pm,
                                      AB_PM_LIBNAME,
                                      AQBANKING_PLUGINS
                                      DIRSEP
                                      AB_BANKINFO_PLUGIN_FOLDER,
                                      GWEN_PathManager_RelModeExe);
#else
        /* add absolute folder */
        GWEN_PluginManager_AddPath(pm,
                                   AB_PM_LIBNAME,
                                   AQBANKING_PLUGINS
                                   DIRSEP
                                   AB_BANKINFO_PLUGIN_FOLDER);
#endif
        ab_pluginManagerBankInfo=pm;


        /* create provider plugin manager */
        DBG_INFO(AQBANKING_LOGDOMAIN, "Registering provider plugin manager");
        pm=GWEN_PluginManager_new("provider", AB_PM_LIBNAME);
        if (GWEN_PluginManager_Register(pm)) {
            DBG_ERROR(AQBANKING_LOGDOMAIN,
                      "Could not register provider plugin manager");
            return GWEN_ERROR_GENERIC;
        }

        GWEN_PluginManager_AddPathFromWinReg(pm,
                                             AB_PM_LIBNAME,
                                             AB_BANKING_REGKEY_PATHS,
                                             AB_BANKING_REGKEY_PROVIDERDIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
        /* add folder relative to EXE */
        GWEN_PluginManager_AddRelPath(pm,
                                      AB_PM_LIBNAME,
                                      AQBANKING_PLUGINS
                                      DIRSEP
                                      AB_PROVIDER_FOLDER,
                                      GWEN_PathManager_RelModeExe);
#else
        /* add absolute folder */
        GWEN_PluginManager_AddPath(pm,
                                   AB_PM_LIBNAME,
                                   AQBANKING_PLUGINS
                                   DIRSEP
                                   AB_PROVIDER_FOLDER);
#endif
        ab_pluginManagerProvider=pm;


        /* create imexporters plugin manager */
        DBG_INFO(AQBANKING_LOGDOMAIN, "Registering imexporters plugin manager");
        pm=GWEN_PluginManager_new("imexporter", AB_PM_LIBNAME);
        if (GWEN_PluginManager_Register(pm)) {
            DBG_ERROR(AQBANKING_LOGDOMAIN,
                      "Could not register imexporters plugin manager");
            return GWEN_ERROR_GENERIC;
        }

        GWEN_PluginManager_AddPathFromWinReg(pm,
                                             AB_PM_LIBNAME,
                                             AB_BANKING_REGKEY_PATHS,
                                             AB_BANKING_REGKEY_IMPORTERDIR);
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
        /* add folder relative to EXE */
        GWEN_PluginManager_AddRelPath(pm,
                                      AB_PM_LIBNAME,
                                      AQBANKING_PLUGINS
                                      DIRSEP
                                      AB_IMEXPORTER_FOLDER,
                                      GWEN_PathManager_RelModeExe);
#else
        /* add absolute folder */
        GWEN_PluginManager_AddPath(pm,
                                   AB_PM_LIBNAME,
                                   AQBANKING_PLUGINS
                                   DIRSEP
                                   AB_IMEXPORTER_FOLDER);
#endif
        ab_pluginManagerImExporter=pm;


        /* insert DBIO plugin folder */
        pm=GWEN_PluginManager_FindPluginManager("dbio");
        if (pm) {
#if defined(OS_WIN32) || defined(ENABLE_LOCAL_INSTALL)
            /* insert folder relative to EXE */
            GWEN_PluginManager_InsertRelPath(pm,
                                             AB_PM_LIBNAME,
                                             AQBANKING_PLUGINS
                                             DIRSEP
                                             AB_DBIO_FOLDER,
                                             GWEN_PathManager_RelModeExe);
#else
            /* add absolute folder */
            GWEN_PluginManager_InsertPath(pm,
                                          AB_PM_LIBNAME,
                                          AQBANKING_PLUGINS
                                          DIRSEP
                                          AB_DBIO_FOLDER);
#endif
        }
        else {
            DBG_ERROR(AQBANKING_LOGDOMAIN,
                      "Could not find DBIO plugin manager, maybe GWEN_Init() was not called?");
            return GWEN_ERROR_GENERIC;
        }


        ab_imexporters=AB_ImExporter_List_new();
        ab_bankInfoPlugins=AB_BankInfoPlugin_List_new();
    }
    ab_plugin_init_count++;
    return 0;
}