// -------------------------------------------------------------------------- // Check whether client key event request can be executed // -------------------------------------------------------------------------- void CAknCompaSrvSession::CheckKeyDownPermissionL(const RMessage2& aMessage) { // We try to increase security by allowing only foreground application // to set key down. As the simulated key events are sent to the // foreground application by window server, the application is // sending a key event to itself. // Granted if client has ECapabilitySwEvent or request is coming from // EikSrv. TApaTaskList won't report EikSrv in foreground though // it's displaying a note. if (!aMessage.HasCapability(ECapabilitySwEvent) && !CAknCompaServer::IsGlobalUiSrv(aMessage)) { // Allow key down only from a foreground task TApaTaskList tasklist(Server().WsSession()); TApaTask foregroundTask = tasklist.FindByPos(0); RThread thread; User::LeaveIfError(thread.Open(foregroundTask.ThreadId())); TSecurityPolicy securityPolicy(thread.SecureId()); thread.Close(); if (!securityPolicy.CheckPolicy(aMessage)) { User::Leave(KErrPermissionDenied); } } }
QString QueryCommand(bool const local) { QString cmd("/bin/ps xc -S -o command=,pid=,time= ${JOB_ID}"); if (local) { // The command only changes for Windows boxes #ifdef Q_OS_WIN32 QFileInfo tasklist("/Windows/System32/tasklist.exe"); if (tasklist.exists()) { QString spid("\"PID eq ${JOB_ID}\""); QStringList args; args << "/v" << "/fo list" << "/fi " + spid; cmd = tasklist.filePath() + " " + args.join(" "); }else { return QString("Error: tasklist.exe not found"); } #endif } return cmd; }
// ----------------------------------------------------------------------------- // Cfota_engine_api::TryResumeDownload // TryResumeDownload test method function. // (other items were commented in a header). // ----------------------------------------------------------------------------- // TInt Cfota_engine_api::TryResumeDownloadL( CStifItemParser& aItem ) { RSyncMLSession syncSession; syncSession.OpenL(); CleanupClosePushL(syncSession); RSyncMLDevManProfile DMProfile; DMProfile.CreateL( syncSession ); CleanupClosePushL( DMProfile); DMProfile.SetDisplayNameL(_L("####´53")); DMProfile.SetServerIdL(_L8("ServerID53")); DMProfile.SetCreatorId(85); DMProfile.SetPasswordL(_L8("Password")); DMProfile.SetServerPasswordL(_L8("ServerPassword")); DMProfile.SetUserNameL(_L8("Username")); DMProfile.UpdateL(); RSyncMLConnection connection; connection.OpenL( DMProfile, KUidNSmlMediumTypeInternet.iUid ); CleanupClosePushL( connection ); TPtrC stringHostaddress; if( aItem.GetNextString ( stringHostaddress ) == KErrNone ) { HBufC16* newaddr = stringHostaddress.AllocL(); TBuf8<100> hostAddress((newaddr->Des()).Collapse()); connection.SetServerURIL( hostAddress ); delete newaddr; } TSmlProfileId ProfileId = DMProfile.Identifier(); CleanupStack::PopAndDestroy(); // connection CleanupStack::PopAndDestroy(); // DMProfile CleanupStack::PopAndDestroy(); // syncSession session.OpenL(); TInt PkgId = 1; TBuf8<10> PkgName; PkgName.Copy(_L8("zkg")); TBuf8<10> PkgVersion; PkgVersion.Copy(_L8("1.0")); TPtrC stringPkgUrl; if( aItem.GetNextString ( stringPkgUrl ) == KErrNone ) { HBufC16* newurl = stringHostaddress.AllocL(); TBuf8<100> PkgURL((newurl->Des()).Collapse()); delete newurl; TInt err = session.Download(PkgId,PkgURL,ProfileId,PkgName,PkgVersion); if(err) { iLog->Log(_L("CFMSInterruptAob::TryResumeDownloadL()- download error")); return err; } } User::After(5000000*6); session.Close(); RWsSession iWsSession; TInt err = iWsSession.Connect(); if(err) { iLog->Log(_L("CFMSInterruptAob::TryResumeDownloadL()- Window server session error")); return err; } TApaTask(CCoeEnv::Static()->WsSession()); TApaTaskList tasklist(iWsSession); TApaTask task=tasklist.FindApp(TUid::Uid(0x101F6DE5)); if(task.Exists()) { task.KillTask(); } iWsSession.Close(); User::After(5000000*3); session.OpenL(); session.TryResumeDownload(); User::After(5000000*3); return KErrNone; }