88 iSystemDrive = iFs.GetSystemDrive(); |
90 iSystemDrive = iFs.GetSystemDrive(); |
89 |
91 |
90 // Create a session with the Software Component Registry |
92 // Create a session with the Software Component Registry |
91 User::LeaveIfError(iScrSession.Connect()); |
93 User::LeaveIfError(iScrSession.Connect()); |
92 |
94 |
|
95 iIsFirstInit = IsFirstInvocationL(); |
|
96 |
|
97 #ifdef __WINSCW__ |
|
98 _LIT_SECURE_ID(KAppArcSID, 0x10003A3F); |
|
99 if (KAppArcSID.iId == iClientSid.iId) |
|
100 { |
|
101 DEBUG_PRINTF(_L8("SIS Registry Server: Init for a connection from AppArc")); |
|
102 ProcessRomApplicationsL(); |
|
103 } |
|
104 else |
|
105 { |
|
106 if (iIsFirstInit) |
|
107 { |
|
108 DEBUG_PRINTF2(_L8("SIS Registry Server: Init for a connection from SID 0x%X"), iClientSid.iId); |
|
109 ProcessRomStubsL(); |
|
110 } |
|
111 } |
|
112 #else |
93 TInt res = KErrNone; |
113 TInt res = KErrNone; |
94 TRAP(res , res = IsFirmwareUpdatedL()); |
114 TRAP(res , res = IsFirmwareUpdatedL()); |
95 |
115 |
96 if (IsFirstInvocationL() || res ) |
116 if (iIsFirstInit || res) |
97 { |
117 { |
98 isFwUpdated = ETrue; |
118 if (res) |
|
119 { |
|
120 iIsFwUpdated = ETrue; |
|
121 } |
|
122 |
99 FirstInvocationInitL(); |
123 FirstInvocationInitL(); |
100 TRAP(res, UpdateRecentFWVersionL();); |
124 if (iIsFwUpdated) |
101 if (res != KErrNone) |
125 { |
102 { |
126 TRAP(res, UpdateRecentFWVersionL()); |
103 // log that |
127 if (res != KErrNone) |
104 DEBUG_PRINTF2(_L8("Updating recent Firmware Version failed with error code = %d."), res); |
128 { |
105 } |
129 DEBUG_PRINTF2(_L8("Updating recent Firmware Version failed with error code = %d."), res); |
106 } |
130 } |
|
131 } |
|
132 } |
|
133 #endif |
107 } |
134 } |
108 |
135 |
109 CSisRegistrySession::~CSisRegistrySession() |
136 CSisRegistrySession::~CSisRegistrySession() |
110 { |
137 { |
111 Server().DropSession(); |
138 Server().DropSession(); |
133 } |
160 } |
134 CleanupStack::PopAndDestroy(&fileName); |
161 CleanupStack::PopAndDestroy(&fileName); |
135 return firstInvocation; |
162 return firstInvocation; |
136 } |
163 } |
137 |
164 |
|
165 void CSisRegistrySession::ProcessRomStubsL() |
|
166 { |
|
167 DEBUG_PRINTF(_L8("SIS Registry Server - Starting processing of ROM Stub sis files")); |
|
168 iScrSession.CreateTransactionL(); |
|
169 ProcessRomDriveL(); |
|
170 iScrSession.CommitTransactionL(); |
|
171 |
|
172 // Create a file in <systemdrive>:\sys to mark a successful initialization |
|
173 // so that we don't come here again (unless firmware is upgraded in which case <systemdrive>:\sys |
|
174 // should be cleaned |
|
175 RBuf fileName; |
|
176 CleanupClosePushL(fileName); |
|
177 fileName.CreateL(KMaxPath); |
|
178 TDriveUnit drive(iSystemDrive); |
|
179 fileName = drive.Name(); |
|
180 fileName.Append(KSWIRegFirstInitFile); |
|
181 RFile file; |
|
182 CleanupClosePushL(file); |
|
183 file.Replace(iFs, fileName, EFileWrite | EFileShareAny); |
|
184 CleanupStack::PopAndDestroy(2, &fileName); // file |
|
185 |
|
186 DEBUG_PRINTF(_L8("SIS Registry Server - Completed processing of ROM Stub sis files")); |
|
187 } |
|
188 |
|
189 void CSisRegistrySession::ProcessRomApplicationsL() |
|
190 { |
|
191 TComponentId compId = 0; |
|
192 DEBUG_PRINTF(_L8("SIS Registry Server - Deleteing all existing ROM applications.")); |
|
193 ScrHelperUtil::DeleteApplicationEntriesL(iScrSession, compId); |
|
194 |
|
195 //Register all apps found in \private\10003a3f\apps |
|
196 TDriveUnit romDrive(SisRegistryUtil::SystemRomDrive()); |
|
197 RBuf romApparcRegFilePath; |
|
198 romApparcRegFilePath.CreateL(romDrive.Name(), KMaxPath); |
|
199 CleanupClosePushL(romApparcRegFilePath); |
|
200 romApparcRegFilePath.Append(KApparcRegFilePath); |
|
201 RegisterAllInRomAppL(romApparcRegFilePath); |
|
202 |
|
203 //Register all apps found in \private\10003a3f\import\apps |
|
204 romApparcRegFilePath = romDrive.Name(); |
|
205 romApparcRegFilePath.Append(KApparcRegFileImportPath); |
|
206 RegisterAllInRomAppL(romApparcRegFilePath); |
|
207 CleanupStack::PopAndDestroy(&romApparcRegFilePath); |
|
208 |
|
209 DEBUG_PRINTF(_L8("SIS Registry Server - Completed processing of all existing ROM applications.")); |
|
210 } |
|
211 |
138 // Does initialization required when run after very first boot of phone (or after firmware upgrade) |
212 // Does initialization required when run after very first boot of phone (or after firmware upgrade) |
139 // Method is only invoked when such a state is detected |
213 // Method is only invoked when such a state is detected (only in device, NOT in emulator) |
140 // Leaves behind a file in <systemdrive>:\sys to mark a successful initialization |
214 // Leaves behind a file in <systemdrive>:\sys to mark a successful initialization |
141 void CSisRegistrySession::FirstInvocationInitL() |
215 void CSisRegistrySession::FirstInvocationInitL() |
142 { |
216 { |
143 // Add the ROM installed stub details to SCR |
217 // Add the ROM installed stub details to SCR |
144 // Create an SCR transaction, so that entries won't be added to the SCR if the function leaves |
218 // Create an SCR transaction, so that entries won't be added to the SCR if the function leaves |
145 iScrSession.CreateTransactionL(); |
219 TInt value(EIdlePhase1NOK); |
146 ProcessRomDriveL(); |
220 RProperty::Get(KPSUidStartup, KPSIdlePhase1Ok, value); |
147 iScrSession.CommitTransactionL(); |
221 |
148 |
222 TBool isFromSWIDaemon = EFalse; |
149 TComponentId compId = 0; |
223 _LIT_SECURE_ID(KSWIDaemonSID, 0x10202DCE); |
150 DEBUG_PRINTF(_L8("SIS Registry Server - Deleteing all existing ROM applications.")); |
224 if (KSWIDaemonSID.iId == iClientSid.iId) |
151 ScrHelperUtil::DeleteApplicationEntriesL(iScrSession, compId); |
225 { |
152 |
226 isFromSWIDaemon = ETrue; |
153 //Register all apps found in \private\10003a3f\apps |
227 } |
154 TDriveUnit romDrive(SisRegistryUtil::SystemRomDrive()); |
228 if ((value == EIdlePhase1Ok || isFromSWIDaemon) && iIsFirstInit) |
155 RBuf romApparcRegFilePath; |
229 { |
156 romApparcRegFilePath.CreateL(romDrive.Name(), KMaxPath); |
230 ProcessRomStubsL(); |
157 CleanupClosePushL(romApparcRegFilePath); |
231 } |
158 romApparcRegFilePath.Append(KApparcRegFilePath); |
232 |
159 RegisterAllInRomAppL(romApparcRegFilePath); |
233 if (iIsFwUpdated) |
160 |
234 { |
161 //Register all apps found in \private\10003a3f\import\apps. |
235 // Delete the SisRegistry marker file |
162 romApparcRegFilePath = romDrive.Name(); |
236 RBuf fileName; |
163 romApparcRegFilePath.Append(KApparcRegFileImportPath); |
237 CleanupClosePushL(fileName); |
164 RegisterAllInRomAppL(romApparcRegFilePath); |
238 fileName.CreateL(KMaxPath); |
165 CleanupStack::PopAndDestroy(&romApparcRegFilePath); |
239 TDriveUnit drive(iSystemDrive); |
166 |
240 fileName = drive.Name(); |
167 // Create a file in <systemdrive>:\sys to mark a successful initialization |
241 fileName.Append(KSWIRegFirstInitFile); |
168 // so that we don't come here again (unless firmware is upgraded in which case <systemdrive>:\sys |
242 iFs.Delete(fileName); |
169 // should be cleaned |
243 CleanupStack::PopAndDestroy(&fileName); |
170 RBuf fileName; |
244 |
171 CleanupClosePushL(fileName); |
245 ProcessRomApplicationsL(); |
172 fileName.CreateL(KMaxPath); |
246 } |
173 TDriveUnit drive(iSystemDrive); |
|
174 fileName = drive.Name(); |
|
175 fileName.Append(KSWIRegFirstInitFile); |
|
176 RFile file; |
|
177 CleanupClosePushL(file); |
|
178 file.Replace(iFs, fileName, EFileWrite | EFileShareAny); |
|
179 CleanupStack::PopAndDestroy(2, &fileName); // file |
|
180 } |
247 } |
181 |
248 |
182 // |
249 // |
183 // Handle a client request. |
250 // Handle a client request. |
184 // Leaving is handled by CSisRegistry::ServiceError() which reports |
251 // Leaving is handled by CSisRegistry::ServiceError() which reports |
582 { |
649 { |
583 RIpcReadStream readStream; |
650 RIpcReadStream readStream; |
584 readStream.Open(aMessage, 3); |
651 readStream.Open(aMessage, 3); |
585 CleanupClosePushL(readStream); |
652 CleanupClosePushL(readStream); |
586 |
653 |
587 RCPointerArray<CSoftwareTypeRegInfo> swTypeRegInfoArray; |
654 RCPointerArray<Usif::CSoftwareTypeRegInfo> swTypeRegInfoArray; |
588 CleanupClosePushL(swTypeRegInfoArray); |
655 CleanupClosePushL(swTypeRegInfoArray); |
589 SoftwareTypeRegInfoUtils::UnserializeArrayL(readStream, swTypeRegInfoArray); |
656 SoftwareTypeRegInfoUtils::UnserializeArrayL(readStream, swTypeRegInfoArray); |
590 |
657 |
591 for (TInt i=0; i<swTypeRegInfoArray.Count(); ++i) |
658 for (TInt i=0; i<swTypeRegInfoArray.Count(); ++i) |
592 { |
659 { |
593 const CSoftwareTypeRegInfo& info = *swTypeRegInfoArray[i]; |
660 iScrSession.AddSoftwareTypeL(*swTypeRegInfoArray[i]); |
594 const RPointerArray<CLocalizedSoftwareTypeName>& locSwTypeNames = info.LocalizedSoftwareTypeNames(); |
|
595 RCPointerArray<Usif::CLocalizedSoftwareTypeName> scrSwTypeNames; |
|
596 CleanupClosePushL(scrSwTypeNames); |
|
597 for (TInt i=0; i<locSwTypeNames.Count(); ++i) |
|
598 { |
|
599 scrSwTypeNames.AppendL(Usif::CLocalizedSoftwareTypeName::NewLC(locSwTypeNames[i]->Name(), locSwTypeNames[i]->Locale())); |
|
600 CleanupStack::Pop(); |
|
601 } |
|
602 |
|
603 DEBUG_PRINTF2(_L("Sis Registry Server - Adding software type: %S"), &info.UniqueSoftwareTypeName()); |
|
604 |
|
605 iScrSession.AddSoftwareTypeL(info.UniqueSoftwareTypeName(), |
|
606 info.SifPluginUid(), |
|
607 info.InstallerSecureId(), |
|
608 info.ExecutionLayerSecureId(), |
|
609 info.MimeTypes(), |
|
610 &scrSwTypeNames); |
|
611 CleanupStack::PopAndDestroy(&scrSwTypeNames); |
|
612 } |
661 } |
613 |
662 |
614 RBuf uniqueNames; |
663 RBuf uniqueNames; |
615 uniqueNames.CleanupClosePushL(); |
664 uniqueNames.CleanupClosePushL(); |
616 SoftwareTypeRegInfoUtils::SerializeUniqueSwTypeNamesL(swTypeRegInfoArray, uniqueNames); |
665 SoftwareTypeRegInfoUtils::SerializeUniqueSwTypeNamesL(swTypeRegInfoArray, uniqueNames); |
1156 TUid sid; |
1205 TUid sid; |
1157 TPckg<TUid> executableSid(sid); |
1206 TPckg<TUid> executableSid(sid); |
1158 |
1207 |
1159 aMessage.ReadL(EIpcArgument0, executableSid); |
1208 aMessage.ReadL(EIpcArgument0, executableSid); |
1160 |
1209 |
1161 // componentId and index of the first matching Sid in CompSID<index> array gets populated |
1210 // Retrieve the component Id's list for the Sid. |
1162 // by call to GetCompIdAndCompSidIndexL().The value of index is redundant here. |
1211 RArray<TComponentId> componentIdList; |
1163 TComponentId componentId = 0; |
1212 CleanupClosePushL(componentIdList); |
1164 TInt index = 0; |
1213 |
1165 GetCompIdAndCompSidIndexL(sid, componentId, index); |
1214 GetComponentIdsForSidL(sid, componentIdList); |
1166 |
1215 |
1167 if(componentId == KErrNotFound) |
1216 if(componentIdList.Count() == 0) |
1168 { |
1217 { |
1169 User::Leave(KErrNotFound); |
1218 User::Leave(KErrNotFound); |
1170 } |
1219 } |
1171 |
1220 |
1172 CSisRegistryPackage *package = NULL; |
1221 CSisRegistryPackage *package = NULL; |
1173 ScrHelperUtil::ReadFromScrL(iScrSession, componentId, package); |
1222 ScrHelperUtil::ReadFromScrL(iScrSession, componentIdList[0], package); |
1174 CleanupStack::PushL(package); |
1223 CleanupStack::PushL(package); |
1175 |
1224 |
1176 DEBUG_PRINTF5(_L("Sis Registry Server - SID 0x%08x is owned by package UID: 0x%08x, Name: %S, Vendor: %S."), |
1225 DEBUG_PRINTF5(_L("Sis Registry Server - SID 0x%08x is owned by package UID: 0x%08x, Name: %S, Vendor: %S."), |
1177 sid.iUid, package->Uid().iUid, &(package->Name()), &(package->Vendor())); |
1226 sid.iUid, package->Uid().iUid, &(package->Name()), &(package->Vendor())); |
1178 |
1227 |
1179 SisRegistryUtil::SendDataL(aMessage, *package, EIpcArgument1); |
1228 SisRegistryUtil::SendDataL(aMessage, *package, EIpcArgument1); |
1180 CleanupStack::PopAndDestroy(package); |
1229 CleanupStack::PopAndDestroy(2, &componentIdList); |
1181 |
1230 |
1182 } |
1231 } |
1183 |
1232 |
1184 void CSisRegistrySession::RequestSidToFileNameL(const RMessage2& aMessage) |
1233 void CSisRegistrySession::RequestSidToFileNameL(const RMessage2& aMessage) |
1185 { |
1234 { |
1194 // This parameter will be set to -1 if user did not specified a drive with this request. |
1243 // This parameter will be set to -1 if user did not specified a drive with this request. |
1195 thirdParameter = aMessage.Int2(); |
1244 thirdParameter = aMessage.Int2(); |
1196 |
1245 |
1197 // Obtain the componentId and array index of CompSID<index> custom property matching a given aSid. |
1246 // Obtain the componentId and array index of CompSID<index> custom property matching a given aSid. |
1198 TComponentId componentId = 0; |
1247 TComponentId componentId = 0; |
1199 TInt index = 0; |
1248 HBufC* fileName = SidToFileNameL(sid, componentId, thirdParameter); |
1200 GetCompIdAndCompSidIndexL(sid, componentId, index, thirdParameter); |
|
1201 |
1249 |
1202 if(componentId == KErrNotFound) |
1250 if(componentId == KErrNotFound) |
1203 { |
1251 { |
1204 User::Leave(KErrNotFound); |
1252 User::Leave(KErrNotFound); |
1205 } |
1253 } |
1206 |
1254 |
1207 // retrieve the CompSidFileName property value , based on the index obtained. |
|
1208 TBuf<KSmlBufferSize> compSidFileName(KEmptyString); |
|
1209 compSidFileName.Format(KCompSidFileNameFormat, index); |
|
1210 |
|
1211 HBufC* fileName = GetStrPropertyValueL(iScrSession, componentId, compSidFileName); |
|
1212 CleanupStack::PushL(fileName); |
1255 CleanupStack::PushL(fileName); |
1213 DEBUG_PRINTF3(_L("Sis Registry Server - SID 0x%08x maps to file '%S'."), |
1256 DEBUG_PRINTF3(_L("Sis Registry Server - SID 0x%08x maps to file '%S'."), |
1214 sid.iUid, fileName); |
1257 sid.iUid, fileName); |
1215 |
1258 |
1216 // Send the filename back to the client in argument slot 1 |
1259 // Send the filename back to the client in argument slot 1 |
1341 { |
1384 { |
1342 TPckgBuf<TUid> uid; |
1385 TPckgBuf<TUid> uid; |
1343 aMessage.ReadL(EIpcArgument0, uid); |
1386 aMessage.ReadL(EIpcArgument0, uid); |
1344 |
1387 |
1345 TBool isPresent = EFalse; |
1388 TBool isPresent = EFalse; |
1346 TComponentId componentId = 0; |
1389 RArray<TComponentId> componentIdList; |
1347 TInt index = 0; |
1390 CleanupClosePushL(componentIdList); |
1348 |
1391 |
1349 // If the supplied SID is present in SCR, then a call to GetCompIdAndCompSidIndexL succeeds. |
1392 // If the supplied SID is present in SCR, then a call to GetComponentIdsForSidL succeeds. |
1350 // Else the componenetId will result in KErrNotFound. |
1393 // Else componentIdList would be empty. |
1351 GetCompIdAndCompSidIndexL(uid(), componentId, index); |
1394 GetComponentIdsForSidL(uid(), componentIdList); |
1352 if(componentId != KErrNotFound) |
1395 |
|
1396 if(componentIdList.Count() != 0) |
1353 { |
1397 { |
1354 isPresent = ETrue; |
1398 isPresent = ETrue; |
1355 } |
1399 } |
1356 |
1400 CleanupStack::PopAndDestroy(&componentIdList); |
1357 DEBUG_CODE_SECTION( |
1401 DEBUG_CODE_SECTION( |
1358 if (isPresent) |
1402 if (isPresent) |
1359 { |
1403 { |
1360 DEBUG_PRINTF2(_L8("Sis Registry Server - SID 0x%08x is present in registry."), |
1404 DEBUG_PRINTF2(_L8("Sis Registry Server - SID 0x%08x is present in registry."), |
1361 uid().iUid); |
1405 uid().iUid); |
1748 RFile file; |
1792 RFile file; |
1749 CleanupClosePushL(file); |
1793 CleanupClosePushL(file); |
1750 User::LeaveIfError(file.Open(fs, appFile, EFileRead)); |
1794 User::LeaveIfError(file.Open(fs, appFile, EFileRead)); |
1751 Usif::CApplicationRegistrationData* appRegData = launcher.SyncParseResourceFileL(file, appLanguages); |
1795 Usif::CApplicationRegistrationData* appRegData = launcher.SyncParseResourceFileL(file, appLanguages); |
1752 CleanupStack::PushL(appRegData); |
1796 CleanupStack::PushL(appRegData); |
1753 ScrHelperUtil::AddApplicationEntryL(iScrSession, aCompId, *appRegData); |
1797 |
|
1798 TRAPD(err, ScrHelperUtil::AddApplicationEntryL(iScrSession, aCompId, *appRegData)); |
|
1799 if (err == KErrAlreadyExists) |
|
1800 { |
|
1801 // Delete the existing application entry, which is not associated with any package |
|
1802 ScrHelperUtil::DeleteApplicationEntryL(iScrSession, appRegData->AppUid()); |
|
1803 ScrHelperUtil::AddApplicationEntryL(iScrSession, aCompId, *appRegData); |
|
1804 } |
|
1805 |
1754 CleanupStack::PopAndDestroy(appRegData); |
1806 CleanupStack::PopAndDestroy(appRegData); |
1755 CleanupStack::PopAndDestroy(2, buf); |
1807 CleanupStack::PopAndDestroy(2, buf); |
1756 } |
1808 } |
1757 CleanupStack::PopAndDestroy(3, &launcher); |
1809 CleanupStack::PopAndDestroy(3, &launcher); |
1758 } |
1810 } |
2220 } |
2272 } |
2221 |
2273 |
2222 CleanupStack::PopAndDestroy(&entryList); |
2274 CleanupStack::PopAndDestroy(&entryList); |
2223 } |
2275 } |
2224 |
2276 |
2225 void CSisRegistrySession::GetCompIdAndCompSidIndexL(const TUid& aSid, TComponentId& aComponentId, TInt& aIndex, TInt aExpectedDrive) |
2277 void CSisRegistrySession::GetComponentIdsForSidL(TUid aSid, RArray<TComponentId>& aComponentIds) |
2226 { |
2278 { |
|
2279 _LIT(KComponentSidPropertyRegex, "CompSid%"); |
2227 CComponentFilter* componentFilter = CComponentFilter::NewLC(); |
2280 CComponentFilter* componentFilter = CComponentFilter::NewLC(); |
2228 componentFilter->SetSoftwareTypeL(KSoftwareTypeNative); |
2281 componentFilter->SetSoftwareTypeL(KSoftwareTypeNative); |
2229 componentFilter->AddPropertyL(KCompSidsPresent, 1); |
2282 componentFilter->AddPropertyL(KComponentSidPropertyRegex, static_cast<TUint>(aSid.iUid), CComponentFilter::ELike, CComponentFilter::EEqual); |
2230 |
2283 |
2231 // Retrieve the componentId of all the components with SIDs from the SCR. |
2284 // Retrieve all component Id's |
2232 RArray<TComponentId> componentIdList; |
2285 iScrSession.GetComponentIdsL(aComponentIds, componentFilter); |
2233 CleanupClosePushL(componentIdList); |
2286 |
2234 iScrSession.GetComponentIdsL(componentIdList, componentFilter); |
2287 CleanupStack::PopAndDestroy(componentFilter); |
2235 |
2288 } |
2236 TInt componentCount = componentIdList.Count(); |
2289 |
2237 RArray<TUid> sidArray; |
2290 |
2238 CleanupClosePushL(sidArray); |
2291 HBufC* CSisRegistrySession::SidToFileNameL(TUid aSid, TComponentId& aComponentId, TInt aExpectedDrive) |
2239 TBool sidMatchFound = EFalse; |
2292 { |
2240 |
2293 aComponentId = KErrNotFound; |
2241 for(TInt i = 0; i < componentCount && !sidMatchFound; ++i) |
2294 RArray<TComponentId> componentIdList; |
2242 { |
2295 CleanupClosePushL(componentIdList); |
2243 TComponentId componentId = componentIdList[i]; |
2296 |
2244 sidArray.Reset(); |
2297 // Retrieve the component Id's. |
2245 ScrHelperUtil::InternalizeSidArrayL(iScrSession, componentId, sidArray); |
2298 GetComponentIdsForSidL(aSid, componentIdList); |
2246 |
2299 |
2247 // index of the first matching SID in the array. |
2300 if(componentIdList.Count() == 0) |
2248 aIndex = sidArray.Find(aSid); |
2301 { |
2249 if(aIndex == KErrNotFound) |
2302 CleanupStack::PopAndDestroy(&componentIdList); |
2250 continue; |
2303 return NULL; |
2251 |
2304 } |
2252 // If the search is narrowed to a particular drive, get the file name and check whether it matches the drive |
2305 |
2253 if (aExpectedDrive != -1) |
2306 RArray<TUid> sidArray; |
2254 { |
2307 CleanupClosePushL(sidArray); |
2255 TBuf<KSmlBufferSize> compSidFileName(KEmptyString); |
2308 TInt index(0); |
2256 compSidFileName.Format(KCompSidFileNameFormat, aIndex); |
2309 TBuf<KSmlBufferSize> compSidFileName(KEmptyString); |
|
2310 HBufC* fileName = NULL; |
|
2311 |
|
2312 |
|
2313 if(aExpectedDrive == -1) |
|
2314 { |
|
2315 // No drive specified, just return the first component Id and the corresponding Sid index. |
|
2316 aComponentId = componentIdList[0]; |
|
2317 sidArray.Reset(); |
|
2318 ScrHelperUtil::InternalizeSidArrayL(iScrSession, aComponentId, sidArray); |
|
2319 index = sidArray.Find(aSid); |
|
2320 compSidFileName.Format(KCompSidFileNameFormat, index); |
|
2321 fileName = GetStrPropertyValueL(iScrSession, aComponentId, compSidFileName); |
|
2322 } |
|
2323 else |
|
2324 { |
|
2325 // If the search is narrowed to a particular drive, get the file name and check whether it matches the drive |
|
2326 |
|
2327 for(TInt i=0; i<componentIdList.Count(); ++i) |
|
2328 { |
|
2329 sidArray.Reset(); |
|
2330 ScrHelperUtil::InternalizeSidArrayL(iScrSession, componentIdList[i], sidArray); |
|
2331 index = sidArray.Find(aSid); |
|
2332 |
|
2333 compSidFileName.Format(KCompSidFileNameFormat, index); |
|
2334 fileName = GetStrPropertyValueL(iScrSession, componentIdList[i], compSidFileName); |
|
2335 CleanupStack::PushL(fileName); |
|
2336 |
|
2337 if (fileName->Length() == 0) |
|
2338 { |
|
2339 CleanupStack::PopAndDestroy(fileName); |
|
2340 fileName = NULL; |
|
2341 continue; |
|
2342 } |
|
2343 |
|
2344 TInt drive; |
|
2345 User::LeaveIfError(RFs::CharToDrive((*fileName)[0], drive)); |
|
2346 if(drive != aExpectedDrive) |
|
2347 { |
|
2348 CleanupStack::PopAndDestroy(fileName); |
|
2349 fileName = NULL; |
|
2350 continue; |
|
2351 } |
|
2352 |
|
2353 //Expected drive found ! |
|
2354 aComponentId = componentIdList[i]; |
|
2355 CleanupStack::Pop(fileName); |
|
2356 break; |
|
2357 } |
|
2358 } |
|
2359 CleanupStack::PopAndDestroy(2, &componentIdList); |
|
2360 return fileName; // Ownership with caller. |
2257 |
2361 |
2258 HBufC* fileName = GetStrPropertyValueL(iScrSession, componentId, compSidFileName); |
|
2259 CleanupStack::PushL(fileName); |
|
2260 if (fileName->Length() == 0) |
|
2261 { |
|
2262 CleanupStack::PopAndDestroy(fileName); |
|
2263 continue; |
|
2264 } |
|
2265 TInt drive; |
|
2266 User::LeaveIfError(RFs::CharToDrive((*fileName)[0], drive)); |
|
2267 if(drive != aExpectedDrive) |
|
2268 { |
|
2269 CleanupStack::PopAndDestroy(fileName); |
|
2270 continue; |
|
2271 } |
|
2272 CleanupStack::PopAndDestroy(fileName); |
|
2273 } |
|
2274 |
|
2275 aComponentId = componentId; |
|
2276 sidMatchFound = ETrue; |
|
2277 } |
|
2278 |
|
2279 CleanupStack::PopAndDestroy(3, componentFilter); // componentIdList and sidArray. |
|
2280 if(!sidMatchFound) |
|
2281 { |
|
2282 // No component contains aSid. |
|
2283 aComponentId = KErrNotFound; |
|
2284 } |
|
2285 } |
2362 } |
2286 |
2363 |
2287 TBool CSisRegistrySession::ModifiableL(const TDesC& aFileName) |
2364 TBool CSisRegistrySession::ModifiableL(const TDesC& aFileName) |
2288 { |
2365 { |
2289 // Retrieve the list of components which contain aFileName. |
2366 // Retrieve the list of components which contain aFileName. |
2460 |
2537 |
2461 |
2538 |
2462 TBool overwriteRegEntry = EFalse; |
2539 TBool overwriteRegEntry = EFalse; |
2463 |
2540 |
2464 TBool isStubRegistered = IsRegisteredL(object->Uid(), object->Name()); |
2541 TBool isStubRegistered = IsRegisteredL(object->Uid(), object->Name()); |
2465 if ( isFwUpdated && isStubRegistered ) |
2542 if ( iIsFirstInit && isStubRegistered ) |
2466 { |
2543 { |
2467 TComponentId compId = ScrHelperUtil::GetComponentIdL(iScrSession, object->Uid(), object->Index()); |
2544 TComponentId compId = ScrHelperUtil::GetComponentIdL(iScrSession, object->Uid(), object->Index()); |
2468 TSisPackageTrust trustStatus; |
2545 TSisPackageTrust trustStatus; |
2469 trustStatus = static_cast<TSisPackageTrust>(GetIntPropertyValueL(iScrSession, compId, KCompTrust, EFalse, KDefaultTrustValue)); |
2546 trustStatus = static_cast<TSisPackageTrust>(GetIntPropertyValueL(iScrSession, compId, KCompTrust, EFalse, KDefaultTrustValue)); |
2470 //ScrHelperUtil::ReadFromScrL(iSession.ScrSession(), iComponentId, trustStatus); |
2547 //ScrHelperUtil::ReadFromScrL(iSession.ScrSession(), iComponentId, trustStatus); |
2758 return EFalse; |
2835 return EFalse; |
2759 } |
2836 } |
2760 |
2837 |
2761 void CSisRegistrySession::UpdateRecentFWVersionL() |
2838 void CSisRegistrySession::UpdateRecentFWVersionL() |
2762 { |
2839 { |
2763 //Write a cache of the ROM version to a separate stream |
2840 //Write a cache of the ROM version to a separate stream |
2764 //Build the filename for the cache file |
2841 //Build the filename for the cache file |
2765 TChar sysDrive = RFs::GetSystemDriveChar(); |
2842 TChar sysDrive = RFs::GetSystemDriveChar(); |
2766 TInt maxSizeofFileName = KROMVersionStringCacheDir().Length() + KROMVersionStringCacheFileName().Length() + 1; |
2843 TInt maxSizeofFileName = KROMVersionStringCacheDir().Length() + KROMVersionStringCacheFileName().Length() + 1; |
2767 RBuf romVersionCacheFileName; |
2844 RBuf romVersionCacheFileName; |
2768 romVersionCacheFileName.CreateL(maxSizeofFileName); |
2845 romVersionCacheFileName.CreateL(maxSizeofFileName); |
2769 romVersionCacheFileName.CleanupClosePushL(); |
2846 romVersionCacheFileName.CleanupClosePushL(); |
2770 romVersionCacheFileName.Append(sysDrive); |
2847 romVersionCacheFileName.Append(sysDrive); |
2771 romVersionCacheFileName.Append(KROMVersionStringCacheDir()); |
2848 romVersionCacheFileName.Append(KROMVersionStringCacheDir()); |
2772 romVersionCacheFileName.Append(KROMVersionStringCacheFileName()); |
2849 romVersionCacheFileName.Append(KROMVersionStringCacheFileName()); |
2773 |
2850 |
2774 //Read the length & value from it, if any. |
2851 iFs.MkDirAll(romVersionCacheFileName); |
2775 RFileWriteStream romVerStream; |
2852 //Read the length & value from it, if any. |
2776 User::LeaveIfError(romVerStream.Replace(iFs,romVersionCacheFileName,EFileWrite)); |
2853 RFileWriteStream romVerStream; |
2777 CleanupClosePushL(romVerStream); |
2854 User::LeaveIfError(romVerStream.Replace(iFs,romVersionCacheFileName,EFileWrite)); |
2778 TBuf<KInfoBufLength> version; |
2855 CleanupClosePushL(romVerStream); |
2779 GetSWVersion(version); |
2856 TBuf<KInfoBufLength> version; |
2780 |
2857 GetSWVersion(version); |
2781 // Write even if SysUtil returns err since all conditions are taken care during restore. |
2858 |
2782 romVerStream.WriteUint32L(version.Length()); |
2859 // Write even if SysUtil returns err since all conditions are taken care during restore. |
2783 romVerStream.WriteL(version); |
2860 romVerStream.WriteUint32L(version.Length()); |
2784 CleanupStack::PopAndDestroy(2); //romVerStream, romVersionCacheFileName |
2861 romVerStream.WriteL(version); |
|
2862 CleanupStack::PopAndDestroy(2); //romVerStream, romVersionCacheFileName |
2785 } |
2863 } |
2786 |
2864 |
2787 void CSisRegistrySession::AppRegInfoEntryL(const RMessage2& aMessage) |
2865 void CSisRegistrySession::AppRegInfoEntryL(const RMessage2& aMessage) |
2788 { |
2866 { |
2789 Usif::TComponentId componentId = aMessage.Int0(); |
2867 Usif::TComponentId componentId = aMessage.Int0(); |