installationservices/swi/source/sisregistry/server/sisregistryserversession.h
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
     1 /*
     1 /*
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    29 #include <e32cmn.h>
    29 #include <e32cmn.h>
    30 #include <swi/msisuihandlers.h>
    30 #include <swi/msisuihandlers.h>
    31 #include <usif/scr/scr.h>
    31 #include <usif/scr/scr.h>
    32 #include <usif/scr/screntries.h>
    32 #include <usif/scr/screntries.h>
    33 #include <usif/sts/sts.h>
    33 #include <usif/sts/sts.h>
       
    34 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
    34 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    35 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    35 #include "stsrecovery.h"
    36 #include "stsrecovery.h"
    36 #include "screntries_internal.h"
    37 #include "screntries_internal.h"
    37 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
    38 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
       
    39 #endif //SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
    38 #include <swi/swiobserverclient.h>
    40 #include <swi/swiobserverclient.h>
    39 #include "sisregistryclientserver.h"
    41 #include "sisregistryclientserver.h"
    40 #include "sisregistryserver.h"
    42 #include "sisregistryserver.h"
    41 #include "sisregistrylog.h"
    43 #include "sisregistrylog.h"
    42 #include "sisregistrypackage.h"
    44 #include "sisregistrypackage.h"
    84  	void PanicClient(const RMessagePtr2& aMessage, TSisRegistryPanic aPanic);
    86  	void PanicClient(const RMessagePtr2& aMessage, TSisRegistryPanic aPanic);
    85 	void GetAugmentationDetailsL(const TUid& aUid, RPointerArray<CSisRegistryPackage>& aPackagesArray, Usif::TComponentId aBaseComponentId);
    87 	void GetAugmentationDetailsL(const TUid& aUid, RPointerArray<CSisRegistryPackage>& aPackagesArray, Usif::TComponentId aBaseComponentId);
    86 	TInt GetAugmentationCountL(const TUid& aUid);
    88 	TInt GetAugmentationCountL(const TUid& aUid);
    87 	TBool IdentifyControllerL(Usif::TComponentId aComponentId, const TDesC& aFileName); // Used by CSisRegistrySubSession
    89 	TBool IdentifyControllerL(Usif::TComponentId aComponentId, const TDesC& aFileName); // Used by CSisRegistrySubSession
    88 
    90 
    89 	CSisRegistrySession(TSecureId aClientSid);
       
    90 	
       
    91 private:
    91 private:
    92 	~CSisRegistrySession();
    92 	~CSisRegistrySession();
    93 	
    93 	
    94 	// Returns ETrue if this is the first run of SWIRegistry server ever (or after firmware upgrade)
    94 	// Returns ETrue if this is the first run of SWIRegistry server ever (or after firmware upgrade)
    95 	TBool IsFirstInvocationL();
    95 	TBool IsFirstInvocationL();
   116 	void PackageExistsInRomL(const RMessage2& aMessage);
   116 	void PackageExistsInRomL(const RMessage2& aMessage);
   117 	void RequestStubFileEntriesL(const RMessage2& aMessage);
   117 	void RequestStubFileEntriesL(const RMessage2& aMessage);
   118 	void RequestRegistryEntryL(const RMessage2& aMessage);
   118 	void RequestRegistryEntryL(const RMessage2& aMessage);
   119 	void IsFileRegisteredL(const RMessage2& aMessage);
   119 	void IsFileRegisteredL(const RMessage2& aMessage);
   120 	void GetComponentIdForUidL(const RMessage2& aMessage);
   120 	void GetComponentIdForUidL(const RMessage2& aMessage);
   121 	void AddAppRegInfoL(const RMessage2& aMessage);
   121 
   122     void RemoveAppRegInfoL(const RMessage2& aMessage);
       
   123     void ValidateAndParseAppRegFileL(const TDesC& aRegFileName, Usif::CApplicationRegistrationData*& aAppRegData, TBool aInternal);
       
   124     void ReRegisterAppRegFileL(const TDesC& aRegFileDrivePath, const TUid& aAppUid);
       
   125 	
       
   126 	// Subsession handling
   122 	// Subsession handling
   127 	void OpenRegistryUidEntryL(const RMessage2& aMessage);
   123 	void OpenRegistryUidEntryL(const RMessage2& aMessage);
   128 	void OpenRegistryPackageEntryL(const RMessage2& aMessage);
   124 	void OpenRegistryPackageEntryL(const RMessage2& aMessage);
   129 	void OpenRegistryNamesEntryL(const RMessage2& aMessage);
   125 	void OpenRegistryNamesEntryL(const RMessage2& aMessage);
   130 	void CloseRegistryEntryL(const RMessage2& aMessage);
   126 	void CloseRegistryEntryL(const RMessage2& aMessage);
   138 	void CreateTransactionL(const RMessage2& aMessage);
   134 	void CreateTransactionL(const RMessage2& aMessage);
   139 	void CommitTransactionL(const RMessage2& aMessage);
   135 	void CommitTransactionL(const RMessage2& aMessage);
   140 	void RollbackTransactionL(const RMessage2& aMessage);
   136 	void RollbackTransactionL(const RMessage2& aMessage);
   141 
   137 
   142 	void RegisterEntryL(const RMessage2& aMessage, TBool aNewEntry, TBool aRegisterSoftwareTypes);
   138 	void RegisterEntryL(const RMessage2& aMessage, TBool aNewEntry, TBool aRegisterSoftwareTypes);
   143 	void AppRegInfoEntryL(const RMessage2& aMessage);
       
   144 
       
   145 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   146 	void RegisterAllAppL(RBuf& aApparcRegFolder);
       
   147     void GetComponentIdForPackageL(const RMessage2& aMessage);
       
   148     void GetAppUidsForComponentL(const RMessage2& aMessage);
       
   149     void GetComponentIdsForUidL(const RMessage2& aMessage);
       
   150 #endif
       
   151 
       
   152 	void DeleteEntryL(const RMessage2& aMessage);
   139 	void DeleteEntryL(const RMessage2& aMessage);
   153 	void DeleteEntryL(const CSisRegistryObject& aObject, TInt64 aTransactionId, TBool aCleanupRequired = ETrue);
       
   154 	void AddSoftwareTypeL(const RMessage2& aMessage);
   140 	void AddSoftwareTypeL(const RMessage2& aMessage);
   155 	void AddDriveL(const RMessage2& aMessage);
   141 	void AddDriveL(const RMessage2& aMessage);
   156 
   142 
   157 	/// Updates the trust status of the base package identified by uid
   143 	/// Updates the trust status of the base package identified by uid
   158 	void UpdateTrustStatusL(const TUid& aUid, const TSisTrustStatus& aTrustStatus);
   144 	void UpdateTrustStatusL(const TUid& aUid, const TSisTrustStatus& aTrustStatus);
   164 	
   150 	
   165 	void LoggingFileInfoL(const RMessage2& aMessage);
   151 	void LoggingFileInfoL(const RMessage2& aMessage);
   166 
   152 
   167 	//sets a particular component's state to the requested value
   153 	//sets a particular component's state to the requested value
   168 	void SetComponentStateL(const RMessage2& aMessage);
   154 	void SetComponentStateL(const RMessage2& aMessage);
   169 	void SetComponentPresenceL(const RMessage2& aMessage);
       
   170 
   155 
   171 	// Helper methods
   156 	// Helper methods
   172 	TBool IsRegisteredL(const TUid& aUid);
   157 	TBool IsRegisteredL(const TUid& aUid);
   173 	TBool IsRegisteredL(const CHashContainer& aHashContainer);
   158 	TBool IsRegisteredL(const CHashContainer& aHashContainer);
   174 	TBool IsRegisteredL(const TUid& aUid, const TDesC& aPackageName);
   159 	TBool IsRegisteredL(const TUid& aUid, const TDesC& aPackageName);
   175 
   160 
   176 	void RemoveEntryL(const Usif::TComponentId aCompId);
       
   177 	void RemoveEntryL(const CSisRegistryPackage& aPackage);
   161 	void RemoveEntryL(const CSisRegistryPackage& aPackage);
   178 	void RemoveCleanupInfrastructureL(const CSisRegistryObject& aObject, Usif::RStsSession& aStsSession);
   162 	void RemoveCleanupInfrastructureL(const CSisRegistryObject& aObject, Usif::RStsSession& aStsSession);
   179 	TBool RemoveControllerL(const CSisRegistryObject& aObject, Usif::RStsSession& aStsSession, TInt aDrive);
   163 	TBool RemoveControllerL(const CSisRegistryObject& aObject, Usif::RStsSession& aStsSession, TInt aDrive);
   180 	void ControllerDriveListL(const CSisRegistryObject& aObject, RArray<TInt>& aDriveList);
   164 	void ControllerDriveListL(const CSisRegistryObject& aObject, RArray<TInt>& aDriveList);
   181 	TUint FixedDrivesL() const;
   165 	TUint FixedDrivesL() const;
   182 	Usif::TComponentId AddRegistryEntryL(CSisRegistryObject& aObject, Usif::RStsSession& aStsSession, const TDesC8& aController, Usif::TScrComponentOperationType aOpType);
   166 	Usif::TComponentId AddRegistryEntryL(CSisRegistryObject& aObject, Usif::RStsSession& aStsSession, const TDesC8& aController, Usif::TScrComponentOperationType aOpType);
   183 	Usif::TComponentId AddEntryL(CSisRegistryObject& aObject, Usif::TScrComponentOperationType aOpType);
   167 	Usif::TComponentId AddEntryL(CSisRegistryObject& aObject, Usif::TScrComponentOperationType aOpType);
   184 	void AddAppsFromStubL(Usif::TComponentId aCompId, const TDesC& aFileName);
       
   185 	void AddControllerL(const CSisRegistryObject& aObject, Usif::RStsSession& aStsSession, const TDesC8& aBuffer, const TInt aDrive);
   168 	void AddControllerL(const CSisRegistryObject& aObject, Usif::RStsSession& aStsSession, const TDesC8& aBuffer, const TInt aDrive);
   186 	void AddCleanupInfrastructureL(CSisRegistryObject& aObject, Usif::RStsSession& aStsSession, const TDesC8& aControllerBuffer);
   169 	void AddCleanupInfrastructureL(CSisRegistryObject& aObject, Usif::RStsSession& aStsSession, const TDesC8& aControllerBuffer);
   187 	TUint CreateSubsessionHandleL(const TUid& aPackageUid);
   170 	TUint CreateSubsessionHandleL(const TUid& aPackageUid);
   188 	TUint CreateSubsessionHandleL(const CSisRegistryPackage& aPackage);
   171 	TUint CreateSubsessionHandleL(const CSisRegistryPackage& aPackage);
   189 	TUint CreateSubsessionHandleL(const TDesC& aPackageName, const TDesC& aVendorName);
   172 	TUint CreateSubsessionHandleL(const TDesC& aPackageName, const TDesC& aVendorName);
   192 	CSisRegistrySubSession& SubsessionL(TUint aSubsessionId);
   175 	CSisRegistrySubSession& SubsessionL(TUint aSubsessionId);
   193 	TUint OpenedPackageIndexL(TUint aSubsessionId);
   176 	TUint OpenedPackageIndexL(TUint aSubsessionId);
   194 	void ProcessRemovableDriveL(TInt aDrive);
   177 	void ProcessRemovableDriveL(TInt aDrive);
   195 	void DiscoverControllersL(const TDesC& aRegistryPath, const TDesC& aDirectoryName);
   178 	void DiscoverControllersL(const TDesC& aRegistryPath, const TDesC& aDirectoryName);
   196 	void ExecuteUninstallLogL(const TDesC& aUninstallLogFile, const TDesC& aControllerFile);
   179 	void ExecuteUninstallLogL(const TDesC& aUninstallLogFile, const TDesC& aControllerFile);
   197 	void GetComponentIdsForSidL(TUid aSid, RArray<Usif::TComponentId>& aComponentIds);
   180 	void GetCompIdAndCompSidIndexL(const TUid& aSid, Usif::TComponentId& aComponentId, TInt& aIndex, TInt aExpectedDrive = -1);
   198 	HBufC* SidToFileNameL(TUid aSid, Usif::TComponentId& aComponentId, TInt aExpectedDrive);
       
   199 	TBool ModifiableL(const TDesC& aFileName);
   181 	TBool ModifiableL(const TDesC& aFileName);
   200 	CHashContainer* HashL(const TDesC& aFileName);
   182 	CHashContainer* HashL(const TDesC& aFileName);
   201 	void RemovablePackageListL(RPointerArray<CSisRegistryPackage>& aPackages);
   183 	void RemovablePackageListL(RPointerArray<CSisRegistryPackage>& aPackages);
   202 	void ProcessRomDriveL();
   184 	void ProcessRomDriveL();
   203 	void RegisterInRomControllerL(const TDesC& aFileName);
   185 	void RegisterInRomControllerL(const TDesC& aFileName);
   204 	void RegisterSoftwareTypesL(Usif::TComponentId aComponentId, const RMessage2& aMessage);
   186 	void RegisterSoftwareTypesL(Usif::TComponentId aComponentId, const RMessage2& aMessage);
   205 	void UnregisterSoftwareTypesL(Usif::TComponentId aComponentId);
   187 	void UnregisterSoftwareTypesL(Usif::TComponentId aComponentId);
   206 	
   188 
   207 	void ProcessRomStubsL();
   189 	
   208 	void ProcessApplicationsL();
   190 	TBool IsFirmwareUpdatedL();
   209 	TBool IsFirmwareUpdatedL();	 
   191 	 
   210 	void  UpdateRecentFWVersionL(); 
   192 	void  UpdateRecentFWVersionL(); 
   211 	void GetStubFileInfoL(TUid aUid, TStubExtractionMode aMode, TInt aStartingFileNo, TInt& aFileCount, RPointerArray<HBufC>& aFileNames);
   193 
   212 	void GetStubFilesL(const TDesC& aFileName, RPointerArray<HBufC>& aFileNames);
       
   213 	void DriveFormatDetectedL(TDriveUnit aDrive);
       
   214 	
       
   215 private:
   194 private:
   216     friend class CSisRevocationManager;
   195     friend class CSisRevocationManager;
   217 
   196 
   218     // File system session which is used to make all requests to file server
   197     // File system session which is used to make all requests to file server
   219 	RFs iFs;
   198 	RFs iFs;
   226 	TDriveNumber iSystemDrive;
   205 	TDriveNumber iSystemDrive;
   227 	
   206 	
   228 	// Session handle to Software Component Registry
   207 	// Session handle to Software Component Registry
   229 	Usif::RSoftwareComponentRegistry iScrSession;
   208 	Usif::RSoftwareComponentRegistry iScrSession;
   230 
   209 
   231 	TSecureId iClientSid;
   210 	TBool isFwUpdated;
   232 	TBool iIsFwUpdated;
       
   233 	TBool iIsFirstInit;
       
   234 	};
   211 	};
   235 
   212 
   236 inline RFs& CSisRegistrySession::Fs()
   213 inline RFs& CSisRegistrySession::Fs()
   237 	{
   214 	{
   238 	return iFs;
   215 	return iFs;
   247 inline Usif::RSoftwareComponentRegistry& CSisRegistrySession::ScrSession()
   224 inline Usif::RSoftwareComponentRegistry& CSisRegistrySession::ScrSession()
   248 	{
   225 	{
   249 	return iScrSession;
   226 	return iScrSession;
   250 	}
   227 	}
   251 
   228 
   252 inline CSisRegistrySession::CSisRegistrySession(TSecureId aClientSid)
       
   253     :CSession2()
       
   254     {
       
   255     iClientSid = aClientSid;
       
   256     }
       
   257 
       
   258 } //namespace
   229 } //namespace
   259 
   230 
   260 #endif // __SISREGISTRYSERVERSESSION_H__
   231 #endif // __SISREGISTRYSERVERSESSION_H__
   261 
   232 
   262 
   233