Esempio n. 1
0
int LoadNewPluginsModuleInfos(void)
{
	bModuleInitialized = TRUE;

	hPluginListHeap=HeapCreate(HEAP_NO_SERIALIZE, 0, 0);
	mirandaVersion = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0);
	//
	CreateServiceFunction(MS_PLUGINS_ENUMDBPLUGINS, PluginsEnum);
	CreateServiceFunction(MS_PLUGINS_GETDISABLEDEFAULTARRAY, PluginsGetDefaultArray);
	// make sure plugins can get internal core APIs
	pluginCoreLink.CallService                    = CallService;
	pluginCoreLink.ServiceExists                  = ServiceExists;
	pluginCoreLink.CreateServiceFunction          = CreateServiceFunction;
	pluginCoreLink.CreateServiceFunctionParam     = CreateServiceFunctionParam;
	pluginCoreLink.CreateServiceFunctionObj       = CreateServiceFunctionObj;
	pluginCoreLink.CreateServiceFunctionObjParam  = CreateServiceFunctionObjParam;
	pluginCoreLink.CreateTransientServiceFunction = CreateServiceFunction;
	pluginCoreLink.DestroyServiceFunction         = DestroyServiceFunction;
	pluginCoreLink.CreateHookableEvent            = CreateHookableEvent;
	pluginCoreLink.DestroyHookableEvent           = DestroyHookableEvent;
	pluginCoreLink.HookEvent                      = HookEvent;
	pluginCoreLink.HookEventParam                 = HookEventParam;
	pluginCoreLink.HookEventObj                   = HookEventObj;
	pluginCoreLink.HookEventObjParam              = HookEventObjParam;
	pluginCoreLink.HookEventMessage               = HookEventMessage;
	pluginCoreLink.UnhookEvent                    = UnhookEvent;
	pluginCoreLink.NotifyEventHooks               = NotifyEventHooks;
	pluginCoreLink.SetHookDefaultForHookableEvent = SetHookDefaultForHookableEvent;
	pluginCoreLink.CallServiceSync                = CallServiceSync;
	pluginCoreLink.CallFunctionAsync              = CallFunctionAsync;
	pluginCoreLink.NotifyEventHooksDirect         = CallHookSubscribers;
	pluginCoreLink.CallProtoService               = CallProtoService;
	pluginCoreLink.CallContactService             = CallContactService;
	pluginCoreLink.KillObjectServices             = KillObjectServices;
	pluginCoreLink.KillObjectEventHooks           = KillObjectEventHooks;

	// remember where the mirandaboot.ini goes
	pathToAbsoluteT(_T("mirandaboot.ini"), mirandabootini, NULL);
	// look for all *.dll's
	enumPlugins(scanPluginsDir, 0, 0);
	// the database will select which db plugin to use, or fail if no profile is selected
	if (LoadDatabaseModule()) return 1;
	InitIni();
	//  could validate the plugin entries here but internal modules arent loaded so can't call Load() in one pass
	return 0;
}
Esempio n. 2
0
// returns 0 if all the APIs are injected otherwise, 1
static int LoadDatabase( char * profile, void * plink )
{
	PLUGINLINK *link = plink;
#ifdef _DEBUG
	_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
	// don't need thread notifications
	strncpy(szDbPath, profile, sizeof(szDbPath));

	// this is like Load()'s pluginLink
	pluginLink=link;

	// set the memory, lists & UTF8 manager
	mir_getLI( &li );
	mir_getMMI( &mmi );
	mir_getUTFI( &utfi );
	mir_getLP( &pluginInfo );

	// inject all APIs and hooks into the core
	return LoadDatabaseModule();
}
Esempio n. 3
0
int LoadDefaultModules(void)
{
	// load order is very important for these
	if (LoadSystemModule()) return 1;
	if (LoadLangPackModule()) return 1;		// langpack will be a system module in the new order so this is moved here
	if (CheckRestart()) return 1;
	if (LoadUtilsModule()) return 1;		//order not important for this, but no dependencies and no point in pluginising
	if (LoadIcoTabsModule()) return 1;
	if (LoadHeaderbarModule()) return 1;
	if (LoadDbintfModule()) return 1;
	if (LoadEventsModule()) return 1;

	// load database drivers & service plugins without executing their Load()
	if (LoadNewPluginsModuleInfos()) return 1;

	switch (LoadDefaultServiceModePlugin()) {
	case SERVICE_CONTINUE:  // continue loading Miranda normally
	case SERVICE_ONLYDB:    // load database and go to the message cycle
		break;
	case SERVICE_MONOPOLY:  // unload database and go to the message cycle
		return 0;
	default:                // smth went wrong, terminating
		return 1;
	}

	// the database will select which db plugin to use, or fail if no profile is selected
	if (LoadDatabaseModule()) return 1;

	// database is available here
	if (LoadButtonModule()) return 1;
	if (LoadIcoLibModule()) return 1;
	if (LoadSkinIcons()) return 1;

	//	if (LoadErrorsModule()) return 1;

	switch (LoadServiceModePlugin()) {
	case SERVICE_CONTINUE:  // continue loading Miranda normally
		break;
	case SERVICE_ONLYDB:    // load database and go to the message cycle
		return 0;
	case SERVICE_MONOPOLY:  // unload database and go to the message cycle
		UnloadDatabase();
		return 0;
	default:                // smth went wrong, terminating
		return 1;
	}

	if (LoadSkinSounds()) return 1;
	if (LoadSkinHotkeys()) return 1;
	if (LoadFontserviceModule()) return 1;
	if (LoadSrmmModule()) return 1;
	if (LoadChatModule()) return 1;
	if (LoadDescButtonModule()) return 1;
	if (LoadOptionsModule()) return 1;
	if (LoadNetlibModule()) return 1;
	if (LoadSslModule()) return 1;
	if (LoadProtocolsModule()) return 1;
	LoadDbAccounts();                    // retrieves the account array from a database
	if (LoadContactsModule()) return 1;
	if (LoadContactListModule()) return 1;   // prepare contact list interface
	if (LoadAddContactModule()) return 1;
	if (LoadMetacontacts()) return 1;

	if (LoadNewPluginsModule()) return 1;    // will call Load(void) on everything, clist will load first

	Langpack_SortDuplicates();

	if (LoadAccountsModule()) return 1;

	//order becomes less important below here
	if (LoadFindAddModule()) return 1;
	if (LoadIgnoreModule()) return 1;
	if (LoadVisibilityModule()) return 1;
	if (LoadStdPlugins()) return 1;
	return 0;
}