installationservices/swi/source/sisregistry/server/sisregistryserversession.cpp
changeset 53 ae54820ef82c
parent 42 d17dc5398051
child 50 c6e8afe0ba85
child 60 245df5276b97
equal deleted inserted replaced
52:92f864ef0288 53:ae54820ef82c
   481 	case ESignedBySuCert:
   481 	case ESignedBySuCert:
   482 		SubsessionL(aMessage.Int3()).SignedBySuCertRegistryEntryL(aMessage);
   482 		SubsessionL(aMessage.Int3()).SignedBySuCertRegistryEntryL(aMessage);
   483  		break;	
   483  		break;	
   484 	case ESetComponentState:
   484 	case ESetComponentState:
   485  		SetComponentStateL(aMessage);
   485  		SetComponentStateL(aMessage);
   486  		break;	
   486  		break;
       
   487 	case ESetComponentPresence:
       
   488 	    SetComponentPresenceL(aMessage);
       
   489 	    break;
   487 	case EIsFileRegistered:
   490 	case EIsFileRegistered:
   488  		IsFileRegisteredL(aMessage);
   491  		IsFileRegisteredL(aMessage);
   489  		break;			
   492  		break;			
   490 	case EComponentIdForUid:
   493 	case EComponentIdForUid:
   491 		GetComponentIdForUidL(aMessage);
   494 		GetComponentIdForUidL(aMessage);
  1058 	    {
  1061 	    {
  1059 	    aMessage.Complete(ret);
  1062 	    aMessage.Complete(ret);
  1060 	    }
  1063 	    }
  1061 	CleanupStack::PopAndDestroy();
  1064 	CleanupStack::PopAndDestroy();
  1062 	}
  1065 	}
       
  1066 
       
  1067 TInt CSisRegistrySession::GetStubFilesL(const TDesC& aFileName, RPointerArray<HBufC>& aFileNames)
       
  1068     {
       
  1069     // Read the ROM stub controller
       
  1070     CFileSisDataProvider* fileProvider = CFileSisDataProvider::NewLC(iFs, aFileName);
       
  1071     Swi::Sis::CController* stubController = NULL;
       
  1072     TRAPD(errCode, stubController = Swi::Sis::CController::NewL(*fileProvider));
       
  1073     if (errCode != KErrNone)
       
  1074         {
       
  1075         // Ignore the broken stub file under the ROM stub directory.
       
  1076         DEBUG_PRINTF2(_L8("Sis Registry Server - Failed to read the stub controller. Error code %d."), errCode);
       
  1077         CleanupStack::PopAndDestroy(fileProvider);
       
  1078         return errCode;
       
  1079         }
       
  1080     CleanupStack::PushL(stubController);
       
  1081     const RPointerArray<Sis::CFileDescription>& depArray = stubController->InstallBlock().FileDescriptions();
       
  1082     // Get as many number of files as possible that can be accomodate in client allocated buffer.
       
  1083     TInt totalDepArrayCount = depArray.Count();
       
  1084     // Populate the files in to a temporary array.
       
  1085     for(TInt fileCount = 0; fileCount < totalDepArrayCount; ++fileCount )
       
  1086         {
       
  1087         // Only create a TPtrC when we know we have space available
       
  1088         HBufC* fileName = depArray[fileCount]->Target().Data().AllocL();
       
  1089         // Adding drive letter of rom if not mentioned in stub sis file
       
  1090         TPtr a=fileName->Des();
       
  1091         if (a[0] == '!')
       
  1092             a[0] = 'z';                        
       
  1093                                        
       
  1094 		CleanupStack::PushL(fileName);
       
  1095 		aFileNames.AppendL(fileName);
       
  1096 		CleanupStack::Pop(fileName);
       
  1097 		}
       
  1098     CleanupStack::PopAndDestroy(2, fileProvider);
       
  1099     return KErrNone;
       
  1100     }
  1063 
  1101 
  1064 TInt CSisRegistrySession::GetStubFileInfoL(TUid aUid, TStubExtractionMode aMode, TInt aStartingFileNo, TInt& aFileCount, RPointerArray<HBufC>& aFileNames)
  1102 TInt CSisRegistrySession::GetStubFileInfoL(TUid aUid, TStubExtractionMode aMode, TInt aStartingFileNo, TInt& aFileCount, RPointerArray<HBufC>& aFileNames)
  1065     {
  1103     {
  1066     TBool stubNotFound(ETrue);
  1104     TBool stubNotFound(ETrue);
  1067     
  1105     
  1486 	aMessage.ReadL(EIpcArgument1, pkgState, 0);
  1524 	aMessage.ReadL(EIpcArgument1, pkgState, 0);
  1487 	iScrSession.SetScomoStateL(pkgComponentId(), pkgState());
  1525 	iScrSession.SetScomoStateL(pkgComponentId(), pkgState());
  1488 	aMessage.Complete(KErrNone);
  1526 	aMessage.Complete(KErrNone);
  1489 	}
  1527 	}
  1490 
  1528 
       
  1529 void CSisRegistrySession::SetComponentPresenceL(const RMessage2& aMessage)
       
  1530     {
       
  1531     TPckgBuf<Usif::TComponentId> componentId;
       
  1532     TPckgBuf<TBool> componentPresence;
       
  1533     aMessage.ReadL(EIpcArgument0, componentId, 0);
       
  1534     aMessage.ReadL(EIpcArgument1, componentPresence, 0);
       
  1535     iScrSession.SetIsComponentPresentL(componentId(), componentPresence());
       
  1536     aMessage.Complete(KErrNone);
       
  1537     }
       
  1538 
  1491 // Helper methods
  1539 // Helper methods
  1492 
  1540 
  1493 TBool CSisRegistrySession::IsRegisteredL(const TUid& aUid)
  1541 TBool CSisRegistrySession::IsRegisteredL(const TUid& aUid)
  1494 	{
  1542 	{
  1495 	return ScrHelperUtil::IsUidPresentL(iScrSession, aUid);
  1543 	return ScrHelperUtil::IsUidPresentL(iScrSession, aUid);
  1545 TBool CSisRegistrySession::IsRegisteredL(const TUid& aUid, const TDesC& aPackageName)
  1593 TBool CSisRegistrySession::IsRegisteredL(const TUid& aUid, const TDesC& aPackageName)
  1546 	{
  1594 	{
  1547 	return ScrHelperUtil::IsUidAndNamePresentL(iScrSession, aUid, aPackageName);
  1595 	return ScrHelperUtil::IsUidAndNamePresentL(iScrSession, aUid, aPackageName);
  1548 	}
  1596 	}
  1549 
  1597 
       
  1598 
       
  1599 void CSisRegistrySession::RemoveEntryL(const TComponentId aCompId)
       
  1600     {
       
  1601     iScrSession.DeleteApplicationEntriesL(aCompId);
       
  1602     iScrSession.DeleteComponentL(aCompId);
       
  1603     }
       
  1604 
  1550 void CSisRegistrySession::RemoveEntryL(const CSisRegistryPackage& aPackage)
  1605 void CSisRegistrySession::RemoveEntryL(const CSisRegistryPackage& aPackage)
  1551 	{
  1606 	{
  1552 	DEBUG_PRINTF4(_L("Sis Registry Server - Removing the entry from Software Component Registry of package : UID: 0x%08x, Name: %S, Vendor: %S ."),
  1607 	DEBUG_PRINTF4(_L("Sis Registry Server - Removing the entry from Software Component Registry of package : UID: 0x%08x, Name: %S, Vendor: %S ."),
  1553 			aPackage.Uid().iUid, &aPackage.Name(), &aPackage.Vendor());
  1608 			aPackage.Uid().iUid, &aPackage.Name(), &aPackage.Vendor());
  1554 
  1609 
  1559 		//if aPackage is not present in the database , then display the message and leave
  1614 		//if aPackage is not present in the database , then display the message and leave
  1560 		DEBUG_PRINTF4(_L("Component Entry : UID: 0x%08x, Name: %S, Vendor: %S , not found in Software Component Registry"),
  1615 		DEBUG_PRINTF4(_L("Component Entry : UID: 0x%08x, Name: %S, Vendor: %S , not found in Software Component Registry"),
  1561 			aPackage.Uid().iUid, &aPackage.Name(), &aPackage.Vendor());
  1616 			aPackage.Uid().iUid, &aPackage.Name(), &aPackage.Vendor());
  1562 		User::Leave(KErrNotFound);
  1617 		User::Leave(KErrNotFound);
  1563 		}
  1618 		}
  1564 	iScrSession.DeleteApplicationEntriesL(compId);
  1619 	
  1565 	iScrSession.DeleteComponentL(compId);
  1620 	RemoveEntryL(compId);
  1566 	}
  1621 	}
  1567 
  1622 
  1568 void CSisRegistrySession::RemoveCleanupInfrastructureL(const CSisRegistryObject& aObject, RStsSession& aStsSession)
  1623 void CSisRegistrySession::RemoveCleanupInfrastructureL(const CSisRegistryObject& aObject, RStsSession& aStsSession)
  1569 	{
  1624 	{
  1570 	DEBUG_PRINTF(_L8("Sis Registry Server - Removing cleanup infrastructure."));
  1625 	DEBUG_PRINTF(_L8("Sis Registry Server - Removing cleanup infrastructure."));
  1742 	iScrSession.SetScomoStateL(compId, EActivated);
  1797 	iScrSession.SetScomoStateL(compId, EActivated);
  1743 	
  1798 	
  1744 	return compId;
  1799 	return compId;
  1745 	}
  1800 	}
  1746 	
  1801 	
  1747 void CSisRegistrySession::AddAppsFromStubL(TComponentId aCompId, TUid aUid)
  1802 void CSisRegistrySession::AddAppsFromStubL(TComponentId aCompId, const TDesC& aFileName)
  1748     {
  1803     {
  1749     TInt startingFileNo = 0;
       
  1750     TInt fileCount = 0;
       
  1751     RPointerArray<HBufC> romFiles;
  1804     RPointerArray<HBufC> romFiles;
  1752     CleanupResetAndDestroy<RPointerArray<HBufC> >::PushL(romFiles);
  1805     CleanupResetAndDestroy<RPointerArray<HBufC> >::PushL(romFiles);
  1753     TInt ret = GetStubFileInfoL(aUid, EGetFiles, startingFileNo, fileCount, romFiles);
  1806     TInt ret = GetStubFilesL(aFileName, romFiles);
  1754 
       
  1755     RPointerArray<HBufC> apparcRegFiles;
  1807     RPointerArray<HBufC> apparcRegFiles;
  1756     CleanupResetAndDestroy<RPointerArray<HBufC> >::PushL(apparcRegFiles);
  1808     CleanupResetAndDestroy<RPointerArray<HBufC> >::PushL(apparcRegFiles);
  1757        
  1809        
  1758     for(TInt i=0; i< romFiles.Count(); i++)
  1810     for(TInt i=0; i< romFiles.Count(); i++)
  1759         {
  1811         {
  2550             DEBUG_PRINTF2(_L8("Sis Registry Server - Attempting to delete registry entry 0x%08x as a firmware update detected"), object->Uid().iUid);
  2602             DEBUG_PRINTF2(_L8("Sis Registry Server - Attempting to delete registry entry 0x%08x as a firmware update detected"), object->Uid().iUid);
  2551             
  2603             
  2552             // If the component being removed has registered software types, unregister them now.
  2604             // If the component being removed has registered software types, unregister them now.
  2553             // This operation deletes MIME types mapping from AppArc and therefore is not transactional.
  2605             // This operation deletes MIME types mapping from AppArc and therefore is not transactional.
  2554             UnregisterSoftwareTypesL(compId);
  2606             UnregisterSoftwareTypesL(compId);
  2555 
       
  2556             CSisRegistryObject* object = CSisRegistryObject::NewLC();
       
  2557             ScrHelperUtil::GetComponentL(iScrSession, compId, *object);
       
  2558 
       
  2559             DEBUG_PRINTF4(_L("Sis Registry Server - Removing package registry entry for UID: %08x, Name: %S, Vendor %S."),
       
  2560                 object->Uid().iUid, &(object->Name()), &(object->Vendor()));
       
  2561                 
  2607                 
  2562             RemoveEntryL(*object);           
  2608             RemoveEntryL(compId);           
  2563 
  2609 
  2564             CleanupStack::PopAndDestroy();
       
  2565             overwriteRegEntry = ETrue;
  2610             overwriteRegEntry = ETrue;
  2566 	        }
  2611 	        }
  2567 	    }
  2612 	    }
  2568 
  2613 
  2569 
  2614 
  2570 	if ( !isStubRegistered || overwriteRegEntry )
  2615 	if ( !isStubRegistered || overwriteRegEntry )
  2571 		{
  2616 		{
  2572 		// update cache or just call refresh
  2617 		// update cache or just call refresh
  2573 		TComponentId compId = AddEntryL(*object, Usif::EScrCompHidden); // EScrCompHidden is supplied not to create any log for the ROM controller on the SCR side.
  2618 		TComponentId compId = AddEntryL(*object, Usif::EScrCompHidden); // EScrCompHidden is supplied not to create any log for the ROM controller on the SCR side.
  2574 		AddAppsFromStubL(compId, object->Uid());
  2619 		AddAppsFromStubL(compId, aFileName);
  2575 		
  2620 		
  2576 		// store a copy of the controller
  2621 		// store a copy of the controller
  2577 		HBufC* name = SisRegistryUtil::BuildControllerFileNameLC(object->Uid(), object->Index(),
  2622 		HBufC* name = SisRegistryUtil::BuildControllerFileNameLC(object->Uid(), object->Index(),
  2578 				0);
  2623 				0);
  2579 		
  2624