示例#1
0
void UnloadNewPluginsModule(void)
{
	int i;

	if ( !bModuleInitialized ) return;

	// unload everything but the DB
	for ( i = pluginList.getCount()-1; i >= 0; i-- ) {
		pluginEntry* p = pluginList[i];
		if ( !(p->pclass & PCLASS_DB) && p != pluginList_crshdmp )
			Plugin_Uninit( p );
	}

    if ( pluginList_crshdmp )
		Plugin_Uninit( pluginList_crshdmp );

	// unload the DB
	for ( i = pluginList.getCount()-1; i >= 0; i-- ) {
		pluginEntry* p = pluginList[i];
		Plugin_Uninit( p );
	}

	if ( hPluginListHeap ) HeapDestroy(hPluginListHeap);
	hPluginListHeap=0;

	pluginList.destroy();
	pluginListAddr.destroy();
	UninitIni();
}
示例#2
0
void RebuildListsBasedOnGroups(LIST<ExtraIconGroup> &groups)
{
	extraIconsByHandle.destroy();

	for (int i=0; i < registeredExtraIcons.getCount(); i++)
		extraIconsByHandle.insert(registeredExtraIcons[i]);

	for (int k=0; k < extraIconsBySlot.getCount(); k++) {
		ExtraIcon *extra = extraIconsBySlot[k];
		if (extra->getType() == EXTRAICON_TYPE_GROUP)
			delete extra;
	}
	extraIconsBySlot.destroy();

	for (int i=0; i < groups.getCount(); i++) {
		ExtraIconGroup *group = groups[i];

		for (int j = 0; j < group->m_items.getCount(); j++)
			extraIconsByHandle.put(group->m_items[j]->getID()-1, group);

		extraIconsBySlot.insert(group);
	}

	for (int k=0; k < extraIconsByHandle.getCount(); k++) {
		ExtraIcon *extra = extraIconsByHandle[k];
		if (extra->getType() != EXTRAICON_TYPE_GROUP)
			extraIconsBySlot.insert(extra);
	}
}
示例#3
0
	~TTreeList_ItemInfo()
	{
		int i;
		for (i = text.getCount(); i--; )
			mir_free(text[i]);
		text.destroy();
		for (i = subItems.getCount(); i--; )
			delete subItems[i];
		subItems.destroy();
	}
示例#4
0
void  RichEditData_Destroy(void)
{
	int i;
	for (i=g_RichEditList.getCount()-1; i >= 0; i--) 
		CloseRichCallback(g_RichEditList[i]->hwnd);
	g_RichEditList.destroy();

	for (i=g_RichEditOwnerList.getCount()-1; i >= 0; i--) 
		CloseRichOwnerCallback(g_RichEditOwnerList[i]->hwnd);
	g_RichEditOwnerList.destroy();
}
示例#5
0
void FreeResidentSettings()
{
	for (int i = 0; i < m_lResidentSettings.getCount(); i++) {
		mir_free(m_lResidentSettings[i]);
	}
	m_lResidentSettings.destroy();

	for (int i = 0; i < m_lResidentModules.getCount(); i++) {
		mir_free(m_lResidentModules[i]);
	}
	m_lResidentModules.destroy();
}
示例#6
0
void UnloadNetlibModule(void)
{
	if (!bModuleInitialized) return;

	if (hConnectionHeaderMutex != NULL)
	{
		int i;

		NetlibUnloadIeProxy();
		NetlibSecurityDestroy();
		NetlibUPnPDestroy();
		NetlibLogShutdown();

		DestroyHookableEvent(hRecvEvent); hRecvEvent = NULL;
		DestroyHookableEvent(hSendEvent); hSendEvent = NULL;

		for (i = netlibUser.getCount(); i > 0; i--)
			NetlibCloseHandle((WPARAM)netlibUser[i-1], 0);

		netlibUser.destroy();

		CloseHandle(hConnectionHeaderMutex);
		if (hConnectionOpenMutex) CloseHandle(hConnectionOpenMutex);
		DeleteCriticalSection(&csNetlibUser);
		WSACleanup();
	}	
}
示例#7
0
int MO_RemoveAllObjects()
{
	for (int i = 0; i < g_menus.getCount(); i++)
		delete g_menus[i];
	g_menus.destroy();
	return 0;
}
示例#8
0
void UnloadLangPackModule()
{
	if (!bModuleInitialized) return;

	int i;
	for (i = 0; i < lMuuids.getCount(); i++)
		mir_free(lMuuids[i]);
	lMuuids.destroy();

	LangPackEntry *p = g_pEntries;
	for (i = 0; i < g_entryCount; i++, p++) {
		if (p->pNext != NULL) {
			for (LangPackEntry *p1 = p->pNext; p1 != NULL;) {
				LangPackEntry *p2 = p1; p1 = p1->pNext;
				mir_free(p2->szLocal);
				mir_free(p2->wszLocal);
				mir_free(p2);
			}
		}

		mir_free(p->szLocal);
		mir_free(p->wszLocal);
	}

	if (g_entryCount) {
		mir_free(g_pEntries);
		g_pEntries = 0;
		g_entryCount = g_entriesAlloced = 0;
	}

	langPack.tszFileName[0] = langPack.tszFullPath[0] = 0;
}
示例#9
0
MIR_CORE_DLL(INT_PTR) Thread_Pop()
{
	if (WaitForSingleObject(hStackMutex, INFINITE) == WAIT_OBJECT_0) {
		DWORD dwThreadId = GetCurrentThreadId();
		for (int j = 0; j < threads.getCount(); j++) {
			THREAD_WAIT_ENTRY *p = threads[j];
			if (p->dwThreadId == dwThreadId) {
				SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
				CloseHandle(p->hThread);
				threads.remove(j);
				mir_free(p);

				if (!threads.getCount()) {
					threads.destroy();
					ReleaseMutex(hStackMutex);
					SetEvent(hThreadQueueEmpty); // thread list is empty now
					return 0;
				}

				ReleaseMutex(hStackMutex);
				return 0;
			}
		}
		ReleaseMutex(hStackMutex);
	}
	return 1;
}
示例#10
0
void FreeTypes()
{
	// Destroy services
	int i;
	for(i = 0; i < MAX_REGS(hServices); ++i)
		DestroyServiceFunction(hServices[i]);

	// Free internal structs
	for(i = 0; i < types.getCount(); i++)
	{
		SPEAK_TYPE *type = types[i];
		mir_free((void *) type->module);
		mir_free((void *) type->name);
		mir_free((void *) type->icon);

		if (type->numTemplates > 0)
		{
			for(int i = 0; i < type->numTemplates; i++)
				mir_free((void *) type->templates[i]);
			mir_free(type->templates);
		}

		mir_free(type);
	}

	types.destroy();
}
示例#11
0
// Free the list returned by GetAvaibleDictionaries
void FreeDictionaries(LIST<Dictionary> &dicts)
{
	for (int i = 0; i < dicts.getCount(); i++)
	{
		delete dicts[i];
	}
	dicts.destroy();
}
示例#12
0
void freeSupportedProtocols()
{
	for (int j=0; j < arProto.getCount(); j++) {
		mir_free(arProto[j]->name);
		mir_free(arProto[j]);
	}

	arProto.destroy();
}
示例#13
0
extern "C" int __declspec(dllexport) Unload(void)
{
	LOG(( "Unload" ));
	
	YmsgrLinksUninit();
	Netlib_CloseHandle( g_hNetlibUser );
	g_instances.destroy();
	return 0;
}
示例#14
0
void msgQueue_destroy(void)
{
    for (int i = 0; i < msgQueue.getCount(); i++) {
        TMsgQueue *item = msgQueue[i];
        mir_free(item->szMsg);
        mir_free(item);
    }
    msgQueue.destroy();
}
示例#15
0
extern "C" int __declspec(dllexport) Unload(void)
{
	UninitContactMenus();
	UninitIcons();
	UninitTimers();

	g_Instances.destroy();
	
	return 0;
}
示例#16
0
extern "C" int __declspec( dllexport ) Unload( void )
{
    UnhookEvent(hModulesLoaded);
    UnhookEvent(hModulesLoadedTB);

    g_MenuUninit();

    g_Instances.destroy();
    return 0;
}
示例#17
0
void UnloadPopupThread()
{
	//  We won't waint for thread to exit, Miranda's thread unsind mechanism will do that for us.
	WaitForSingleObject(hThread, INFINITE);
	CloseHandle(hThread);

	for (int i = 0; i < popupList.getCount(); ++i)
		delete popupList[i];
	popupList.destroy();
}
示例#18
0
void msgQueue_destroy(void)
{
	for (int i = 0; i < msgQueue.getCount(); i++) {
		TMsgQueue *item = msgQueue[i];
		mir_free(item->szMsg);
		mir_free(item);
	}
	msgQueue.destroy();

	DeleteCriticalSection(&csMsgQueue);
}
示例#19
0
void SvcFlagsUnloadModule()
{
	//Uninit message winsow
	for (int i = 0; i < gMsgWndList.getCount(); i++) {
		//this should not happen
		delete gMsgWndList[i];
		gMsgWndList.remove(i);
	}
	gMsgWndList.destroy();

	// Uninit misc
	UninitIcons();
}
示例#20
0
// free list of secureIM users
void freeContactList()
{
	for (int j=0; j < arClist.getCount(); j++) {
		pUinKey p = arClist[j];
		cpp_delete_context(p->cntx); p->cntx = 0;
		mir_free(p->tmp);
		mir_free(p->msgSplitted);
		mir_free(p);
	}
	arClist.destroy();

	freeSupportedProtocols();
}
示例#21
0
static int OnContactMenuBuild(WPARAM wParam, LPARAM)
{
	int i;
	OBJLIST<GroupItemSort> groups(10, GroupItemSort::compare);

	if (!hMoveToGroupItem) {
		CMenuItem mi;
		SET_UID(mi, 0x403c548, 0x4ac6, 0x4ced, 0xa7, 0x6c, 0x4e, 0xb9, 0xc8, 0xba, 0x94, 0x5);
		mi.position = 100000;
		mi.name.a = LPGEN("&Move to group");
		mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUP);

		hMoveToGroupItem = Menu_AddContactMenuItem(&mi);
	}

	for (i=0; i < lphGroupsItems.getCount(); i++)
		Menu_RemoveItem((HGENMENU)lphGroupsItems[i]);
	lphGroupsItems.destroy();

	ptrT szContactGroup(db_get_tsa(wParam, "CList", "Group"));

	int pos = 1000;

	AddGroupItem(hMoveToGroupItem, TranslateT("<Root group>"), pos, -1, !szContactGroup);

	pos += 100000; // Separator

	for (i=0; ; i++) {
		char intname[20];
		_itoa(i, intname, 10);

		DBVARIANT dbv;
		if (db_get_ts(NULL, "CListGroups", intname, &dbv))
			break;

		if (dbv.ptszVal[0])
			groups.insert(new GroupItemSort(dbv.ptszVal + 1, i + 1));

		mir_free(dbv.ptszVal);
	}

	for (i=0; i < groups.getCount(); i++) {
		bool checked = szContactGroup && !mir_tstrcmp(szContactGroup, groups[i].name);
		AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked);
	}

	return 0;
}
示例#22
0
static int OnContactMenuBuild(WPARAM wParam, LPARAM)
{
	int i;
	OBJLIST<GroupItemSort> groups(10, GroupItemSort::compare);

	if (!hMoveToGroupItem) {
		CLISTMENUITEM mi = { sizeof(mi) };
		mi.position = 100000;
		mi.pszName = LPGEN("&Move to group");
		mi.flags = CMIF_ROOTHANDLE;
		mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_GROUP);

		hMoveToGroupItem = Menu_AddContactMenuItem(&mi);
	}

	for (i=0; i < lphGroupsItems.getCount(); i++)
		CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)lphGroupsItems[i], 0);
	lphGroupsItems.destroy();

	ptrT szContactGroup( db_get_tsa((HANDLE)wParam, "CList", "Group"));

	int pos = 1000;

	AddGroupItem(hMoveToGroupItem, TranslateT("<Root group>"), pos, -1, !szContactGroup);

	pos += 100000; // Separator

	for (i=0; ; i++) {
		char intname[20];
		_itoa(i, intname, 10);

		DBVARIANT dbv;
		if (db_get_ts(NULL, "CListGroups", intname, &dbv))
			break;

		if (dbv.ptszVal[0])
			groups.insert(new GroupItemSort(dbv.ptszVal + 1, i + 1));

		mir_free(dbv.ptszVal);
	}

	for (i=0; i < groups.getCount(); i++) {
		bool checked = szContactGroup && !_tcscmp(szContactGroup, groups[i].name);
		AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked);
	}

	return 0;
}
示例#23
0
void RemoveDialogBoxHook(void)
{
	if (g_hHookMsgWnd) UnhookEvent(g_hHookMsgWnd);
	if (g_hMessageHookPre) UnhookWindowsHookEx(g_hMessageHookPre);

	WaitForSingleObject(g_hMutex, 2000);
	for (int i=0; i<g_MsgWndList.getCount(); i++) 
		delete g_MsgWndList[i];
	g_MsgWndList.destroy();
	ReleaseMutex(g_hMutex);

	if (g_hMutex) CloseHandle(g_hMutex);

	g_hHookMsgWnd = NULL;
	g_hMessageHookPre = NULL;
	g_hMutex = NULL;
}
示例#24
0
void UnloadEventsModule()
{
	int i;

	if ( !bModuleInitialized ) return;

	for ( i=0; i < eventTypes.getCount(); i++ ) {
		DBEVENTTYPEDESCR* p = eventTypes[i];
		mir_free( p->module );
		mir_free( p->descr );
		mir_free( p->textService );
		mir_free( p->iconService );
		mir_free( p );
	}

	eventTypes.destroy();
}
示例#25
0
static void CALLBACK KillAllThreads(HWND, UINT, UINT_PTR, DWORD)
{
	if (MirandaWaitForMutex(hStackMutex)) {
		for (int j = 0; j < threads.getCount(); j++) {
			THREAD_WAIT_ENTRY *p = threads[j];
			char szModuleName[MAX_PATH];
			GetModuleFileNameA(p->hOwner, szModuleName, sizeof(szModuleName));
			Netlib_Logf(0, "Killing thread %s:%p (%p)", szModuleName, p->dwThreadId, p->pEntryPoint);
			TerminateThread(p->hThread, 9999);
			CloseHandle(p->hThread);
			mir_free(p);
		}

		threads.destroy();

		ReleaseMutex(hStackMutex);
		SetEvent(hThreadQueueEmpty);
	}
}
示例#26
0
int deinitTokenRegister()
{
	for (int i = 0; i < tokens.getCount(); i++) {
		TokenRegisterEntry *tre = tokens[i];
		if (!(tre->tr.flags & TRF_PARSEFUNC) && tre->tr.szService != NULL)
			mir_free(tre->tr.szService);

		if (tre->tr.tszTokenString != NULL)
			mir_free(tre->tr.tszTokenString);

		if (tre->tr.szHelpText != NULL)
			mir_free(tre->tr.szHelpText);

		if ((tre->tr.flags & TRF_CLEANUP) && !(tre->tr.flags & TRF_CLEANUPFUNC) && tre->tr.szCleanupService != NULL)
			mir_free(tre->tr.szCleanupService);

		mir_free(tre);
	}
	tokens.destroy();

	return 0;
}
示例#27
0
extern "C" int __declspec(dllexport) Unload(void)
{
	// Shutdown cleanup
	{
		Lock l(cs);
		for (int i = FlashList.getCount()-1; i >= 0; i--)
		{
			flash_avatar_item *item = FlashList[i];
			if (item->pFlash)
				item->pFlash->Release();
			if (item->hFA.hWindow)
				DestroyWindow(item->hFA.hWindow);
			mir_free(item->hFA.cUrl);
			delete item;
		}
		FlashList.destroy();
	}

	if (hNetlibUser)
		CallService(MS_NETLIB_CLOSEHANDLE, (WPARAM)hNetlibUser, 0);

	return 0;
}
示例#28
0
static int OnContactMenuBuild(WPARAM wParam, LPARAM)
{
	OBJLIST<GroupItemSort> groups(10, GroupItemSort::compare);
	for (int i = 0; i < lphGroupsItems.getCount(); i++)
		Menu_RemoveItem((HGENMENU)lphGroupsItems[i]);
	lphGroupsItems.destroy();

	ptrT szContactGroup(db_get_tsa(wParam, "CList", "Group"));

	int pos = 1000;

	AddGroupItem(hMoveToGroupItem, TranslateT("<Root group>"), pos, -1, !szContactGroup);

	pos += 100000; // Separator

	for (int i = 0;; i++) {
		char intname[20];
		_itoa(i, intname, 10);

		DBVARIANT dbv;
		if (db_get_ts(NULL, "CListGroups", intname, &dbv))
			break;

		if (dbv.ptszVal[0])
			groups.insert(new GroupItemSort(dbv.ptszVal + 1, i + 1));

		mir_free(dbv.ptszVal);
	}

	for (int i = 0; i < groups.getCount(); i++) {
		bool checked = szContactGroup && !mir_tstrcmp(szContactGroup, groups[i].name);
		AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked);
	}

	return 0;
}
示例#29
0
static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch ( msg ) {
	case WM_INITDIALOG:
		TranslateDialogDefault( hwndDlg );

		arNewClasses = arClasses;
		{
			int index;
			for (int i = 0; i < arNewClasses.getCount(); i++) {
				POPUPCLASS *pc = arNewClasses[i];
				if (pc->flags & PCF_UNICODE)
					index = SendDlgItemMessageW(hwndDlg, IDC_LST_CLASSES, LB_ADDSTRING, 0, (LPARAM)pc->pwszDescription);
				else
					index = SendDlgItemMessageA(hwndDlg, IDC_LST_CLASSES, LB_ADDSTRING, 0, (LPARAM)pc->pszDescription);

				SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_SETITEMDATA, index, i);
			}
		}
		return FALSE;

	case WM_COMMAND:
		if ( LOWORD(wParam) == IDC_LST_CLASSES && HIWORD(wParam) == LBN_SELCHANGE) {
			int index = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETCURSEL, 0, 0);
			EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_PREVIEW), index != -1);
			EnableWindow(GetDlgItem(hwndDlg, IDC_COL_TEXT), index != -1);
			EnableWindow(GetDlgItem(hwndDlg, IDC_COL_BG), index != -1);
			EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_TIMEOUT), index != -1);
			if (index != -1) {
				int i = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETITEMDATA, index, 0);
				SendDlgItemMessage(hwndDlg, IDC_COL_TEXT, CPM_SETCOLOUR, 0, (LPARAM)arNewClasses[i]->colorText);
				SendDlgItemMessage(hwndDlg, IDC_COL_BG, CPM_SETCOLOUR, 0, (LPARAM)arNewClasses[i]->colorBack);
				CheckDlgButton(hwndDlg, IDC_CHK_TIMEOUT, arNewClasses[i]->iSeconds != -1);
				SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, arNewClasses[i]->iSeconds, TRUE);
			}
			EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TIMEOUT), index != -1 && IsDlgButtonChecked(hwndDlg, IDC_CHK_TIMEOUT));
			return TRUE;
		}
		if ( HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
			int index = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETCURSEL, 0, 0);
			if (index != -1) {
				int i = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETITEMDATA, index, 0);
				BOOL tr;
				int t = GetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, &tr, FALSE);
				arNewClasses[i]->iSeconds = t;

				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			}
		}
		else {
			int index = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETCURSEL, 0, 0);
			if (index != -1) {
				int i = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETITEMDATA, index, 0);
				switch(LOWORD(wParam)) {
				case IDC_CHK_TIMEOUT: 
					{
						BOOL isChecked = IsDlgButtonChecked(hwndDlg, IDC_CHK_TIMEOUT);
						EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TIMEOUT), isChecked);
						if (isChecked) arNewClasses[i]->iSeconds = 0;
						else arNewClasses[i]->iSeconds = -1;
						SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, arNewClasses[i]->iSeconds, TRUE);
					}
					SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0);
					break;

				case IDC_COL_TEXT:
					arNewClasses[i]->colorText = SendDlgItemMessage(hwndDlg, IDC_COL_TEXT, CPM_GETCOLOUR, 0, 0);
					SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0);
					break;

				case IDC_COL_BG:
					arNewClasses[i]->colorBack = SendDlgItemMessage(hwndDlg, IDC_COL_BG, CPM_GETCOLOUR, 0, 0);
					SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0);
					break;

				case IDC_BTN_PREVIEW:
					if (arNewClasses[i]->flags & PCF_UNICODE) {
						POPUPCLASS pc = *arNewClasses[i];
						pc.PluginWindowProc = 0;
						POPUPDATACLASS d = {sizeof(d), pc.pszName};
						d.pwszTitle = L"Preview";
						d.pwszText = L"The quick brown fox jumps over the lazy dog.";
						CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)&pc, (LPARAM)&d);
					}
					else {
						POPUPCLASS pc = *arNewClasses[i];
						pc.PluginWindowProc = 0;
						POPUPDATACLASS d = {sizeof(d), pc.pszName};
						d.pszTitle = "Preview";
						d.pszText = "The quick brown fox jumps over the lazy dog.";
						CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)&pc, (LPARAM)&d);
					}
					break;
				}
			}
		}
		break;

	case WM_NOTIFY:
		if (((LPNMHDR)lParam)->code == PSN_APPLY) {
			arClasses = arNewClasses;
			char setting[256];
			for (int i = 0; i < arClasses.getCount(); i++) {
				POPUPCLASS *pc = arClasses[i];
				mir_snprintf(setting, 256, "%s/Timeout", pc->pszName);
				db_set_w(0, MODULE, setting, pc->iSeconds);
				mir_snprintf(setting, 256, "%s/TextCol", pc->pszName);
				db_set_dw(0, MODULE, setting, (DWORD)pc->colorText);
				mir_snprintf(setting, 256, "%s/BgCol", pc->pszName);
				db_set_dw(0, MODULE, setting, (DWORD)pc->colorBack);
			}
			return TRUE;
		}
		break;

	case WM_DESTROY:
		arNewClasses.destroy();
		break;
	}
	return 0;
}
示例#30
0
void UnhookProtoEvents(void)
{
	for (int i = 0; i < arProtoHooks.getCount(); ++i)
		UnhookEvent( arProtoHooks[i] );
	arProtoHooks.destroy();
}