221 ReadSisRegistryVersion(); |
221 ReadSisRegistryVersion(); |
222 } |
222 } |
223 |
223 |
224 if(iParamList.RegistryVersionExists()) |
224 if(iParamList.RegistryVersionExists()) |
225 { |
225 { |
226 LINFO(L"Using SIS Registry v" << iParamList.RegistryMajorVersion() << L"." << iParamList.RegistryMinorVersion()); |
226 if ( !iParamList.IsFlagSet(CParameterList::EFlagsRomInstallSet)) |
|
227 { |
|
228 LINFO(L"Using SIS Registry v" << iParamList.RegistryMajorVersion() << L"." << iParamList.RegistryMinorVersion()); |
227 |
229 |
228 std::wstring registryPathDriveC = KPathToRegistry; |
230 std::wstring registryPathDriveC = KPathToRegistry; |
229 |
231 |
230 ConvertToLocalPath( registryPathDriveC, iParamList.SystemDrivePath() ); |
232 ConvertToLocalPath( registryPathDriveC, iParamList.SystemDrivePath() ); |
231 |
233 |
232 ReadRegistry( registryPathDriveC ); |
234 ReadRegistry( registryPathDriveC ); |
|
235 } |
233 } |
236 } |
234 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
237 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
235 // this code is for handling the database registry implementation |
238 // this code is for handling the database registry implementation |
236 else |
239 else |
237 { |
240 { |
250 iDbHelper = new DbHelper(iParamList.RomDrivePath(), false); |
253 iDbHelper = new DbHelper(iParamList.RomDrivePath(), false); |
251 } |
254 } |
252 } |
255 } |
253 #endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
256 #endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
254 |
257 |
255 GenerateStubRegistry(); |
258 if ( !iParamList.IsFlagSet(CParameterList::EFlagsRomInstallSet)) |
|
259 { |
|
260 GenerateStubRegistry(); |
|
261 } |
256 } |
262 } |
257 |
263 |
258 |
264 |
259 SisRegistry::~SisRegistry() |
265 SisRegistry::~SisRegistry() |
260 { |
266 { |
556 |
562 |
557 while(it != iEntries.end()) |
563 while(it != iEntries.end()) |
558 { |
564 { |
559 if (aUid == it->first && !wcscmp(aPackageName.c_str(), it->second->GetPackageName().c_str()) && aVendorName == it->second->GetVendorName() ) |
565 if (aUid == it->first && !wcscmp(aPackageName.c_str(), it->second->GetPackageName().c_str()) && aVendorName == it->second->GetVendorName() ) |
560 { |
566 { |
561 LINFO(L"Removing package \"" << it->second->GetPackageName() |
567 LINFO(L"Removing package \"" << it->second->GetPackageName().c_str() |
562 << L"\" prior to re-installation"); |
568 << L"\" prior to re-installation"); |
563 |
569 |
564 // Remove .reg file |
570 // Remove .reg file |
565 std::wstring registryPath = it->second->GetRegistryDir( iParamList.SystemDrivePath() ); |
571 std::wstring registryPath = it->second->GetRegistryDir( iParamList.SystemDrivePath() ); |
566 RemoveFile(registryPath + StringUtils::BuildSisRegistryFileName( it->second->GetIndex() )); |
572 RemoveFile(registryPath + StringUtils::BuildSisRegistryFileName( it->second->GetIndex() )); |
594 if(componentId == DbHelper::Absent) |
600 if(componentId == DbHelper::Absent) |
595 { |
601 { |
596 return; |
602 return; |
597 } |
603 } |
598 |
604 |
599 LINFO(L"Removing package \"" << aPackageName << L"\" prior to re-installation"); |
605 LINFO(L"Removing package \"" << aPackageName.c_str() << L"\" prior to re-installation"); |
600 |
606 |
601 // Remove .ctl file |
607 // Remove .ctl file |
602 int drive = tolower(iDbHelper->GetSelectedDrive(componentId)); |
608 int drive = tolower(iDbHelper->GetSelectedDrive(componentId)); |
603 std::wstring localTargetPath = iConfigManager.GetLocalDrivePath(drive); |
609 std::wstring localTargetPath = iConfigManager.GetLocalDrivePath(drive); |
604 std::wstring registryPath = GetRegistryDir( localTargetPath,componentId ); |
610 std::wstring registryPath = GetRegistryDir( localTargetPath,componentId ); |
730 FileDescriptions::const_iterator end = aFileDes.end(); |
736 FileDescriptions::const_iterator end = aFileDes.end(); |
731 |
737 |
732 for ( ; curr != end ; ++curr) |
738 for ( ; curr != end ; ++curr) |
733 { |
739 { |
734 std::wstring target((*curr)->GetTarget()); |
740 std::wstring target((*curr)->GetTarget()); |
735 |
741 |
736 ConvertToLocalPath(target, aLocalPath); |
742 if(target[0]==iParamList.SystemDriveLetter()) |
|
743 { |
|
744 ConvertToLocalPath(target, iParamList.SystemDrivePath()); |
|
745 } |
|
746 else |
|
747 { |
|
748 ConvertToLocalPath(target, aLocalPath); |
|
749 } |
737 RemoveFile(target); |
750 RemoveFile(target); |
738 RemoveHashForFile(target, iParamList.SystemDriveLetter(), iParamList.SystemDrivePath()); |
751 RemoveHashForFile(target, iParamList.SystemDriveLetter(), iParamList.SystemDrivePath()); |
739 } |
752 } |
740 } |
753 } |
741 |
754 |
911 if ( !MakeDir( regPath ) ) |
924 if ( !MakeDir( regPath ) ) |
912 { |
925 { |
913 throw InterpretSisError(L"Directory Creation Error - "+regPath, DIRECTORY_CREATION_ERROR); |
926 throw InterpretSisError(L"Directory Creation Error - "+regPath, DIRECTORY_CREATION_ERROR); |
914 } |
927 } |
915 |
928 |
916 LINFO(L"\tAdding ROM Stub: 0x" << std::hex << aSisRegistryObject->GetUid() << L" \"" << aSisRegistryObject->GetPackageName() << L"\""); |
929 LINFO(L"\tAdding ROM Stub: 0x" << std::hex << aSisRegistryObject->GetUid() << L" \"" << aSisRegistryObject->GetPackageName().c_str() << L"\""); |
917 |
930 |
918 if(iParamList.RegistryVersionExists()) |
931 if(iParamList.RegistryVersionExists()) |
919 { |
932 { |
920 iEntries.insert( EntryMap::value_type( aSisRegistryObject->GetUid(), aSisRegistryObject ) ); |
933 iEntries.insert( EntryMap::value_type( aSisRegistryObject->GetUid(), aSisRegistryObject ) ); |
921 |
934 |
1151 } |
1163 } |
1152 return NULL; |
1164 return NULL; |
1153 } |
1165 } |
1154 |
1166 |
1155 |
1167 |
1156 CSISController* SisRegistry::GetStubControllerInDir( const std::wstring& aDirectory, const TUint32 aUid) |
1168 CSISController* SisRegistry::GetStubControllerUid(const std::wstring& aTarget) |
|
1169 { |
|
1170 if (iParamList.IsFlagSet(CParameterList::EFlagsDisableZDriveChecksSet)) |
|
1171 { |
|
1172 return NULL; |
|
1173 } |
|
1174 // If the -z option were used to launch the tool, then read any |
|
1175 // SIS stubs that we have gathered from the emulated Z:\System\Install |
|
1176 // location. |
|
1177 if (iParamList.IsFlagSet(CParameterList::EFlagsZDriveSet)) |
|
1178 { |
|
1179 std::wstring stubPathZ = KPathToRomStubs; |
|
1180 ConvertToLocalPath( stubPathZ, iParamList.RomDrivePath() ); |
|
1181 |
|
1182 CSISController* sisController = GetStubControllerInDir( stubPathZ, aTarget ); |
|
1183 |
|
1184 if (sisController) |
|
1185 { |
|
1186 return sisController; |
|
1187 } |
|
1188 } |
|
1189 |
|
1190 // If an additional SIS stub path were specified, we'll |
|
1191 // also handle that here too. |
|
1192 if (iParamList.IsFlagSet(CParameterList::EFlagsStubDirectorySet)) |
|
1193 { |
|
1194 bool readCustomStubPath = true; |
|
1195 std::wstring customStubPath = iParamList.SisStubPath(); |
|
1196 |
|
1197 // But make sure we don't read the same directory twice! |
|
1198 const bool haveRomDrive = iParamList.IsFlagSet(CParameterList::EFlagsZDriveSet); |
|
1199 if ( haveRomDrive ) |
|
1200 { |
|
1201 std::wstring stubPathZ = KPathToRomStubs; |
|
1202 ConvertToLocalPath( stubPathZ, iParamList.RomDrivePath() ); |
|
1203 readCustomStubPath = ( stubPathZ != customStubPath ); |
|
1204 } |
|
1205 |
|
1206 if ( readCustomStubPath ) |
|
1207 { |
|
1208 CSISController* sisController = GetStubControllerInDir( customStubPath, aTarget ); |
|
1209 |
|
1210 if (sisController) |
|
1211 { |
|
1212 return sisController; |
|
1213 } |
|
1214 } |
|
1215 } |
|
1216 return NULL; |
|
1217 } |
|
1218 |
|
1219 |
|
1220 CSISController* SisRegistry::GetStubControllerInDir( const std::wstring& aDirectory, const std::wstring& aTarget) |
1157 { |
1221 { |
1158 // Make sure the directory name is properly terminated. |
1222 // Make sure the directory name is properly terminated. |
1159 std::wstring basePath = StringUtils::EnsureDirectoryTerminated( aDirectory ); |
1223 std::wstring basePath = StringUtils::EnsureDirectoryTerminated( aDirectory ); |
1160 |
1224 |
1161 std::list<std::wstring> stubDirs; |
1225 std::list<std::wstring> stubDirs; |
1178 _TCHAR* fileName = const_cast<_TCHAR *>(stubPath.c_str()); |
1242 _TCHAR* fileName = const_cast<_TCHAR *>(stubPath.c_str()); |
1179 CSISController* sisController = ReadStubController( fileName ); |
1243 CSISController* sisController = ReadStubController( fileName ); |
1180 |
1244 |
1181 if (!sisController) |
1245 if (!sisController) |
1182 continue; |
1246 continue; |
1183 |
1247 const CSISInstallBlock& installBlock = sisController->InstallBlock(); |
|
1248 int fileCount = installBlock.FileCount(); |
|
1249 |
|
1250 for (int i = 0; i < fileCount; ++i) |
|
1251 { |
|
1252 std::wstring file(installBlock.FileDescription(i).Target().GetString()); |
|
1253 if(file[0]!=L'z') |
|
1254 { |
|
1255 file[0]=L'z'; |
|
1256 } |
|
1257 file = StringUtils::ToLower(file); |
|
1258 aTarget = StringUtils::ToLower(aTarget); |
|
1259 #ifdef __TOOLS2_LINUX__ |
|
1260 ConvertToForwardSlash(file); |
|
1261 #endif |
|
1262 |
|
1263 if (!wcscmp(file.c_str(), aTarget.c_str())) |
|
1264 { |
|
1265 return sisController; |
|
1266 } |
|
1267 } |
|
1268 |
|
1269 delete sisController; |
|
1270 } |
|
1271 |
|
1272 return NULL; |
|
1273 } |
|
1274 |
|
1275 CSISController* SisRegistry::GetStubControllerInDir( const std::wstring& aDirectory, const TUint32 aUid) |
|
1276 { |
|
1277 // Make sure the directory name is properly terminated. |
|
1278 std::wstring basePath = StringUtils::EnsureDirectoryTerminated( aDirectory ); |
|
1279 |
|
1280 std::list<std::wstring> stubDirs; |
|
1281 GetDirContents( basePath, stubDirs ); |
|
1282 |
|
1283 std::list<std::wstring>::iterator curr; |
|
1284 for (curr = stubDirs.begin(); curr != stubDirs.end() ; ++curr) |
|
1285 { |
|
1286 std::wstring stubPath ( basePath + *curr ); |
|
1287 |
|
1288 int dotIndex = stubPath.rfind(L"."); |
|
1289 if(dotIndex == std::wstring::npos) |
|
1290 continue; |
|
1291 |
|
1292 std::wstring extOfString = stubPath.substr(dotIndex+1); |
|
1293 |
|
1294 std::wstring extOfStringUpper = StringUtils::ToUpper(extOfString); |
|
1295 if (extOfStringUpper != L"SIS" && extOfStringUpper != L"SISX") |
|
1296 continue; |
|
1297 |
|
1298 _TCHAR* fileName = const_cast<_TCHAR *>(stubPath.c_str()); |
|
1299 CSISController* sisController = ReadStubController( fileName ); |
|
1300 |
|
1301 if (!sisController) |
|
1302 continue; |
|
1303 |
1184 if (sisController->UID1() == aUid) |
1304 if (sisController->UID1() == aUid) |
1185 { |
1305 { |
|
1306 SetRomStubFile(fileName); |
1186 return sisController; |
1307 return sisController; |
1187 } |
1308 } |
1188 delete sisController; |
1309 delete sisController; |
1189 } |
1310 } |
1190 return NULL; |
1311 return NULL; |
1423 num = ++index; |
1544 num = ++index; |
1424 } |
1545 } |
1425 #endif //SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
1546 #endif //SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
1426 return num; |
1547 return num; |
1427 } |
1548 } |
|
1549 |
|
1550 void SisRegistry::SetRomStubFile(const std::wstring& aRomStubFile) |
|
1551 { |
|
1552 iRomStubFile = aRomStubFile; |
|
1553 } |
|
1554 |
|
1555 const std::wstring& SisRegistry::GetRomStubFile() const |
|
1556 { |
|
1557 return iRomStubFile; |
|
1558 } |
|
1559 |
1428 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
1560 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
1429 |
1561 |
1430 std::wstring SisRegistry::FormatVersionToString( const Version& aVersion ) |
1562 std::wstring SisRegistry::FormatVersionToString( const Version& aVersion ) |
1431 { |
1563 { |
1432 std::wstringstream versionText; |
1564 std::wstringstream versionText; |