| 
sl@0
 | 
     1  | 
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
  | 
| 
sl@0
 | 
     2  | 
// All rights reserved.
  | 
| 
sl@0
 | 
     3  | 
// This component and the accompanying materials are made available
  | 
| 
sl@0
 | 
     4  | 
// under the terms of "Eclipse Public License v1.0"
  | 
| 
sl@0
 | 
     5  | 
// which accompanies this distribution, and is available
  | 
| 
sl@0
 | 
     6  | 
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
  | 
| 
sl@0
 | 
     7  | 
//
  | 
| 
sl@0
 | 
     8  | 
// Initial Contributors:
  | 
| 
sl@0
 | 
     9  | 
// Nokia Corporation - initial contribution.
  | 
| 
sl@0
 | 
    10  | 
//
  | 
| 
sl@0
 | 
    11  | 
// Contributors:
  | 
| 
sl@0
 | 
    12  | 
//
  | 
| 
sl@0
 | 
    13  | 
// Description:
  | 
| 
sl@0
 | 
    14  | 
// Implements Registry data handling.
  | 
| 
sl@0
 | 
    15  | 
// Registry structure...
  | 
| 
sl@0
 | 
    16  | 
// iRegistrations
  | 
| 
sl@0
 | 
    17  | 
// -> CDriveData					(Drive number 1)
  | 
| 
sl@0
 | 
    18  | 
// -> CDllData						(Dll number 1)
  | 
| 
sl@0
 | 
    19  | 
// |	 -> CInterfaceData				(Interface number 1)
  | 
| 
sl@0
 | 
    20  | 
// |	|	 -> CImplementationData -> CImplementationInformation	(Implementation 1)
  | 
| 
sl@0
 | 
    21  | 
// |	|	 -> CImplementationData -> CImplementationInformation	(Implementation 2)
  | 
| 
sl@0
 | 
    22  | 
// |	 -> CInterfaceData			
  | 
| 
sl@0
 | 
    23  | 
// -> CDllData						(Dll number 2)
  | 
| 
sl@0
 | 
    24  | 
// -> CInterfaceData				(Interface number 1)
  | 
| 
sl@0
 | 
    25  | 
// -> CImplementationData -> CImplementationInformation	(Implementation 1)
  | 
| 
sl@0
 | 
    26  | 
// 
  | 
| 
sl@0
 | 
    27  | 
//
  | 
| 
sl@0
 | 
    28  | 
  | 
| 
sl@0
 | 
    29  | 
/**
  | 
| 
sl@0
 | 
    30  | 
 @code
  | 
| 
sl@0
 | 
    31  | 
 @endcode
  | 
| 
sl@0
 | 
    32  | 
*/
  | 
| 
sl@0
 | 
    33  | 
  | 
| 
sl@0
 | 
    34  | 
#ifndef __REGISTRYDATA_H__
  | 
| 
sl@0
 | 
    35  | 
#define __REGISTRYDATA_H__
  | 
| 
sl@0
 | 
    36  | 
  | 
| 
sl@0
 | 
    37  | 
#include <e32base.h>
  | 
| 
sl@0
 | 
    38  | 
#include <f32file.h>
  | 
| 
sl@0
 | 
    39  | 
#include <barsread2.h> // RResourceReader
  | 
| 
sl@0
 | 
    40  | 
#include <s32std.h>
  | 
| 
sl@0
 | 
    41  | 
#include <s32file.h>
  | 
| 
sl@0
 | 
    42  | 
#include <badesca.h>
  | 
| 
sl@0
 | 
    43  | 
#include "clientrequest.h"
  | 
| 
sl@0
 | 
    44  | 
#include <ecom/ecom.h>
  | 
| 
sl@0
 | 
    45  | 
#include <ecom/ecomerrorcodes.h>
  | 
| 
sl@0
 | 
    46  | 
#include <ecom/ecomresolverparams.h>
  | 
| 
sl@0
 | 
    47  | 
#include <ecom/implementationinformation.h>
  | 
| 
sl@0
 | 
    48  | 
#include <ecom/publicregistry.h>
  | 
| 
sl@0
 | 
    49  | 
#include "EComEntry.h"
  | 
| 
sl@0
 | 
    50  | 
#include "DiscovererObserver.h"
  | 
| 
sl@0
 | 
    51  | 
#include "EComPerformance.h"
  | 
| 
sl@0
 | 
    52  | 
#include "callback.h"
  | 
| 
sl@0
 | 
    53  | 
  | 
| 
sl@0
 | 
    54  | 
/** 
  | 
| 
sl@0
 | 
    55  | 
The index of the uid which is used for matching dlls 
  | 
| 
sl@0
 | 
    56  | 
@internalComponent
  | 
| 
sl@0
 | 
    57  | 
*/
  | 
| 
sl@0
 | 
    58  | 
const TInt KTEntryDllUniqueIdIndex = 2;
  | 
| 
sl@0
 | 
    59  | 
  | 
| 
sl@0
 | 
    60  | 
/**
  | 
| 
sl@0
 | 
    61  | 
Default path to Interface Implementation Collection resource files.
  | 
| 
sl@0
 | 
    62  | 
@internalComponent
  | 
| 
sl@0
 | 
    63  | 
*/
  | 
| 
sl@0
 | 
    64  | 
_LIT(KEComResourceFilePath,"\\resource\\plugins\\");
  | 
| 
sl@0
 | 
    65  | 
  | 
| 
sl@0
 | 
    66  | 
/** The granularities of two arrays, iInterfaceImplIndex and
  | 
| 
sl@0
 | 
    67  | 
iImplIndex, have huge impact on
  | 
| 
sl@0
 | 
    68  | 
discovery time on boot up. Larger granularity does not
  | 
| 
sl@0
 | 
    69  | 
always shorten discovery time. The two default granularities
  | 
| 
sl@0
 | 
    70  | 
below are chosen empirically to optimize discovery time
  | 
| 
sl@0
 | 
    71  | 
while as much as possible, not to waste too much memory.
  | 
| 
sl@0
 | 
    72  | 
  | 
| 
sl@0
 | 
    73  | 
@internalComponent
  | 
| 
sl@0
 | 
    74  | 
*/
  | 
| 
sl@0
 | 
    75  | 
const TInt KDefaultInterfaceImplIndexGranularity = 23;
  | 
| 
sl@0
 | 
    76  | 
  | 
| 
sl@0
 | 
    77  | 
/** @internalComponent */
  | 
| 
sl@0
 | 
    78  | 
const TInt KDefaultImplIndexGranularity = 29;
  | 
| 
sl@0
 | 
    79  | 
  | 
| 
sl@0
 | 
    80  | 
// Forward declaration
  | 
| 
sl@0
 | 
    81  | 
class CEComCachedDriveInfo;
  | 
| 
sl@0
 | 
    82  | 
  | 
| 
sl@0
 | 
    83  | 
//
  | 
| 
sl@0
 | 
    84  | 
// CRegistryData class
  | 
| 
sl@0
 | 
    85  | 
  | 
| 
sl@0
 | 
    86  | 
/**
  | 
| 
sl@0
 | 
    87  | 
@internalComponent
  | 
| 
sl@0
 | 
    88  | 
class CRegistryData.
  | 
| 
sl@0
 | 
    89  | 
This class manages the entire data of the registry.
  | 
| 
sl@0
 | 
    90  | 
*/
  | 
| 
sl@0
 | 
    91  | 
class CRegistryData : public CBase
  | 
| 
sl@0
 | 
    92  | 
	{
 | 
| 
sl@0
 | 
    93  | 
public:
  | 
| 
sl@0
 | 
    94  | 
	// Make the test State Accessor a friend
  | 
| 
sl@0
 | 
    95  | 
	friend class TRegistryData_StateAccessor;
  | 
| 
sl@0
 | 
    96  | 
	friend class CRegistrar;
  | 
| 
sl@0
 | 
    97  | 
	
  | 
| 
sl@0
 | 
    98  | 
	class CDriveData;
  | 
| 
sl@0
 | 
    99  | 
	class CDllData;
  | 
| 
sl@0
 | 
   100  | 
	class CInterfaceData;
  | 
| 
sl@0
 | 
   101  | 
	class CImplementationData;	
  | 
| 
sl@0
 | 
   102  | 
  | 
| 
sl@0
 | 
   103  | 
	// The implemented structure for the registry data 
  | 
| 
sl@0
 | 
   104  | 
	typedef CRegistryData::CImplementationData* CImplementationDataPtr;
  | 
| 
sl@0
 | 
   105  | 
	
  | 
| 
sl@0
 | 
   106  | 
	typedef RArray<CImplementationDataPtr> RImplDataArray;
  | 
| 
sl@0
 | 
   107  | 
	/** whether the implementation to be added to the registry data
  | 
| 
sl@0
 | 
   108  | 
	is a newcomer, or upgrade of an existing implementation, or
  | 
| 
sl@0
 | 
   109  | 
	downgrade of an existing implementation. 
  | 
| 
sl@0
 | 
   110  | 
 	*/
  | 
| 
sl@0
 | 
   111  | 
	enum TInsertImplMode
  | 
| 
sl@0
 | 
   112  | 
		{
 | 
| 
sl@0
 | 
   113  | 
		EInsertImplUndefinedMode,
  | 
| 
sl@0
 | 
   114  | 
		EInsertImplAsNewcomerOfInterface,
  | 
| 
sl@0
 | 
   115  | 
		EInsertImplAsUpgradeOfExistingImpl,
  | 
| 
sl@0
 | 
   116  | 
		EInsertImplAsUnusedImpl
  | 
| 
sl@0
 | 
   117  | 
		};
  | 
| 
sl@0
 | 
   118  | 
		
  | 
| 
sl@0
 | 
   119  | 
public:	
  | 
| 
sl@0
 | 
   120  | 
	static CRegistryData* NewL(RFs& aFs);
  | 
| 
sl@0
 | 
   121  | 
  | 
| 
sl@0
 | 
   122  | 
	/** This overload is provided for ECom performance test to find
  | 
| 
sl@0
 | 
   123  | 
	the optimum granularity settings.
  | 
| 
sl@0
 | 
   124  | 
	@see CEComImplIndexPerfTest
  | 
| 
sl@0
 | 
   125  | 
	*/
  | 
| 
sl@0
 | 
   126  | 
	static CRegistryData* NewL(RFs& aFs, 
  | 
| 
sl@0
 | 
   127  | 
		TInt aInterfaceImplIndexGranularity, TInt aImplIndexGranularity);
  | 
| 
sl@0
 | 
   128  | 
  | 
| 
sl@0
 | 
   129  | 
	virtual ~CRegistryData();
  | 
| 
sl@0
 | 
   130  | 
	void ListImplementationsL(TUid aInterfaceUid,
  | 
| 
sl@0
 | 
   131  | 
							  RImplDataArray& aImplementationData) const;
  | 
| 
sl@0
 | 
   132  | 
	TInt SetEnabledState(TUid aImplementationUid, TBool aState);
  | 
| 
sl@0
 | 
   133  | 
	void TemporaryUninstallL(const TDriveUnit& aDrive);
  | 
| 
sl@0
 | 
   134  | 
	void UndoTemporaryUninstallL(const TDriveUnit& aDrive);
  | 
| 
sl@0
 | 
   135  | 
	TBool IsRegisteredWithDate(TUid aDllUid, 
  | 
| 
sl@0
 | 
   136  | 
								const TTime& aModified, 
  | 
| 
sl@0
 | 
   137  | 
								TBool& aUpdate, 
  | 
| 
sl@0
 | 
   138  | 
								CDriveData* aDriveData);
  | 
| 
sl@0
 | 
   139  | 
	void AddDllDataL(const TDriveUnit& aDrive, TInt aFoundDriveIndex, CDllData* aDllData);
  | 
| 
sl@0
 | 
   140  | 
	void UpdateDllDataL(const TDriveUnit& aDrive,TInt aFoundDriveIndex, CDllData* aDllData);
  | 
| 
sl@0
 | 
   141  | 
	void DiscoveriesBeginning() const;
  | 
| 
sl@0
 | 
   142  | 
	void DiscoveriesCompleteL(TBool aSuccessful, TPluginProcessingTypeIdentifier aProcessingType, TBool& aHasRegistryChanged);
  | 
| 
sl@0
 | 
   143  | 
	TBool IndexValid() const;
  | 
| 
sl@0
 | 
   144  | 
	TInt GetImplementationDllInfoForServer(	const TCapabilitySet& aCapabilitySet,
  | 
| 
sl@0
 | 
   145  | 
											const TUid aImplUid,
  | 
| 
sl@0
 | 
   146  | 
											const TUid aInterfaceUid,
  | 
| 
sl@0
 | 
   147  | 
											TEntry& aEntry,
  | 
| 
sl@0
 | 
   148  | 
											CImplementationInformation*& aImplInfo,
  | 
| 
sl@0
 | 
   149  | 
											TBool& aIsOnRWDrive) const;
  | 
| 
sl@0
 | 
   150  | 
	TInt GetImplementationDllInfoForClientL(const TClientRequest& aClientRequest,
  | 
| 
sl@0
 | 
   151  | 
											const TUid aImplUid,
  | 
| 
sl@0
 | 
   152  | 
											const TUid aInterfaceUid,
  | 
| 
sl@0
 | 
   153  | 
											TEntry& aEntry,
  | 
| 
sl@0
 | 
   154  | 
											CImplementationInformation*& aImplInfo,
  | 
| 
sl@0
 | 
   155  | 
											TBool aSecurityCheckNeeded)const;
  | 
| 
sl@0
 | 
   156  | 
	TBool HasLanguageChanged() const;
  | 
| 
sl@0
 | 
   157  | 
	TBool InsertIntoIndexL(CImplementationData* aImplPtr, TBool aCheckIsNeeded);
  | 
| 
sl@0
 | 
   158  | 
	void RemoveFromIndexL(CDllData* aDllData) const;
  | 
| 
sl@0
 | 
   159  | 
	TBool IsAnyDllRegisteredWithDriveL(const TDriveUnit& aDrive)const;
  | 
| 
sl@0
 | 
   160  | 
	TInt FindDriveL(const TDriveUnit& aDrive, CDriveData*& aDriveData)const;
  | 
| 
sl@0
 | 
   161  | 
	void SetDiscoveryFlagL(const TDriveUnit& aDriveUnit);
  | 
| 
sl@0
 | 
   162  | 
	void LanguageChangedL(TBool& aLanguageChanged);
  | 
| 
sl@0
 | 
   163  | 
	void SetImplUpgradeCallBack(const TCallBackWithArg& aCallBack);
  | 
| 
sl@0
 | 
   164  | 
	
  | 
| 
sl@0
 | 
   165  | 
#ifdef __ECOM_SERVER_PERFORMANCE__
  | 
| 
sl@0
 | 
   166  | 
	void GetRegistryCountsL(TInt aType, RegistryCounts::TRegistryCounts& aCounts) const;
  | 
| 
sl@0
 | 
   167  | 
#endif // __ECOM_SERVER_PERFORMANCE__
  | 
| 
sl@0
 | 
   168  | 
  | 
| 
sl@0
 | 
   169  | 
private:
  | 
| 
sl@0
 | 
   170  | 
	typedef RPointerArray<CDriveData> TRegistration;
  | 
| 
sl@0
 | 
   171  | 
  | 
| 
sl@0
 | 
   172  | 
	/** 
  | 
| 
sl@0
 | 
   173  | 
	Implementation structure containing the current in use implementation and
  | 
| 
sl@0
 | 
   174  | 
	a list of unused implementations with the same uid held in the registry tree.
  | 
| 
sl@0
 | 
   175  | 
	The unused list is used to allow efficient rollback to previous impl in the event
  | 
| 
sl@0
 | 
   176  | 
	that the current impl is removed.
  | 
| 
sl@0
 | 
   177  | 
	*/	
  | 
| 
sl@0
 | 
   178  | 
	typedef struct TImplStruct
  | 
| 
sl@0
 | 
   179  | 
		{
 | 
| 
sl@0
 | 
   180  | 
		/** Constructor */
  | 
| 
sl@0
 | 
   181  | 
		TImplStruct();
  | 
| 
sl@0
 | 
   182  | 
		/** Resets iUnusedImpls*/
  | 
| 
sl@0
 | 
   183  | 
		inline void Reset();
  | 
| 
sl@0
 | 
   184  | 
		/** Comparer*/
  | 
| 
sl@0
 | 
   185  | 
		static TInt CompareImplStructUid(const TImplStruct& aEntry1,const TImplStruct& aEntry2);
  | 
| 
sl@0
 | 
   186  | 
		/** Comparer to search TImplStruct with just the Impl. UID */
  | 
| 
sl@0
 | 
   187  | 
		static TInt CompareUidAgainstImplStruct(const TUid* aUid, const TImplStruct& aEntry);
  | 
| 
sl@0
 | 
   188  | 
		/**
  | 
| 
sl@0
 | 
   189  | 
		Current Impl. This is not held in an array with the unused implementations because the array is not
  | 
| 
sl@0
 | 
   190  | 
		sorted. See comment for iUnusedImpls.
  | 
| 
sl@0
 | 
   191  | 
		*/
  | 
| 
sl@0
 | 
   192  | 
		CImplementationDataPtr iCurrentImpl;
  | 
| 
sl@0
 | 
   193  | 
		/**
  | 
| 
sl@0
 | 
   194  | 
		List of additional unused implementations. This list is not ordered as the processing required to sort
  | 
| 
sl@0
 | 
   195  | 
		the list when adding is more than that required to determine which should be used on rollback.
  | 
| 
sl@0
 | 
   196  | 
		Also this additional processing is not wanted during startup.
  | 
| 
sl@0
 | 
   197  | 
		*/
  | 
| 
sl@0
 | 
   198  | 
		RImplDataArray iUnusedImpls;
  | 
| 
sl@0
 | 
   199  | 
		}TImplContainer;
  | 
| 
sl@0
 | 
   200  | 
	
  | 
| 
sl@0
 | 
   201  | 
	typedef RArray<TImplContainer> TImplContainerArray;
  | 
| 
sl@0
 | 
   202  | 
  | 
| 
sl@0
 | 
   203  | 
	/** 
  | 
| 
sl@0
 | 
   204  | 
	Interface used by all implementation index
  | 
| 
sl@0
 | 
   205  | 
	*/
  | 
| 
sl@0
 | 
   206  | 
	typedef struct TInterfaceStruct
  | 
| 
sl@0
 | 
   207  | 
		{
 | 
| 
sl@0
 | 
   208  | 
		/** Constructor */
  | 
| 
sl@0
 | 
   209  | 
		TInterfaceStruct();
  | 
| 
sl@0
 | 
   210  | 
		/** Resets iImplementationInfo */
  | 
| 
sl@0
 | 
   211  | 
		inline void Reset();
  | 
| 
sl@0
 | 
   212  | 
		/** Comparer*/
  | 
| 
sl@0
 | 
   213  | 
		static TInt CompareInfUid(const TInterfaceStruct& aIndexEntry1,const TInterfaceStruct& aIndexEntry2);
  | 
| 
sl@0
 | 
   214  | 
		/** Unique Id of this interface */
  | 
| 
sl@0
 | 
   215  | 
		TUid	iInterfaceUid;
  | 
| 
sl@0
 | 
   216  | 
		/** List of the implementations of this interface */
  | 
| 
sl@0
 | 
   217  | 
		TImplContainerArray iImpData;
  | 
| 
sl@0
 | 
   218  | 
		}TInterfaceIndex;
  | 
| 
sl@0
 | 
   219  | 
  | 
| 
sl@0
 | 
   220  | 
private:
  | 
| 
sl@0
 | 
   221  | 
	explicit CRegistryData(RFs& aFs, TInt aInterfaceImplIndexGranularity, TInt aImplIndexGranularity);
  | 
| 
sl@0
 | 
   222  | 
	void ConstructL();
  | 
| 
sl@0
 | 
   223  | 
  | 
| 
sl@0
 | 
   224  | 
	TInt IndexedFind(TUid aInterfaceUid) const;
  | 
| 
sl@0
 | 
   225  | 
	static TBool MatchOnDrive(const CRegistryData::CDriveData& aIndexOne, 
  | 
| 
sl@0
 | 
   226  | 
							  const CRegistryData::CDriveData& aIndexTwo);
  | 
| 
sl@0
 | 
   227  | 
  | 
| 
sl@0
 | 
   228  | 
	TInt FindImplementation(const TUid aImplUid, const TUid aInterfaceUid, CImplementationData*& aImplData) const;
  | 
| 
sl@0
 | 
   229  | 
	CImplementationData* SelectDuplicatedImpl(const CImplementationData* aImpl1, const CImplementationData* aImpl2) const;
  | 
| 
sl@0
 | 
   230  | 
  | 
| 
sl@0
 | 
   231  | 
	void ValidateRegistryL();
  | 
| 
sl@0
 | 
   232  | 
	
  | 
| 
sl@0
 | 
   233  | 
	CImplementationData* SelectPreferredImplL(CImplementationData* aOldImpl,
  | 
| 
sl@0
 | 
   234  | 
											CImplementationData* aNewImpl,
  | 
| 
sl@0
 | 
   235  | 
											TBool& aLigitimateImpl,
  | 
| 
sl@0
 | 
   236  | 
											TBool aCheckIsNeeded) const;
  | 
| 
sl@0
 | 
   237  | 
  | 
| 
sl@0
 | 
   238  | 
	void FilterForLatestLegitimateImplL(TImplContainerArray& aIdxArray,
  | 
| 
sl@0
 | 
   239  | 
										CImplementationData* aNewImpl,
  | 
| 
sl@0
 | 
   240  | 
										TInsertImplMode& aInsertMode,
  | 
| 
sl@0
 | 
   241  | 
										TInt&  aPosOfImplInArray,
  | 
| 
sl@0
 | 
   242  | 
										TBool& aLigitimateImpl,
  | 
| 
sl@0
 | 
   243  | 
										TBool aCheckIsNeeded);
  | 
| 
sl@0
 | 
   244  | 
	void DeleteDllL(CDllData* aDllData) const;
  | 
| 
sl@0
 | 
   245  | 
	void AddImplDataL(CDriveData* aDriveData);
  | 
| 
sl@0
 | 
   246  | 
  | 
| 
sl@0
 | 
   247  | 
	void InsertImplInIndexesL(TInsertImplMode	aInsertMode,
  | 
| 
sl@0
 | 
   248  | 
							  TInt				aIfPosInInterfaceImplIndex,
  | 
| 
sl@0
 | 
   249  | 
							  TInterfaceIndex&  aNewIfIndexEl,
  | 
| 
sl@0
 | 
   250  | 
							  TInt				aImplPosInContainerArray,
  | 
| 
sl@0
 | 
   251  | 
							  CImplementationData* aNewImpl,
  | 
| 
sl@0
 | 
   252  | 
							  TBool aLegitimateImpl);
  | 
| 
sl@0
 | 
   253  | 
	static void ResetTInterfaceIndex(TAny* aObject);
  | 
| 
sl@0
 | 
   254  | 
  | 
| 
sl@0
 | 
   255  | 
	/** Remove the pointer from iImplIndex based on the impl address*/
  | 
| 
sl@0
 | 
   256  | 
    TBool RemoveImplByAddrFromImplIndex(CImplementationData* aPtr) const;
  | 
| 
sl@0
 | 
   257  | 
  | 
| 
sl@0
 | 
   258  | 
    /** Used to restore the impIndex sanity in case of a leave */
  | 
| 
sl@0
 | 
   259  | 
	static void RemoveImplFromImplIndexCleanUp(TAny* aPtr);
  | 
| 
sl@0
 | 
   260  | 
	
  | 
| 
sl@0
 | 
   261  | 
	/** Insert aNewImpl into iImplIndex. */
  | 
| 
sl@0
 | 
   262  | 
	TInt InsertImplIntoImplIndex(CImplementationData* aNewImpl) const;
  | 
| 
sl@0
 | 
   263  | 
	/** Store change in drive state - addition or removal*/
  | 
| 
sl@0
 | 
   264  | 
	void DriveChanged(const TDriveUnit& aDrive, TBool aDriveRemoved);
  | 
| 
sl@0
 | 
   265  | 
  | 
| 
sl@0
 | 
   266  | 
// Attributes / Properties
  | 
| 
sl@0
 | 
   267  | 
private:
  | 
| 
sl@0
 | 
   268  | 
	/** A reference to a connected file server instance */
  | 
| 
sl@0
 | 
   269  | 
	RFs& iFs;
  | 
| 
sl@0
 | 
   270  | 
	/** The flag to indicate that we are in the middle of discoveries and therefore
  | 
| 
sl@0
 | 
   271  | 
	the index list is probably out of date */
  | 
| 
sl@0
 | 
   272  | 
	mutable TBool iCurrentlyDiscovering;
  | 
| 
sl@0
 | 
   273  | 
	/** A boolean, indicating if the language downgrade path has changed */
  | 
| 
sl@0
 | 
   274  | 
	TBool iLanguageChanged;
  | 
| 
sl@0
 | 
   275  | 
	/** The entire registration data */ 
  | 
| 
sl@0
 | 
   276  | 
	TRegistration* iRegistrations;
  | 
| 
sl@0
 | 
   277  | 
	/** The index of all registered implementations sorted by interface UID.*/
  | 
| 
sl@0
 | 
   278  | 
	mutable RArray<TInterfaceIndex> iInterfaceImplIndex;
  | 
| 
sl@0
 | 
   279  | 
	/** Index of all implementations available to clients sorted by
  | 
| 
sl@0
 | 
   280  | 
	 Implementation UID.
  | 
| 
sl@0
 | 
   281  | 
	 Majority of clients do not specify the interface UID in 
  | 
| 
sl@0
 | 
   282  | 
	 their create requests. Thus ECOM needs this auxiliary index.
  | 
| 
sl@0
 | 
   283  | 
	 Note that if multiple entries have the same Impl. UID, they are
  | 
| 
sl@0
 | 
   284  | 
	 ordered by the interface UID.
  | 
| 
sl@0
 | 
   285  | 
	*/
  | 
| 
sl@0
 | 
   286  | 
	mutable RPointerArray<CImplementationData> iImplIndex;
  | 
| 
sl@0
 | 
   287  | 
	/**Bitmap indicating any drives removed */
  | 
| 
sl@0
 | 
   288  | 
	TInt iRemovedDrives;
  | 
| 
sl@0
 | 
   289  | 
  | 
| 
sl@0
 | 
   290  | 
	TCallBackWithArg iImplUpgradeCallBack;
  | 
| 
sl@0
 | 
   291  | 
  | 
| 
sl@0
 | 
   292  | 
public:
  | 
| 
sl@0
 | 
   293  | 
	/** System Drive cache to allow access by CEComServer*/
  | 
| 
sl@0
 | 
   294  | 
	TDriveNumber iSystemDrive;	
  | 
| 
sl@0
 | 
   295  | 
  | 
| 
sl@0
 | 
   296  | 
	/** cached info on drivelist */
  | 
| 
sl@0
 | 
   297  | 
	CEComCachedDriveInfo*  iCachedDriveInfo;	
  | 
| 
sl@0
 | 
   298  | 
	};  // End of CRegistryData definition
  | 
| 
sl@0
 | 
   299  | 
	
  | 
| 
sl@0
 | 
   300  | 
  | 
| 
sl@0
 | 
   301  | 
//
  | 
| 
sl@0
 | 
   302  | 
// CRegistryData::CImplementationData class
  | 
| 
sl@0
 | 
   303  | 
/**
  | 
| 
sl@0
 | 
   304  | 
This wrapper class is needed, to create a 2 way relationship between CInterfaceData and the public 
  | 
| 
sl@0
 | 
   305  | 
CImplementationInformation objects. It holds a reference to an implementation and a reference to its 
  | 
| 
sl@0
 | 
   306  | 
parent interface data. 
  | 
| 
sl@0
 | 
   307  | 
@internalComponent
  | 
| 
sl@0
 | 
   308  | 
*/
  | 
| 
sl@0
 | 
   309  | 
class CRegistryData::CImplementationData : public CBase
  | 
| 
sl@0
 | 
   310  | 
	{
 | 
| 
sl@0
 | 
   311  | 
public:
  | 
| 
sl@0
 | 
   312  | 
	static CImplementationData* NewLC(CInterfaceData* aParent);
  | 
| 
sl@0
 | 
   313  | 
	static CImplementationData* NewL(CInterfaceData* aParent,
  | 
| 
sl@0
 | 
   314  | 
											TUid	aUid,
  | 
| 
sl@0
 | 
   315  | 
											TInt	aVersion, 
  | 
| 
sl@0
 | 
   316  | 
											HBufC*  aName,
  | 
| 
sl@0
 | 
   317  | 
											HBufC8* aDataType,
  | 
| 
sl@0
 | 
   318  | 
											HBufC8* aOpaqueData,
  | 
| 
sl@0
 | 
   319  | 
											TDriveUnit aDrive,
  | 
| 
sl@0
 | 
   320  | 
											TBool aRomOnly,
  | 
| 
sl@0
 | 
   321  | 
											TBool aRomBased);
  | 
| 
sl@0
 | 
   322  | 
	static CImplementationData* NewL(CInterfaceData* aParent,
  | 
| 
sl@0
 | 
   323  | 
											TUid	aUid,
  | 
| 
sl@0
 | 
   324  | 
											TInt	aVersion, 
  | 
| 
sl@0
 | 
   325  | 
											HBufC*  aName,
  | 
| 
sl@0
 | 
   326  | 
											HBufC8* aDataType,
  | 
| 
sl@0
 | 
   327  | 
											HBufC8* aOpaqueData,
  | 
| 
sl@0
 | 
   328  | 
											TDriveUnit aDrive,
  | 
| 
sl@0
 | 
   329  | 
											TBool aRomOnly,
  | 
| 
sl@0
 | 
   330  | 
											TBool aRomBased,
  | 
| 
sl@0
 | 
   331  | 
											RExtendedInterfacesArray* aExtendedInterfaces);											
  | 
| 
sl@0
 | 
   332  | 
	~CImplementationData();
  | 
| 
sl@0
 | 
   333  | 
	void ExternalizeL(RWriteStream& aStore) const;
  | 
| 
sl@0
 | 
   334  | 
	void InternalizeL(RReadStream& aStore);
  | 
| 
sl@0
 | 
   335  | 
	static TInt CompareImplUid(const CImplementationData& aImpl1,const CImplementationData& aImpl2);
  | 
| 
sl@0
 | 
   336  | 
	static TInt CompareImplUidIgnoreIfUid(const CImplementationData& aImpl1,const CImplementationData& aImpl2);
  | 
| 
sl@0
 | 
   337  | 
	static TInt CompareUidAgainstImplData(const CImplementationData& aUid, const CImplementationData& aImplData);
  | 
| 
sl@0
 | 
   338  | 
private:
  | 
| 
sl@0
 | 
   339  | 
	CImplementationData(CInterfaceData* aParent);
  | 
| 
sl@0
 | 
   340  | 
	void ConstructL(TUid	aUid,
  | 
| 
sl@0
 | 
   341  | 
					TInt	aVersion, 
  | 
| 
sl@0
 | 
   342  | 
					HBufC*  aName,
  | 
| 
sl@0
 | 
   343  | 
					HBufC8* aDataType,
  | 
| 
sl@0
 | 
   344  | 
					HBufC8* aOpaqueData,
  | 
| 
sl@0
 | 
   345  | 
					TDriveUnit aDrive,
  | 
| 
sl@0
 | 
   346  | 
					TBool aRomOnly,
  | 
| 
sl@0
 | 
   347  | 
					TBool aRomBased);
  | 
| 
sl@0
 | 
   348  | 
	void ConstructL(TUid	aUid,
  | 
| 
sl@0
 | 
   349  | 
					TInt	aVersion, 
  | 
| 
sl@0
 | 
   350  | 
					HBufC*  aName,
  | 
| 
sl@0
 | 
   351  | 
					HBufC8* aDataType,
  | 
| 
sl@0
 | 
   352  | 
					HBufC8* aOpaqueData,
  | 
| 
sl@0
 | 
   353  | 
					TDriveUnit aDrive,
  | 
| 
sl@0
 | 
   354  | 
					TBool aRomOnly,
  | 
| 
sl@0
 | 
   355  | 
					TBool aRomBased,
  | 
| 
sl@0
 | 
   356  | 
					RExtendedInterfacesArray* aExtendedInterfaces);				
  | 
| 
sl@0
 | 
   357  | 
public:
  | 
| 
sl@0
 | 
   358  | 
	/** A pointer to the implementation */
  | 
| 
sl@0
 | 
   359  | 
	CImplementationInformation* iImplInfo;
  | 
| 
sl@0
 | 
   360  | 
	/**Pointer to the parent CInterfaceData */
  | 
| 
sl@0
 | 
   361  | 
	CInterfaceData* iParent;
  | 
| 
sl@0
 | 
   362  | 
	};
  | 
| 
sl@0
 | 
   363  | 
  | 
| 
sl@0
 | 
   364  | 
//
  | 
| 
sl@0
 | 
   365  | 
// CRegistryData::CInterfaceData class
  | 
| 
sl@0
 | 
   366  | 
  | 
| 
sl@0
 | 
   367  | 
/**
  | 
| 
sl@0
 | 
   368  | 
This class manages the entire data for an interface of a dll.
  | 
| 
sl@0
 | 
   369  | 
@internalComponent
  | 
| 
sl@0
 | 
   370  | 
*/
  | 
| 
sl@0
 | 
   371  | 
class CRegistryData::CInterfaceData : public CBase
  | 
| 
sl@0
 | 
   372  | 
	{
 | 
| 
sl@0
 | 
   373  | 
public:
  | 
| 
sl@0
 | 
   374  | 
	static CInterfaceData* NewLC(CDllData* aParent);
  | 
| 
sl@0
 | 
   375  | 
	static CInterfaceData* NewLC(TUid aInterfaceUid, CDllData* aParent);
  | 
| 
sl@0
 | 
   376  | 
	~CInterfaceData();
  | 
| 
sl@0
 | 
   377  | 
	void AddL(const CImplementationData* aImplementation);
  | 
| 
sl@0
 | 
   378  | 
	void SetInterfaceUid(TUid aInterfaceUid);
  | 
| 
sl@0
 | 
   379  | 
	void ExternalizeL(RWriteStream& aStore) const;
  | 
| 
sl@0
 | 
   380  | 
	void InternalizeL(RReadStream& aStore);
  | 
| 
sl@0
 | 
   381  | 
private:
  | 
| 
sl@0
 | 
   382  | 
	CInterfaceData(CDllData* aParent);
  | 
| 
sl@0
 | 
   383  | 
	CInterfaceData(TUid aInterfaceUid,CDllData* aParent);
  | 
| 
sl@0
 | 
   384  | 
	void ConstructL();
  | 
| 
sl@0
 | 
   385  | 
public:
  | 
| 
sl@0
 | 
   386  | 
	/** The interface UID */
  | 
| 
sl@0
 | 
   387  | 
	TUid		iInterfaceUid;
  | 
| 
sl@0
 | 
   388  | 
	/** The implementations related to this interface */
  | 
| 
sl@0
 | 
   389  | 
	RPointerArray<CImplementationData>* iImplementations;
  | 
| 
sl@0
 | 
   390  | 
	/** Pointer to the parent DLL data */
  | 
| 
sl@0
 | 
   391  | 
	CDllData* iParent;
  | 
| 
sl@0
 | 
   392  | 
	};	// End CRegistryData::CInterfaceData
  | 
| 
sl@0
 | 
   393  | 
  | 
| 
sl@0
 | 
   394  | 
/**
  | 
| 
sl@0
 | 
   395  | 
@internalComponent
  | 
| 
sl@0
 | 
   396  | 
*/
  | 
| 
sl@0
 | 
   397  | 
typedef RPointerArray<CRegistryData::CInterfaceData> RInterfaceList ;
  | 
| 
sl@0
 | 
   398  | 
  | 
| 
sl@0
 | 
   399  | 
//
  | 
| 
sl@0
 | 
   400  | 
// CRegistryData::CDllData class
  | 
| 
sl@0
 | 
   401  | 
  | 
| 
sl@0
 | 
   402  | 
/**
  | 
| 
sl@0
 | 
   403  | 
This class manages the entire data of a registered dll.
  | 
| 
sl@0
 | 
   404  | 
@internalComponent
  | 
| 
sl@0
 | 
   405  | 
*/
  | 
| 
sl@0
 | 
   406  | 
class CRegistryData::CDllData : public CBase
  | 
| 
sl@0
 | 
   407  | 
	{
 | 
| 
sl@0
 | 
   408  | 
public:
  | 
| 
sl@0
 | 
   409  | 
	static CDllData* NewLC( CDriveData* iParent);//
  | 
| 
sl@0
 | 
   410  | 
	static CDllData* NewLC(const TDesC& aDllName,const TTime& aDllModTime,const TUid& aSecondUid,const TUid& aThirdUid, CDriveData* iParent);
  | 
| 
sl@0
 | 
   411  | 
	~CDllData();
  | 
| 
sl@0
 | 
   412  | 
	void AddL(const CInterfaceData* aInterface);
  | 
| 
sl@0
 | 
   413  | 
	void ExternalizeL(RWriteStream& aStore) const;
  | 
| 
sl@0
 | 
   414  | 
	void InternalizeL(RReadStream& aStore);
  | 
| 
sl@0
 | 
   415  | 
	void PopulateAnEntry(TEntry& aEntry) const;
  | 
| 
sl@0
 | 
   416  | 
	TBool ProcessSecurityCheckL();
  | 
| 
sl@0
 | 
   417  | 
	TBool SaveSecurityInfoL();
  | 
| 
sl@0
 | 
   418  | 
	void SetResourceExtL(const TDesC& aExt);
  | 
| 
sl@0
 | 
   419  | 
private:
  | 
| 
sl@0
 | 
   420  | 
	CDllData( CDriveData* iParent);//
  | 
| 
sl@0
 | 
   421  | 
	void ConstructL();//
  | 
| 
sl@0
 | 
   422  | 
	/** See CDllData* NewLC */
  | 
| 
sl@0
 | 
   423  | 
	void ConstructL(const TDesC& aDllName,const TTime& aDllModTime,const TUid& aSecondUid,const TUid& aThirdUid);
  | 
| 
sl@0
 | 
   424  | 
  | 
| 
sl@0
 | 
   425  | 
public:
  | 
| 
sl@0
 | 
   426  | 
	/** Information on the DLL */
  | 
| 
sl@0
 | 
   427  | 
	CEComEntry* iDllEntry;
  | 
| 
sl@0
 | 
   428  | 
	/** The list of interfaces within the dll */
  | 
| 
sl@0
 | 
   429  | 
	RInterfaceList*	iIfList;
  | 
| 
sl@0
 | 
   430  | 
	/** Capability set of this dll */
  | 
| 
sl@0
 | 
   431  | 
	TCapabilitySet iCapSet;
  | 
| 
sl@0
 | 
   432  | 
	/** A flag to tell if the DLL's security has been previously checked or not.*/
  | 
| 
sl@0
 | 
   433  | 
	TBool iSecurityChecked;
  | 
| 
sl@0
 | 
   434  | 
	/** A pointer to the parent drive data. */
  | 
| 
sl@0
 | 
   435  | 
	CDriveData* iParent;
  | 
| 
sl@0
 | 
   436  | 
	/** The VendorId of the DLL. */
  | 
| 
sl@0
 | 
   437  | 
	TVendorId iVid;
  | 
| 
sl@0
 | 
   438  | 
	/** The plugin resource file extension  - not set for plugins residing on RO Internal drives*/
  | 
| 
sl@0
 | 
   439  | 
	HBufC* iRscFileExtension;
  | 
| 
sl@0
 | 
   440  | 
	}; // End CRegistryData::CDllData
  | 
| 
sl@0
 | 
   441  | 
  | 
| 
sl@0
 | 
   442  | 
/**
  | 
| 
sl@0
 | 
   443  | 
@internalComponent
  | 
| 
sl@0
 | 
   444  | 
*/
  | 
| 
sl@0
 | 
   445  | 
typedef RPointerArray<CRegistryData::CDllData> TDll ;
  | 
| 
sl@0
 | 
   446  | 
  | 
| 
sl@0
 | 
   447  | 
//
  | 
| 
sl@0
 | 
   448  | 
// CRegistryData::CDriveData class
  | 
| 
sl@0
 | 
   449  | 
  | 
| 
sl@0
 | 
   450  | 
/**
  | 
| 
sl@0
 | 
   451  | 
This class manages the entire data of a registered dll.
  | 
| 
sl@0
 | 
   452  | 
*/
  | 
| 
sl@0
 | 
   453  | 
class CRegistryData::CDriveData : public CBase
  | 
| 
sl@0
 | 
   454  | 
	{
 | 
| 
sl@0
 | 
   455  | 
public:
  | 
| 
sl@0
 | 
   456  | 
	static CDriveData* NewLC(TDriveUnit aDrive,CRegistryData* aParent);
  | 
| 
sl@0
 | 
   457  | 
	~CDriveData();
  | 
| 
sl@0
 | 
   458  | 
	void AddL(const CDllData* aDll);
  | 
| 
sl@0
 | 
   459  | 
	void ExternalizeL(RFs& aFs,const TDesC& aDatFileName);
  | 
| 
sl@0
 | 
   460  | 
	void InternalizeL(RFs& aFs,const TDesC& aDatFileName);
  | 
| 
sl@0
 | 
   461  | 
	TInt FindDllIndex(const TUid aDllUid) const;
  | 
| 
sl@0
 | 
   462  | 
private:
  | 
| 
sl@0
 | 
   463  | 
	void DoInternalizeL(RFs& aFs, const TDesC& aFileName);
  | 
| 
sl@0
 | 
   464  | 
	CDriveData(TDriveUnit aDrive,CRegistryData* aParent);
  | 
| 
sl@0
 | 
   465  | 
	void ConstructL();
  | 
| 
sl@0
 | 
   466  | 
  | 
| 
sl@0
 | 
   467  | 
public:
  | 
| 
sl@0
 | 
   468  | 
	/** A reference to the drive. */
  | 
| 
sl@0
 | 
   469  | 
	TDriveUnit	iDrive;
  | 
| 
sl@0
 | 
   470  | 
	/** The list of Interface Implementation Collections upon the drive */
  | 
| 
sl@0
 | 
   471  | 
	TDll*		iDllList;
  | 
| 
sl@0
 | 
   472  | 
	/** The registry data. */
  | 
| 
sl@0
 | 
   473  | 
    CRegistryData* iParent;
  | 
| 
sl@0
 | 
   474  | 
    /**indicate the drive has change */
  | 
| 
sl@0
 | 
   475  | 
    TBool iDriveChanged;
  | 
| 
sl@0
 | 
   476  | 
    /**indiacate the registry data on the drive has changed */
  | 
| 
sl@0
 | 
   477  | 
    TBool iRegistryChanged;
  | 
| 
sl@0
 | 
   478  | 
  | 
| 
sl@0
 | 
   479  | 
	}; // End CRegistryData::CDriveData
  | 
| 
sl@0
 | 
   480  | 
  | 
| 
sl@0
 | 
   481  | 
void CRegistryData::TInterfaceIndex::Reset()
  | 
| 
sl@0
 | 
   482  | 
 	{
 | 
| 
sl@0
 | 
   483  | 
 	TInt count = iImpData.Count();
  | 
| 
sl@0
 | 
   484  | 
 	while(count > 0)
  | 
| 
sl@0
 | 
   485  | 
 		{
 | 
| 
sl@0
 | 
   486  | 
 		--count;
  | 
| 
sl@0
 | 
   487  | 
 		iImpData[count].Reset();
  | 
| 
sl@0
 | 
   488  | 
 		}
  | 
| 
sl@0
 | 
   489  | 
 	iImpData.Reset();
  | 
| 
sl@0
 | 
   490  | 
   	}
  | 
| 
sl@0
 | 
   491  | 
  | 
| 
sl@0
 | 
   492  | 
void CRegistryData::TImplContainer::Reset()
  | 
| 
sl@0
 | 
   493  | 
 	{
 | 
| 
sl@0
 | 
   494  | 
 	iUnusedImpls.Reset();
  | 
| 
sl@0
 | 
   495  | 
   	}
  | 
| 
sl@0
 | 
   496  | 
  | 
| 
sl@0
 | 
   497  | 
    
  | 
| 
sl@0
 | 
   498  | 
    class TCleanupImplIndexEntry
  | 
| 
sl@0
 | 
   499  | 
        {
 | 
| 
sl@0
 | 
   500  | 
        public:
  | 
| 
sl@0
 | 
   501  | 
        TCleanupImplIndexEntry(CRegistryData* aRegData, CRegistryData::CImplementationData* aImpl)
  | 
| 
sl@0
 | 
   502  | 
        : iRegistryData(aRegData), iImplEntry(aImpl)   
  | 
| 
sl@0
 | 
   503  | 
        {}
 | 
| 
sl@0
 | 
   504  | 
        CRegistryData*         iRegistryData;
  | 
| 
sl@0
 | 
   505  | 
        CRegistryData::CImplementationData*   iImplEntry;
  | 
| 
sl@0
 | 
   506  | 
        };
  | 
| 
sl@0
 | 
   507  | 
#endif //__REGISTRYDATA_H__
  |