/** Launch a process @param aExeName the executable used to create the process @param aCommandLine the commandline parameters passed to the new process file name of the executable used to create the process @return KErrNone on success, or one of the other system wide error codes */ TInt CRunModeAgent::LaunchProcessL( RProcess& aProcess, const TDesC& aExeName, const TDesC& aCommandLine ) { LOG_ENTRY(); RBuf launcherOptions; launcherOptions.CleanupClosePushL(); const TInt additionalWords = 1; launcherOptions.CreateL( aCommandLine.Length() + additionalWords ); launcherOptions.Format( aCommandLine, iParams.iTestTargetPriority); LOG_DES(_L("launcherOptions %S"), &launcherOptions); TInt err = aProcess.Create( aExeName, launcherOptions ); CleanupStack::PopAndDestroy(); // check that there was no error raised if (err != KErrNone) return err; // rendezvous with process TRequestStatus status = KRequestPending; aProcess.Rendezvous(status); // start the test target aProcess.Resume(); User::WaitForRequest(status); if(KErrNone != status.Int()) { aProcess.Kill(KErrNone); } LOG_EXIT(); return status.Int(); }
// ----------------------------------------------------------------------------- // CMoveObject::MoveObjectL // Move object operation // ----------------------------------------------------------------------------- // void CMoveObject::MoveObjectL() { PRINT( _L( "MM MTP => CMoveObject::MoveObjectL" ) ); TMTPResponseCode responseCode = EMTPRespCodeOK; GetParametersL(); RBuf newObjectName; newObjectName.CreateL( KMaxFileName ); newObjectName.CleanupClosePushL(); // + newObjectName newObjectName = *iDest; TPtrC suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); TParsePtrC fileNameParser( suid ); if ( ( newObjectName.Length() + fileNameParser.NameAndExt().Length() ) <= newObjectName.MaxLength() ) { newObjectName.Append( fileNameParser.NameAndExt() ); responseCode = CanMoveObjectL( suid, newObjectName ); if ( responseCode == EMTPRespCodeOK ) MoveFileL( newObjectName ); } else // Destination is not appropriate for the full path name shouldn't be longer than 255 responseCode = EMTPRespCodeInvalidDataset; SendResponseL( responseCode ); CleanupStack::PopAndDestroy( &newObjectName ); // - newObjectName PRINT1( _L( "MM MTP <= CMoveObject::MoveObjectL responseCode = 0x%x" ), responseCode ); }
/** A helper function of MoveObjectL. @param aNewFolderName the new file folder name after the folder is moved. */ void CMTPMoveObject::MoveFolderL() { OstTraceFunctionEntry0( CMTPMOVEOBJECT_MOVEFOLDERL_ENTRY ); RBuf oldFolderName; oldFolderName.CreateL(KMaxFileName); oldFolderName.CleanupClosePushL(); oldFolderName = iObjectInfo->DesC(CMTPObjectMetaData::ESuid); iPathToMove = oldFolderName.AllocL(); if (iObjectInfo->Uint(CMTPObjectMetaData::EDataProviderId) == iFramework.DataProviderId()) { GetPreviousPropertiesL(oldFolderName); // Remove backslash. oldFolderName.SetLength(oldFolderName.Length() - 1); SetPreviousPropertiesL(*iNewRootFolder); _LIT(KBackSlash, "\\"); oldFolderName.Append(KBackSlash); iObjectInfo->SetDesCL(CMTPObjectMetaData::ESuid, *iNewRootFolder); iObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, iNewParentHandle); iObjectInfo->SetUint(CMTPObjectMetaData::EStorageId, iStorageId); iFramework.ObjectMgr().ModifyObjectL(*iObjectInfo); } CleanupStack::PopAndDestroy(); // oldFolderName. OstTraceFunctionExit0( CMTPMOVEOBJECT_MOVEFOLDERL_EXIT ); }
CUninstallMachine::TState* CUninstallMachine::TRegistrationState::CompleteL() /** Obtains the log file handle and its name from the SWI Observer. Adds the log file to the transaction */ { DEBUG_PRINTF(_L8("Uninstall Machine - Registration State complete")); RBuf logFileName; logFileName.CreateL(KMaxFileName); logFileName.CleanupClosePushL(); //Get created a log file and obtains its full name. iUninstallMachine.Observer().GetFileHandleL(logFileName); //Add the log file to the transaction #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK iUninstallMachine.TransactionSession().RegisterNewL(logFileName); #else iUninstallMachine.IntegrityServicesL().AddL(logFileName); #endif CleanupStack::PopAndDestroy(&logFileName); // Get Controllers. return static_cast<TState*>(&iUninstallMachine.iConfirmationState); }
void CCmdCustomCommand::WriteHandleToFileL(TInt aHandle) { const TChar sysDrive = RFs::GetSystemDriveChar(); RBuf filename; filename.CreateL(KNeverUnloadLibHandleFile().Length() + 1); filename.Append(sysDrive); filename.Append(KNeverUnloadLibHandleFile()); filename.CleanupClosePushL(); RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); fs.MkDirAll(filename); // ignore any error RFile file; CleanupClosePushL(file); TInt err=KErrNone; TInt pos = 0; if(KErrNotFound == (err = file.Open(fs, filename, EFileShareExclusive|EFileStream|EFileWrite))) { User::LeaveIfError(file.Replace(fs, filename, EFileShareExclusive|EFileStream|EFileWrite)); } else { User::LeaveIfError(err); file.Seek(ESeekEnd, pos); } RFileWriteStream targetStream; targetStream.Attach(file, pos); // file gets closed by this call, but that's okay, we don't need it any more (targetStream has its own copy of this RFile object that it owns) CleanupClosePushL(targetStream); targetStream.WriteInt32L(aHandle); targetStream.CommitL(); CleanupStack::PopAndDestroy(4); }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CaSqlQueryCreator::PopulateQueryWithIdListL( const TInt aIdEntryCount, CCaSqlQuery* aQuery, const TDesC& aSqlQueryText ) { DEBUG(("_CA_:CASqlQueryCreator::PopulateQueryWithIdListL")); RBuf entryIdList; entryIdList.CleanupClosePushL(); CreateIdListL( aIdEntryCount, entryIdList, KSQLEntryId ); RBuf query; query.CleanupClosePushL(); query.CreateL( aSqlQueryText.Length() + entryIdList.Length() ); query.AppendFormat( aSqlQueryText, &entryIdList ); aQuery->SetQueryL( query ); CleanupStack::PopAndDestroy( &query ); CleanupStack::PopAndDestroy( &entryIdList ); }
/* * Save Form data, function to be executed when save option is selected. * Creates the second form which allows for selecting the category. */ TBool CYPagesForm1::SaveFormDataL() { CAknPopupFieldText* popupFieldText = static_cast <CAknPopupFieldText*> (ControlOrNull(EYPagesPopup)); if (popupFieldText) { TInt categoryIndex = popupFieldText->CurrentValueIndex(); TBuf <30> KMyTextFile; KMyTextFile.Format(_L("D:\\YPages\\%d%d.txt"), iColor, categoryIndex); RFs fileServer; User :: LeaveIfError (fileServer.Connect()); RFile file; User::LeaveIfError(file.Open(fileServer, KMyTextFile, EFileRead|EFileStreamText)); CleanupClosePushL(file); TFileText fileText; fileText.Set(file); TBuf<100> buffer; buffer = _L(""); RBuf rBuf; rBuf.Create(buffer); rBuf.CleanupClosePushL(); TInt err = KErrNone; while(err != KErrEof) { err = fileText.Read(buffer); if ((err != KErrNone) && (err != KErrEof)) { User :: Leave(err); } if (KErrNone == err) { rBuf.ReAllocL(rBuf.Length() + buffer.Length()+2); rBuf.Append(buffer); rBuf.Append(_L("\n")); } } CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(rBuf); dlg->PrepareLC(R_ABOUT_HEADING_PANE); dlg->SetHeaderTextL(_L("")); dlg->RunLD(); CleanupStack::PopAndDestroy(&rBuf); CleanupStack::PopAndDestroy(&file); fileServer.Close(); } return ETrue; }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CaSqlQueryCreator::CreateLocalizationTableQueryL( CCaSqlQuery* aSqlQuery, const TDesC& aStatement) { DEBUG(("_CA_:CASqlQueryCreator::CreateLocalizationTableQueryL")); RBuf query; query.CleanupClosePushL(); query.CreateL( aStatement.Length() ); query.Append( aStatement ); aSqlQuery->SetQueryL( query ); CleanupStack::PopAndDestroy( &query ); }
LOCAL_C void mainL() { CCommandLineArguments* cmdLine = CCommandLineArguments::NewLC(); CConsoleBase* console = Console::NewL(_L("Siftestintegrationlockfile"),TSize(KConsFullScreen,KConsFullScreen)); CleanupStack::PushL(console); TInt argTotal(cmdLine->Count()); if (argTotal < 2 || argTotal > 3) { console->Printf(_L("Incorrect arguments specified: expected 1, received %d"), argTotal - 1); User::Leave(KErrArgument); } TPtrC filename(cmdLine->Arg(1)); _LIT(KDoLockFileParam, " lockfile"); if (argTotal == 2) { RBuf params; params.CreateL(filename.Length() + KDoLockFileParam().Length()); params.CleanupClosePushL(); params.Append(cmdLine->Arg(1)); params.Append(KDoLockFileParam()); // Since this executable is used by TEF, we wish to lock the file after the launched process has exited, so we spawn this process again with a different set of parameters RProcess newInstance; User::LeaveIfError(newInstance.Create(_L("Siftestintegrationlockfile"), params)); CleanupClosePushL(newInstance); newInstance.Resume(); TRequestStatus status; newInstance.Rendezvous(status); User::WaitForRequest(status); User::LeaveIfError(status.Int()); CleanupStack::PopAndDestroy(2, ¶ms); // newInstance } else { // This is the execution for locking the file, invoked using the branch above console->Printf(_L("Locking file %S for read"), &filename); RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); RFile file; User::LeaveIfError(file.Open(fs, filename, EFileShareReadersOnly|EFileRead)); CleanupClosePushL(file); // Signal the invoker only here, so that the file will definitely get locked before TEF proceeds to the next step RProcess::Rendezvous(KErrNone); User::After(10*1000*1000); // Wait for 10 seconds CleanupStack::PopAndDestroy(2 , &fs); // file } CleanupStack::PopAndDestroy(2, cmdLine); // console, }
/** Initialize the counter with the numeric equivalent of the descriptor contents This function is here to demonstrate reading from the client address space. Note that in this example, the client and the server are part of the same process, */ void CCountServSession::SetFromStringL(const RMessage2& aMessage) { // length of passed descriptor (1st parameter passed from client) TInt deslen = aMessage.GetDesLength(0); // Passed data will be saved in this descriptor. RBuf buffer; // Max length set to the value of "deslen", but current length is zero buffer.CreateL(deslen); // Do the right cleanup if anything subsequently goes wrong buffer.CleanupClosePushL(); // Copy the client's descriptor data into our buffer. aMessage.ReadL(0,buffer,0); // Now do a validation to make sure that the string only has digits if (buffer.Length() == 0) { User::Leave(ENonNumericString); } TLex16 lexer; lexer.Assign(buffer); while (!lexer.Eos()) { TChar thechar; thechar = lexer.Peek(); if (!thechar.IsDigit()) { User::Leave(ENonNumericString); } lexer.Inc(); } // Convert to a simple TInt value. lexer.Assign(buffer); if (lexer.Val(iCount)) { User::Leave(ENonNumericString); } // Clean up the memory acquired by the RBuf variable "buffer" CleanupStack::PopAndDestroy(); }
void CMscFileSession::SetupLogicalUnitL( const RMessage2& aMessage ) { TRACE_FUNC_ENTRY TInt protocol; TInt lun; RBuf fullImageFileName; TInt len = aMessage.GetDesLength( 0 ); fullImageFileName.CreateL( len ); fullImageFileName.CleanupClosePushL(); aMessage.ReadL( 0, fullImageFileName ); protocol = aMessage.Int1(); lun = aMessage.Int2(); iMscFileServer.Controller().SetupLogicalUnitL( fullImageFileName, protocol, lun ); CleanupStack::PopAndDestroy( &fullImageFileName ); TRACE_FUNC_EXIT }
// --------------------------------------------------------------------------- // Find entry by ID. // --------------------------------------------------------------------------- // EXPORT_C TInt CCenRepDatabaseUtil::FindEntryL( TInt aEntryId, RIpAppPropArray& aArray ) { //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindEntryL - IN" ); RKeyArray keys; CleanupClosePushL( keys ); // Find all rows where ID is aServiceId (entry row + each property row) TInt err = iRepository->FindEqL( iStartKey, iColMask, aEntryId, keys ); TInt count = keys.Count(); if ( KErrNone == err && count > 0 ) { TUint32 idKey = keys[ 0 ]; for ( TInt i = 1; i <= iColCount; i++ ) { RBuf value; value.CreateL( KCenRepMaxDesLength ); value.CleanupClosePushL(); TUint32 propertyKey = idKey + i * iColIncrement; TInt errProperty = iRepository->Get( propertyKey, value ); if( errProperty == KErrNone && value.Compare( KNullDesC ) != 0 ) { CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC(); property->SetName( propertyKey - idKey + iStartKey ); User::LeaveIfError( property->SetValue( value ) ); User::LeaveIfError( aArray.Append( property ) ); CleanupStack::Pop( property ); } CleanupStack::PopAndDestroy( &value ); } } CleanupStack::PopAndDestroy( &keys ); //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindEntryL - OUT" ); return err; }
void CScrHelperSession::GetFileHandleL(RFs& aFs, const RMessage2& aMessage, const TDesC& aFileName) { DEBUG_PRINTF2(_L("Returning file handle of %S."), &aFileName); RBuf filePath; filePath.CreateL(aFileName.Length()); filePath.CleanupClosePushL(); filePath.Copy(aFileName); filePath[0] = aFs.GetSystemDriveChar(); TInt err = aFs.MkDirAll(filePath); if(KErrNone != err && KErrAlreadyExists != err) { DEBUG_PRINTF3(_L("An error (%d) occured while making all directories of %S."), err, &filePath); User::Leave(err); } RFile file; TEntry entry; if(KErrNone == aFs.Entry(filePath, entry)) { // The file exists, just open it. User::LeaveIfError(file.Open(aFs, filePath, EFileShareAny|EFileWrite)); } else { // The file doesn't exist. First, check if the requested file is database or journal file. if(KScrDatabaseFilePath() == aFileName) { // This is the database file. Copy the default one into the requested location. DEBUG_PRINTF(_L8("SCR database file doesn't exist. It is being copied from ROM")); CopyDbFromROMToSystemL(aFs, filePath); // Then, open the file. User::LeaveIfError(file.Open(aFs, filePath, EFileShareAny|EFileWrite)); } else { // This is the journal file, simply create an empty file. User::LeaveIfError(file.Create(aFs, filePath, EFileShareAny|EFileWrite)); } } CleanupStack::PopAndDestroy(&filePath); CleanupClosePushL(file); // Store the RFile handle into the package buffer in slot 0 and complete the message with the RFs handle User::LeaveIfError(file.TransferToClient(aMessage, 0)); ASSERT(aMessage.IsNull()); // The message should have been completed CleanupStack::PopAndDestroy(&file); }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CaSqlQueryCreator::CreateUpdateIconQueryL( const CCaInnerEntry* aEntry, CCaSqlQuery* aQuery ) { DEBUG(("_CA_:CASqlQueryCreator::CreateUpdateIconQueryL")); RBuf query; query.CleanupClosePushL(); query.CreateL( KSQLUpdateIcon().Length() ); query.Append( KSQLUpdateIcon ); if( aEntry->Icon()->FileName().Compare( KNullDesC ) ) { query.ReAllocL( query.Length() + KSQLUpdateIconFileName().Length() + KComma().Length() ); query.Append( KSQLUpdateIconFileName ); query.Append( KComma ); } if( aEntry->Icon()->SkinId().Compare( KNullDesC ) ) { query.ReAllocL( query.Length() + KSQLUpdateIconSkinId().Length() + KComma().Length() ); query.Append( KSQLUpdateIconSkinId ); query.Append( KComma ); } if( aEntry->Icon()->ApplicationId().Compare(KNullDesC) ) { query.ReAllocL( query.Length() + KSQLUpdateIconAppId().Length() + KComma().Length() ); query.Append( KSQLUpdateIconAppId ); } if( !query.Right( KComma().Length() ).Compare( KComma ) ) { query.Delete( query.Length() - KComma().Length(), KComma().Length() ); } // add WHERE expr query.ReAllocL( query.Length() + KSQLUpdateIconWhere().Length() ); query.Append( KSQLUpdateIconWhere ); aQuery->SetQueryL( query ); aQuery->SetTableType( CCaSqlQuery::EIconTable ); CleanupStack::PopAndDestroy( &query ); }
void CMTPDeviceDataProvider::AddFolderRecursiveL( const TMTPNotificationParamsFolderChange& aFolder ) { OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_ADDFOLDERRECURSIVEL_ENTRY ); TPtrC folderRight( aFolder.iFolderChanged ); OstTraceExt1(TRACE_NORMAL, CMTPDEVICEDATAPROVIDER_ADDFOLDERRECURSIVEL, "Folder Addition - DriveAndFullPath:%S", folderRight); if ( !BaflUtils::FolderExists( Framework().Fs(), folderRight )) { OstTrace0(TRACE_NORMAL, DUP1_CMTPDEVICEDATAPROVIDER_ADDFOLDERRECURSIVEL, "Folder not exist in file system"); User::Leave( KErrArgument ); } TUint32 parentHandle( KMTPHandleNoParent ); TUint32 handle( KMTPHandleNoParent ); TInt pos( KErrNotFound ); TInt lengthOfRight( folderRight.Length()); TFileName folderLeft; // get root path of storage TInt driveNumber; User::LeaveIfError(Framework().Fs().CharToDrive(folderRight[0], driveNumber)); RBuf rootDirPath; rootDirPath.CreateL(KMaxFileName); rootDirPath.CleanupClosePushL(); iDevDpSingletons.ConfigMgr().GetRootDirPathL(driveNumber, rootDirPath); rootDirPath.Insert(0, folderRight.Mid(0, 2));// get drive: /* Go through from beginning. when this while end, folderLeft keeps the top layer folder which has no handle */ do { pos = folderRight.Locate( KPathDelimiter ); if ( KErrNotFound == pos ) { break; } folderLeft.Append( folderRight.Left( pos + 1 )); lengthOfRight = folderRight.Length()-pos -1; folderRight.Set( folderRight.Right( lengthOfRight )); if ( rootDirPath.FindF(folderLeft) != KErrNotFound) { //first time, root folder //continue continue; } parentHandle = handle; handle = Framework().ObjectMgr().HandleL( folderLeft ); } while( KMTPHandleNone != handle ); CleanupStack::PopAndDestroy(&rootDirPath); if ( KMTPHandleNone == handle ) { OstTrace0(TRACE_NORMAL, DUP2_CMTPDEVICEDATAPROVIDER_ADDFOLDERRECURSIVEL, "need to add entry into mtp database"); CMTPObjectMetaData* folderObject = CMTPObjectMetaData::NewL(); TUint32 storageId = GetStorageIdL( folderLeft ); while( 1 ) { parentHandle = AddEntryL( folderLeft, parentHandle, storageId, *folderObject ); OnDeviceFolderChangedL( EMTPEventCodeObjectAdded, *folderObject ); pos = folderRight.Locate( KPathDelimiter ); lengthOfRight = folderRight.Length()-pos -1; if ( KErrNotFound == pos ) { break; } folderLeft.Append( folderRight.Left( pos + 1 )); folderRight.Set( folderRight.Right( lengthOfRight )); } delete folderObject; } OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_ADDFOLDERRECURSIVEL_EXIT ); }
CDecisionRecord* CDatabase::ParseAndCreateRecordLC(TDesC8& aLine) /** Parse a line and create a decision record from the parsed values @param aLine A line containing a decision record values quoted with double quotes and separated by semi-colon @return A newly created decision record */ { CDecisionRecord* record = NULL; TLex8 parser(aLine); TChar achar; TBool start = ETrue; TUint16 flag = 0x078F; TUint16 pos = 0x0001; TInt32 value=0; TUint32 hexVal = 0; TSecureId clientSid(0); TSecureId serverSid(0); TUid serviceId = TUid::Null(); TUid evaluatorId = TUid::Null(); TBuf8<KUpsMaxFingerprintLength*2> fingerprint; TBuf8<KUpsMaxClientEntityLength*2> clientEntity; RBuf description; TUint8 result=0; TUint32 evaluatorInfo=0; TUint16 policyVer=0; TUint32 recordId=0; while(!parser.Eos()) { //Get cyrrent char achar = parser.Get(); //Skip delimiter if(achar == ';') { start = ETrue; } //if double quote start or stop token reading if('\"' == achar) { if(start) { parser.Mark(); start = EFalse; } else { parser.UnGet(); if(flag & pos) { TLex8 intToken(parser.MarkedToken()); switch(pos) { case KLocClientSid: intToken.Val(hexVal,EHex); clientSid.iId = hexVal; break; case KLocEvaluatorId: intToken.Val(hexVal,EHex); evaluatorId.iUid = hexVal; break; case KLocServiceId: intToken.Val(hexVal,EHex); serviceId.iUid = hexVal; break; case KLocServerSid: intToken.Val(hexVal,EHex); serverSid.iId = hexVal; break; case KLocResult: intToken.Val(value); result = (TUint8)value; break; case KLocEvaluatorInfo: intToken.Val(value); evaluatorInfo = value; break; case KLocMajorPolicyVersion: intToken.Val(value); policyVer = (TUint16)value; break; case KLocRecordId: intToken.Val(value); recordId = (TUint32)value; break; default: User::Leave(KErrGeneral); } } else { switch(pos) { case KLocDescription: { TPtrC8 tmpDescription = parser.MarkedToken(); description.Create(tmpDescription.Length()); description.CleanupClosePushL(); description.Copy(tmpDescription); break; } case KLocFingerprint: { fingerprint = parser.MarkedToken(); HexToStrL(fingerprint); break; } case KLocClientEntity: { clientEntity = parser.MarkedToken(); if(!(iFlag & EPrintBinary)) { HexToStrL(clientEntity); } break; } default: User::Leave(KErrGeneral); } } start = ETrue; pos = pos<<1; } } } record = CDecisionRecord::NewL(clientSid,evaluatorId,serviceId,serverSid,fingerprint,clientEntity,description,result,policyVer,evaluatorInfo,recordId); CleanupStack::PopAndDestroy(&description); CleanupStack::PushL(record); return record; }
/** move object operations @return A valid MTP response code. */ TMTPResponseCode CMTPMoveObject::MoveObjectL() { OstTraceFunctionEntry0( CMTPMOVEOBJECT_MOVEOBJECTL_ENTRY ); TMTPResponseCode responseCode = EMTPRespCodeOK; GetParametersL(); RBuf newObjectName; newObjectName.CreateL(KMaxFileName); newObjectName.CleanupClosePushL(); newObjectName = *iDest; const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid)); TParsePtrC fileNameParser(suid); // Check if the object is a folder or a file. if(!iIsFolder) { if((newObjectName.Length() + fileNameParser.NameAndExt().Length()) <= newObjectName.MaxLength()) { newObjectName.Append(fileNameParser.NameAndExt()); } responseCode = CanMoveObjectL(suid, newObjectName); } else // It is a folder. { TFileName rightMostFolderName; LEAVEIFERROR(BaflUtils::MostSignificantPartOfFullName(suid, rightMostFolderName), OstTraceExt1( TRACE_ERROR, DUP1_CMTPMOVEOBJECT_MOVEOBJECTL, "extract most significant part of %S failed", suid)); if((newObjectName.Length() + rightMostFolderName.Length() + 1) <= newObjectName.MaxLength()) { newObjectName.Append(rightMostFolderName); // Add backslash. _LIT(KBackSlash, "\\"); newObjectName.Append(KBackSlash); } } iNewRootFolder = newObjectName.AllocL(); OstTraceExt1( TRACE_NORMAL, CMTPMOVEOBJECT_MOVEOBJECTL, "%S", *iNewRootFolder ); if(responseCode == EMTPRespCodeOK) { delete iFileMan; iFileMan = NULL; iFileMan = CFileMan::NewL(iFramework.Fs()); if(!iIsFolder) { MoveFileL(newObjectName); } else { MoveFolderL(); SendResponseL(responseCode); } } CleanupStack::PopAndDestroy(); // newObjectName. OstTraceFunctionExit0( CMTPMOVEOBJECT_MOVEOBJECTL_EXIT ); return responseCode; }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CaSqlQueryCreator::CreateGetEntriesQueryByQueryL( const CCaInnerQuery* aQuery, CCaSqlQuery* aSqlQuery ) { DEBUG(("_CA_:CASqlQueryCreator::CreateGetEntriesQueryByQueryL")); RBuf whereStatement; whereStatement.CleanupClosePushL(); TUint flagsOn = aQuery->GetFlagsOn(); if( flagsOn != 0 ) { whereStatement.ReAllocL( KAnd().Length() + whereStatement.Length() + KSQLGetEntryFlagsOn().Length() ); whereStatement.Append( KAnd ); whereStatement.Append( KSQLGetEntryFlagsOn ); } TUint flagsOff = aQuery->GetFlagsOff(); if( flagsOff != 0 ) { whereStatement.ReAllocL( KAnd().Length() + whereStatement.Length() + KSQLGetEntryFlagsOff().Length() ); whereStatement.Append( KAnd ); whereStatement.Append( KSQLGetEntryFlagsOff ); } TInt role = aQuery->GetRole(); if( role != 0 ) { whereStatement.ReAllocL( KAnd().Length() + whereStatement.Length() + KSQLGetEntryRole().Length() ); whereStatement.Append( KAnd ); whereStatement.Append( KSQLGetEntryRole ); } TUint uid = aQuery->GetUid(); if( uid != 0 ) { whereStatement.ReAllocL( KAnd().Length() + whereStatement.Length() + KSQLGetEntryUid().Length() ); whereStatement.Append( KAnd ); whereStatement.Append( KSQLGetEntryUid ); } const CDesC16ArrayFlat* typeNames = aQuery->GetEntryTypeNames(); if( typeNames && typeNames->MdcaCount() > 0 ) { RBuf typeNameWhereStatement; typeNameWhereStatement.CleanupClosePushL(); for( TInt i = 0; i < typeNames->MdcaCount(); i++ ) { typeNameWhereStatement.ReAllocL( typeNameWhereStatement.Length() + typeNames->MdcaPoint( i ).Length() + KSingleQuotes().Length() * 2 + KComma().Length() ); typeNameWhereStatement.Append( KSingleQuotes ); typeNameWhereStatement.Append( typeNames->MdcaPoint( i ) ); typeNameWhereStatement.Append( KSingleQuotes ); if( i != typeNames->MdcaCount() - 1 ) { typeNameWhereStatement.Append( KComma ); } } whereStatement.ReAllocL( KAnd().Length() + KSQLGetEntryTypeNames().Length() + typeNameWhereStatement.Length() + whereStatement.Length() ); whereStatement.Append( KAnd ); whereStatement.AppendFormat( KSQLGetEntryTypeNames, &typeNameWhereStatement ); CleanupStack::PopAndDestroy( &typeNameWhereStatement ); } if( aQuery->GetAttributes().Count() ) { RBuf whereAttributes; whereAttributes.CleanupClosePushL(); whereAttributes.CreateL( KEmpty ); for( TInt j=1; j <= aQuery->GetAttributes().Count(); j++ ) { // at1.AT_NAME = 'Attribute_Name_1' AND at1.AT_VALUE = 'Attribute_VALUE_1' TPtrC atrName( aQuery->GetAttributes().operator [](j-1)->Name() ); TPtrC atrValue( aQuery->GetAttributes().operator [](j-1)->Value() ); whereAttributes.ReAllocL( whereAttributes.Length() + 2 * KAnd().Length() + 4 * KSingleQuotes().Length() + 2 * KMaxIntNumLength + 2 * KAt().Length() + 2 * KDot().Length() + 2 * KEqual().Length() + KColumnAttrName().Length() + KColumnAttrValue().Length() + atrName.Length() + atrValue.Length() ); whereAttributes.Append( KAnd ); whereAttributes.Append( KAt ); whereAttributes.AppendNum( j ); whereAttributes.Append( KDot ); whereAttributes.Append( KColumnAttrName ); whereAttributes.Append( KEqual ); whereAttributes.Append( KSingleQuotes ); whereAttributes.Append( atrName ); whereAttributes.Append( KSingleQuotes ); whereAttributes.Append( KAnd ); whereAttributes.Append( KAt ); whereAttributes.AppendNum( j ); whereAttributes.Append( KDot ); whereAttributes.Append( KColumnAttrValue ); whereAttributes.Append( KEqual ); whereAttributes.Append( KSingleQuotes ); whereAttributes.Append( atrValue ); whereAttributes.Append( KSingleQuotes ); } whereStatement.ReAllocL( whereStatement.Length() + whereAttributes.Length() ); whereStatement.Append( whereAttributes ); CleanupStack::PopAndDestroy( &whereAttributes ); } RBuf leftJoins; leftJoins.CleanupClosePushL(); leftJoins.CreateL( KEmpty ); if( aQuery->GetAttributes().Count() ) { for( TInt j=1; j <= aQuery->GetAttributes().Count(); j++ ) { // LEFT JOIN CA_ATTRIBUTE as at1 ON ENTRY_ID = at1.AT_ENTRY_ID leftJoins.ReAllocL( leftJoins.Length() + KLeftJoinCaAttrubute1().Length() + KMaxIntNumLength + KLeftJoinCaAttrubute2().Length() + KMaxIntNumLength + KLeftJoinCaAttrubute3().Length() ); leftJoins.Append( KLeftJoinCaAttrubute1 ); leftJoins.AppendNum( j ); leftJoins.Append( KLeftJoinCaAttrubute2 ); leftJoins.AppendNum( j ); leftJoins.Append( KLeftJoinCaAttrubute3 ); } } whereStatement.ReAllocL( whereStatement.Length() + KGroupBy().Length() + KColumnEntryId().Length() ); whereStatement.Append( KGroupBy ); whereStatement.Append( KColumnEntryId ); TInt groupId = aQuery->GetParentId(); RBuf query; query.CleanupClosePushL(); if( groupId > 0 ) { RBuf getListByParentId2withWhere; getListByParentId2withWhere.CleanupClosePushL(); getListByParentId2withWhere.CreateL( KSQLGetListByParentId2().Length() + whereStatement.Length() ); getListByParentId2withWhere.AppendFormat( KSQLGetListByParentId2, &whereStatement ); query.ReAllocL( KSQLGetListByParentId1().Length() + leftJoins.Length() + getListByParentId2withWhere.Length() ); query.Append( KSQLGetListByParentId1 ); query.Append( leftJoins ); query.Append( getListByParentId2withWhere ); CleanupStack::PopAndDestroy( &getListByParentId2withWhere ); } else if ( aQuery->GetChildId() > 0 ) { RBuf getListByCildIdwithWhere; getListByCildIdwithWhere.CleanupClosePushL(); getListByCildIdwithWhere.CreateL( KSQLGetListByChildId().Length() + whereStatement.Length() ); getListByCildIdwithWhere.AppendFormat( KSQLGetListByChildId, &whereStatement ); query.ReAllocL( KSQLGetListByParentId1().Length() + leftJoins.Length() + getListByCildIdwithWhere.Length() ); query.Append( KSQLGetListByParentId1 ); query.Append( leftJoins ); query.Append( getListByCildIdwithWhere ); CleanupStack::PopAndDestroy( &getListByCildIdwithWhere ); } else { query.CreateL( KSQLGetList1().Length() ); query.Append( KSQLGetList1 ); query.ReAllocL( query.Length() + leftJoins.Length() + KSQLGetList2().Length() ); query.Append( leftJoins ); query.Append( KSQLGetList2 ); if( whereStatement.Length() >= KAnd().Length() ) { TPtrC ptrWhereStatement( whereStatement.Right( whereStatement.Length() - KAnd().Length() ) ); query.ReAllocL( query.Length() + KWhere().Length() + ptrWhereStatement.Length() ); query.Append( KWhere ); query.Append( ptrWhereStatement ); } } CCaInnerQuery::TSortAttribute sort = aQuery->GetSort(); ModifyQueryForSortOrderL( sort, query, groupId > 0 ); if( aQuery->GetCount() > 0 ) { query.ReAllocL( query.Length() + KLimit().Length() + KMaxIntNumLength ); query.Append( KLimit ); TInt limitCount = aQuery->GetCount(); query.AppendNum( limitCount ); } aSqlQuery->SetQueryL( query ); CleanupStack::PopAndDestroy( &query ); CleanupStack::PopAndDestroy( &leftJoins ); CleanupStack::PopAndDestroy( &whereStatement ); }
/** * Read command line parameters and control the launching of the agents. */ void MainL() { LOG_MSG( "ENTER: t_multi_agent_launcher MainL()"); TInt ret = KErrNone; TInt numAgents = KNumAgents; TInt numTargets = KNumTargets; TInt numTestRuns = KNumTestRuns; TInt argc = User::CommandLineLength(); HBufC* commandLine = NULL; LOG_MSG2("t_multi_agent_launcher: MainL(): argc=%d", argc); if(argc) { commandLine = HBufC::NewLC(argc); TPtr commandLineBuffer = commandLine->Des(); User::CommandLine(commandLineBuffer); RBuf printCommandLine; CleanupClosePushL( printCommandLine ); printCommandLine.CreateL( commandLine->Des().Length() ); printCommandLine.Copy( commandLine->Des() ); printCommandLine.Collapse(); LOG_MSG2("t_multi_agent_launcher: command line = %S", &printCommandLine); CleanupStack::PopAndDestroy( &printCommandLine ); // create a lexer and read through the command line TLex lex(*commandLine); while (!lex.Eos()) { // only look for options with first character '-' if (lex.Get() == '-') { TChar arg = lex.Get(); switch ( arg ) { case 'n': lex.Val( numAgents ); LOG_MSG2("t_multi_agent_launcher: parsed numAgents as %d", numAgents); break; case 'm': lex.Val( numTargets ); LOG_MSG2("t_multi_agent_launcher: parsed numTargets as %d", numTargets); break; case 't': lex.Val( numTestRuns ); LOG_MSG2("t_multi_agent_launcher: parsed numTestRuns as %d", numTestRuns); break; default: LOG_MSG("t_multi_agent_launcher: unknown argument ignoring it"); break; } } } } // Note: below is a workaround to overcome an issue with RTest server crashing // when writing to the windows console from different agents (on different CPUs // at the same time). To overcome this we get signaled by the agents when they have // completed their tests so that we can do a RTest complete RSemaphore launchSemaphore; CleanupClosePushL(launchSemaphore); ret = launchSemaphore.CreateGlobal(KLaunchSemaphoreName, 0); LOG_MSG2( ">Target Launcher : RSemaphore.CreateGlobal ret %d", ret); User::LeaveIfError( ret ); ret = launchSemaphore.OpenGlobal(KLaunchSemaphoreName); LOG_MSG2( ">Target Launcher : RSemaphore.OpenGlobal ret %d", ret); User::LeaveIfError( ret ); //Now launch the requested number of apps for the requested number of test runs for( TInt j = 0; j < numTestRuns; j++ ) { for( TInt i = 0; i < numAgents; i++ ) { RBuf targetName; targetName.CleanupClosePushL(); targetName.CreateL(KAgentExe()); RProcess aProc; CleanupClosePushL(aProc); RBuf launcherOptions; CleanupClosePushL(launcherOptions); const TInt additionalWords = 2; launcherOptions.CreateL( KAgentOptions().Length() + additionalWords ); // Apply offset: launcherOptions.Format( .., .., i * numTargets, ..) // workaround to ensure we have the same binary for multiple agents. // e.g. So if offset = 0, agent attaches to app1, app2, app3, app4, app5 // if offset = 5, agent attached to app6, app7, app8, app9, app10 etc. // Note: apps need to be in rom otherwise the agent will fail on an assert // (with KErrNotFound) launcherOptions.Format( KAgentOptions(), (TUint)numTargets, i * numTargets, 0); ret = LaunchProcess( aProc, targetName, launcherOptions ); CleanupStack::PopAndDestroy(3,&targetName); User::LeaveIfError(ret); } } // Wait for all agents to do their testing before checking the semaphore User::After(12000000); LOG_MSG( ">Target Launcher: Semaphore wait"); for (TInt i = 0; i < numAgents; i ++) { //We need this delay just in case an agent crashes and never signals the sem ret = launchSemaphore.Wait(100000); if( ret != KErrNone ) { LOG_MSG3("launchSemaphore.Wait ret %d for agent %d", ret, i); break; } } LOG_MSG2( "testing for Semaphore ret %d", ret); // We only want to have one RTest instance at any one time since otherwise RTest can panic RTest test(_L("T_MULTI_AGENT_LAUNCHER")); test.Start(_L("t_multi_agent_launcher Check for agents finishing correctly")); test(ret == KErrNone); test.End(); test.Close(); CleanupStack::PopAndDestroy(&launchSemaphore); // launchSemaphore if( commandLine ) CleanupStack::PopAndDestroy(commandLine); LOG_MSG("EXIT: t_multi_agent_launcher MainL()"); }
void CConeErrorMsgTestAppUi::TestLeaveWithErrorTextL(const TDesC& aErrorText, const TDesC* aContextErrorText, const TBool& aExceedMaxDesc) { RBuf testMsg; testMsg.CreateL(aErrorText); testMsg.CleanupClosePushL(); TInt err=KErrNone; if (aContextErrorText) { RBuf testConMsg; testConMsg.CreateL(*aContextErrorText); testConMsg.CleanupClosePushL(); TRAP(err,iCoeEnv->LeaveWithErrorText(testMsg, &testConMsg)); TDes& errConRxText = static_cast<CTestCoeEnv*>(iCoeEnv)->TestErrorContextText(); RBuf errConMsg; errConMsg.CreateL(errConRxText); errConMsg.CleanupClosePushL(); INFO_PRINTF3(_L("Err Cntxt Msg Tx: %S, Err Cntxt Msg Rx: %S"), &testConMsg, &errConMsg); if (aExceedMaxDesc) { TEST(testConMsg!=errConMsg); TEST(errConMsg.Length()==80); // KErrorContextTextLength TEST(errConMsg[79]==KBaflCharTruncation); testConMsg.Delete(80, 1); // remove the last char testConMsg[79]=KBaflCharTruncation; // set the last char to the truncation char TEST(testConMsg==errConMsg); } else { TEST(testConMsg==errConMsg); } CleanupStack::PopAndDestroy(2); } else { TRAP(err,iCoeEnv->LeaveWithErrorText(testMsg)); TDes& errConText = static_cast<CTestCoeEnv*>(iCoeEnv)->TestErrorContextText(); INFO_PRINTF3(_L("Actual Context Length: %d, Expected Context Length: %d"), errConText.Length(), 0); TEST(errConText.Length()==0); } INFO_PRINTF3(_L("Actual Leave Code: %d, Expected Leave Code: %d"), err, KErrExtendedWithText); TEST(err==KErrExtendedWithText); TDes& errRxText = ((CTestCoeEnv *)iCoeEnv)->TestErrorText(); RBuf errMsg; errMsg.CreateL(errRxText); errMsg.CleanupClosePushL(); INFO_PRINTF3(_L("Err Msg Tx: %S, Err Msg Rx: %S"), &testMsg, &errMsg); if (aExceedMaxDesc) { TEST(testMsg!=errMsg); TEST(errMsg.Length()==80); // KErrorTextLength TEST(errMsg[79]==KBaflCharTruncation); testMsg.Delete(80, 1); // remove the last char testMsg[79]=KBaflCharTruncation; // set the last char to the truncation char TEST(testMsg==errMsg); } else { TEST(testMsg==errMsg); } CleanupStack::PopAndDestroy(2); }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CaSqlQueryCreator::CreateAddQueryL( CCaInnerEntry* aEntry, RPointerArray<CCaSqlQuery>& aSqlQuery, RSqlDatabase& aSqlDb ) { DEBUG(("_CA_:CASqlQueryCreator::CreateAddQueryL")); CCaSqlQuery* queryIcon = CCaSqlQuery::NewLC( aSqlDb ); TIconType iconType = CaSqlQueryCreator::CheckIconType( aEntry ); if( iconType == EProperIcon ) { CreateAddIconQueryL( aEntry, queryIcon, aSqlDb ); //add new icon to DB aSqlQuery.AppendL( queryIcon ); CleanupStack::Pop( queryIcon ); } else { // icon added to DB by another entry or not added CleanupStack::PopAndDestroy( queryIcon ); queryIcon = NULL; } if( aEntry->GetId() != -1 ) { // check if entry is new and has to be added to DB or just updated CCaSqlQuery* query = CCaSqlQuery::NewLC( aSqlDb ); if( aEntry->GetId() > 0 ) { //Update query is faster than replace query CreateUpdateQueryEntryL( aEntry, query ); } else { // check if entry's Uid was set if( aEntry->GetUid() == 0 ) { if( ( aEntry->GetIconId() == 0 ) && ( queryIcon == NULL ) ) { query->SetQueryL( KSQLInsertToEntryUniqueUidWithoutIcon ); } else { query->SetQueryL( KSQLInsertToEntryUniqueUid ); } } else { if( ( aEntry->GetIconId() == 0 ) && ( queryIcon == NULL ) ) { query->SetQueryL( KSQLInsertToEntryWithoutIcon ); } else { query->SetQueryL( KSQLInsertToEntry ); } } } query->SetTableType( CCaSqlQuery::EEntryTable ); aSqlQuery.AppendL( query ); CleanupStack::Pop( query ); } // remove all entry's attributs from DB CCaSqlQuery* query = CCaSqlQuery::NewLC( aSqlDb ); query->SetQueryL( KSQLDeleteAttribute ); aSqlQuery.Append( query ); query->SetTableType( CCaSqlQuery::EAttributeTable ); CleanupStack::Pop( query ); if( aEntry->GetAttributes().Count() > 0 ) { CCaSqlQuery* query = CCaSqlQuery::NewLC( aSqlDb ); query->SetQueryL( KSQLInsertToAttribute ); aSqlQuery.AppendL( query ); query->SetTableType( CCaSqlQuery::EAttributeTable ); CleanupStack::Pop( query ); } if( iconType == ENullIconToRemove ) { RBuf queryRemoveIcon; queryRemoveIcon.CleanupClosePushL(); queryRemoveIcon.CreateL( KSQLDeleteIconWhereIconId().Length() ); queryRemoveIcon.Append( KSQLDeleteIconWhereIconId ); queryRemoveIcon.ReAllocL( KSQLDeleteIconWhereIconId().Length() + KMaxIntNumLength ); queryRemoveIcon.AppendNum( aEntry->GetIconId() ); CCaSqlQuery* query = CCaSqlQuery::NewLC( aSqlDb ); query->SetQueryL( queryRemoveIcon ); aSqlQuery.AppendL( query ); query->SetTableType( CCaSqlQuery::EIconTable ); CleanupStack::Pop( query ); CleanupStack::PopAndDestroy( &queryRemoveIcon ); } }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CaSqlQueryCreator::CreateUpdateQueryEntryL( const CCaInnerEntry* aEntry, CCaSqlQuery* aQuery ) { DEBUG( ("_CA_:CASqlQueryCreator::CreateUpdateQueryEntryL") ); RBuf query; query.CleanupClosePushL(); query.CreateL( KSQLUpdateEntry().Length() ); query.Append( KSQLUpdateEntry ); // text if( aEntry->GetText().Length() != 0 ) { query.ReAllocL( query.Length() + KSQLUpdateEntryText().Length() + KComma().Length() ); query.Append( KSQLUpdateEntryText ); query.Append( KComma ); } // description query.ReAllocL( query.Length() + KSQLUpdateEntryDescription().Length() + KComma().Length() ); query.Append( KSQLUpdateEntryDescription ); query.Append( KComma ); // role query.ReAllocL( query.Length() + KSQLUpdateEntryRole().Length() + KComma().Length() ); query.Append( KSQLUpdateEntryRole ); query.Append( KComma ); // type_name if( aEntry->GetEntryTypeName().Length() != 0 ) { query.ReAllocL( query.Length() + KSQLUpdateEntryTypeName().Length() + KComma().Length() ); query.Append( KSQLUpdateEntryTypeName ); query.Append( KComma ); } // id_icon TIconType iconType = CaSqlQueryCreator::CheckIconType( aEntry ); if( iconType == ENullIconToRemove || iconType == ENullIcon ) { query.ReAllocL( query.Length( ) + KSQLUpdateEntryIdIconNull().Length() + KComma().Length() ); query.Append( KSQLUpdateEntryIdIconNull ); } else { query.ReAllocL( query.Length( ) + KSQLUpdateEntryIdIcon().Length() + KComma().Length() ); query.Append( KSQLUpdateEntryIdIcon ); } query.Append( KComma ); // check if entry's Uid was set if( aEntry->GetUid() ) { query.ReAllocL( query.Length() + KSQLUpdateEntryUid().Length() + KComma().Length() ); query.Append( KSQLUpdateEntryUid ); query.Append( KComma ); } else { query.ReAllocL( query.Length() + KSQLUpdateEntryUidNULL().Length() + KComma().Length() ); query.Append( KSQLUpdateEntryUidNULL ); query.Append( KComma ); } //flags query.ReAllocL( query.Length() + KSQLUpdateEntryFlags().Length() + KComma().Length() ); query.Append( KSQLUpdateEntryFlags ); query.ReAllocL( query.Length() + KSQLUpdateWhere().Length() ); query.Append( KSQLUpdateWhere ); aQuery->SetQueryL( query ); CleanupStack::PopAndDestroy( &query ); }
/** * Reads test configuration data from ini file * Leaves if expected data not found */ TVerdict CWServTestStep::doTestStepPreambleL() { TVerdict ret=CTestStep::doTestStepPreambleL(); if (!GetIntFromConfig(KDefaultSectionName, KT_WservStressInit, iData.initPeriod)|| !GetIntFromConfig(KDefaultSectionName, KT_WservStressPeriod, iData.period)|| !GetIntFromConfig(KDefaultSectionName, KT_WservStressMaxRunCycles, iData.maxRunCycles)) { INFO_PRINTF1(_L("Error reading ini file")); User::Leave(KErrNotFound); } //random_seed is not a mandatory parameter iData.randomSeed = -1; TPtrC strSeed; GetStringFromConfig(KDefaultSectionName, KT_WservStressRandomSeed, strSeed); if (strSeed.Ptr()) { TLex seed; seed.Assign(strSeed); seed.Val(iData.randomSeed); } iData.minNumWindows = 0; //unlimited GetIntFromConfig(KDefaultSectionName, KT_WservStressMinNumWindows, iData.minNumWindows); iData.windowWidth = 400; GetIntFromConfig(KDefaultSectionName, KT_WservStressWindowWidth, iData.windowWidth); iData.windowHeight = 400; GetIntFromConfig(KDefaultSectionName, KT_WservStressWindowHeight, iData.windowHeight); iData.compareBitmaps = ETrue; GetBoolFromConfig(KDefaultSectionName, KT_WservStressCompareBitmaps, iData.compareBitmaps); iData.saveOnlyDifferent = ETrue; GetBoolFromConfig(KDefaultSectionName, KT_WservStressSaveOnlyDifferent, iData.saveOnlyDifferent); iData.saveDifferenceBitmap = EFalse; GetBoolFromConfig(KDefaultSectionName, KT_WservStressSaveDifferenceBitmap, iData.saveDifferenceBitmap); iData.clearAllBackground = ETrue; GetBoolFromConfig(KDefaultSectionName, KT_WservStressClearAllBackground, iData.clearAllBackground); TPtrC path; GetStringFromConfig(KDefaultSectionName, KT_WservStressLoggingPath, path); RBuf loggingPath; loggingPath.CleanupClosePushL(); loggingPath.CreateL(path.Length() + 16); if (path.Length()) { loggingPath.Copy(path); if (path[path.Length()-1] != '\\') { loggingPath.Append('\\'); } } else { loggingPath = _L("C:\\StressLog\\"); } iData.loggingPath = loggingPath; CleanupStack::PopAndDestroy(&loggingPath); return ret; }
// --------------------------------------------------------------------------- // Find property and its value by ID. // --------------------------------------------------------------------------- // EXPORT_C TInt CCenRepDatabaseUtil::FindPropertyL( TInt aEntryId, TUint32 aPropertyName, CCenRepDatabaseProperty& aProperty ) { //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindPropertyL - IN" ); RKeyArray keys; CleanupClosePushL( keys ); TBool found = EFalse; // Find all rows where ID is aServiceId (entry row + each property row) TInt err = iRepository->FindEqL( iStartKey, iColMask, aEntryId, keys ); TInt count = keys.Count(); if ( KErrNone == err && count > 0 ) { TUint32 idKey = keys[ 0 ]; for ( TInt i = 1; i <= iColCount; i++ ) { TUint32 propertyKey = idKey + i * iColIncrement; TUint32 propertyName = propertyKey - idKey + iStartKey; if( propertyName == aPropertyName ) { RBuf value; value.CreateL( KCenRepMaxDesLength ); value.CleanupClosePushL(); err = iRepository->Get( propertyKey, value ); if( err == KErrNone ) { if( value.Compare( KNullDesC ) != 0 ) { aProperty.SetName( propertyName ); User::LeaveIfError( aProperty.SetValue( value ) ); found = ETrue; } } CleanupStack::PopAndDestroy( &value ); break; } } } if( found ) { err = KErrNone; } else { if( err == KErrNone ) { err = KErrNotFound; } } CleanupStack::PopAndDestroy( &keys ); //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindPropertyL - OUT" ); return err; }
/** GetObjectHandles request handler */ void CMTPGetObjectHandles::ServiceL() { OstTraceFunctionEntry0( CMTPGETOBJECTHANDLES_SERVICEL_ENTRY ); if(iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted) { TUint storageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1); TUint handle = Request().Uint32(TMTPTypeRequest::ERequestParameter3); TUint enumerateState = iSingletons.DpController().StorageEnumerateState(storageId); if ( (enumerateState < CMTPDataProviderController::EEnumeratingPhaseOneDone) || (enumerateState != CMTPDataProviderController::EEnumeratedFulllyCompleted && handle != KMTPHandleAll)) { if (iTimeoutCount++ >= KMTPGetObjectHandlesTimeOut) { OstTrace0( TRACE_NORMAL, CMTPGETOBJECTHANDLES_SERVICEL, "Wait for enumeration time out, return busy." ); SendResponseL(EMTPRespCodeDeviceBusy); iTimeoutCount = 0; OstTraceFunctionExit0( CMTPGETOBJECTHANDLES_SERVICEL_EXIT ); return; } else { OstTrace0( TRACE_NORMAL, DUP1_CMTPGETOBJECTHANDLES_SERVICEL, "Enumeration not completed, suspend request." ); RegisterPendingRequest(20); OstTraceFunctionExit0( DUP1_CMTPGETOBJECTHANDLES_SERVICEL_EXIT ); return; } } } iTimeoutCount = 0; delete iHandles; iHandles = NULL; iHandles = CMTPTypeArray::NewL(EMTPTypeAUINT32); OstTraceExt2( TRACE_NORMAL, DUP2_CMTPGETOBJECTHANDLES_SERVICEL, "IsConnectMac = %d; ERequestParameter2 = %d", iDevDpSingletons.DeviceDataStore().IsConnectMac(), Request().Uint32(TMTPTypeRequest::ERequestParameter2)); if(iDevDpSingletons.DeviceDataStore().IsConnectMac() &&(KMTPFormatsAll == Request().Uint32(TMTPTypeRequest::ERequestParameter2))) { OstTrace0( TRACE_NORMAL, DUP3_CMTPGETOBJECTHANDLES_SERVICEL, "ConnectMac and Fetch all." ); HandleObjectHandlesUnderMacL(*iHandles); } else { RMTPObjectMgrQueryContext context; RArray<TUint> handles; CleanupClosePushL(context); CleanupClosePushL(handles); TMTPObjectMgrQueryParams params(Request().Uint32(TMTPTypeRequest::ERequestParameter1), Request().Uint32(TMTPTypeRequest::ERequestParameter2), Request().Uint32(TMTPTypeRequest::ERequestParameter3)); do { iFramework.ObjectMgr().GetObjectHandlesL(params, context, handles); TUint32 storageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1); TUint32 parentHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter3); if ( storageId != KMTPStorageAll && parentHandle == KMTPHandleNoParent ) { const CMTPStorageMetaData& storage(iFramework.StorageMgr().StorageL(storageId)); HBufC* StorageSuid = storage.DesC(CMTPStorageMetaData::EStorageSuid).AllocL(); RBuf suid; suid.CleanupClosePushL(); suid.CreateL(KMaxFileName); suid = *StorageSuid; _LIT(WMPInfoXml,"WMPInfo.xml"); suid.Append(WMPInfoXml); TUint32 handle = iFramework.ObjectMgr().HandleL(suid); if ( handle != KMTPHandleNone ) { TInt index = handles.Find(handle); if ( index != KErrNotFound ) { handles.Remove(index); handles.InsertL(handle,0); } } delete StorageSuid; StorageSuid = NULL; CleanupStack::PopAndDestroy(); } iHandles->AppendL(handles); } while (!context.QueryComplete()); CleanupStack::PopAndDestroy(&handles); CleanupStack::PopAndDestroy(&context); } SendDataL(*iHandles); OstTraceFunctionExit0( DUP2_CMTPGETOBJECTHANDLES_SERVICEL_EXIT ); }