// ---------------------------------------------------------
// CNSmlDsProvisioningAdapter::GetTitleL
// ---------------------------------------------------------
void CNSmlDsProvisioningAdapter::GetTitleL()
	{
	if( iTitle == 0 )
		{
		RFs	fs;
		User::LeaveIfError( fs.Connect() );
		CleanupClosePushL( fs );

		TFileName fileName;
		TParse parse;
		parse.Set( KNSmlDsPovisioningDirAndResource, &KDC_RESOURCE_FILES_DIR, NULL );
		fileName = parse.FullName();

		RResourceFile resourceFile;
		BaflUtils::NearestLanguageFile( fs, fileName );
		resourceFile.OpenL( fs, fileName );
		CleanupClosePushL( resourceFile );

		HBufC8* dataBuffer = resourceFile.AllocReadLC( R_SYNC_PROVISIONING_TITLE );
			
		TResourceReader reader;
		reader.SetBuffer( dataBuffer ); 
		iTitle = reader.ReadHBufC16L(); 
		CleanupStack::PopAndDestroy( 3 ); //fs, resourcefile, databuffer
		}
	}
void CNSmlDSSettings::CreateHiddenProfilesL()
	{
	TFileName fileName;
	Dll::FileName( fileName );
	TParse parse;

	parse.Set( KNSmlDSProfilesRsc, &fileName, NULL );
	fileName = parse.FullName();

	RResourceFile resourceFile; 
	BaflUtils::NearestLanguageFile( iFsSession, fileName );

	TRAPD(leavecode,resourceFile.OpenL( iFsSession,fileName));
	if(leavecode != 0)
		{
		return;
		}
	CleanupClosePushL(resourceFile);
	
	HBufC8* profileRes = resourceFile.AllocReadLC( NSML_DS_PROFILES );
	TResourceReader reader;
	reader.SetBuffer( profileRes );

	CNSmlDSResourceProfiles* profileResReader = CNSmlDSResourceProfiles::NewLC( reader, this );
	profileResReader->SaveProfilesL(iResourceProfileArray);
	CleanupStack::PopAndDestroy(3); // profileResReader, profileRes, resourceFile
	}
示例#3
0
void CImConvertCharconv::SetSystemDefaultCharsetL()
	{	
	TBuf8<KMaxMIMECharSetLength> charsetName;
	TUint charset = KDefaultPlainCharset;
	
	// Try to get the character set from the Central Repository
	TInt err = GetSystemCharsetFromCenRepL(charsetName);
	if (KErrNone != err)
		{
		// That failed, fallback to reading from the resource file
		// Check the resource file..
		RResourceFile resFile;
		OpenResourceFileL(resFile, iFs);	// NB leaves if file not found

		// make sure the resource file will be closed if anything goes wrong
		TCleanupItem close( CloseResourceFile, &resFile );
		CleanupStack::PushL( close );		
			
		HBufC8* buf = resFile.AllocReadLC( DEFAULT_SYSTEM_CHARSET );

		TResourceReader reader;
		reader.SetBuffer(buf);
		charsetName.Copy(reader.ReadTPtrC8());
		
		CleanupStack::PopAndDestroy(2,&resFile); // buf, resFile
		}

	charset = GetMimeCharsetUidL(charsetName);

	// If the character set in the resource file is not recognised. Leave..
	if (charset==KUidMsvCharsetNone || !CharsetAvailable(charset))
		User::Panic(_L("IMCM"),EImcmSystemDefaultCharsetNotSupported);
	else
		iSystemDefaultCharset=charset;
	}
void CDPOFPrintingDevice::ShowConfirmationQueryL() 
    {
    LOG("CDPOFPrintingDevice::ShowConfirmationQueryL begin");
  	
  	RFs fs;
	User::LeaveIfError( fs.Connect() );
	CleanupClosePushL( fs );
	TFileName resourceFileName;
	resourceFileName.Append ( KDC_RESOURCE_FILES_DIR );
	resourceFileName.Append ( KResourceFileName );
	BaflUtils::NearestLanguageFile( fs, resourceFileName );
	RResourceFile resFile;
	resFile.OpenL( fs, resourceFileName );
	CleanupClosePushL( resFile );
	HBufC8 *resBuffer = resFile.AllocReadLC( R_QTN_PRINT_DPOF_CONFIRMATION_DIALOG );
	TResourceReader reader;
	reader.SetBuffer( resBuffer );
	TPtrC ptrQuestion = reader.ReadTPtrC();
	iQuestion = ptrQuestion.AllocL();
	CleanupStack::PopAndDestroy( 3 ); // resBuffer, resFile, fs

	iPQ = CAknGlobalConfirmationQuery::NewL();
    
    iConfirmationQuery = CConfirmationQuery::NewL( *this );
    
    iConfirmationQuery->StartWaitingAnswer( );        
    
    iPQ->ShowConfirmationQueryL( iConfirmationQuery->iStatus, *iQuestion, R_AVKON_SOFTKEYS_YES_NO );

    LOG("CDPOFPrintingDevice::ShowConfirmationQueryL end");
    }
EXPORT_C void CTestUtils::ReadResourceStringL(RResourceFile& aResFile, TInt aId, TDes& rString)
	{
	HBufC8* buf = aResFile.AllocReadLC(aId);
	TResourceReader reader;
	reader.SetBuffer(buf);
	rString.Copy(reader.ReadTPtrC());
	CleanupStack::PopAndDestroy(buf);
	}
// -----------------------------------------------------------------------------
// CAknKeyRotatorImpl::LoadHwStateRotationsL
// Reads the HW states from the AknPriv.rsc to an array.
// -----------------------------------------------------------------------------
//
void CAknKeyRotatorImpl::LoadHwStateRotationsL()
    {
    // Find the language specific resource file and then load it.
    RResourceFile resourceFile;
    RFs fsSession;
    User::LeaveIfError( fsSession.Connect() );
    CleanupClosePushL( fsSession );
    
    TFileName resourceFileName (KAknPrivRscFilePath);
    BaflUtils::NearestLanguageFile( fsSession, resourceFileName );
    resourceFile.OpenL(fsSession, resourceFileName);

    CleanupClosePushL( resourceFile );
    resourceFile.ConfirmSignatureL(0);
    
    // Read resources to a buffer. The resource definition for the target and
    // emulator are a bit different.
    HBufC8* res;
#ifdef __WINS__
    res = resourceFile.AllocReadLC( R_AKNPRIV_HARDWARE_STATE_SCREEN_MAP_EMUL );
#else
    res = resourceFile.AllocReadLC( R_AKNPRIV_HARDWARE_STATE_SCREEN_MAP );
#endif
    
    TResourceReader reader;
    reader.SetBuffer(res);
    
    // Read the entires. We are only interrested about the hwRotation.
    TInt count = reader.ReadInt16();
    for (TInt ii=0; ii<count; ii++)
        {
        /*TInt state =*/ reader.ReadInt16(); // Assumption (state == ii)
        /*TInt width =*/ reader.ReadInt16();
        /*TInt height =*/ reader.ReadInt16();
        CFbsBitGc::TGraphicsOrientation hwRotation = 
            static_cast<CFbsBitGc::TGraphicsOrientation>(reader.ReadInt16());
        /*CFbsBitGc::TGraphicsOrientation altRotation =*/ 
            static_cast<CFbsBitGc::TGraphicsOrientation>(reader.ReadInt16());
        
        User::LeaveIfError( iHwRotations.Append( hwRotation ) );
        }
    
    CleanupStack::PopAndDestroy(res);
    CleanupStack::PopAndDestroy(&resourceFile); // resourceFile.Close();  
    CleanupStack::PopAndDestroy(&fsSession); // fsSession.Close();
    }
// -----------------------------------------------------------------------------
// CPIMLocalizationData::ReadListInfoFromResourceL
// -----------------------------------------------------------------------------
//
void CPIMLocalizationData::ReadListInfoFromResourceL(
    RResourceFile& aResourceFile,
    TResourceReader& aReader)
{
    TInt32 listNameLabelId(aReader.ReadInt32());
    TInt32 fieldsId(aReader.ReadInt32());
    TInt32 attrsId(aReader.ReadInt32());

    // Read label from resource
    aReader.SetBuffer(aResourceFile.AllocReadLC(listNameLabelId));
    iListName = aReader.ReadHBufCL();
    // Resource buffer is not needed anymore
    CleanupStack::PopAndDestroy(); // AllocReadLC()

    // Read fields from resource. Fields must be specified in the resource
    // file since empty lists are not allowed.
    aReader.SetBuffer(aResourceFile.AllocReadLC(fieldsId));

    TInt count(aReader.ReadInt16());
    for (TInt i(0); i < count; i++)
    {
        CPIMLabelProvider* provider = CPIMLabelProvider::NewLC(aReader);
        iFields.AppendL(provider);
        CleanupStack::Pop(provider);
    }
    // Resource buffer is not needed anymore
    CleanupStack::PopAndDestroy(); // AllocReadLC()

    // Read attributes from resource. Do nothing if attributes not specified
    if (attrsId != 0)
    {
        // Create buffer to the attributes lists
        aReader.SetBuffer(aResourceFile.AllocReadLC(attrsId));

        count = aReader.ReadInt16();
        for (TInt i(0); i < count; i++)
        {
            CPIMLabelProvider* provider = CPIMLabelProvider::NewLC(aReader);
            iAttributes.AppendL(provider);
            CleanupStack::Pop(provider);
        }
        // Resource buffer is not needed anymore
        CleanupStack::PopAndDestroy(); // AllocReadLC()
    }
}
示例#8
0
LOCAL_C void CheckDefaultTemplate(CContactDatabase* aDb, RFs& aFs, TContactItemId aSystemTemplateId)
	{
	test.Next(_L("System template"));
	
    _LIT(KCntSystemTemplate,"z:\\resource\\cntmodel\\customisedcntmodel.rsc");
	
	TFileName fileName(KCntSystemTemplate);
	BaflUtils::NearestLanguageFile(aFs,fileName);
//
	RResourceFile resourceFile;
	resourceFile.OpenL(CntTest->Fs(),fileName);
	CleanupClosePushL(resourceFile);
	resourceFile.ConfirmSignatureL(4);
	TResourceReader resReader;
	resReader.SetBuffer(resourceFile.AllocReadLC(R_CNTUI_NEW_FIELD_DEFNS));
//
	CContactTemplate *testTemplate=CContactTemplate::NewLC();
	TInt count=resReader.ReadInt16(); // num fields
	while(count--)
		{
		TStorageType storageType=resReader.ReadInt32();
		TUid contactFieldUid=TUid::Uid(resReader.ReadInt32());
		TUid vCardMappingUid=TUid::Uid(resReader.ReadInt32());
//
		CContactItemField* field=CContactItemField::NewLC(storageType);
//
		field->SetMapping(vCardMappingUid);
		if (contactFieldUid!=KUidContactFieldNone)
			field->AddFieldTypeL(contactFieldUid);
//
		TInt mappingCount;
		if((mappingCount=resReader.ReadInt16())!=0)
			{
			while(mappingCount--)
				field->AddFieldTypeL(TUid::Uid(resReader.ReadInt32()));
			}
		field->SetUserFlags(resReader.ReadInt32());
		field->SetLabel(resReader.ReadHBufCL());
		TUint flags=resReader.ReadInt32();
		if (flags&EContactFieldFlagHidden)
			field->SetHidden(ETrue);
		if (flags&EContactFieldFlagReadOnly)
			field->SetReadOnly(ETrue);
		if (flags&EContactFieldFlagSynchronize)
			field->SetSynchronize(ETrue);
		if (flags&EContactFieldFlagDisabled)
			field->SetDisabled(ETrue);
//
		testTemplate->AddFieldL(*field);
		CleanupStack::Pop();
		}
	doTestTemplate(aDb,aSystemTemplateId,testTemplate,ETrue);
	CleanupStack::PopAndDestroy(3);	// testTemplate,resourceFile close, resBuffer
	}
/**
Sets default content base filename
*/	
void CUnknownPushMsgEntry::SetDefaultBaseFileNameL()
	{
	// generate default filename from the wappushunknown resource file. 
	RResourceFile resourceFile;
	OpenResourceFileL(resourceFile);
	CleanupClosePushL(resourceFile);

	HBufC8* buf = resourceFile.AllocReadLC(CONTENT);
	TResourceReader reader;
	reader.SetBuffer(buf);

	iDefaultBaseFilename.Copy(reader.ReadTPtrC());		
	CleanupStack::PopAndDestroy(2,&resourceFile); // buf, resourceFile
	}
// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CCapabilityManager::GetPhoneConfigL()
    {
    FLOG(_L("[IMAGEPRINTUI]>>> :CCapabilityManager, GetPhoneConfigL BEGIN"));
    
        
    TBuf<KResource> resourceFile(PathInfo::RomRootPath());
    TBuf<KResource> length(KPhoneCapability);    
    resourceFile.SetLength(KDriver + length.Length());
    resourceFile.Replace(KDriver, length.Length(), KPhoneCapability);
    
    RResourceFile resource;
    resource.OpenL(CCoeEnv::Static()->FsSession(),  resourceFile);
    FLOG(_L("[IMAGEPRINTUI]>>> CImagePrintUi:CCapabilityManager, Resource open"));
    
    CleanupClosePushL(resource);
    resource.ConfirmSignatureL(KPhoneCapabilityVersion);
    
    HBufC8* id = resource.AllocReadLC(PHONECAPABILITY_CONFIG);
    
    TResourceReader reader;
    reader.SetBuffer(id);   
    
    TInt qualityCount = reader.ReadUint8();
    TInt papersizeCount = reader.ReadUint8();
    TInt layoutCount  = reader.ReadUint8();
      
       
    for (TInt i = 0; i < qualityCount; i++)
    	{
    	iPhoneSuppQuality.AppendL(reader.ReadUint16());
    	}
    FLOG(_L("[IMAGEPRINTUI]>>> CImagePrintUi:CCapabilityManager, quality readed"));
    	
    for (TInt i = 0; i < papersizeCount; i++)
    	{
       	iPhoneSuppPaperSize.AppendL(reader.ReadUint16());
    	}		
    
    FLOG(_L("[IMAGEPRINTUI]>>> CImagePrintUi:CCapabilityManager, papersize readed"));
    for (TInt i = 0; i < layoutCount; i++)
    	{
    	iPhoneSuppLayout.AppendL(reader.ReadUint16());
    	}
    FLOG(_L("[IMAGEPRINTUI]>>> CImagePrintUi:CCapabilityManager, layout readed"));
    	
    CleanupStack::PopAndDestroy(id);
    CleanupStack::PopAndDestroy(&resource);
    FLOG(_L("[IMAGEPRINTUI]<<< CImagePrintUi:CCapabilityManager GetPhoneConfigL END "));
    }
/**
CheckIfFooterMessageExistsL()
Checks the email for the presence of the footer string

@param aRecvBodyText
Reference to a descriptor holding the body text

@param aFooterSize
The expected number of KB remaining on the server which has been inserted into the footer string

@return
ETrue if footer string found otherwise EFalse 
*/
TBool CT_MsgComparePopEmailMsgs::CheckIfFooterMessageExistsL(TPtrC& aRecvBodyText , TInt& aFooterSize)
	{
	RResourceFile resFile;
	CT_MsgUtils ::OpenResourceFileL(resFile, iFs, KImEngineResourceFile);	// NB leaves if file not found
	TCleanupItem close(CT_MsgUtils ::CloseResourceFile, &resFile);
	CleanupStack::PushL(close);
	
	HBufC8* buf = NULL;
	buf = resFile.AllocReadLC(PARTIAL_DOWNLOAD_FOOTER_MESSAGE);
	TResourceReader reader;
	reader.SetBuffer(buf);

	HBufC* resourceBuf = (reader.ReadTPtrC()).AllocL();
	CleanupStack::PushL(resourceBuf);

	TInt len = resourceBuf->Find(_L("%d"));
	const TInt KBufLen = 256;
	TBuf<KBufLen> findBuf;

	if(len == KErrNotFound)
		{
		len = resourceBuf->Length();
		}

	if(len > KBufLen)
		{
		len = KBufLen;
		}
	
	findBuf.Copy(resourceBuf->Ptr(), len);
	len = aRecvBodyText.Find(findBuf);

	if(len>=0)
		{
		TPtrC rest=aRecvBodyText.Right(aRecvBodyText.Length()-len-findBuf.Length());
		TLex lex(rest.Left(rest.Locate(TChar(' '))));
		lex.Val(aFooterSize);
		}
	else
		{
		aFooterSize=0;
		}

	CT_MsgUtils ::CloseResourceFile(&resFile);
	CleanupStack::PopAndDestroy(3); // buf, resourceBuf, close
	return (len != KErrNotFound);
	}
示例#12
0
void HlpLauncher::DoLaunchHelpApplicationL(RWsSession& aWsSession, const TDesC8& aCmdLine)
	{
	TApaTaskList taskList(aWsSession);
	TApaTask task = taskList.FindApp(KHlpAppUid);
	if (task.Exists())
		{
		task.SendMessage (KHlpAppWsMsg, aCmdLine); 
		task.BringToForeground();
		}
	else
		{
		CApaCommandLine* cmdLine=CApaCommandLine::NewLC();

		// INC057477 fix
		// Get and open the resource file
		RFs f;
		CleanupClosePushL(f);

		User::LeaveIfError(f.Connect());
		RResourceFile r;

		r.OpenL(f, KHelpLauncherResource);
		CleanupClosePushL(r);
		
		// Read the path of the help application from the resource file
		r.ConfirmSignatureL();
		TResourceReader resReader;
		resReader.SetBuffer(r.AllocReadLC(R_HELP_PATH));
		TPtrC16 helpPath = resReader.ReadTPtrC16();
		cmdLine->SetExecutableNameL(helpPath);
		CleanupStack::PopAndDestroy(); // AllocReadLC
		CleanupStack::PopAndDestroy(); // close r
		CleanupStack::PopAndDestroy(); // close f
		
		cmdLine->SetCommandL(EApaCommandOpen);
		cmdLine->SetTailEndL(aCmdLine);
		//EikDll::StartAppL(*cmdLine);
		RApaLsSession lsSession;
  		User::LeaveIfError(lsSession.Connect());
  		CleanupClosePushL(lsSession);
  		User::LeaveIfError(lsSession.StartApp(*cmdLine));
  		CleanupStack::PopAndDestroy(&lsSession);
		CleanupStack::PopAndDestroy(); //cmdLine
		}
	}
示例#13
0
LOCAL_C void doExampleL()
    {
		// Declare a resource file
	RResourceFile resourceFile;
	
		// open resource file on the emulator(__WINS__  is defined for the Windows emulator)
		//(leave if error)
	#if defined(__WINS__)
	_LIT(KZSystemDataRsc,"Z:\\Resource\\apps\\ReadData.rsc");
	resourceFile.OpenL(fsSession, KZSystemDataRsc);
	#endif

		// open a resource file on the target phone
		// ( __EPOC32__ is defined for all target hardware platforms regardless of processor type/hardware architecture)
	#if defined(__EPOC32__)
	_LIT(KCSystemDataRsc,"C:\\Resource\\apps\\ReadData.rsc");
	resourceFile.OpenL(fsSession, KCSystemDataRsc);
	#endif
	
		// Read the first resource & construct a resource reader
	HBufC8* res = resourceFile.AllocReadLC(FIRST);

	TResourceReader theReader;
	theReader.SetBuffer(res);

		// construct a CResData object to contain
		// the simple resource of type DATA.
	CResData* resData = CResData::NewLC(theReader);

		// Can now remove resData from the cleanup stack
	CleanupStack::Pop();

		// finished with res
	CleanupStack::PopAndDestroy(); 

		// display data
	resData->ShowData();

		// destroy the CResData 
	delete resData;

		// finished with resource file, so close it.
	resourceFile.Close();
	}
示例#14
0
// ----------------------------------------------------------------------------
// CATCmdPluginEcom::::LoadResourcesL
// Load resources
// (may leave)
// Status : Approved
// ----------------------------------------------------------------------------
//
void CATCmdPluginEcom::LoadResourcesL()
    {
    TRACE_FUNC_ENTRY

    RFs fs;
    CleanupClosePushL( fs );

    TFileName fileName;
    fileName.Copy( KFileName );
    User::LeaveIfError( fs.Connect() );
    BaflUtils::NearestLanguageFile( fs, fileName );

    RResourceFile resourceFile;
    CleanupClosePushL( resourceFile );
    resourceFile.OpenL( fs, fileName );
    resourceFile.ConfirmSignatureL();

    HBufC8* buf8 = resourceFile.AllocReadLC( R_ATCMDPLUGIN_TRANSLATIONTABLE );
    
    TResourceReader reader;
    reader.SetBuffer( buf8 );
    
    TInt count = reader.ReadInt16(); // array count
    iTranslations = new ( ELeave ) CArrayPtrFlat<CATCmdTranslation>( count );

    while ( count-- )
        {
        const TInt code = reader.ReadInt32(); 

        HBufC8* param = reader.ReadHBufC8L(); 
        CleanupStack::PushL( param );
        CATCmdTranslation* t = new (ELeave) CATCmdTranslation( *param, code );
        CleanupStack::Pop( param ); // transfer ownership

        CleanupStack::PushL( t );
        iTranslations->AppendL( t );
        CleanupStack::Pop( t ); // transfer ownership
        }

    CleanupStack::PopAndDestroy( 3 ); // resourceFile, fs, buf8

    TRACE_FUNC_EXIT
    }
示例#15
0
void CSmtpClientMtm::ConstructL()
	{
	iWait=CMsvOperationActiveSchedulerWait::NewLC();
	CleanupStack::Pop();	// iWait

	iImSmtpSettings = new (ELeave) CImSmtpSettings;
	iHeader = CImHeader::NewLC();
	CleanupStack::Pop();	// iHeader

	//open the resource file
	RResourceFile resourceFile;
	OpenResourceFileL(resourceFile, Session().FileSession());
	CleanupClosePushL(resourceFile);

	HBufC8* buf = resourceFile.AllocReadLC(EMAIL_ADDRESS_FORMATTING_STRING);
	TResourceReader reader;
	reader.SetBuffer(buf);
	iEmailAddressFormatString = (reader.ReadTPtrC()).AllocL();
	CleanupStack::PopAndDestroy(2); // resourceFile (Close resourceFile), buf
	}
示例#16
0
// -----------------------------------------------------------------------------
// WPAdapterUtil::ReadHBufCL
// -----------------------------------------------------------------------------
//
EXPORT_C HBufC* WPAdapterUtil::ReadHBufCL( const TDesC& aDllPath, 
                                           const TDesC& aAdapterName,
                                           TInt aResourceId )
    {
    // Open a file server session
    RFs fs;
    User::LeaveIfError(fs.Connect());
    CleanupClosePushL(fs);

    // Open the resource file
    RResourceFile resourceFile;
    FindAndOpenResourceFileLC(fs, aDllPath, aAdapterName, resourceFile);

    TResourceReader resReader;
    resReader.SetBuffer( resourceFile.AllocReadLC( aResourceId ) );
    HBufC* text = resReader.ReadHBufCL();

    CleanupStack::PopAndDestroy(3); // resourceFile, fs, aResourceId

    return text;
    }
// ------------------------------------------------------------------------------------------------
// CNSmlAgendaDataProvider::DoOwnStoreFormatL
// Read own store format from own resource file.
// ------------------------------------------------------------------------------------------------
//
CSmlDataStoreFormat* CNSmlAgendaDataProvider::DoOwnStoreFormatL()
	{
	_DBG_FILE("CNSmlAgendaDataProvider::DoOwnStoreFormatL(): BEGIN");
	TFileName fileName;
	TParse parse;

    // Check correct Data Sync protocol
	TInt value( EDataSyncNotRunning );
	TInt error = RProperty::Get( KPSUidDataSynchronizationInternalKeys,
                                 KDataSyncStatus,
                                 value );
	if ( error == KErrNone &&
	     value == EDataSyncRunning )
	    {
	    parse.Set( KNSmlDSAgendaDataStoreRsc_1_1_2, &KDC_RESOURCE_FILES_DIR, NULL );
	    }
	else // error or protocol version 1.2 
	    {
	    parse.Set( KNSmlDSAgendaDataStoreRsc_1_2, &KDC_RESOURCE_FILES_DIR, NULL );
	    }		
	
	fileName = parse.FullName();
	RResourceFile resourceFile;
	BaflUtils::NearestLanguageFile( iSession, fileName );

	resourceFile.OpenL( iSession, fileName );
	CleanupClosePushL( resourceFile );

	HBufC8* profileRes = resourceFile.AllocReadLC( NSML_AGENDA_DATA_STORE );
	TResourceReader reader;
	reader.SetBuffer( profileRes );

	CSmlDataStoreFormat* dsFormat = CSmlDataStoreFormat::NewLC( iStringPool, reader );
	CleanupStack::Pop(); // dsFormat
	CleanupStack::PopAndDestroy( 2 ); // profileRes, resourceFile
	_DBG_FILE("CNSmlAgendaDataProvider::DoOwnStoreFormatL(): END");
	return dsFormat;
	}
void CMTPProxyDpConfigMgr::ConstructL()
	{
	OstTraceFunctionEntry0( CMTPPROXYDPCONFIGMGR_CONSTRUCTL_ENTRY );
	TUint32 resourceId = iFramework.DataProviderConfig().UintValue(MMTPDataProviderConfig::EOpaqueResource);
	// Reading from resource file mtpproxydp_config.rss 
	RResourceFile resourceFile;
	CleanupClosePushL(resourceFile);
	resourceFile.OpenL(iFramework.Fs(), iFramework.DataProviderConfig().DesCValue(MMTPDataProviderConfig::EResourceFileName));
	TResourceReader resourceReader;
	HBufC8* buffer = resourceFile.AllocReadLC(resourceId); 
	resourceReader.SetBuffer(buffer);
	FileMappingStruct st;
	const TInt numberOfEntries=resourceReader.ReadInt16();
	for(TInt count =0;count<numberOfEntries ; count++)
		{
		st.iDpUid=resourceReader.ReadInt32();
		st.iFileArray = resourceReader.ReadDesCArrayL();
		InsertToMappingStruct(st);	
		}	
		
	CleanupStack::PopAndDestroy(2, &resourceFile);
	
	OstTraceFunctionExit0( CMTPPROXYDPCONFIGMGR_CONSTRUCTL_EXIT );
	}
// -----------------------------------------------------------------------------
// CSisxUIStartupFile::ReadStartupItemsL
// Get all startup items from the given resource file.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CSisxUIStartupFile::ReadNewStartupItemsL( RArray<TStartupTaskParam>& aStartupItems,
                                               const RPointerArray<HBufC>& aFiles )
    {
    RResourceFile resource;
    CleanupClosePushL( resource );
    resource.OpenL( iFileSession, *iNewFile );
  
    TInt index( 0 );    

    // Read resources
    for ( index = 1; resource.OwnsResourceId( index ); index++ )
        {
        // Create the reader
        HBufC8* resBuffer = resource.AllocReadLC( index );
        TResourceReader reader;
        reader.SetBuffer( resBuffer );
 
        // Read version byte
        TInt version = reader.ReadUint8();        
     
        // Read actual parameters
        TStartupTaskParam item;
        item.iFileName.Copy( reader.ReadTPtrC() );        
        item.iRecoveryPolicy = (TStartupExceptionPolicy) reader.ReadUint16();
        
        aStartupItems.Append( item );

        CleanupStack::PopAndDestroy( resBuffer );
        }   

    // Validate the array. Each and every executable to be added to the 
    // startup list must also be installed by this package.
    for ( index = 0; index < aStartupItems.Count(); index++ ) 
        {
        // Sanity check
        if ( !aStartupItems[index].iFileName.Length() )
            {
            continue;
            }        
             
        TBool entryFound( EFalse );        
        TInt j( 0 );        
        iTemp = aStartupItems[index].iFileName;
        iTemp.Delete( 0, 1 );        
        iTemp.Fold();        

        for ( j = 0; j < aFiles.Count(); j++ )
            {            
            if ( aFiles[j]->FindF( iTemp ) >= 0 )
                {
                entryFound = ETrue;
                // Replace the possible ! with correct drive
                if ( aStartupItems[index].iFileName[0] == '!' )
                    {
                    TBuf<1> temp;
                    temp.Append( (*aFiles[j])[0] );                    
                    aStartupItems[index].iFileName.Replace(0, 1, temp );                    
                    }
                
                break;                
                }            
            }

        if ( !entryFound )
            {
            aStartupItems.Remove( index );
            index--;            
            }        
        }    

    CleanupStack::PopAndDestroy(); // resource
    }
示例#20
0
void TRsReadTester::CreateResourceReaderLC(TResourceReader& aReader,TInt aResourceId) const
    {
    HBufC8* resource=TheResourceFile.AllocReadLC(aResourceId);
    aReader.SetBuffer(resource);
    }