Example #1
0
BOOL WINAPI get_mozilla_profile(LPCWSTR app, LPWSTR in_dir, size_t len)
{
    BOOL  sz_name = is_thunderbird();
    in_dir[0] = L'\0';
    if (sz_name)
    {
        _snwprintf(in_dir,len,L"%ls%ls",app,L"\\Thunderbird\\profiles.ini");
    }
    else if (is_browser())
    {
        _snwprintf(in_dir,len,L"%ls%ls",app,L"\\Mozilla\\Firefox\\profiles.ini");
        sz_name = TRUE;
    }
    return sz_name;
}
Example #2
0
unsigned WINAPI bosskey_thread(void * lparam)
{
	MSG msg;
	LPWNDINFO lpInfo = (LPWNDINFO)lparam;
	set_hotkey(lpInfo);
	if ( is_browser()  || is_thunderbird() )
	{
		if ( init_bosskey(lpInfo) )
		{
			while( GetMessageW(&msg, NULL, 0, 0) > 0 )
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
				EnumWindows(find_chwnd, (LPARAM)lpInfo);
			}
		}
	}
	return (1);
}
Example #3
0
BOOL init_bosskey(LPWNDINFO pInfo)
{
	WCHAR	win_titiles[BUFSIZE+1];
	while ( !pInfo->hFF )                 /* 等待主窗口并获取句柄 */
	{
		HWND hwnd_pre = FindWindowExW( NULL, NULL, L"MozillaWindowClass", NULL );
		while (NULL != hwnd_pre)
		{
			int n = GetWindowTextW(hwnd_pre, win_titiles, BUFSIZE);
			if ( n>0 && n < BUFSIZE)
			{
				win_titiles[n] = L'\0';
				if (  stristrW(win_titiles, L"- Mozilla Thunderbird") )
				{
					/* 获取thunderbird窗体句柄 */
					pInfo->hFF = is_thunderbird()?hwnd_pre:NULL;
				}
				else
				{
					/* 获取firefox窗体句柄 */
					pInfo->hFF = is_browser()?hwnd_pre:NULL;
				}
			}
			if (pInfo->hFF)
			{
				break;
			}
			hwnd_pre = FindWindowExW(NULL, hwnd_pre, L"MozillaWindowClass", NULL);
		}
		Sleep(800);
	}
	if ( pInfo->hFF )
	{
		WCHAR atom_str[VALUE_LEN+1] = {0};
		GetModuleFileNameW(NULL,atom_str,VALUE_LEN);
		GetWindowThreadProcessId(pInfo->hFF, &pInfo->pFF);
		pInfo->atom_str = GlobalAddAtomW(atom_str)-0xC000;
	}
	return RegisterHotKey(NULL, pInfo->atom_str, pInfo->key_mod, pInfo->key_vk);
}
Example #4
0
void WINAPI do_it(void)
{
	HANDLE		 hc = NULL;
	UINT_PTR	 dwCaller = 0;
#ifdef _LOGDEBUG
	if ( GetEnvironmentVariableA("APPDATA",logfile_buf,MAX_PATH) > 0 )
	{
		strncat(logfile_buf,"\\",1);
		strncat(logfile_buf,LOG_FILE,strlen((LPCSTR)LOG_FILE));
	}
#endif
	if (!dll_module)
	{
	#ifdef __GNUC__
		dwCaller = (UINT_PTR)__builtin_return_address(0);
	#else
		dwCaller = (UINT_PTR)_ReturnAddress();
	#endif
	}
	if (dwCaller)
	{
		GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)dwCaller, &dll_module);
	}
	if ( read_appint(L"General",L"SafeEx") > 0 )
	{
		init_safed(NULL);
	}
	if ( read_appint(L"General", L"Portable") > 0 )
	{
		env_thread = (HANDLE)_beginthreadex(NULL,0,&init_global_env,NULL,0,NULL);
		if (env_thread) 
		{
			SetThreadPriority(env_thread,THREAD_PRIORITY_HIGHEST);
			init_portable(NULL);
		}
	}
	if ( is_browser() || is_thunderbird() )
	{
		if ( read_appint(L"General",L"GdiBatchLimit") > 0 )
		{
			hc = OpenThread(THREAD_ALL_ACCESS, 0, GetCurrentThreadId());
			if (hc)
			{
				CloseHandle((HANDLE)_beginthreadex(NULL,0,&GdiSetLimit_tt,hc,0,NULL));
			}
		}
		if ( read_appint(L"General",L"ProcessAffinityMask") > 0 )
		{
			hc = OpenThread(THREAD_ALL_ACCESS, 0, GetCurrentThreadId());
			if (hc)
			{
				CloseHandle((HANDLE)_beginthreadex(NULL,0,&SetCpuAffinity_tt,hc,0,NULL));
			}
		}
		if ( read_appint(L"General",L"CreateCrashDump") > 0 )
		{
			CloseHandle((HANDLE)_beginthreadex(NULL,0,&init_exeception,NULL,0,NULL));
		}
		if ( read_appint(L"General", L"Bosskey") > 0 )
		{
			CloseHandle((HANDLE)_beginthreadex(NULL,0,&bosskey_thread,&ff_info,0,NULL));
		}
		CloseHandle((HANDLE)_beginthreadex(NULL,0,&SetPluginPath,NULL,0,NULL));
	}
}