52 #include "adornedutilities.h" |
54 #include "adornedutilities.h" |
53 |
55 |
54 // Constants |
56 // Constants |
55 const char KRomDriveLetter = 'z'; |
57 const char KRomDriveLetter = 'z'; |
56 const TUint32 KSwiDaemonUid = 0x10202DCE; |
58 const TUint32 KSwiDaemonUid = 0x10202DCE; |
|
59 #ifndef __TOOLS2_LINUX__ |
57 const std::wstring KSysBinPath = L"\\sys\\bin\\"; |
60 const std::wstring KSysBinPath = L"\\sys\\bin\\"; |
|
61 #else |
|
62 const std::wstring KSysBinPath = L"/sys/bin/"; |
|
63 #endif |
58 |
64 |
59 TInt CheckWildCard(TInt aVal, TInt aReplace) |
65 TInt CheckWildCard(TInt aVal, TInt aReplace) |
60 { |
66 { |
61 return |
67 return |
62 aVal == -1 |
68 aVal == -1 |
109 { |
115 { |
110 std::wstring shortName(curr->iFileName); |
116 std::wstring shortName(curr->iFileName); |
111 |
117 |
112 // Ensure formatting is correct |
118 // Ensure formatting is correct |
113 if ( StringUtils::IsLastCharacter( shortName, KDirectorySeparator[ 0 ] ) || |
119 if ( StringUtils::IsLastCharacter( shortName, KDirectorySeparator[ 0 ] ) || |
|
120 #ifndef __TOOLS2_LINUX__ |
114 StringUtils::IsLastCharacter( shortName, L'/' ) ) |
121 StringUtils::IsLastCharacter( shortName, L'/' ) ) |
|
122 #else |
|
123 StringUtils::IsLastCharacter( shortName, L'\\' ) ) |
|
124 #endif |
115 { |
125 { |
116 shortName.erase(shortName.length()-1,1); |
126 shortName.erase(shortName.length()-1,1); |
117 } |
127 } |
118 |
128 |
119 if ( IsDirectory(shortName) ) |
129 if ( IsDirectory(shortName) ) |
196 result = FILE_ERROR; |
206 result = FILE_ERROR; |
197 } |
207 } |
198 catch (InterpretSisError& e) |
208 catch (InterpretSisError& e) |
199 { |
209 { |
200 LERROR(L"Failed installing " << (curr->iFileName)); |
210 LERROR(L"Failed installing " << (curr->iFileName)); |
201 LERROR(L"\t" << Utf8ToUcs2(e.what())); |
211 LERROR(L"\t" << string2wstring(e.what())); |
202 curr = sisFiles.erase(curr); |
212 curr = sisFiles.erase(curr); |
203 |
213 |
204 if (result == 0) |
214 if (result == 0) |
205 result = e.GetErrorCode(); |
215 result = e.GetErrorCode(); |
206 } |
216 } |
463 } |
473 } |
464 |
474 |
465 if (installType == CSISInfo::EInstAugmentation) |
475 if (installType == CSISInfo::EInstAugmentation) |
466 { |
476 { |
467 // Clean up the installed files from the specified SP package and the SisRegistry Entry |
477 // Clean up the installed files from the specified SP package and the SisRegistry Entry |
468 iRegistry.RemoveEntry(uid, aSis.GetPackageName(), aSis.GetVendorName()); |
478 iRegistry.RemoveEntry(uid, aSis.GetPackageName().c_str(), aSis.GetVendorName().c_str()); |
469 } |
479 } |
470 |
480 |
471 // Regenerate the ROM stub registry entries for eclipsing check later. |
481 // Regenerate the ROM stub registry entries for eclipsing check later. |
472 iRegistry.GenerateStubRegistry(); |
482 iRegistry.GenerateStubRegistry(); |
473 } |
483 } |
729 LINFO(L"Skipping file with empty destination filename"); |
739 LINFO(L"Skipping file with empty destination filename"); |
730 } |
740 } |
731 else |
741 else |
732 { |
742 { |
733 // Unicode characters can not be displayed on DOS prompt |
743 // Unicode characters can not be displayed on DOS prompt |
734 std::string temporary = Ucs2ToUtf8(target); |
744 std::string temporary = wstring2string(target); |
735 std::wstring targetDisplay = Utf8ToUcs2( temporary ); |
745 std::wstring targetDisplay = string2wstring( temporary ); |
736 LINFO(L"Installing file: " << targetDisplay); |
746 LINFO(L"Installing file: " << targetDisplay); |
737 |
747 |
738 std::wstring targetDirectory = localTarget.substr( 0, localTarget.rfind( KDirectorySeparator ) ); |
748 std::wstring targetDirectory = localTarget.substr( 0, localTarget.rfind( KDirectorySeparator ) ); |
739 const unsigned char* buffer = NULL; |
749 const unsigned char* buffer = NULL; |
740 TUint32 len; |
750 TUint32 len; |
781 |
791 |
782 if (aFile->IsExecutable() && !fileNullOption) |
792 if (aFile->IsExecutable() && !fileNullOption) |
783 { |
793 { |
784 // register the hash |
794 // register the hash |
785 std::wstring basename = localTarget.substr( localTarget.rfind( KDirectorySeparator ) + 1 ); |
795 std::wstring basename = localTarget.substr( localTarget.rfind( KDirectorySeparator ) + 1 ); |
786 std::wstring hashdir = iSystemDrivePath + L"\\sys\\hash\\"; |
796 #ifndef __TOOLS2_LINUX__ |
|
797 // Remove the null character at the end and. |
|
798 std::wstring tempStr = iSystemDrivePath.c_str(); |
|
799 std::wstring hashdir = tempStr + L"\\sys\\hash\\"; |
787 std::wstring reghashdir = L"$:\\sys\\hash\\"; |
800 std::wstring reghashdir = L"$:\\sys\\hash\\"; |
|
801 #else |
|
802 std::wstring hashdir = iSystemDrivePath + L"/sys/hash/"; |
|
803 std::wstring reghashdir = L"$:/sys/hash/"; |
|
804 #endif |
788 |
805 |
789 if ( !MakeDir( hashdir ) ) |
806 if ( !MakeDir( hashdir ) ) |
790 { |
807 { |
791 throw InterpretSisError(L"Directory Creation Error - "+hashdir, |
808 throw InterpretSisError(L"Directory Creation Error - "+hashdir, |
792 DIRECTORY_CREATION_ERROR); |
809 DIRECTORY_CREATION_ERROR); |
793 } |
810 } |
794 |
811 |
795 // hash file is always created on the system drive |
812 // hash file is always created on the system drive |
796 reghashdir[0] = iSystemDrive; |
813 reghashdir[0] = iSystemDrive; |
797 |
814 |
798 LINFO(L"\tCreating hash: " << reghashdir << basename); |
815 LINFO(L"\tCreating hash: " << reghashdir << basename.c_str()); |
799 |
|
800 std::wstring hash = hashdir + basename; |
816 std::wstring hash = hashdir + basename; |
801 HANDLE hFile = MakeSISOpenFile(hash.c_str(), GENERIC_WRITE, CREATE_ALWAYS); |
817 HANDLE hFile = MakeSISOpenFile(hash.c_str(), GENERIC_WRITE, CREATE_ALWAYS); |
802 if( INVALID_HANDLE_VALUE == hFile ) |
818 if( INVALID_HANDLE_VALUE == hFile ) |
803 { |
819 { |
804 throw InterpretSisError(L"FileOpenError - " + hashdir + basename, FILE_ERROR); |
820 throw InterpretSisError(L"FileOpenError - " + hashdir + basename, FILE_ERROR); |
868 FindAllAdornedVariants(searchNameWild, KSysBinPath, aAdornedFileNamesFound, driveMap); |
884 FindAllAdornedVariants(searchNameWild, KSysBinPath, aAdornedFileNamesFound, driveMap); |
869 |
885 |
870 // find all adorned variants in the ROM/ROFS logs |
886 // find all adorned variants in the ROM/ROFS logs |
871 if (iParamList.IsFlagSet(CParameterList::EFlagsRomRofsLogFilesSet)) |
887 if (iParamList.IsFlagSet(CParameterList::EFlagsRomRofsLogFilesSet)) |
872 { |
888 { |
|
889 #ifndef __TOOLS2_LINUX__ |
873 std::wstring romSearchNameWild = L"z:\\sys\\bin\\"; |
890 std::wstring romSearchNameWild = L"z:\\sys\\bin\\"; |
|
891 #else |
|
892 std::wstring romSearchNameWild = L"z:/sys/bin/"; |
|
893 #endif |
874 romSearchNameWild.append(searchNameWild); |
894 romSearchNameWild.append(searchNameWild); |
875 iRomManager.FindAllAdornedVariants(romSearchNameWild, aAdornedFileNamesFound); |
895 iRomManager.FindAllAdornedVariants(romSearchNameWild, aAdornedFileNamesFound); |
876 } |
896 } |
877 } |
897 } |
878 |
898 |
981 } |
1001 } |
982 else if (disk == 'z') // case (2) |
1002 else if (disk == 'z') // case (2) |
983 { |
1003 { |
984 // we are eclipsing a ROM file, check if this is authorised: |
1004 // we are eclipsing a ROM file, check if this is authorised: |
985 // see implementation of IsEclipsable() |
1005 // see implementation of IsEclipsable() |
|
1006 #ifndef __TOOLS2_LINUX__ |
986 if (!IsEclipsable(searchNameUnadorned, aSUFlag)) |
1007 if (!IsEclipsable(searchNameUnadorned, aSUFlag)) |
|
1008 #else |
|
1009 if (!IsEclipsable(searchNameUnadorned, aSUFlag, localDir)) |
|
1010 #endif |
987 { |
1011 { |
988 result = false; |
1012 result = false; |
989 break; |
1013 break; |
990 } |
1014 } |
991 } |
1015 } |
996 |
1020 |
997 // now check to see whether the unadorned or the adorned filename found on |
1021 // now check to see whether the unadorned or the adorned filename found on |
998 // this drive should be added to iEclipsableOverwriteFiles. |
1022 // this drive should be added to iEclipsableOverwriteFiles. |
999 if (processEclipsingSuspectsFoundOnThisDrive && unadornedFound) |
1023 if (processEclipsingSuspectsFoundOnThisDrive && unadornedFound) |
1000 { |
1024 { |
1001 iEclipsableOverwriteFiles.push_back(searchNameUnadorned); |
1025 iEclipsableOverwriteFiles.push_back(searchNameUnadorned.c_str()); |
1002 } |
1026 } |
1003 |
1027 |
1004 if (processEclipsingSuspectsFoundOnThisDrive && adornedFound) |
1028 if (processEclipsingSuspectsFoundOnThisDrive && adornedFound) |
1005 { |
1029 { |
1006 nrOfAdornedFilenamesFound = adornedFileNamesFound.size(); |
1030 nrOfAdornedFilenamesFound = adornedFileNamesFound.size(); |
1085 and we have z:\sys\bin\A.dll as an eclipsable file or any z:\sys\bin\A{????????}.dll |
1109 and we have z:\sys\bin\A.dll as an eclipsable file or any z:\sys\bin\A{????????}.dll |
1086 then we are allowed to eclipse. |
1110 then we are allowed to eclipse. |
1087 @param aRomFile fully qualified filename in ROM that is to be checked for eclipising (i.e: z:\sys\bin\some.dll) |
1111 @param aRomFile fully qualified filename in ROM that is to be checked for eclipising (i.e: z:\sys\bin\some.dll) |
1088 @param aSUFlag specifies if the installing SIS file has been signed by a SU certificate |
1112 @param aSUFlag specifies if the installing SIS file has been signed by a SU certificate |
1089 */ |
1113 */ |
|
1114 #ifndef __TOOLS2_LINUX__ |
1090 bool Installer::IsEclipsable(std::wstring& aRomFile, bool aSUFlag) |
1115 bool Installer::IsEclipsable(std::wstring& aRomFile, bool aSUFlag) |
|
1116 #else |
|
1117 bool Installer::IsEclipsable(std::wstring& aRomFile, bool aSUFlag, const std::wstring& aDrivePath) |
|
1118 #endif |
1091 { |
1119 { |
1092 // SA/SP/PU sis + RU flag + signed by SU root cert is allowed |
1120 // SA/SP/PU sis + RU flag + signed by SU root cert is allowed |
1093 if (aSUFlag) |
1121 if (aSUFlag) |
1094 return true; |
1122 return true; |
1095 |
1123 |
1109 isEclipsable = true; |
1137 isEclipsable = true; |
1110 break; |
1138 break; |
1111 } |
1139 } |
1112 else if (goesToSysBin) // case 2 |
1140 else if (goesToSysBin) // case 2 |
1113 { |
1141 { |
|
1142 #ifndef __TOOLS2_LINUX__ |
1114 if (IsAdornedVariationOf(eclipsableRomFile,aRomFile)) |
1143 if (IsAdornedVariationOf(eclipsableRomFile,aRomFile)) |
|
1144 #else |
|
1145 if (IsAdornedVariationOf(eclipsableRomFile,aRomFile,aDrivePath)) |
|
1146 #endif |
1115 { |
1147 { |
1116 isEclipsable = true; |
1148 isEclipsable = true; |
1117 break; |
1149 break; |
1118 } |
1150 } |
1119 } |
1151 } |
1143 if (owningUid == 0) |
1175 if (owningUid == 0) |
1144 { |
1176 { |
1145 // do not display a warning if the installing file is a PA. The user |
1177 // do not display a warning if the installing file is a PA. The user |
1146 // needs to copy the installing files to the installing directory |
1178 // needs to copy the installing files to the installing directory |
1147 // prior to installing the SIS file. |
1179 // prior to installing the SIS file. |
1148 std::string tempTarget = Ucs2ToUtf8(aTarget); |
1180 std::string tempTarget = wstring2string(aTarget); |
1149 std::wstring targetDisplay = Utf8ToUcs2( tempTarget ); |
1181 std::wstring targetDisplay = string2wstring( tempTarget ); |
1150 if (aFile.GetInstallType() == CSISInfo::EInstPreInstalledApp) |
1182 if (aFile.GetInstallType() == CSISInfo::EInstPreInstalledApp) |
1151 { |
1183 { |
1152 LINFO(targetDisplay << L" found for PA installation"); |
1184 LINFO(targetDisplay << L" found for PA installation"); |
1153 } |
1185 } |
1154 else |
1186 else |
1160 { |
1192 { |
1161 // SP can not overwrite a file in the base pkg |
1193 // SP can not overwrite a file in the base pkg |
1162 if (isSp) |
1194 if (isSp) |
1163 { |
1195 { |
1164 std::wostringstream os; |
1196 std::wostringstream os; |
1165 os << aTarget << L" overwrites file from base package 0x" << std::hex << owningUid << L" \"" << owningObj->GetPackageName() << L"\"" << std::endl; |
1197 os << aTarget.c_str() << L" overwrites file from base package 0x" << std::hex << owningUid << L" \"" << owningObj->GetPackageName() << L"\"" << std::endl; |
1166 iProblemFiles.append(os.str()); |
1198 iProblemFiles.append(os.str()); |
1167 iError = ECLIPSING_VIOLATION; |
1199 iError = ECLIPSING_VIOLATION; |
1168 } |
1200 } |
1169 } |
1201 } |
1170 else |
1202 else |
1173 // PU/SA can not overwrite a file belonging to a different base pkg unless it has been signed by |
1205 // PU/SA can not overwrite a file belonging to a different base pkg unless it has been signed by |
1174 // a SU cert |
1206 // a SU cert |
1175 if (isSp || (!aSUFlag && (isPu || isSa))) |
1207 if (isSp || (!aSUFlag && (isPu || isSa))) |
1176 { |
1208 { |
1177 std::wostringstream os; |
1209 std::wostringstream os; |
1178 os << aTarget << L" overwrites file from base package 0x" << std::hex << owningUid << L" \"" << owningObj->GetPackageName() << L"\"" << std::endl; |
1210 os << aTarget.c_str() << L" overwrites file from base package 0x" << std::hex << owningUid << L" \"" << owningObj->GetPackageName() << L"\"" << std::endl; |
1179 iProblemFiles.append(os.str()); |
1211 iProblemFiles.append(os.str()); |
1180 iError = ECLIPSING_VIOLATION; |
1212 iError = ECLIPSING_VIOLATION; |
1181 } |
1213 } |
1182 else |
1214 else |
1183 { |
1215 { |
1184 LWARN(aTarget << L" overwrites file from base package 0x" << std::hex << owningUid << L" \"" << owningObj->GetPackageName() << L"\""); |
1216 LWARN(aTarget.c_str() << L" overwrites file from base package 0x" << std::hex << owningUid << L" \"" << owningObj->GetPackageName() << L"\""); |
1185 } |
1217 } |
1186 } |
1218 } |
1187 } |
1219 } |
1188 |
1220 |
1189 void Installer::WarnEclipseOverWrite(const SisFile& aFile) |
1221 void Installer::WarnEclipseOverWrite(const SisFile& aFile) |
1199 for ( ; curr != end; ++curr) |
1231 for ( ; curr != end; ++curr) |
1200 { |
1232 { |
1201 std::wstring eclipseFile(*curr); |
1233 std::wstring eclipseFile(*curr); |
1202 |
1234 |
1203 TUint32 owningUid = 0; |
1235 TUint32 owningUid = 0; |
1204 const SisRegistryObject* owningObj = iRegistry.OwningPackage(eclipseFile, owningUid); |
1236 const SisRegistryObject* owningObj = iRegistry.OwningPackage(eclipseFile.c_str(), owningUid); |
1205 |
1237 |
1206 // always allow orphaned file overwriting |
1238 // always allow orphaned file overwriting |
1207 if (owningUid == 0) |
1239 if (owningUid == 0) |
1208 { |
1240 { |
1209 LWARN(eclipseFile << L" eclipses orphaned file."); |
1241 LWARN(eclipseFile.c_str() << L" eclipses orphaned file."); |
1210 } |
1242 } |
1211 else |
1243 else |
1212 { |
1244 { |
1213 // SP/PU can not overwrite a file belonging to a different base pkg or |
1245 // SP/PU can not overwrite a file belonging to a different base pkg or |
1214 // SP/PU can not eclipse a base package which is not in the ROM. |
1246 // SP/PU can not eclipse a base package which is not in the ROM. |
1215 std::wostringstream os; |
1247 std::wostringstream os; |
1216 os << eclipseFile << L" eclipses file from package 0x" << std::hex << owningUid << L" \"" << owningObj->GetPackageName() << L"\"" << std::endl; |
1248 os << eclipseFile.c_str() << L" eclipses file from package 0x" << std::hex << owningUid << L" \"" << owningObj->GetPackageName().c_str() << L"\""<< std::endl; |
1217 iProblemFiles.append(os.str()); |
1249 iProblemFiles.append(os.str()); |
1218 iError = ECLIPSING_VIOLATION; |
1250 iError = ECLIPSING_VIOLATION; |
1219 continue; |
1251 continue; |
1220 } |
1252 } |
1221 } |
1253 } |
1233 iError = SUCCESS; |
1265 iError = SUCCESS; |
1234 |
1266 |
1235 Sids sids; |
1267 Sids sids; |
1236 GetSidsFromInstallable(aFiles, sids); |
1268 GetSidsFromInstallable(aFiles, sids); |
1237 |
1269 |
|
1270 #ifndef __TOOLS2_LINUX__ |
1238 const std::wstring privatePath = L":\\private\\"; |
1271 const std::wstring privatePath = L":\\private\\"; |
1239 const std::wstring sysPath = L":\\sys\\"; |
1272 const std::wstring sysPath = L":\\sys\\"; |
1240 const std::wstring sysBinPath = L":\\sys\\bin\\"; |
1273 const std::wstring sysBinPath = L":\\sys\\bin\\"; |
1241 const std::wstring resourcePath = L":\\resource\\"; |
1274 const std::wstring resourcePath = L":\\resource\\"; |
|
1275 #else |
|
1276 const std::wstring privatePath = L":/private/"; |
|
1277 const std::wstring sysPath = L":/sys/"; |
|
1278 const std::wstring sysBinPath = L":/sys/bin/"; |
|
1279 const std::wstring resourcePath = L":/resource/"; |
|
1280 #endif |
1242 const std::wstring exeType = L".exe"; |
1281 const std::wstring exeType = L".exe"; |
1243 |
1282 |
1244 int num_of_files = aFiles.size(); |
1283 int num_of_files = aFiles.size(); |
1245 TUint32 pkgUid = aFile.GetPackageUid(); |
1284 TUint32 pkgUid = aFile.GetPackageUid(); |
1246 TUint32 installType = aFile.GetInstallType(); |
1285 TUint32 installType = aFile.GetInstallType(); |
1263 { |
1302 { |
1264 const InstallableFile* file = aFiles[ ii ]; |
1303 const InstallableFile* file = aFiles[ ii ]; |
1265 const CSISFileDescription* sisDescription = file->FileDescription(); |
1304 const CSISFileDescription* sisDescription = file->FileDescription(); |
1266 |
1305 |
1267 // file to be installed |
1306 // file to be installed |
1268 std::wstring target( file->GetTarget() ); |
1307 std::wstring target( file->GetTarget().c_str() ); |
1269 |
1308 |
1270 if (sisDescription->Operation() == CSISFileDescription::EOpText) |
1309 if (sisDescription->Operation() == CSISFileDescription::EOpText) |
1271 break; |
1310 break; |
1272 if (sisDescription->Operation() == CSISFileDescription::EOpNull) |
1311 if (sisDescription->Operation() == CSISFileDescription::EOpNull) |
1273 { |
1312 { |
1274 // a FN file can not remove a file from \sys or \resource |
1313 // a FN file can not remove a file from \sys or \resource |
1275 if ((target.find(sysPath,0) != std::wstring::npos) || (target.find(resourcePath,0) != std::wstring::npos)) |
1314 if ((target.find(sysPath,0) != std::wstring::npos) || (target.find(resourcePath,0) != std::wstring::npos)) |
1276 { |
1315 { |
1277 // eclipsing problem |
1316 // eclipsing problem |
1278 std::wostringstream os; |
1317 std::wostringstream os; |
1279 os << L"FN file \"" << target << L"\" can not remove a file from \\sys or \\resource" << std::endl; |
1318 os << L"FN file \"" << target.c_str() << L"\" can not remove a file from \\sys or \\resource" << std::endl; |
1280 iProblemFiles.append(os.str()); |
1319 iProblemFiles.append(os.str()); |
1281 iError = DATA_CAGE_VIOLATION; |
1320 iError = DATA_CAGE_VIOLATION; |
1282 continue; |
1321 continue; |
1283 } |
1322 } |
1284 } |
1323 } |
1285 else |
1324 else |
1286 { |
1325 { |
1287 std::wstring realTarget(file->GetLocalTarget()); |
1326 std::wstring realTarget(file->GetLocalTarget().c_str()); |
1288 |
1327 |
1289 std::wstring romTarget(target); |
1328 std::wstring romTarget(target); |
1290 romTarget[0] = KRomDriveLetter; |
1329 romTarget[0] = KRomDriveLetter; |
1291 |
1330 |
1292 // check to see if we are legally allowed to eclipse a ROM file |
1331 // check to see if we are legally allowed to eclipse a ROM file |
1294 { |
1333 { |
1295 if (!ValidEclipse(aFile, target, *file, suFlag)) |
1334 if (!ValidEclipse(aFile, target, *file, suFlag)) |
1296 { |
1335 { |
1297 // eclipsing problem |
1336 // eclipsing problem |
1298 std::wostringstream os; |
1337 std::wostringstream os; |
1299 os << target << L" eclipses file from ROM" << std::endl; |
1338 os << target.c_str() << L" eclipses file from ROM" << std::endl; |
1300 iProblemFiles.append(os.str()); |
1339 iProblemFiles.append(os.str()); |
1301 iError = ECLIPSING_VIOLATION; |
1340 iError = ECLIPSING_VIOLATION; |
1302 continue; |
1341 continue; |
1303 } |
1342 } |
1304 } |
1343 } |
1346 // this package is trying to write to a SID's private directory |
1385 // this package is trying to write to a SID's private directory |
1347 // which does not belong to this package |
1386 // which does not belong to this package |
1348 |
1387 |
1349 const int KUidStringLength = 8; |
1388 const int KUidStringLength = 8; |
1350 std::wstring importPath = privatePath; |
1389 std::wstring importPath = privatePath; |
1351 |
1390 #ifndef __TOOLS2_LINUX__ |
1352 importPath.append( uidStr.str() + L"\\import" ); |
1391 importPath.append( uidStr.str() + L"\\import" ); |
|
1392 #else |
|
1393 importPath.append( uidStr.str() + L"/import" ); |
|
1394 #endif |
1353 |
1395 |
1354 if ((target.find(importPath,0) == std::wstring::npos) && !suFlag) |
1396 if ((target.find(importPath,0) == std::wstring::npos) && !suFlag) |
1355 { |
1397 { |
1356 // only SA with RU + SU and PU with RU + SU flag can override other private directory |
1398 // only SA with RU + SU and PU with RU + SU flag can override other private directory |
1357 std::wostringstream os; |
1399 std::wostringstream os; |
1358 os << target << L" cannot be written to a private directory which " |
1400 os << target.c_str() << L" cannot be written to a private directory which " |
1359 << L"does not belong to any exe in this package" << std::endl; |
1401 << L"does not belong to any exe in this package" << std::endl; |
1360 iProblemFiles.append(os.str()); |
1402 iProblemFiles.append(os.str()); |
1361 iError = DATA_CAGE_VIOLATION; |
1403 iError = DATA_CAGE_VIOLATION; |
1362 continue; |
1404 continue; |
1363 } |
1405 } |
1423 |
1465 |
1424 if (!allowSidEclipse) |
1466 if (!allowSidEclipse) |
1425 { |
1467 { |
1426 std::wostringstream os; |
1468 std::wostringstream os; |
1427 |
1469 |
1428 os << L"The existing file " << owningSidFile << L" already has the SID 0x" << std::hex << sid |
1470 os << L"The existing file " << owningSidFile.c_str() << L" already has the SID 0x" << std::hex << sid |
1429 << std::dec << L", cannot install " << target << std::endl; |
1471 << std::dec << L", cannot install " << target.c_str() << std::endl; |
1430 iProblemFiles.append(os.str()); |
1472 iProblemFiles.append(os.str()); |
1431 iError = DUPLICATE_SID; |
1473 iError = DUPLICATE_SID; |
1432 continue; |
1474 continue; |
1433 } |
1475 } |
1434 } |
1476 } |
1448 sisController->InstallBlock().GetFileList(fileDesList); |
1490 sisController->InstallBlock().GetFileList(fileDesList); |
1449 for(TFileDescListConstIter iter = fileDesList.begin(); iter != fileDesList.end(); ++iter) |
1491 for(TFileDescListConstIter iter = fileDesList.begin(); iter != fileDesList.end(); ++iter) |
1450 { |
1492 { |
1451 const CSISFileDescription* fD = *iter; |
1493 const CSISFileDescription* fD = *iter; |
1452 |
1494 |
1453 std::wstring romStubTarget(fD->Target().GetString()); |
1495 std::wstring romStubTarget(fD->Target().GetString().c_str()); |
1454 |
1496 |
1455 if (StringUtils::WildcardCompare(romStubTarget,romFileWithDuplicateSid)) |
1497 if (StringUtils::WildcardCompare(romStubTarget,romFileWithDuplicateSid)) |
1456 { |
1498 { |
1457 ownedByRomStub = true; |
1499 ownedByRomStub = true; |
1458 break; |
1500 break; |
1469 if (!allowSidEclipse && !ownedByRomStub) |
1511 if (!allowSidEclipse && !ownedByRomStub) |
1470 { |
1512 { |
1471 std::wostringstream os; |
1513 std::wostringstream os; |
1472 |
1514 |
1473 os << L"A ROM file already has the SID 0x" << std::hex << file->Sid() |
1515 os << L"A ROM file already has the SID 0x" << std::hex << file->Sid() |
1474 << std::dec << L", cannot install " << target << std::endl; |
1516 << std::dec << L", cannot install " << target.c_str() << std::endl; |
1475 iProblemFiles.append(os.str()); |
1517 iProblemFiles.append(os.str()); |
1476 iError = DUPLICATE_SID; |
1518 iError = DUPLICATE_SID; |
1477 continue; |
1519 continue; |
1478 } |
1520 } |
1479 } |
1521 } |
1480 } |
1522 } |
1481 else if (realTarget.find(sysBinPath) != std::wstring::npos) |
1523 else if (realTarget.find(sysBinPath) != std::wstring::npos) |
1482 { |
1524 { |
1483 std::wostringstream os; |
1525 std::wostringstream os; |
1484 os << target << L" cannot be installed to a data caged area" << std::endl; |
1526 os << target.c_str() << L" cannot be installed to a data caged area" << std::endl; |
1485 iProblemFiles.append(os.str()); |
1527 iProblemFiles.append(os.str()); |
1486 iError = DATA_CAGE_VIOLATION; |
1528 iError = DATA_CAGE_VIOLATION; |
1487 continue; |
1529 continue; |
1488 } |
1530 } |
1489 } |
1531 } |
1495 iEclipsableOverwriteFiles.clear(); |
1537 iEclipsableOverwriteFiles.clear(); |
1496 iEclipsableRomFiles.clear(); |
1538 iEclipsableRomFiles.clear(); |
1497 |
1539 |
1498 if (!iProblemFiles.empty()) |
1540 if (!iProblemFiles.empty()) |
1499 { |
1541 { |
1500 std::string x; |
1542 std::string x = wstring2string(iProblemFiles); |
1501 throw InvalidSis("", Ucs2ToUtf8(iProblemFiles,x), iError); |
1543 throw InvalidSis("", x, iError); |
1502 } |
1544 } |
1503 } |
1545 } |
1504 |
1546 |
1505 void Installer::SetupExpressionEnvironment(const SisFile& aFile, const SisRegistry& aSisRegistry, RomManager& aRomManager ) |
1547 void Installer::SetupExpressionEnvironment(const SisFile& aFile, const SisRegistry& aSisRegistry, RomManager& aRomManager ) |
1506 { |
1548 { |
1534 |
1576 |
1535 void Installer::CreateStubSisFile(const InstallSISFile& aInstallSISFile, SisFile& aSis) |
1577 void Installer::CreateStubSisFile(const InstallSISFile& aInstallSISFile, SisFile& aSis) |
1536 { |
1578 { |
1537 int targetDrive = aInstallSISFile.iTargetDrive; |
1579 int targetDrive = aInstallSISFile.iTargetDrive; |
1538 std::wstring drivePath = iConfigManager.GetLocalDrivePath(targetDrive); |
1580 std::wstring drivePath = iConfigManager.GetLocalDrivePath(targetDrive); |
1539 |
1581 #ifndef __TOOLS2_LINUX__ |
1540 drivePath.append(L"\\private\\"); |
1582 drivePath.append(L"\\private\\"); |
|
1583 #else |
|
1584 drivePath.append(L"/private/"); |
|
1585 #endif |
1541 |
1586 |
1542 // build SwiDaemon Pathname |
1587 // build SwiDaemon Pathname |
1543 std::wstring ctrl = StringUtils::MakePathFromSID(drivePath, KSwiDaemonUid); |
1588 std::wstring ctrl = StringUtils::MakePathFromSID(drivePath, KSwiDaemonUid); |
1544 |
1589 |
1545 if ( !MakeDir( ctrl ) ) |
1590 if ( !MakeDir( ctrl ) ) |
1549 |
1594 |
1550 std::wstringstream s; |
1595 std::wstringstream s; |
1551 s << std::hex << aSis.GetPackageUid(); |
1596 s << std::hex << aSis.GetPackageUid(); |
1552 |
1597 |
1553 ctrl.append(s.str()); |
1598 ctrl.append(s.str()); |
1554 |
|
1555 |
1599 |
1556 switch(aSis.GetInstallType()) |
1600 switch(aSis.GetInstallType()) |
1557 { |
1601 { |
1558 case CSISInfo::EInstInstallation: |
1602 case CSISInfo::EInstInstallation: |
1559 case CSISInfo::EInstPreInstalledApp: |
1603 case CSISInfo::EInstPreInstalledApp: |