EXPORT_C void CImSSmtpSettings::RestoreL( CMsvStore& aMessageStore )
	{
	RMsvReadStream in;
	in.OpenLC( aMessageStore, KUidMsvServiceEntry ); // pushes 'in' to the stack
	InternalizeL(in);
	CleanupStack::PopAndDestroy();
	}
/** Restores the object to the specified message store.

The function can leave with the standard stream leave codes.

@param aStore Store to which to write
*/
EXPORT_C void TImEmailTransformingInfo::RestoreL( CMsvStore& aStore )
	{
	RMsvReadStream in;
	in.OpenLC( aStore, KUidMsgFileTransformingInfo ); // pushes 'in' to the stack
	InternalizeL(in);
	in.Close();// make sure we close the stream
	CleanupStack::PopAndDestroy();
	}
// -----------------------------------------------------------------------------
// CWPPushMessage::RestoreL
// -----------------------------------------------------------------------------
//
EXPORT_C void CWPPushMessage::RestoreL( CMsvStore& aStore )
    {
    RMsvReadStream stream;
    stream.OpenLC( aStore, TUid::Uid( KProvisioningMessageStreamUid ) );
    InternalizeL( stream );
    CleanupStack::PopAndDestroy(); // stream

    ParseHeaderL();
    }
EXPORT_C void CImOffLineArrayStore::RestoreL(const CMsvStore& aMessageStore )
	{
	if (aMessageStore.IsPresentL(KUidImQueuedOperationList))
		{
		RMsvReadStream in;
		in.OpenLC( aMessageStore, KUidImQueuedOperationList ); // pushes 'in' to the stack
		InternalizeL(in);
		CleanupStack::PopAndDestroy();
		}
	}
EXPORT_C  void CObexMtmFileNameExternaliser::Internalise1FileNameL(CMsvEntry* aEntry,  TDes16* aFileName)
/**
* Static function to read in one filename from the store.
*
* @param aEntry entry to read the filename from
* @param aFileName Descriptor to receive the new filename. Any existing data will be overwritten. MUST be long enough to contain the name.
* @leave KErrXXX system wide error codes.
*/	
	{
	CMsvStore* messageStore = aEntry->ReadStoreL();
	CleanupStack::PushL(messageStore);

	RMsvReadStream messageReadStream;
	messageReadStream.OpenLC(*messageStore, KObexFileNameStreamUid);  // If data hasn't been stored then this will provide the error.

	// verify that we're reading the right type of data from the stream


	// INC042468: "AV21: Data Compatibility break caused by "PHAR-5SDJG9""
	// To regain compatibility, if the first integer read from the stream
	// is not the expected "KObexFileNameStreamFileNameUid", it is assumed it 
	// is the filename length. An extra check is made that it is a valid filename
	// length (<= KMaxFileName).
	// "KObexFileNameStreamFileNameUid" has also been modified so that there cannot
	// be a file with a name length equal to KObexFileNameStreamFileNameUid (in which
	// case we would have been in trouble ;-) )

	TInt32 firstInt = messageReadStream.ReadInt32L();
	TInt32 fileNameLength = 0;
	if (firstInt == KObexFileNameStreamFileNameUid)
		{
		// next will be the filename length
		fileNameLength = messageReadStream.ReadInt32L();
		}
	else if (firstInt <= KMaxFileName)
		{
		// let's assume the first integer in the stream was the filename length
		// (this happens if the message was saved by an old build (previous to PHAR-5SDJG9)
		fileNameLength = firstInt;
		}
	else
		{
		// neither the expected "KObexFileNameStreamFileNameUid" nor a valid filename length
		User::Leave(KErrArgument);	
		}

	messageReadStream.ReadL(*aFileName, fileNameLength);

	CleanupStack::PopAndDestroy(2, messageStore);  // messageStore, messageReadStream (calls Close() first)
	}