1463 } |
1464 } |
1464 |
1465 |
1465 void SisRegistry::UpdateInstallationInformation(XmlDetails::TScrPreProvisionDetail aScrPreProvisionDetail) |
1466 void SisRegistry::UpdateInstallationInformation(XmlDetails::TScrPreProvisionDetail aScrPreProvisionDetail) |
1466 { |
1467 { |
1467 CXmlGenerator xmlGenerator; |
1468 CXmlGenerator xmlGenerator; |
1468 char* tmpFileName = tmpnam(NULL); |
1469 |
|
1470 #ifndef __TOOLS2_LINUX__ |
|
1471 char* tmpFileName = tmpnam(NULL); |
|
1472 #else |
|
1473 char tmpFileName[] = "/tmp/interpretsis_XXXXXX"; |
|
1474 int temp_fd; |
|
1475 temp_fd=mkstemp(tmpFileName); |
|
1476 fclose(fdopen(temp_fd,"w")); |
|
1477 #endif |
|
1478 |
1469 std::wstring filename(string2wstring(tmpFileName)); |
1479 std::wstring filename(string2wstring(tmpFileName)); |
1470 |
1480 |
1471 int isRomApplication = 0; |
1481 int isRomApplication = 0; |
1472 xmlGenerator.WritePreProvisionDetails(filename , aScrPreProvisionDetail, isRomApplication); |
1482 xmlGenerator.WritePreProvisionDetails(filename , aScrPreProvisionDetail, isRomApplication); |
1473 |
1483 |
1474 #ifdef __LINUX__ |
1484 #ifdef __TOOLS2_LINUX__ |
1475 std::string executable = "scrtool"; |
1485 std::string executable = "scrtool"; |
1476 #else |
1486 #else |
1477 std::string executable = "scrtool.exe"; |
1487 std::string executable = "scrtool.exe"; |
1478 #endif |
1488 #endif |
1479 |
1489 |
1515 |
1525 |
1516 } |
1526 } |
1517 |
1527 |
1518 std::string SisRegistry::GetEpocRoot() |
1528 std::string SisRegistry::GetEpocRoot() |
1519 { |
1529 { |
1520 const char* epocRoot = getenv("EPOCROOT"); |
1530 const char* epocRoot = getenv("EPOCROOT"); |
1521 if(NULL == epocRoot) |
1531 if(NULL == epocRoot) |
1522 { |
1532 { |
1523 std::string err = "EPOCROOT environment variable not specified. Please specify it as part of your environment variable." \ |
1533 std::string err = "EPOCROOT environment variable not specified. Please specify it as part of your environment variable." \ |
1524 "It should point uptil the start of the epoc32 directory."; |
1534 "It should point uptil the start of the epoc32 directory."; |
1525 LERROR(L"EPOCROOT environment variable not specified. Please specify it as part of your environment variable." \ |
1535 LERROR(L"EPOCROOT environment variable not specified. Please specify it as part of your environment variable." \ |
1538 #ifdef _MSC_VER |
1548 #ifdef _MSC_VER |
1539 swprintf(textGlobalId,L"%08x",aUid); |
1549 swprintf(textGlobalId,L"%08x",aUid); |
1540 #else |
1550 #else |
1541 swprintf(textGlobalId,20,L"%08x",aUid); |
1551 swprintf(textGlobalId,20,L"%08x",aUid); |
1542 #endif |
1552 #endif |
1543 |
1553 |
|
1554 |
1544 std::wstring globalId = textGlobalId; |
1555 std::wstring globalId = textGlobalId; |
1545 |
1556 |
1546 if( aInstallType == CSISInfo::EInstAugmentation || aInstallType == CSISInfo::EInstPreInstalledPatch ) |
1557 if( aInstallType == CSISInfo::EInstAugmentation || aInstallType == CSISInfo::EInstPreInstalledPatch ) |
1547 { |
1558 { |
1548 if(aPackageName.empty()) |
1559 if(aPackageName.empty()) |
1643 } |
1662 } |
1644 // remove the application from database |
1663 // remove the application from database |
1645 iDbHelper->RemoveEntry(*compIter); |
1664 iDbHelper->RemoveEntry(*compIter); |
1646 } |
1665 } |
1647 } |
1666 } |
|
1667 |
|
1668 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
1669 void SisRegistry::BackupCtl(TUint32 aUid) |
|
1670 { |
|
1671 std::list<std::wstring> regDirFiles; |
|
1672 std::wstring path = GetRegistryDir( iParamList.SystemDrivePath(), aUid ); |
|
1673 GetDirContents(path, regDirFiles); |
|
1674 std::list<std::wstring>::iterator currFile = regDirFiles.begin(); |
|
1675 |
|
1676 std::wstring path1 = FixPathDelimiterstap(path); |
|
1677 // Backup all .ctl files in the system drive for this package |
|
1678 while (currFile != regDirFiles.end()) |
|
1679 { |
|
1680 if (*currFile != L"." && *currFile != L"..") |
|
1681 { |
|
1682 std::string ifile = wstring2string(path1 +*currFile); |
|
1683 std::string ibackupfile(ifile); |
|
1684 ibackupfile.append("_backup"); |
|
1685 |
|
1686 int err=FileCopyA(ifile.c_str(),ibackupfile.c_str(),0); |
|
1687 if (err != 0) |
|
1688 LERROR(L"Failed to Backup .ctl "); |
|
1689 } |
|
1690 ++currFile; |
|
1691 } |
|
1692 } |
|
1693 |
|
1694 void SisRegistry::RestoreCtl(TUint32 aUid, TBool& aBackupFlag) |
|
1695 { |
|
1696 std::list<std::wstring> regDirFiles; |
|
1697 std::wstring path = GetRegistryDir( iParamList.SystemDrivePath(), aUid ); |
|
1698 GetDirContents(path, regDirFiles); |
|
1699 std::list<std::wstring>::iterator currFile = regDirFiles.begin(); |
|
1700 |
|
1701 // Restore all .ctl files in the system drive for this package |
|
1702 while (currFile != regDirFiles.end()) |
|
1703 { |
|
1704 if (*currFile != L"." && *currFile != L"..") |
|
1705 { |
|
1706 if(aBackupFlag) |
|
1707 { |
|
1708 int pos =0; |
|
1709 if((pos = currFile->find(L".ctl_backup", 0)) == std::wstring::npos) |
|
1710 { |
|
1711 std::string ifile = wstring2string(path +*currFile); |
|
1712 std::string ibackupfile(ifile); |
|
1713 ibackupfile.append("_backup"); |
|
1714 |
|
1715 RemoveFile(path + *currFile); |
|
1716 int err = FileMoveA(ibackupfile.c_str(),ifile.c_str()); |
|
1717 if (err != 0) |
|
1718 LERROR(L"Failed to Restore .ctl "); |
|
1719 } |
|
1720 } |
|
1721 else |
|
1722 { |
|
1723 RemoveFile(path + *currFile); |
|
1724 } |
|
1725 } |
|
1726 ++currFile; |
|
1727 } |
|
1728 } |
|
1729 |
|
1730 void SisRegistry::RemoveCtlBackup(TUint32 aUid) |
|
1731 { |
|
1732 std::list<std::wstring> regDirFiles; |
|
1733 std::wstring path = GetRegistryDir( iParamList.SystemDrivePath(), aUid ); |
|
1734 GetDirContents(path, regDirFiles); |
|
1735 std::list<std::wstring>::iterator currFile = regDirFiles.begin(); |
|
1736 |
|
1737 // Remove all .ctl backup files in the system drive for this package |
|
1738 while (currFile != regDirFiles.end()) |
|
1739 { |
|
1740 if (*currFile != L"." && *currFile != L"..") |
|
1741 { |
|
1742 std::wstring ifile(path +*currFile); |
|
1743 ifile.append(L"_backup"); |
|
1744 |
|
1745 if (FileExists(ifile)) |
|
1746 RemoveFile(ifile); |
|
1747 } |
|
1748 ++currFile; |
|
1749 } |
|
1750 } |
|
1751 #endif |
1648 |
1752 |
1649 TUint32 SisRegistry::GetUid(TUint32 aSid) const |
1753 TUint32 SisRegistry::GetUid(TUint32 aSid) const |
1650 { |
1754 { |
1651 return iDbHelper->GetUid(aSid); |
1755 return iDbHelper->GetUid(aSid); |
1652 } |
1756 } |
1679 |
1783 |
1680 AddComponentDependencies(component, aSisRegistryObject); |
1784 AddComponentDependencies(component, aSisRegistryObject); |
1681 AddEmbeddedPackages(component, aSisRegistryObject.GetEmbeddedPackages()); |
1785 AddEmbeddedPackages(component, aSisRegistryObject.GetEmbeddedPackages()); |
1682 AddProperties(component, aSisRegistryObject.GetProperties()); |
1786 AddProperties(component, aSisRegistryObject.GetProperties()); |
1683 AddFileDescription(component, aSisRegistryObject.GetFileDescriptions()); |
1787 AddFileDescription(component, aSisRegistryObject.GetFileDescriptions()); |
|
1788 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
1789 AddApplicationRegistrationInfoL(component, aSisRegistryObject.GetFileDescriptions(), aSisRegistryObject.GetInRom()); |
|
1790 #endif //SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
1684 |
1791 |
1685 // inROM |
1792 // inROM |
1686 if(DbConstants::KDefaultIsInRom != aSisRegistryObject.GetInRom()) |
1793 if(DbConstants::KDefaultIsInRom != aSisRegistryObject.GetInRom()) |
1687 AddComponentProperty(component, DbConstants::CompInRom, aSisRegistryObject.GetInRom(), IGNORE_FORMATTING ); |
1794 AddComponentProperty(component, DbConstants::CompInRom, aSisRegistryObject.GetInRom(), IGNORE_FORMATTING ); |
1688 |
1795 |
1983 } |
2090 } |
1984 |
2091 |
1985 // add the location in the component files table |
2092 // add the location in the component files table |
1986 XmlDetails::TScrPreProvisionDetail::TComponentFile componentFile; |
2093 XmlDetails::TScrPreProvisionDetail::TComponentFile componentFile; |
1987 componentFile.iLocation = (*filedesIter)->GetTarget(); |
2094 componentFile.iLocation = (*filedesIter)->GetTarget(); |
|
2095 |
1988 AddFileDescriptionAsFileProperty(componentFile, *filedesIter); |
2096 AddFileDescriptionAsFileProperty(componentFile, *filedesIter); |
1989 aComponent.iComponentFiles.push_back(componentFile); |
2097 aComponent.iComponentFiles.push_back(componentFile); |
1990 } |
2098 } |
1991 |
2099 |
1992 if (DbConstants::KDefaultWildCardFileCount != wildcardFileCount) |
2100 if (DbConstants::KDefaultWildCardFileCount != wildcardFileCount) |
1993 AddComponentProperty(aComponent, DbConstants::CompWildCardFileCount, wildcardFileCount, IGNORE_FORMATTING); |
2101 AddComponentProperty(aComponent, DbConstants::CompWildCardFileCount, wildcardFileCount, IGNORE_FORMATTING); |
1994 } |
2102 } |
|
2103 |
|
2104 |
|
2105 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
2106 void SisRegistry::AddApplicationRegistrationInfoL(XmlDetails::TScrPreProvisionDetail::TComponent& aComponent, const std::vector<FileDescription*>& aFileDescription, int aInRom ) |
|
2107 { |
|
2108 std::vector<FileDescription*>::const_iterator filedesIter; |
|
2109 std::wstring iLocalFile; |
|
2110 std::string RegistrationFileName; |
|
2111 |
|
2112 //Find Registration File from list of filelist |
|
2113 for(filedesIter = aFileDescription.begin() ; filedesIter != aFileDescription.end(); ++filedesIter) |
|
2114 { |
|
2115 // if it has wild card characters then donot process. Continue. |
|
2116 if( IsFileWideCard((*filedesIter)->GetLocalFile()) ) |
|
2117 { |
|
2118 continue; |
|
2119 } |
|
2120 |
|
2121 iLocalFile = (*filedesIter)->GetLocalFile(); |
|
2122 RegistrationFileName = wstring2string(iLocalFile); |
|
2123 |
|
2124 std::string iRomPath = wstring2string(iParamList.RomDrivePath()); |
|
2125 if(aInRom) |
|
2126 { |
|
2127 std::string localpath = FullNameWithoutDrive(RegistrationFileName); |
|
2128 RegistrationFileName = iRomPath + localpath; |
|
2129 } |
|
2130 |
|
2131 size_t found=RegistrationFileName.rfind(".rsc"); |
|
2132 if(found==string::npos) |
|
2133 continue; |
|
2134 |
|
2135 //Return 0 for Registration file else 1 |
|
2136 TInt err = FindRegistrationResourceFileL(RegistrationFileName); |
|
2137 |
|
2138 if(err) |
|
2139 continue; |
|
2140 |
|
2141 std::string folder; |
|
2142 #ifdef __LINUX__ |
|
2143 const char *privateFolder = "private/10003a3f/"; |
|
2144 #else |
|
2145 const char *privateFolder = "private\\10003a3f\\"; |
|
2146 #endif |
|
2147 |
|
2148 found=RegistrationFileName.find(privateFolder); |
|
2149 |
|
2150 if( found != string::npos ) |
|
2151 folder = RegistrationFileName.substr(0,found); |
|
2152 else |
|
2153 folder = RegistrationFileName; |
|
2154 |
|
2155 CAppInfoReader* appInfoReader = NULL; |
|
2156 appInfoReader = CAppInfoReader::NewL(RegistrationFileName, NullUid, folder); |
|
2157 if (!appInfoReader) |
|
2158 { |
|
2159 std::string errMsg= "Error in Reading File. Memory Allocation Failed"; |
|
2160 throw CResourceFileException(errMsg); |
|
2161 } |
|
2162 else |
|
2163 { |
|
2164 TBool readSuccessful=EFalse; |
|
2165 |
|
2166 readSuccessful= appInfoReader->ReadL(aFileDescription, iRomPath, aInRom); |
|
2167 |
|
2168 if (readSuccessful) |
|
2169 { |
|
2170 CreateApplicationRegistrationInfoL(aComponent,appInfoReader); |
|
2171 } |
|
2172 else |
|
2173 { |
|
2174 delete appInfoReader; |
|
2175 std::string errMsg= "Reading Resource File failed."; |
|
2176 throw CResourceFileException(errMsg); |
|
2177 } |
|
2178 } |
|
2179 delete appInfoReader; |
|
2180 } |
|
2181 } |
|
2182 #endif //SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
1995 |
2183 |
1996 void SisRegistry::AddFileDescriptionAsFileProperty ( XmlDetails::TScrPreProvisionDetail::TComponentFile& aComponentFile, |
2184 void SisRegistry::AddFileDescriptionAsFileProperty ( XmlDetails::TScrPreProvisionDetail::TComponentFile& aComponentFile, |
1997 const FileDescription* aFileDescription |
2185 const FileDescription* aFileDescription |
1998 ) |
2186 ) |
1999 { |
2187 { |