51 #endif |
50 #endif |
52 |
51 |
53 // SisX Library Includes |
52 // SisX Library Includes |
54 #include "sisfiledescription.h" |
53 #include "sisfiledescription.h" |
55 #include "sisstring.h" |
54 #include "sisstring.h" |
|
55 #include "utility.h" |
56 |
56 |
57 // User Includes |
57 // User Includes |
58 #include "sisregistry.h" |
58 #include "sisregistry.h" |
59 #include "errors.h" |
59 #include "errors.h" |
60 #include "rommanager.h" |
60 #include "rommanager.h" |
64 #include "sisregistrypackage.h" |
64 #include "sisregistrypackage.h" |
65 #include "sisregistryobject.h" |
65 #include "sisregistryobject.h" |
66 #include "configmanager.h" |
66 #include "configmanager.h" |
67 |
67 |
68 // Constants |
68 // Constants |
|
69 #ifndef __TOOLS2_LINUX__ |
69 const std::wstring SisRegistry::KPathToRegistry(L"\\sys\\install\\sisregistry/"); |
70 const std::wstring SisRegistry::KPathToRegistry(L"\\sys\\install\\sisregistry/"); |
70 const std::wstring SisRegistry::KPathToRomStubs(L"\\system\\install\\"); |
71 const std::wstring SisRegistry::KPathToRomStubs(L"\\system\\install\\"); |
71 const std::wstring SisRegistry::KPathToRegistryVersionMarker(L"\\system\\data\\"); |
72 const std::wstring SisRegistry::KPathToRegistryVersionMarker(L"\\system\\data\\"); |
|
73 #else |
|
74 const std::wstring SisRegistry::KPathToRegistry(L"/sys/install/sisregistry/"); |
|
75 const std::wstring SisRegistry::KPathToRomStubs(L"/system/install/"); |
|
76 const std::wstring SisRegistry::KPathToRegistryVersionMarker(L"/system/data/"); |
|
77 #endif |
72 const std::wstring KRegistryEntry(L"00000000.reg"); |
78 const std::wstring KRegistryEntry(L"00000000.reg"); |
73 const std::wstring KControllerEntry(L"00000000_0000.ctl"); |
79 const std::wstring KControllerEntry(L"00000000_0000.ctl"); |
74 const std::wstring KBackupLst(L"backup.lst"); |
80 const std::wstring KBackupLst(L"backup.lst"); |
75 |
81 |
76 const int SisRegistry::KSisRegistryMajorVersion = 5; |
82 const int SisRegistry::KSisRegistryMajorVersion = 5; |
81 const std::wstring SisRegistry::KRegistryV40(L"sisregistry_4.0.txt"); |
87 const std::wstring SisRegistry::KRegistryV40(L"sisregistry_4.0.txt"); |
82 const std::wstring SisRegistry::KRegistryV51(L"sisregistry_5.1.txt"); |
88 const std::wstring SisRegistry::KRegistryV51(L"sisregistry_5.1.txt"); |
83 const std::wstring SisRegistry::KRegistryV52(L"sisregistry_5.2.txt"); |
89 const std::wstring SisRegistry::KRegistryV52(L"sisregistry_5.2.txt"); |
84 const std::wstring SisRegistry::KRegistryV53(L"sisregistry_5.3.txt"); |
90 const std::wstring SisRegistry::KRegistryV53(L"sisregistry_5.3.txt"); |
85 const std::wstring SisRegistry::KRegistryV54(L"sisregistry_5.4.txt"); |
91 const std::wstring SisRegistry::KRegistryV54(L"sisregistry_5.4.txt"); |
|
92 #ifndef __TOOLS2_LINUX__ |
86 const std::wstring SisRegistry::KRomStubDir(L"z:\\system\\install\\"); |
93 const std::wstring SisRegistry::KRomStubDir(L"z:\\system\\install\\"); |
87 const std::wstring SisRegistry::KRomRegistryVersionMarker(L"z:\\system\\data\\"); |
94 const std::wstring SisRegistry::KRomRegistryVersionMarker(L"z:\\system\\data\\"); |
88 |
95 #else |
|
96 const std::wstring SisRegistry::KRomStubDir(L"z:/system/install/"); |
|
97 const std::wstring SisRegistry::KRomRegistryVersionMarker(L"z:/system/data/"); |
|
98 #endif |
89 const std::string SisRegistry::KRegistryV40string("4.0"); |
99 const std::string SisRegistry::KRegistryV40string("4.0"); |
90 const std::string SisRegistry::KRegistryV50string("5.0"); |
100 const std::string SisRegistry::KRegistryV50string("5.0"); |
91 const std::string SisRegistry::KRegistryV51string("5.1"); |
101 const std::string SisRegistry::KRegistryV51string("5.1"); |
92 const std::string SisRegistry::KRegistryV52string("5.2"); |
102 const std::string SisRegistry::KRegistryV52string("5.2"); |
93 const std::string SisRegistry::KRegistryV53string("5.3"); |
103 const std::string SisRegistry::KRegistryV53string("5.3"); |
545 { |
555 { |
546 EntryMap::iterator it = iEntries.find(aUid); |
556 EntryMap::iterator it = iEntries.find(aUid); |
547 |
557 |
548 while(it != iEntries.end()) |
558 while(it != iEntries.end()) |
549 { |
559 { |
550 if (aUid == it->first && |
560 if (aUid == it->first && !wcscmp(aPackageName.c_str(), it->second->GetPackageName().c_str()) && aVendorName == it->second->GetVendorName() ) |
551 aPackageName == it->second->GetPackageName() && |
|
552 aVendorName == it->second->GetVendorName()) |
|
553 { |
561 { |
554 LINFO(L"Removing package \"" << it->second->GetPackageName() |
562 LINFO(L"Removing package \"" << it->second->GetPackageName() |
555 << L"\" prior to re-installation"); |
563 << L"\" prior to re-installation"); |
556 |
564 |
557 // Remove .reg file |
565 // Remove .reg file |
948 |
956 |
949 bool SisRegistry::IsFileWideCard(const std::wstring& aFileName) |
957 bool SisRegistry::IsFileWideCard(const std::wstring& aFileName) |
950 { |
958 { |
951 return (aFileName.find(L'?') != std::wstring::npos || |
959 return (aFileName.find(L'?') != std::wstring::npos || |
952 aFileName.find(L'*') != std::wstring::npos || |
960 aFileName.find(L'*') != std::wstring::npos || |
|
961 #ifndef __TOOLS2_LINUX__ |
953 aFileName[aFileName.length() - 1] == L'\\'); |
962 aFileName[aFileName.length() - 1] == L'\\'); |
|
963 #else |
|
964 aFileName[aFileName.length() - 1] == L'/'); |
|
965 #endif |
954 } |
966 } |
955 |
967 |
956 |
968 |
957 void SisRegistry::GenerateStubRegistry() |
969 void SisRegistry::GenerateStubRegistry() |
958 { |
970 { |
1030 { |
1042 { |
1031 if (c->find(L".reg",0) == std::wstring::npos) |
1043 if (c->find(L".reg",0) == std::wstring::npos) |
1032 continue; |
1044 continue; |
1033 |
1045 |
1034 std::fstream input; |
1046 std::fstream input; |
|
1047 #ifndef __TOOLS2_LINUX__ |
1035 std::wstring filename(aPath + L"\\" + *c); |
1048 std::wstring filename(aPath + L"\\" + *c); |
|
1049 #else |
|
1050 std::wstring filename(aPath + L"/" + *c); |
|
1051 #endif |
1036 |
1052 |
1037 OpenFile(filename.c_str(), input, std::fstream::in | std::fstream::binary); |
1053 OpenFile(filename.c_str(), input, std::fstream::in | std::fstream::binary); |
1038 |
1054 |
1039 if (!input.good()) |
1055 if (!input.good()) |
1040 continue; |
1056 continue; |
1041 |
1057 |
1042 SisRegistryObject* obj = new SisRegistryObject(iConfigManager); |
1058 SisRegistryObject* obj = new SisRegistryObject(iConfigManager); |
1043 |
1059 |
1044 if (!obj) |
1060 if (!obj) |
1045 { |
1061 { |
1046 throw std::runtime_error("Cannot create SisRegistryObject for " + Ucs2ToUtf8(filename)); |
1062 throw std::runtime_error("Cannot create SisRegistryObject for " + wstring2string(filename)); |
1047 } |
1063 } |
1048 Deserialiser des(input); |
1064 Deserialiser des(input); |
1049 |
1065 |
1050 des >> *obj; |
1066 des >> *obj; |
1051 iEntries.insert(EntryMap::value_type(obj->GetUid(), obj)); |
1067 iEntries.insert(EntryMap::value_type(obj->GetUid(), obj)); |
1241 // No SisRegistry file found!! |
1257 // No SisRegistry file found!! |
1242 std::wstring msg = StringUtils::MakePathFromSID ( iParamList.SystemDrivePath()+L"\\", pkgUid ); |
1258 std::wstring msg = StringUtils::MakePathFromSID ( iParamList.SystemDrivePath()+L"\\", pkgUid ); |
1243 |
1259 |
1244 msg.append(L" does not have any SisRegistry file"); |
1260 msg.append(L" does not have any SisRegistry file"); |
1245 |
1261 |
1246 throw std::runtime_error( Ucs2ToUtf8(msg) ); |
1262 throw std::runtime_error( wstring2string(msg) ); |
1247 } |
1263 } |
1248 |
1264 |
1249 aObj.SetIndex( index ); |
1265 aObj.SetIndex( index ); |
1250 |
1266 |
1251 if ( !CheckSisRegistryDirPresent(iParamList.SystemDrivePath(), pkgUid) ) |
1267 if ( !CheckSisRegistryDirPresent(iParamList.SystemDrivePath(), pkgUid) ) |
1253 // c:\sys\install\sisregistry\<UID>\ directory not exist |
1269 // c:\sys\install\sisregistry\<UID>\ directory not exist |
1254 std::wstring msg = StringUtils::MakePathFromSID ( iParamList.SystemDrivePath()+L"\\", pkgUid ); |
1270 std::wstring msg = StringUtils::MakePathFromSID ( iParamList.SystemDrivePath()+L"\\", pkgUid ); |
1255 |
1271 |
1256 msg.append(L" directory NOT found"); |
1272 msg.append(L" directory NOT found"); |
1257 |
1273 |
1258 throw std::runtime_error( Ucs2ToUtf8(msg) ); |
1274 throw std::runtime_error( wstring2string(msg) ); |
1259 } |
1275 } |
1260 } |
1276 } |
1261 } |
1277 } |
1262 |
1278 |
1263 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
1279 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
1329 // No SIS controller file found!! |
1345 // No SIS controller file found!! |
1330 std::wstring msg = StringUtils::MakePathFromSID ( iParamList.SystemDrivePath()+L"\\", pkgUid ); |
1346 std::wstring msg = StringUtils::MakePathFromSID ( iParamList.SystemDrivePath()+L"\\", pkgUid ); |
1331 |
1347 |
1332 msg.append(L" does not have any Sis Controller file"); |
1348 msg.append(L" does not have any Sis Controller file"); |
1333 |
1349 |
1334 throw std::runtime_error( Ucs2ToUtf8(msg) ); |
1350 throw std::runtime_error( wstring2string(msg) ); |
1335 } |
1351 } |
1336 } |
1352 } |
1337 |
1353 |
1338 // Finally, externalise the new controller file |
1354 // Finally, externalise the new controller file |
1339 std::fstream ctlFile; |
1355 std::fstream ctlFile; |
1448 } |
1464 } |
1449 |
1465 |
1450 void SisRegistry::UpdateInstallationInformation(XmlDetails::TScrPreProvisionDetail aScrPreProvisionDetail) |
1466 void SisRegistry::UpdateInstallationInformation(XmlDetails::TScrPreProvisionDetail aScrPreProvisionDetail) |
1451 { |
1467 { |
1452 CXmlGenerator xmlGenerator; |
1468 CXmlGenerator xmlGenerator; |
1453 char* tmpFileName = tmpnam(NULL); |
1469 char* tmpFileName = tmpnam(NULL); |
1454 std::wstring filename(string2wstring(tmpFileName)); |
1470 std::wstring filename(string2wstring(tmpFileName)); |
1455 |
1471 |
1456 int isRomApplication = 0; |
1472 int isRomApplication = 0; |
1457 xmlGenerator.WritePreProvisionDetails(filename , aScrPreProvisionDetail, isRomApplication); |
1473 xmlGenerator.WritePreProvisionDetails(filename , aScrPreProvisionDetail, isRomApplication); |
1458 |
1474 |
|
1475 #ifdef __LINUX__ |
|
1476 std::string executable = "scrtool"; |
|
1477 #else |
1459 std::string executable = "scrtool.exe"; |
1478 std::string executable = "scrtool.exe"; |
|
1479 #endif |
|
1480 |
1460 std::string command; |
1481 std::string command; |
1461 command = executable + " -d " + GetDbPath() + " -p " + tmpFileName; |
1482 command = executable + " -d " + GetDbPath() + " -p " + tmpFileName; |
1462 |
1483 |
1463 int error = system(command.c_str()); |
1484 int error = system(command.c_str()); |
1464 |
1485 |
1479 if ( |
1500 if ( |
1480 (iParamList.RomLogFileNames().size() != 0 && iParamList.RomDrivePath().size() == 0 ) || |
1501 (iParamList.RomLogFileNames().size() != 0 && iParamList.RomDrivePath().size() == 0 ) || |
1481 iParamList.IsFlagSet(CParameterList::EFlagsDisableZDriveChecksSet) |
1502 iParamList.IsFlagSet(CParameterList::EFlagsDisableZDriveChecksSet) |
1482 ) |
1503 ) |
1483 { |
1504 { |
|
1505 #ifndef __TOOLS2_LINUX__ |
1484 return wstring2string(iParamList.SystemDrivePath()) + "\\sys\\install\\scr\\scr.db"; |
1506 return wstring2string(iParamList.SystemDrivePath()) + "\\sys\\install\\scr\\scr.db"; |
1485 } |
1507 #else |
1486 |
1508 return wstring2string(iParamList.SystemDrivePath()) + "/sys/install/scr/scr.db"; |
|
1509 #endif |
|
1510 } |
|
1511 #ifndef __TOOLS2_LINUX__ |
1487 return wstring2string(iParamList.RomDrivePath()) + "\\sys\\install\\scr\\provisioned\\scr.db"; |
1512 return wstring2string(iParamList.RomDrivePath()) + "\\sys\\install\\scr\\provisioned\\scr.db"; |
|
1513 #else |
|
1514 return wstring2string(iParamList.RomDrivePath()) + "/sys/install/scr/provisioned/scr.db"; |
|
1515 #endif |
1488 |
1516 |
1489 } |
1517 } |
1490 |
1518 |
1491 std::string SisRegistry::GetEpocRoot() |
1519 std::string SisRegistry::GetEpocRoot() |
1492 { |
1520 { |
1493 const char* epocRoot = getenv("EPOCROOT"); |
1521 const char* epocRoot = getenv("EPOCROOT"); |
1494 if(NULL == epocRoot) |
1522 if(NULL == epocRoot) |
1495 { |
1523 { |
1496 std::string err = "EPOCROOT environment variable not specified. Please specify it as part of your environment variable." \ |
1524 std::string err = "EPOCROOT environment variable not specified. Please specify it as part of your environment variable." \ |
1497 "It should point uptil the start of the epoc32 directory."; |
1525 "It should point uptil the start of the epoc32 directory."; |
1498 LERROR(L"EPOCROOT environment variable not specified. Please specify it as part of your environment variable." \ |
1526 LERROR(L"EPOCROOT environment variable not specified. Please specify it as part of your environment variable." \ |
1511 #ifdef _MSC_VER |
1539 #ifdef _MSC_VER |
1512 swprintf(textGlobalId,L"%08x",aUid); |
1540 swprintf(textGlobalId,L"%08x",aUid); |
1513 #else |
1541 #else |
1514 swprintf(textGlobalId,20,L"%08x",aUid); |
1542 swprintf(textGlobalId,20,L"%08x",aUid); |
1515 #endif |
1543 #endif |
1516 |
1544 |
|
1545 |
1517 std::wstring globalId = textGlobalId; |
1546 std::wstring globalId = textGlobalId; |
1518 |
1547 |
1519 if( aInstallType == CSISInfo::EInstAugmentation || aInstallType == CSISInfo::EInstPreInstalledPatch ) |
1548 if( aInstallType == CSISInfo::EInstAugmentation || aInstallType == CSISInfo::EInstPreInstalledPatch ) |
1520 { |
1549 { |
1521 if(aPackageName.empty()) |
1550 if(aPackageName.empty()) |
1644 std::string ifile = wstring2string(path1 +*currFile); |
1673 std::string ifile = wstring2string(path1 +*currFile); |
1645 std::string ibackupfile(ifile); |
1674 std::string ibackupfile(ifile); |
1646 ibackupfile.append("_backup"); |
1675 ibackupfile.append("_backup"); |
1647 |
1676 |
1648 int err=FileCopyA(ifile.c_str(),ibackupfile.c_str(),0); |
1677 int err=FileCopyA(ifile.c_str(),ibackupfile.c_str(),0); |
1649 if (err == 0) |
1678 if (err != 0) |
1650 LERROR(L"Failed to Backup .ctl "); |
1679 LERROR(L"Failed to Backup .ctl "); |
1651 } |
1680 } |
1652 ++currFile; |
1681 ++currFile; |
1653 } |
1682 } |
1654 } |
1683 } |
1674 std::string ibackupfile(ifile); |
1703 std::string ibackupfile(ifile); |
1675 ibackupfile.append("_backup"); |
1704 ibackupfile.append("_backup"); |
1676 |
1705 |
1677 RemoveFile(path + *currFile); |
1706 RemoveFile(path + *currFile); |
1678 int err = FileMoveA(ibackupfile.c_str(),ifile.c_str()); |
1707 int err = FileMoveA(ibackupfile.c_str(),ifile.c_str()); |
1679 if (err == 0) |
1708 if (err != 0) |
1680 LERROR(L"Failed to Restore .ctl "); |
1709 LERROR(L"Failed to Restore .ctl "); |
1681 } |
1710 } |
1682 } |
1711 } |
1683 else |
1712 else |
1684 { |
1713 { |
1912 |
1941 |
1913 int algorithmId = aHashContainer.GetHashId(); |
1942 int algorithmId = aHashContainer.GetHashId(); |
1914 // The property is a concatenation of the algorithm id and the hash data |
1943 // The property is a concatenation of the algorithm id and the hash data |
1915 const std::string hashData = aHashContainer.GetData(); |
1944 const std::string hashData = aHashContainer.GetData(); |
1916 |
1945 |
1917 std::string encodedHashData = Util::Base64Encode(hashData); |
1946 std::string encodedHashData = Util::Base64Encode(hashData); |
1918 std::wstring wideHashData = Utils::string2wstring(encodedHashData); |
1947 std::wstring wideHashData = string2wstring(encodedHashData); |
1919 AddComponentProperty( aComponent, DbConstants::CompControllerHashData, wideHashData, aCount, true); |
1948 AddComponentProperty( aComponent, DbConstants::CompControllerHashData, wideHashData, aCount, true); |
1920 |
1949 |
1921 } |
1950 } |
1922 |
1951 |
1923 |
1952 |
2073 |
2102 |
2074 //Find Registration File from list of filelist |
2103 //Find Registration File from list of filelist |
2075 for(filedesIter = aFileDescription.begin() ; filedesIter != aFileDescription.end(); ++filedesIter) |
2104 for(filedesIter = aFileDescription.begin() ; filedesIter != aFileDescription.end(); ++filedesIter) |
2076 { |
2105 { |
2077 // if it has wild card characters then donot process. Continue. |
2106 // if it has wild card characters then donot process. Continue. |
2078 if( IsFileWideCard((*filedesIter)->GetLocalFile()) ) |
2107 if( IsFileWideCard((*filedesIter)->GetLocalFile()) ) |
2079 { |
2108 { |
2080 continue; |
2109 continue; |
2081 } |
2110 } |
2082 |
2111 |
2083 iLocalFile = (*filedesIter)->GetLocalFile(); |
2112 iLocalFile = (*filedesIter)->GetLocalFile(); |
2099 |
2128 |
2100 if(err) |
2129 if(err) |
2101 continue; |
2130 continue; |
2102 |
2131 |
2103 std::string folder; |
2132 std::string folder; |
2104 found=RegistrationFileName.find("private\\10003a3f\\"); |
2133 #ifdef __LINUX__ |
|
2134 const char *privateFolder = "private/10003a3f/"; |
|
2135 #else |
|
2136 const char *privateFolder = "private\\10003a3f\\"; |
|
2137 #endif |
|
2138 |
|
2139 found=RegistrationFileName.find(privateFolder); |
2105 |
2140 |
2106 if( found != string::npos ) |
2141 if( found != string::npos ) |
2107 folder = RegistrationFileName.substr(0,found); |
2142 folder = RegistrationFileName.substr(0,found); |
2108 else |
2143 else |
2109 folder = RegistrationFileName; |
2144 folder = RegistrationFileName; |
2182 } |
2217 } |
2183 // file hash data |
2218 // file hash data |
2184 if(!aFileDescription->GetHash().GetData().empty()) |
2219 if(!aFileDescription->GetHash().GetData().empty()) |
2185 { |
2220 { |
2186 std::string binHashData = Util::Base64Encode(aFileDescription->GetHash().GetData()); |
2221 std::string binHashData = Util::Base64Encode(aFileDescription->GetHash().GetData()); |
2187 std::wstring hashData = Utils::string2wstring(binHashData); |
2222 std::wstring hashData = string2wstring(binHashData); |
2188 AddFileProperty( aComponentFile, DbConstants::FileHashData, hashData, true); |
2223 AddFileProperty( aComponentFile, DbConstants::FileHashData, hashData, true); |
2189 } |
2224 } |
2190 } |
2225 } |
2191 |
2226 |
2192 void SisRegistry::AddTrustStatus ( XmlDetails::TScrPreProvisionDetail::TComponent& aComponent, |
2227 void SisRegistry::AddTrustStatus ( XmlDetails::TScrPreProvisionDetail::TComponent& aComponent, |