void UpdateChecker::Run() { // no initialization to do, so signal readiness immediately SignalReady(); try { #ifdef _DEBUG const std::string url = "https://s3.amazonaws.com/qvivo_releases/v2/win32/testing/appcast.xml"; #else const std::string url = Settings::GetAppcastURL(); #endif if ( url.empty() ) throw std::runtime_error("Appcast URL not specified."); StringDownloadSink appcast_xml; DownloadFile(url, &appcast_xml, GetAppcastDownloadFlags()); Appcast appcast; appcast.Load(appcast_xml.data); Settings::WriteConfigValue("LastCheckTime", time(NULL)); const std::string currentVersion = WideToAnsi(Settings::GetAppVersion()); std::string currentBuild = currentVersion.substr(currentVersion.find(":") + 1); std::string appcastBuild = appcast.Build.substr(appcast.Build.find(":") + 1); std::string currentProductionVersion = currentVersion.substr(0, currentVersion.find(",")); std::string appcastProductionVersion = appcast.Build.substr(0, appcast.Build.find(",")); // Check if our version is out of date. if ( CompareVersions(currentProductionVersion, appcastProductionVersion) >= 0 ) { // The same or newer version is already installed. if(m_showUI) UI::NotifyNoUpdates(); return; } // Check if the user opted to ignore this particular version. std::string toSkip; if ( Settings::ReadConfigValue("SkipThisVersion", toSkip) && toSkip == appcast.Version ) { if(m_showUI) UI::NotifyNoUpdates(); return; } UI::NotifyUpdateAvailable(appcast); } catch ( ... ) { UI::NotifyUpdateError(); throw; } }
static NTSTATUS SilentUpdateCheckThreadStart( __in PVOID Parameter ) { if (ConnectionAvailable()) { if (QueryXmlData()) { ULONG majorVersion = 0; ULONG minorVersion = 0; // Get the current Process Hacker version PhGetPhVersionNumbers(&majorVersion, &minorVersion, NULL, NULL); // Compare the current version against the latest available version if (CompareVersions(UpdateData.MajorVersion, UpdateData.MinorVersion, majorVersion, minorVersion) > 0) { // Don't spam the user the second they open PH, delay dialog creation for 3 seconds. Sleep(3 * 1000); // Show the dialog asynchronously on a new thread. ShowUpdateDialog(); } } FreeXmlData(); } return STATUS_SUCCESS; }
//zarafaclient-6.20-1234.msi //zarafaclient-*.*-*.msi bool GetLatestVersionAtServer(char *szUpdatePath, unsigned int ulTrackid, ClientVersion *lpLatestVersion) { ClientVersion tempVersion = {0}; ClientVersion latestVersion = {0}; std::string strFileStart = "zarafaclient-"; bool bRet = false; if (szUpdatePath == NULL) goto exit; try { bfs::path updatesdir = szUpdatePath; if (!bfs::exists(updatesdir)) { g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, Unable to open client_update_path directory", ulTrackid); goto exit; } bfs::directory_iterator update_last; for (bfs::directory_iterator update(updatesdir); update != update_last; update++) { const bfs::file_type file_type = update->status().type(); if (file_type != bfs::regular_file && file_type != bfs::symlink_file) { continue; } const std::string strFilename = filename_from_path(update->path()); if (!ba::starts_with(strFilename, strFileStart)) { g_lpLogger->Log(EC_LOGLEVEL_DEBUG, "Client update: trackid: 0x%08X, Ignoring file %s for client update", ulTrackid, strFilename.c_str()); continue; } g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: trackid: 0x%08X, Update Name: %s", ulTrackid, strFilename.c_str()); const char *pTemp = strFilename.c_str() + strFileStart.length(); if (!GetVersionFromMSIName(pTemp, &tempVersion)) { g_lpLogger->Log(EC_LOGLEVEL_WARNING, "Client update: trackid: 0x%08X, Failed in getting version from string '%s'", ulTrackid, pTemp); continue; } // first time, latestVersion will be 0, so always older if (CompareVersions(latestVersion, tempVersion) < 0) { bRet = true; latestVersion = tempVersion; } } } catch (const bfs::filesystem_error &e) { g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: trackid: 0x%08X, Boost exception during certificate validation: %s", ulTrackid, e.what()); } catch (const std::exception &e) { g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: trackid: 0x%08X, STD exception during certificate validation: %s", ulTrackid, e.what()); } if (bRet) *lpLatestVersion = latestVersion; exit: return bRet; }
void UpdateChecker::Run() { // no initialization to do, so signal readiness immediately SignalReady(); try { const std::string url = Settings::GetAppcastURL(); if ( url.empty() ) throw std::runtime_error("Appcast URL not specified."); CheckForInsecureURL(url, "appcast feed"); StringDownloadSink appcast_xml; DownloadFile(url, &appcast_xml, GetAppcastDownloadFlags()); Appcast appcast = Appcast::Load(appcast_xml.data); if (!appcast.ReleaseNotesURL.empty()) CheckForInsecureURL(appcast.ReleaseNotesURL, "release notes"); if (!appcast.DownloadURL.empty()) CheckForInsecureURL(appcast.DownloadURL, "update file"); Settings::WriteConfigValue("LastCheckTime", time(NULL)); const std::string currentVersion = WideToAnsi(Settings::GetAppBuildVersion()); // Check if our version is out of date. if ( !appcast.IsValid() || CompareVersions(currentVersion, appcast.Version) >= 0 ) { // The same or newer version is already installed. UI::NotifyNoUpdates(ShouldAutomaticallyInstall()); return; } // Check if the user opted to ignore this particular version. if ( ShouldSkipUpdate(appcast) ) { UI::NotifyNoUpdates(ShouldAutomaticallyInstall()); return; } UI::NotifyUpdateAvailable(appcast, ShouldAutomaticallyInstall()); } catch ( ... ) { UI::NotifyUpdateError(); throw; } }
void UpdateChecker::Run() { // no initialization to do, so signal readiness immediately SignalReady(); try { const std::string url = Settings::GetAppcastURL(); if ( url.empty() ) throw std::runtime_error("Appcast URL not specified."); StringDownloadSink appcast_xml; DownloadFile(url, &appcast_xml, GetAppcastDownloadFlags()); Appcast appcast; appcast.Load(appcast_xml.data); Settings::WriteConfigValue("LastCheckTime", time(NULL)); const std::string currentVersion = WideToAnsi(Settings::GetAppVersion()); // Check if our version is out of date. if ( CompareVersions(currentVersion, appcast.Version) >= 0 ) { // The same or newer version is already installed. UI::NotifyNoUpdates(); return; } // Check if the user opted to ignore this particular version. std::string toSkip; if ( Settings::ReadConfigValue("SkipThisVersion", toSkip) && toSkip == appcast.Version ) { UI::NotifyNoUpdates(); return; } UI::NotifyUpdateAvailable(appcast); } catch ( ... ) { UI::NotifyUpdateError(); throw; } }
void CUpdateDlg::OnEndDialog() { if (m_bOk) { if (CompareVersions(m_strNewVersion, CURRENT_VERSION) > 0) { if (AfxMessageBox(FormatString(IDS_NEW_VERSION_AVAILABLE, m_strNewVersion), MB_ICONQUESTION | MB_YESNO) == IDYES) { ::ShellExecute(NULL, _T("open"), LoadString(IDS_WEBSITE_URL), NULL, NULL, SW_SHOW); } } else AfxMessageBox(IDS_NO_UPDATES_AVAILABLE, MB_ICONINFORMATION | MB_OK); } else AfxMessageBox(IDS_CONNECT_ERROR, MB_ICONEXCLAMATION | MB_OK); EndDialog(IDOK); }
SharedComponent ResolveDependency(SharedDependency dep, vector<SharedComponent>& components) { vector<SharedComponent>::iterator i = components.begin(); while (i != components.end()) { SharedComponent comp = *i++; if (dep->type != comp->type || dep->name != comp->name) continue; int compare = CompareVersions(comp->version, dep->version); if ((dep->requirement == Dependency::EQ && compare == 0) || (dep->requirement == Dependency::GTE && compare >= 0) || (dep->requirement == Dependency::GT && compare > 0) || (dep->requirement == Dependency::LT && compare < 0)) { return comp; } } return NULL; }
// Check if an update is required // CAutoUpdater::ErrorType CAutoUpdater::CheckForUpdate() { if (!InternetOkay()) { return InternetConnectFailure; } bTransferSuccess = false; // First we must check the remote configuration file to see if an update is necessary CString URL = CString(UPDATE_CHECK_URL) + CString(LOCATION_UPDATE_FILE_CHECK); HINTERNET hSession = GetSession(URL); if (!hSession) { return InternetSessionFailure; } BYTE pBuf[TRANSFER_SIZE]; memset(pBuf, NULL, sizeof(pBuf)); bTransferSuccess = DownloadConfig(hSession, pBuf, TRANSFER_SIZE); InternetCloseHandle(hSession); if (!bTransferSuccess) { return ConfigDownloadFailure; } // Get the version number of our executable and compare to see if an update is needed CString executable = GetExecutable(); CString fileVersion = GetFileVersion(executable);\ if (fileVersion.IsEmpty()) { return NoExecutableVersion; } CString updateVersion = (char *) pBuf; if (CompareVersions(updateVersion, fileVersion) != 1) { return UpdateNotRequired; } // At this stage an update is required TCHAR path[MAX_PATH]; GetTempPath(MAX_PATH, path); CString directory = path; // Download the updated file /* TCHAR *pToken = strtok(updateVersion.GetBuffer(256),_T(".")); while(pToken!=NULL) { if(IsDigits(pToken[0])) URL.Insert(URL.GetLength(),pToken[0]); pToken = strtok(NULL, _T(".")); } */ updateVersion.TrimLeft(); updateVersion.TrimRight(); updateVersion.TrimRight(_T(".")); URL = CString(UPDATE_DOWNLOAD_URL) + updateVersion + CString("/") + CString(InstallerName) + CString(".exe"); updateVersion.ReleaseBuffer(); DBG_PRINT(URL); hSession = GetSession(URL); if (!hSession) { return InternetSessionFailure; } CAutoUpdateDlg autoupdate_dlg; int nResult = autoupdate_dlg.DoModal(); if (nResult==0) { AppConfig.autoupdate_disable=1; return UpdateNotComplete; } else if (nResult==2) { return UpdateNotComplete; } // Proceed with the update CString updateFileLocation = directory+InstallerName+CString(".exe"); download_update_dlg = new CDownloadUpdateDlg(); CAutoUpdater_DownloadInfo * Info = new CAutoUpdater_DownloadInfo(hSession, updateFileLocation,download_update_dlg); CWinThread * controlThread = AfxBeginThread(DownloadUpdateFile,Info,THREAD_PRIORITY_NORMAL); download_update_dlg->DoModal(); //download_update_dlg->OnCancel(); LPDWORD lpExitCode = new unsigned long; *lpExitCode = STILL_ACTIVE; //while(*lpExitCode==STILL_ACTIVE) //{ // GetExitCodeThread(controlThread->m_hThread,lpExitCode); // ::Sleep(1000); //} //bTransferSuccess = (int)(*lpExitCode); //InternetCloseHandle(hSession); // if (!bTransferSuccess) // { // return FileDownloadFailure; // } MessageBox(AfxGetMainWnd()->m_hWnd, LoadString(IDS_INSTALL_UPDATE), LoadString(IDS_PCMAN_CLOSE), MB_ICONINFORMATION|MB_OK); if (!::ShellExecute(AfxGetMainWnd()->m_hWnd, "open", updateFileLocation, NULL, NULL, SW_SHOWNORMAL)) { return UpdateNotComplete; } ASSERT(AfxGetMainWnd() != NULL); SetActiveWindow(AfxGetMainWnd()->m_hWnd); AfxGetMainWnd()->SendMessage(WM_COMMIT_UPDATE); return Success; }
/* * Handles the HTTP GET command from soap, only the client update install may be downloaded. * * This function can only be called when client_update_enabled is set to yes. * * @note This function is only use for backward compatibility */ int HandleClientUpdate(struct soap *soap) { std::string strPath; int nRet = 404; // default return file not found to soap char *szClientUpdatePath = NULL; char *szCurrentVersion = NULL; char *szReq = NULL; char *szReqEnd = NULL; std::string strLicenseRequest; std::string strLicenseResponse; ECLicenseClient *lpLicenseClient = NULL; unsigned int ulLicenseResponse = 0; unsigned char *lpLicenseResponse = NULL; ECRESULT er = erSuccess; ClientVersion currentVersion = {0}; ClientVersion latestVersion = {0}; std::string strClientMSIName; FILE *fd = NULL; // Get the server.cfg setting szClientUpdatePath = g_lpConfig->GetSetting("client_update_path"); if (!szClientUpdatePath || szClientUpdatePath[0] == 0) { g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: The configuration field 'client_update_path' is empty."); goto exit; } // if the version comes as "/autoupdate/6.20.1.1234?licreq", we need to pass the license request szReq = strrchr(soap->path, '?'); if (szReq != NULL) { // since we have the ?, that's good enough szReq = strstr(soap->buf, "X-License: "); if (szReq == NULL) { g_lpLogger->Log(EC_LOGLEVEL_DEBUG, "Client update: Invalid license request, header not found."); goto exit; } szReq += strlen("X-License: "); szReqEnd = strstr(szReq, "\r\n"); // TODO: can be be split over multiple lines? if (szReqEnd == NULL) { g_lpLogger->Log(EC_LOGLEVEL_DEBUG, "Client update: Invalid license request, end of header not found."); goto exit; } strLicenseRequest = base64_decode(std::string(szReq, szReqEnd - szReq)); lpLicenseClient = new ECLicenseClient(g_lpConfig->GetSetting("license_socket"), atoui(g_lpConfig->GetSetting("license_timeout"))); er = lpLicenseClient->Auth((unsigned char*)strLicenseRequest.c_str(), strLicenseRequest.length(), &lpLicenseResponse, &ulLicenseResponse); if (er != erSuccess) { g_lpLogger->Log(EC_LOGLEVEL_DEBUG, "Client update: Invalid license request, error: 0x%08X.", er); goto exit; } strLicenseResponse = base64_encode(lpLicenseResponse, ulLicenseResponse); soap->http_content = "binary"; soap_response(soap, SOAP_FILE); nRet = soap_send_raw(soap, strLicenseResponse.c_str(), strLicenseResponse.length()); g_lpLogger->Log(EC_LOGLEVEL_DEBUG, "Client update: Processing license request."); goto exit; } // the version comes as "/autoupdate/6.20.1.1234", convert it to "6.20.1.1234" szCurrentVersion = soap->path + strlen("/autoupdate"); if (szCurrentVersion[0] == '/') szCurrentVersion++; if (szCurrentVersion[0] != '\0') { g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: The current client version is %s.", szCurrentVersion); if (!GetVersionFromString(szCurrentVersion, ¤tVersion)) { g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: Failed in getting version from input data."); goto exit; } } if (!GetLatestVersionAtServer(szClientUpdatePath, 0, &latestVersion)) { g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: No updates found on server."); goto exit; } if (szCurrentVersion[0] != '\0') { int res = CompareVersions(currentVersion, latestVersion); if (res == 0) { g_lpLogger->Log(EC_LOGLEVEL_DEBUG, "Client update: Client already has latest version."); goto exit; } else if (res > 0) { g_lpLogger->Log(EC_LOGLEVEL_DEBUG, "Client update: Client has newer version than server."); goto exit; } } if (!GetClientMSINameFromVersion(latestVersion, &strClientMSIName)) { g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: No suitable version available."); goto exit; } if (ConvertAndValidatePath(szClientUpdatePath, strClientMSIName, &strPath) != true) { g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: Error in path conversion and validation."); goto exit; } fd = fopen(strPath.c_str(), "rb"); if (!fd) { g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: Path not found %s.", strPath.c_str()); goto exit; } g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: Sending client %s new installer %s", PrettyIP(soap->ip).c_str(), strClientMSIName.c_str()); // application/msi-installer ? soap->http_content = "binary"; soap_response(soap, SOAP_FILE); while (true) { // FIXME: tmpbuf is only 1K, good enough? size_t nSize = fread(soap->tmpbuf, 1, sizeof(soap->tmpbuf), fd); if (!nSize) break; if (soap_send_raw(soap, soap->tmpbuf, nSize)) { g_lpLogger->Log(EC_LOGLEVEL_FATAL, "Client update: Error while sending client new installer"); goto exit; } } nRet = SOAP_OK; exit: if (lpLicenseResponse) delete [] lpLicenseResponse; if (lpLicenseClient) delete lpLicenseClient; if (fd) fclose(fd); return nRet; }
int ns__getClientUpdate(struct soap *soap, struct clientUpdateInfoRequest sClientUpdateInfo, struct clientUpdateResponse* lpsResponse) { unsigned int er = erSuccess; ClientVersion sCurrentVersion = {0}; ClientVersion sLatestVersion; unsigned int ulLicenseResponse = 0; unsigned char *lpLicenseResponse = NULL; ECLicenseClient *lpLicenseClient = NULL; std::string strClientMSIName; std::string strPath; FILE *fd = NULL; int res; unsigned int ulUserID = 0; ECSession *lpecSession = NULL; ECDatabase *lpDatabase = NULL; std::string strCurVersion; std::string strLatestVersion; std::string strQuery; time_t tNow = 0; char *lpszClientUpdatePath = g_lpConfig->GetSetting("client_update_path"); unsigned int ulLogLevel = atoui(g_lpConfig->GetSetting("client_update_log_level")); if (!parseBool(g_lpConfig->GetSetting("client_update_enabled"))) { // do not set on high loglevel, since by default the client updater is installed, and this will be quite often in your log g_lpLogger->Log(EC_LOGLEVEL_NOTICE, "Client update: trackid: 0x%08X, Config option 'client_update_enabled' has disabled this feature.", sClientUpdateInfo.ulTrackId); er = ZARAFA_E_NO_SUPPORT; goto exit; } // setup soap soap_set_imode(soap, SOAP_IO_KEEPALIVE | SOAP_C_UTFSTRING | SOAP_ENC_ZLIB | SOAP_ENC_MTOM); soap_set_omode(soap, SOAP_IO_KEEPALIVE | SOAP_C_UTFSTRING | SOAP_ENC_ZLIB | SOAP_ENC_MTOM | SOAP_IO_CHUNK); if (!lpszClientUpdatePath || lpszClientUpdatePath[0] == 0) { g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, The configuration field 'client_update_path' is empty.", sClientUpdateInfo.ulTrackId); er = ZARAFA_E_NO_ACCESS; goto exit; } er = g_lpSessionManager->CreateSessionInternal(&lpecSession); if(er != erSuccess) goto exit; // Lock the session lpecSession->Lock(); er = lpecSession->GetDatabase(&lpDatabase); if (er != erSuccess) goto exit; //@TODO change loglevel? g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, computername: %s, username: %s, clientversion: %s, windowsversion: %s, iplist: %s, soapip: %s", sClientUpdateInfo.ulTrackId, (sClientUpdateInfo.szComputerName) ? sClientUpdateInfo.szComputerName : "-", (sClientUpdateInfo.szUsername) ? sClientUpdateInfo.szUsername : "******", (sClientUpdateInfo.szClientVersion) ? sClientUpdateInfo.szClientVersion : "-", (sClientUpdateInfo.szWindowsVersion) ? sClientUpdateInfo.szWindowsVersion : "-", (sClientUpdateInfo.szClientIPList) ? sClientUpdateInfo.szClientIPList : "-", PrettyIP(soap->ip).c_str() ); if (!sClientUpdateInfo.szComputerName) sClientUpdateInfo.szComputerName = ""; //Client has no name? if(!sClientUpdateInfo.szUsername) { er = ZARAFA_E_NO_ACCESS; g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, Client did not send a username", sClientUpdateInfo.ulTrackId); } // validate user name er = lpecSession->GetUserManagement()->SearchObjectAndSync(sClientUpdateInfo.szUsername, 0x01/*EMS_AB_ADDRESS_LOOKUP*/, &ulUserID); if (er != erSuccess) { er = ZARAFA_E_NO_ACCESS; g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, unknown username '%s'", sClientUpdateInfo.ulTrackId, sClientUpdateInfo.szUsername); } if(lpecSession->GetUserManagement()->IsInternalObject(ulUserID)) { er = ZARAFA_E_NO_ACCESS; g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, Wrong user data. User name '%s' is a reserved user", sClientUpdateInfo.ulTrackId, sClientUpdateInfo.szUsername); goto exit; } // Check if the user connect to the right server, else redirect if (lpecSession->GetSessionManager()->IsDistributedSupported() ) { objectdetails_t sUserDetails; er = lpecSession->GetUserManagement()->GetObjectDetails(ulUserID, &sUserDetails); if (er != erSuccess) goto exit; /* Check if this is the correct server */ string strServerName = sUserDetails.GetPropString(OB_PROP_S_SERVERNAME); if (strServerName.empty()) { g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, User '%s' has no default server", sClientUpdateInfo.ulTrackId, sClientUpdateInfo.szUsername); er = ZARAFA_E_NO_ACCESS; goto exit; } if (stricmp(strServerName.c_str(), g_lpSessionManager->GetConfig()->GetSetting("server_name")) != 0) { string strServerPath; er = GetBestServerPath(soap, lpecSession, strServerName, &strServerPath); if (er != erSuccess) goto exit; lpsResponse->lpszServerPath = s_strcpy(soap, strServerPath.c_str());// Server Path must always utf8 (also in 6.40.x) g_lpSessionManager->GetLogger()->Log(EC_LOGLEVEL_INFO, "Client update: trackid: 0x%08X, User '%s' is redirected to '%s'", sClientUpdateInfo.ulTrackId, sClientUpdateInfo.szUsername, lpsResponse->lpszServerPath); g_lpStatsCollector->Increment(SCN_REDIRECT_COUNT, 1); er = ZARAFA_E_UNABLE_TO_COMPLETE; goto exit; } } lpLicenseClient = new ECLicenseClient(g_lpConfig->GetSetting("license_socket"), atoui(g_lpConfig->GetSetting("license_timeout"))); er = lpLicenseClient->Auth(sClientUpdateInfo.sLicenseReq.__ptr, sClientUpdateInfo.sLicenseReq.__size, &lpLicenseResponse, &ulLicenseResponse); if (er != erSuccess) { g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, Invalid license request, error: 0x%08X.", sClientUpdateInfo.ulTrackId, er); goto exit; } if (sClientUpdateInfo.szClientVersion == NULL || sClientUpdateInfo.szClientVersion[0] == '\0') { g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: trackid: 0x%08X, The client did not sent the current version number.", sClientUpdateInfo.ulTrackId); } else if (!GetVersionFromString(sClientUpdateInfo.szClientVersion, &sCurrentVersion)) { g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, Failed in getting version from input data.", sClientUpdateInfo.ulTrackId); goto exit; //@fixme can we give the latest? } if (!GetLatestVersionAtServer(lpszClientUpdatePath, sClientUpdateInfo.ulTrackId, &sLatestVersion)) { g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, No updates found on server.", sClientUpdateInfo.ulTrackId); er = ZARAFA_E_NO_ACCESS; goto exit; } res = CompareVersions(sCurrentVersion, sLatestVersion); if (res == 0) { g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: trackid: 0x%08X, Client already has the latest version.", sClientUpdateInfo.ulTrackId); goto ok; } else if (res > 0) { g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: trackid: 0x%08X, Client has newer version than server.", sClientUpdateInfo.ulTrackId); goto ok; } if (!GetClientMSINameFromVersion(sLatestVersion, &strClientMSIName)) { g_lpLogger->Log(EC_LOGLEVEL_INFO, "Client update: trackid: 0x%08X, No suitable version available.", sClientUpdateInfo.ulTrackId); er = ZARAFA_E_NO_ACCESS; goto exit; } if (ConvertAndValidatePath(lpszClientUpdatePath, strClientMSIName, &strPath) != true) { g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, Error in path conversion and validation.", sClientUpdateInfo.ulTrackId); er = ZARAFA_E_NO_ACCESS; goto exit; } fd = fopen(strPath.c_str(), "rb"); if (!fd) { g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, Path not found %s.", sClientUpdateInfo.ulTrackId, strPath.c_str()); er = ZARAFA_E_NO_ACCESS; goto exit; } // Update auto update client status VersionToString(sCurrentVersion, &strCurVersion); VersionToString(sLatestVersion, &strLatestVersion); tNow = time(NULL); // Get current time strQuery = "REPLACE INTO clientupdatestatus(userid, trackid, updatetime, currentversion, latestversion, computername, status) VALUES ("+ stringify(ulUserID)+", "+stringify(sClientUpdateInfo.ulTrackId)+", FROM_UNIXTIME("+ stringify(tNow) + "), \"" + strCurVersion + "\", \"" + strLatestVersion + "\", \"" + lpDatabase->Escape(sClientUpdateInfo.szComputerName).c_str()+"\", "+ stringify(UPDATE_STATUS_PENDING) + ")"; // ignore error in database tracking, SQL error logged in server, still send new client lpDatabase->DoUpdate(strQuery); soap->fmimereadopen = &mime_file_read_open; soap->fmimeread = &mime_file_read; soap->fmimereadclose = &mime_file_read_close; // Setup the MTOM Attachments lpsResponse->sStreamData.xop__Include.__ptr = (unsigned char*)fd; lpsResponse->sStreamData.xop__Include.__size = 0; lpsResponse->sStreamData.xop__Include.type = s_strcpy(soap, "application/binary"); lpsResponse->sStreamData.xop__Include.id = s_strcpy(soap, "zarafaclient"); g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Client update: trackid: 0x%08X, Sending new installer %s", sClientUpdateInfo.ulTrackId, strClientMSIName.c_str()); ok: // Client is already up to date lpsResponse->sLicenseResponse.__size = ulLicenseResponse; lpsResponse->sLicenseResponse.__ptr = (unsigned char *)s_memcpy(soap, (const char *)lpLicenseResponse, ulLicenseResponse); lpsResponse->ulLogLevel = ulLogLevel; // 0 = none, 1 = on errors, 2 = always exit: if(lpecSession) { lpecSession->Unlock(); g_lpSessionManager->RemoveSessionInternal(lpecSession); } lpsResponse->er = er; if (lpLicenseResponse) delete [] lpLicenseResponse; if (lpLicenseClient) delete lpLicenseClient; if (er && fd) fclose(fd); return SOAP_OK; }
nsresult GfxInfo::GetFeatureStatusImpl(int32_t aFeature, int32_t *aStatus, nsAString &aSuggestedDriverVersion, const nsTArray<GfxDriverInfo>& aDriverInfo, nsACString &aFailureId, OperatingSystem* aOS /* = nullptr */) { NS_ENSURE_ARG_POINTER(aStatus); aSuggestedDriverVersion.SetIsVoid(true); *aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN; OperatingSystem os = mOS; if (aOS) *aOS = os; // OpenGL layers are never blacklisted on Android. // This early return is so we avoid potentially slow // GLStrings initialization on startup when we initialize GL layers. if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS) { *aStatus = nsIGfxInfo::FEATURE_STATUS_OK; return NS_OK; } EnsureInitialized(); if (mGLStrings->Vendor().IsEmpty() || mGLStrings->Renderer().IsEmpty()) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } // Don't evaluate special cases when evaluating the downloaded blocklist. if (aDriverInfo.IsEmpty()) { if (aFeature == nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION) { if (mSDKVersion < 11) { // It's slower than software due to not having a compositing fast path *aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION; aFailureId = "FEATURE_FAILURE_CANVAS_2D_SDK"; } else if (mGLStrings->Renderer().Find("Vivante GC1000") != -1) { // Blocklist Vivante GC1000. See bug 1248183. *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; aFailureId = "FEATURE_FAILED_CANVAS_2D_HW"; } else { *aStatus = nsIGfxInfo::FEATURE_STATUS_OK; } return NS_OK; } if (aFeature == FEATURE_WEBGL_OPENGL) { if (mGLStrings->Renderer().Find("Adreno 200") != -1 || mGLStrings->Renderer().Find("Adreno 205") != -1) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; aFailureId = "FEATURE_FAILURE_ADRENO_20x"; return NS_OK; } if (mHardware.EqualsLiteral("ville")) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; aFailureId = "FEATURE_FAILURE_VILLE"; return NS_OK; } } if (aFeature == FEATURE_STAGEFRIGHT) { NS_LossyConvertUTF16toASCII cManufacturer(mManufacturer); NS_LossyConvertUTF16toASCII cModel(mModel); NS_LossyConvertUTF16toASCII cHardware(mHardware); if (cHardware.EqualsLiteral("antares") || cHardware.EqualsLiteral("harmony") || cHardware.EqualsLiteral("picasso") || cHardware.EqualsLiteral("picasso_e") || cHardware.EqualsLiteral("ventana") || cHardware.EqualsLiteral("rk30board")) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; aFailureId = "FEATURE_FAILURE_STAGE_HW"; return NS_OK; } if (CompareVersions(mOSVersion.get(), "4.1.0") < 0) { // Whitelist: // All Samsung ICS devices, except for: // Samsung SGH-I717 (Bug 845729) // Samsung SGH-I727 (Bug 845729) // Samsung SGH-I757 (Bug 845729) // All Galaxy nexus ICS devices // Sony Xperia Ion (LT28) ICS devices bool isWhitelisted = cModel.Equals("LT28h", nsCaseInsensitiveCStringComparator()) || cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator()) || cModel.Equals("galaxy nexus", nsCaseInsensitiveCStringComparator()); // some Galaxy Nexus have manufacturer=amazon if (cModel.Find("SGH-I717", true) != -1 || cModel.Find("SGH-I727", true) != -1 || cModel.Find("SGH-I757", true) != -1) { isWhitelisted = false; } if (!isWhitelisted) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; aFailureId = "FEATURE_FAILURE_4_1_HW"; return NS_OK; } } else if (CompareVersions(mOSVersion.get(), "4.2.0") < 0) { // Whitelist: // All JB phones except for those in blocklist below // Blocklist: // Samsung devices from bug 812881 and 853522. // Motorola XT890 from bug 882342. bool isBlocklisted = cModel.Find("GT-P3100", true) != -1 || cModel.Find("GT-P3110", true) != -1 || cModel.Find("GT-P3113", true) != -1 || cModel.Find("GT-P5100", true) != -1 || cModel.Find("GT-P5110", true) != -1 || cModel.Find("GT-P5113", true) != -1 || cModel.Find("XT890", true) != -1; if (isBlocklisted) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; aFailureId = "FEATURE_FAILURE_4_2_HW"; return NS_OK; } } else if (CompareVersions(mOSVersion.get(), "4.3.0") < 0) { // Blocklist all Sony devices if (cManufacturer.Find("Sony", true) != -1) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; aFailureId = "FEATURE_FAILURE_4_3_SONY"; return NS_OK; } } } if (aFeature == FEATURE_WEBRTC_HW_ACCELERATION_ENCODE) { if (mozilla::AndroidBridge::Bridge()) { *aStatus = mozilla::AndroidBridge::Bridge()->GetHWEncoderCapability() ? nsIGfxInfo::FEATURE_STATUS_OK : nsIGfxInfo::FEATURE_BLOCKED_DEVICE; aFailureId = "FEATURE_FAILURE_WEBRTC_ENCODE"; return NS_OK; } } if (aFeature == FEATURE_WEBRTC_HW_ACCELERATION_DECODE) { if (mozilla::AndroidBridge::Bridge()) { *aStatus = mozilla::AndroidBridge::Bridge()->GetHWDecoderCapability() ? nsIGfxInfo::FEATURE_STATUS_OK : nsIGfxInfo::FEATURE_BLOCKED_DEVICE; aFailureId = "FEATURE_FAILURE_WEBRTC_DECODE"; return NS_OK; } } if (aFeature == FEATURE_VP8_HW_DECODE || aFeature == FEATURE_VP9_HW_DECODE) { NS_LossyConvertUTF16toASCII model(mModel); bool isBlocked = // GIFV crash, see bug 1232911. model.Equals("GT-N8013", nsCaseInsensitiveCStringComparator()); if (isBlocked) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; aFailureId = "FEATURE_FAILURE_VPx"; } else { *aStatus = nsIGfxInfo::FEATURE_STATUS_OK; } return NS_OK; } } return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, aFailureId, &os); }
bool PluginManager::InstallPlugin(const wxString& pluginName, bool forAllUsers, bool askForConfirmation) { if (pluginName.IsEmpty()) return false; wxString actualName = pluginName; Manager::Get()->GetMacrosManager()->ReplaceMacros(actualName); // base name wxString basename = wxFileName(actualName).GetName(); wxString version; if (basename.Contains(_T('-'))) { version = basename.AfterFirst(_T('-')); basename = basename.BeforeFirst(_T('-')); } // Manager::Get()->GetLogManager()->DebugLog(F(_T("InstallPlugin: basename='%s', version=%s"), basename.c_str(), version.c_str())); // if plugin with the same name exists, ask to uninstall first cbPlugin* existingPlugin = FindPluginByName(basename); if (existingPlugin) { if (askForConfirmation) { wxString msg = _("A plugin with the same name is already installed.\n"); if (!version.IsEmpty()) { const PluginInfo* existingInfo = GetPluginInfo(existingPlugin); if (CompareVersions(version, existingInfo->version) < 0) { msg = _("The plugin you are trying to install, is older " "than the one currently installed."); } } if (cbMessageBox(msg + _T('\n') + _("If you want to proceed, the installed plugin will be " "uninstalled first.\n" "Do you want to proceed?"), _("Confirmation"), wxICON_QUESTION | wxYES_NO) == wxID_NO) { return false; } } if (!UninstallPlugin(existingPlugin)) return false; } wxString pluginDir; wxString resourceDir; if (forAllUsers) { pluginDir = ConfigManager::GetFolder(sdPluginsGlobal); resourceDir = ConfigManager::GetFolder(sdDataGlobal); } else { pluginDir = ConfigManager::GetFolder(sdPluginsUser); resourceDir = ConfigManager::GetFolder(sdDataUser); } wxProgressDialog pd(_("Installing: ") + basename, _T("A description wide enough for the dialog ;)"), 5); wxString localName = basename + FileFilters::DYNAMICLIB_DOT_EXT; wxString resourceName = basename + _T(".zip"); wxString settingsOnName = basename + _T(".png"); wxString settingsOffName = basename + _T("-off.png"); if (!platform::windows && resourceName.StartsWith(_T("lib"))) resourceName.Remove(0, 3); if (!platform::windows && settingsOnName.StartsWith(_T("lib"))) settingsOnName.Remove(0, 3); if (!platform::windows && settingsOffName.StartsWith(_T("lib"))) settingsOffName.Remove(0, 3); wxString pluginFilename = pluginDir + _T('/') + localName; // Manager::Get()->GetLogManager()->DebugLog(F(_T("Plugin filename: ") + pluginFilename)); // Manager::Get()->GetLogManager()->DebugLog(F(_T("Plugin resources: ") + ConfigManager::GetDataFolder() + _T('/') + resourceName)); pd.Update(1, _("Extracting plugin")); // extract plugin from bundle if (!ExtractFile(actualName, localName, pluginFilename)) return false; // Manager::Get()->GetLogManager()->DebugLog(F(_T("Extracted plugin"))); pd.Update(2, _("Extracting plugin resources")); // extract resources from bundle if (!ExtractFile(actualName, resourceName, resourceDir + _T('/') + resourceName)) return false; // Manager::Get()->GetLogManager()->DebugLog(F(_T("Extracted resources"))); pd.Update(3, _("Extracting plugin icons for \"Settings\" dialog")); // extract resources from bundle ExtractFile(actualName, settingsOnName, resourceDir + _T("/images/settings/") + settingsOnName, false); // Manager::Get()->GetLogManager()->DebugLog(F(_T("Extracted resources"))); // extract resources from bundle ExtractFile(actualName, settingsOffName, resourceDir + _T("/images/settings/") + settingsOffName, false); // Manager::Get()->GetLogManager()->DebugLog(F(_T("Extracted resources"))); // extract extra files wxArrayString extraFiles; ReadExtraFilesFromManifestFile(localName, extraFiles); for (size_t i = 0; i < extraFiles.GetCount(); ++i) { ExtractFile(actualName, extraFiles[i], resourceDir + _T("/") + extraFiles[i], false); } pd.Update(4, _("Loading plugin")); // bundle extracted; now load the plugin on-the-fly // Manager::Get()->GetLogManager()->DebugLog(F(_T("Loading plugin..."))); ScanForPlugins(pluginDir); LoadAllPlugins(); cbPlugin* plugin = FindPluginByFileName(pluginFilename); const PluginInfo* info = GetPluginInfo(plugin); if (!plugin || !info) { Manager::Get()->GetLogManager()->DebugLog(_T("Failed")); return false; } // Manager::Get()->GetLogManager()->DebugLog(F(_T("Succeeded"))); // inform app to update menus and toolbars pd.Update(5, _("Updating menus and toolbars")); CodeBlocksEvent evt(cbEVT_PLUGIN_INSTALLED); evt.SetPlugin(plugin); Manager::Get()->ProcessEvent(evt); // Manager::Get()->GetLogManager()->DebugLog(F(_T("Menus updated"))); return true; }
bool DialogInstall::ReadOptions(const WCHAR* file) { WCHAR buffer[MAX_LINE_LENGTH]; const bool newFormat = m_PackageFormat == PackageFormat::New; const WCHAR* section = newFormat ? L"rmskin" : L"Rainstaller"; const HWND window = m_TabInstall.GetWindow(); if (GetPrivateProfileString(section, L"Name", L"", buffer, 64, file) == 0) { return false; } Static_SetText(GetDlgItem(window, IDC_INSTALLTAB_NAME_TEXT), buffer); if (!newFormat) { // Determine if skins need to backed up based on name int s; int scanned = swscanf(buffer, L"Backup-%d.%d.%d-%d.%d.rmskin", &s, &s, &s, &s, &s); m_BackupPackage = scanned == 5; } GetPrivateProfileString(section, L"Author", L"", buffer, 64, file); Static_SetText(GetDlgItem(window, IDC_INSTALLTAB_AUTHOR_TEXT), buffer); GetPrivateProfileString(section, L"Version", L"", buffer, 64, file); Static_SetText(GetDlgItem(window, IDC_INSTALLTAB_VERSION_TEXT), buffer); m_MergeSkins = GetPrivateProfileInt(section, newFormat ? L"MergeSkins" : L"Merge", 0, file) != 0; GetPrivateProfileString(section, newFormat ? L"VariableFiles" : L"KeepVar", L"", buffer, MAX_LINE_LENGTH, file); m_VariablesFiles = Tokenize(buffer, L"|"); if (GetPrivateProfileString(section, newFormat ? L"MinimumRainmeter" : L"MinRainmeterVer", L"", buffer, MAX_LINE_LENGTH, file) > 0) { std::wstring rainmeterDll = g_Data.programPath + L"Rainmeter.dll"; std::wstring rainmeterVersion = GetFileVersionString(rainmeterDll.c_str()); if (CompareVersions(buffer, rainmeterVersion) == 1) { m_ErrorMessage = L"Rainmeter "; m_ErrorMessage += buffer; m_ErrorMessage += L" or higher is required to install this package.\n\n" L"Get the latest version from rainmeter.net and try again."; return false; } } if (GetPrivateProfileString(section, newFormat ? L"LoadType" : L"LaunchType", L"", buffer, MAX_LINE_LENGTH, file) > 0) { bool loadSkin = _wcsicmp(buffer, newFormat ? L"Skin" : L"Load") == 0; GetPrivateProfileString(section, newFormat ? L"Load" : L"LaunchCommand", L"", buffer, MAX_LINE_LENGTH, file); if (loadSkin) { if (newFormat) { m_LoadSkins.push_back(buffer); } else { m_LoadSkins = Tokenize(buffer, L"|"); } } else { m_LoadLayout = buffer; } } if (newFormat) { if (GetPrivateProfileString(section, L"MinimumDotNET", L"", buffer, MAX_LINE_LENGTH, file) > 0 && CompareVersions(buffer, GetDotNetVersionString()) == 1) { m_ErrorMessage = L".NET framework "; m_ErrorMessage += buffer; m_ErrorMessage += L" or higher is required to install this package."; return false; } if (GetPrivateProfileString(section, L"MinimumWindows", L"", buffer, MAX_LINE_LENGTH, file) > 0 && CompareVersions(buffer, GetWindowsVersionString()) == 1) { m_ErrorMessage = L"Your version of Windows is not supported by this package.\n\n" L"Contact the package author for more information."; return false; } } return true; }
bool RheiaPluginManager::RegisterPlugin(const wxString& name, CreatePluginProcess createProc, FreePluginProcess freeProc ) { // sanity checks if ( name.IsEmpty() || !createProc || !freeProc ) { RheiaLoggerManager::sdLog( wxT("RheiaPluginManager::RegisterPlugin wrong plugin : ") + name + wxT(" ...") , RheiaLogging::error ); return false; } // first check to see it's not already loaded if (FindElement(name)) { RheiaLoggerManager::sdLog( wxT("RheiaPluginManager::RegisterPlugin plugin exists : ") + name + wxT(" ...") , RheiaLogging::error ); return false; } // read manifest file for plugin wxString resName = name; if ( !FileExt::DYNAMIC_LIBRARY_PREFIX.IsEmpty() && !platform::windows && resName.StartsWith(FileExt::DYNAMIC_LIBRARY_PREFIX) ) resName = resName.Remove(0,FileExt::DYNAMIC_LIBRARY_PREFIX.Length()); wxString libName = name; if ( !FileExt::DYNAMIC_LIBRARY_PREFIX.IsEmpty() && !platform::windows && !libName.StartsWith(FileExt::DYNAMIC_LIBRARY_PREFIX) ) libName = FileExt::DYNAMIC_LIBRARY_PREFIX + libName + FileExt::PLUGIN_EXT; RheiaPluginManifest* manifest = ReadManifestFile( resName + wxT("_res") ); if ( manifest == NULL ) { wxMessageBox(wxT("Error reading manifest for ") + name,_("Error")); return false; } // now perform the SDK version number (extra check) RheiaPackageVersion* sdkversion = manifest->GetSDKVersion(); long major = sdkversion->GetMajor(); long minor = sdkversion->GetMinor(); //long build = sdkversion->GetBuild(); long dmajor = AutoVersion::MAJOR; long dminor = AutoVersion::MINOR; if( CompareVersions( dmajor , dminor , major , minor ) < 0 ) //package is made for a newer version than the current one { RheiaLoggerManager::sdLog( wxT("RheiaPluginManager::RegisterPlugin version problem : ") + name + wxT(" ...") , RheiaLogging::error ); delete manifest; return false; } // all done // register this plugin in the map so that the plugin can be attached later RheiaPluginRegistration registration; registration.name = name; registration.createProcess = createProc; registration.freeProcess = freeProc; registration.info = manifest; RegisteredPlugins.push_back(registration); return true; }
nsresult GfxInfo::GetFeatureStatusImpl(int32_t aFeature, int32_t *aStatus, nsAString & aSuggestedDriverVersion, const nsTArray<GfxDriverInfo>& aDriverInfo, OperatingSystem* aOS /* = nullptr */) { NS_ENSURE_ARG_POINTER(aStatus); aSuggestedDriverVersion.SetIsVoid(true); *aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN; OperatingSystem os = mOS; if (aOS) *aOS = os; // OpenGL layers are never blacklisted on Android. // This early return is so we avoid potentially slow // GLStrings initialization on startup when we initialize GL layers. if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS) { *aStatus = nsIGfxInfo::FEATURE_STATUS_OK; return NS_OK; } EnsureInitialized(); if (mGLStrings->Vendor().IsEmpty() || mGLStrings->Renderer().IsEmpty()) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } // Don't evaluate special cases when evaluating the downloaded blocklist. if (aDriverInfo.IsEmpty()) { if (aFeature == FEATURE_WEBGL_OPENGL) { if (mGLStrings->Renderer().Find("Adreno 200") != -1 || mGLStrings->Renderer().Find("Adreno 205") != -1) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } if (mHardware.EqualsLiteral("ville")) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } } if (aFeature == FEATURE_STAGEFRIGHT) { NS_LossyConvertUTF16toASCII cManufacturer(mManufacturer); NS_LossyConvertUTF16toASCII cModel(mModel); NS_LossyConvertUTF16toASCII cHardware(mHardware); if (cHardware.EqualsLiteral("antares") || cHardware.EqualsLiteral("harmony") || cHardware.EqualsLiteral("picasso") || cHardware.EqualsLiteral("picasso_e") || cHardware.EqualsLiteral("ventana") || cHardware.EqualsLiteral("rk30board")) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } if (CompareVersions(mOSVersion.get(), "2.2.0") >= 0 && CompareVersions(mOSVersion.get(), "2.3.0") < 0) { // Froyo LG devices are whitelisted. // All other Froyo bool isWhitelisted = cManufacturer.Equals("lge", nsCaseInsensitiveCStringComparator()); if (!isWhitelisted) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } } else if (CompareVersions(mOSVersion.get(), "2.3.0") >= 0 && CompareVersions(mOSVersion.get(), "2.4.0") < 0) { // Gingerbread HTC devices are whitelisted. // Gingerbread Samsung devices are whitelisted except for: // Samsung devices identified in Bug 847837 // Gingerbread Sony devices are whitelisted. // All other Gingerbread devices are blacklisted. bool isWhitelisted = cManufacturer.Equals("htc", nsCaseInsensitiveCStringComparator()) || (cManufacturer.Find("sony", true) != -1) || cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator()); if (cModel.Equals("GT-I8160", nsCaseInsensitiveCStringComparator()) || cModel.Equals("GT-I8160L", nsCaseInsensitiveCStringComparator()) || cModel.Equals("GT-I8530", nsCaseInsensitiveCStringComparator()) || cModel.Equals("GT-I9070", nsCaseInsensitiveCStringComparator()) || cModel.Equals("GT-I9070P", nsCaseInsensitiveCStringComparator()) || cModel.Equals("GT-I8160P", nsCaseInsensitiveCStringComparator()) || cModel.Equals("GT-S7500", nsCaseInsensitiveCStringComparator()) || cModel.Equals("GT-S7500T", nsCaseInsensitiveCStringComparator()) || cModel.Equals("GT-S7500L", nsCaseInsensitiveCStringComparator()) || cModel.Equals("GT-S6500T", nsCaseInsensitiveCStringComparator()) || cHardware.Equals("smdkc110", nsCaseInsensitiveCStringComparator()) || cHardware.Equals("smdkc210", nsCaseInsensitiveCStringComparator()) || cHardware.Equals("herring", nsCaseInsensitiveCStringComparator()) || cHardware.Equals("shw-m110s", nsCaseInsensitiveCStringComparator()) || cHardware.Equals("shw-m180s", nsCaseInsensitiveCStringComparator()) || cHardware.Equals("n1", nsCaseInsensitiveCStringComparator()) || cHardware.Equals("latona", nsCaseInsensitiveCStringComparator()) || cHardware.Equals("aalto", nsCaseInsensitiveCStringComparator()) || cHardware.Equals("atlas", nsCaseInsensitiveCStringComparator()) || cHardware.Equals("qcom", nsCaseInsensitiveCStringComparator())) { isWhitelisted = false; } if (!isWhitelisted) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } } else if (CompareVersions(mOSVersion.get(), "3.0.0") >= 0 && CompareVersions(mOSVersion.get(), "4.0.0") < 0) { // Honeycomb Samsung devices are whitelisted. // All other Honeycomb devices are blacklisted. bool isWhitelisted = cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator()); if (!isWhitelisted) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } } else if (CompareVersions(mOSVersion.get(), "4.0.0") < 0) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION; return NS_OK; } else if (CompareVersions(mOSVersion.get(), "4.1.0") < 0) { // Whitelist: // All Samsung ICS devices, except for: // Samsung SGH-I717 (Bug 845729) // Samsung SGH-I727 (Bug 845729) // Samsung SGH-I757 (Bug 845729) // All Galaxy nexus ICS devices // Sony Xperia Ion (LT28) ICS devices bool isWhitelisted = cModel.Equals("LT28h", nsCaseInsensitiveCStringComparator()) || cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator()) || cModel.Equals("galaxy nexus", nsCaseInsensitiveCStringComparator()); // some Galaxy Nexus have manufacturer=amazon if (cModel.Find("SGH-I717", true) != -1 || cModel.Find("SGH-I727", true) != -1 || cModel.Find("SGH-I757", true) != -1) { isWhitelisted = false; } if (!isWhitelisted) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } } else if (CompareVersions(mOSVersion.get(), "4.2.0") < 0) { // Whitelist: // All JB phones except for those in blocklist below // Blocklist: // Samsung devices from bug 812881 and 853522. // Motorola XT890 from bug 882342. bool isBlocklisted = cModel.Find("GT-P3100", true) != -1 || cModel.Find("GT-P3110", true) != -1 || cModel.Find("GT-P3113", true) != -1 || cModel.Find("GT-P5100", true) != -1 || cModel.Find("GT-P5110", true) != -1 || cModel.Find("GT-P5113", true) != -1 || cModel.Find("XT890", true) != -1; if (isBlocklisted) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } } else if (CompareVersions(mOSVersion.get(), "4.3.0") < 0) { // Blocklist all Sony devices if (cManufacturer.Find("Sony", true) != -1) { *aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } } } if (aFeature == FEATURE_WEBRTC_HW_ACCELERATION_ENCODE) { if (mozilla::AndroidBridge::Bridge()) { *aStatus = mozilla::AndroidBridge::Bridge()->GetHWEncoderCapability() ? nsIGfxInfo::FEATURE_STATUS_OK : nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } } if (aFeature == FEATURE_WEBRTC_HW_ACCELERATION_DECODE) { if (mozilla::AndroidBridge::Bridge()) { *aStatus = mozilla::AndroidBridge::Bridge()->GetHWDecoderCapability() ? nsIGfxInfo::FEATURE_STATUS_OK : nsIGfxInfo::FEATURE_BLOCKED_DEVICE; return NS_OK; } } } return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os); }