secureswitools/swisistools/source/interpretsislib/sisfile.cpp
branchRCL_3
changeset 73 79647526f98c
parent 66 8b7f4e561641
child 81 42552535c1ac
--- a/secureswitools/swisistools/source/interpretsislib/sisfile.cpp	Tue Sep 14 21:31:28 2010 +0300
+++ b/secureswitools/swisistools/source/interpretsislib/sisfile.cpp	Wed Sep 15 12:20:42 2010 +0300
@@ -116,7 +116,9 @@
 bool SisFile::GetInstallableFiles(InstallableFiles& aFiles, 
 								  ExpressionEvaluator& aEvaluator,
 								  const std::wstring& aDrivePath,
-								  int aInstallingDrive) const
+								  int aInstallingDrive,
+								  const int aSystemDrive,
+								  const bool aGenerateRomStub) const
 {
 	bool success = true;
 	
@@ -141,12 +143,12 @@
 			// aFiles will be filled with only file descriptions of files, empty file data
 			if (NULL != dataUnit && fileDes.Operation() != CSISFileDescription::EOpNull)
 				{
-				aFiles.push_back(new InstallableFile(fileDes, new CSISFileData(dataUnit->FileData(fileDes.FileIndex())), aDrivePath, aInstallingDrive));		
+				aFiles.push_back(new InstallableFile(fileDes, new CSISFileData(dataUnit->FileData(fileDes.FileIndex())), aDrivePath, aInstallingDrive, aSystemDrive, aGenerateRomStub));		
 				}
 			else 
 				{
 				// SIS files will not be present in PA stubs
-				aFiles.push_back( new InstallableFile(fileDes,aDrivePath,aInstallingDrive));		
+				aFiles.push_back( new InstallableFile(fileDes,aDrivePath,aInstallingDrive, aSystemDrive, aGenerateRomStub));		
 				}
 			}
 		}
@@ -154,7 +156,7 @@
 	// process main controller - data unit 0
 	const CSISInstallBlock& installBlock = iContents.Controller().InstallBlock();
 
-	ProcessInstallBlock(installBlock, aFiles, aEvaluator, aDrivePath, aInstallingDrive);
+	ProcessInstallBlock(installBlock, aFiles, aEvaluator, aDrivePath, aInstallingDrive, aSystemDrive, aGenerateRomStub);
 
 	return success;
 }
@@ -230,35 +232,35 @@
 				const CSISFileDescription::TSISInstOption operationOptions = fD.OperationOptions();
 				if(operationOptions & CSISFileDescription::EInstFileRunOptionByMimeType)
 				{
-					LWARN(L"File " << target << L" contains \"Run-Using-MIME\" option that will be ignored.");
+					LWARN(L"File " << target.c_str() << L" contains \"Run-Using-MIME\" option that will be ignored.");
 				}
 				if((operationOptions & CSISFileDescription::EInstFileRunOptionInstall) \
 						&& (operationOptions & CSISFileDescription::EInstFileRunOptionUninstall))
 				{
-					LWARN(L"File " << target << L" contains \"RUN-BOTH\" option that will be ignored.");			
+					LWARN(L"File " << target.c_str() << L" contains \"RUN-BOTH\" option that will be ignored.");			
 				}
 				else if(operationOptions & CSISFileDescription::EInstFileRunOptionInstall)
 				{
-					LWARN(L"File " << target << L" contains \"Run-On-Install\" option that will be ignored.");			
+					LWARN(L"File " << target.c_str() << L" contains \"Run-On-Install\" option that will be ignored.");			
 				}
 				else if(operationOptions & CSISFileDescription::EInstFileRunOptionUninstall)
 				{
-					LWARN(L"File " << target << L" contains \"Run-On-Uninstall\" option that will be ignored.");			
+					LWARN(L"File " << target.c_str() << L" contains \"Run-On-Uninstall\" option that will be ignored.");			
 				}
 				if(operationOptions & CSISFileDescription::EInstFileRunOptionBeforeShutdown)
 				{
-					LWARN(L"File " << target << L" contains \"Run-Before-Shutdown\" option that will be ignored.");			
+					LWARN(L"File " << target.c_str() << L" contains \"Run-Before-Shutdown\" option that will be ignored.");			
 				}
                 if(operationOptions & CSISFileDescription::EInstFileRunOptionAfterInstall)
 				{
-					LWARN(L"File " << target << L" contains \"Run-After-Install\" option that will be ignored.");			
+					LWARN(L"File " << target.c_str() << L" contains \"Run-After-Install\" option that will be ignored.");			
 				}
-				LWARN(L"File " << target << L" contains \"File-Run\" option that will be ignored.");			
+				LWARN(L"File " << target.c_str() << L" contains \"File-Run\" option that will be ignored.");			
 			}
             success = true;
             break;
         case CSISFileDescription::EOpText:
-        	LWARN(L"File " << target << L" contains \"Display Text\" option that will be ignored." );
+        	LWARN(L"File " << target.c_str() << L" contains \"Display Text\" option that will be ignored." );
             success = true;
             break;
         case CSISFileDescription::EOpNull:
@@ -371,7 +373,9 @@
 void SisFile::GetInstallableFiles(	InstallableFiles& aFiles, 
 									const CSISInstallBlock& aInstallBlock, 
 									const std::wstring& aDrivePath,
-									int aInstallingDrive) const
+									int aInstallingDrive,
+									const int aSystemDrive,
+									const bool aGenerateRomStub) const
 	{
 	CSISInfo::TSISInstallationType installType = iContents.Controller().SISInfo().InstallationType();
 	const CSISDataUnit* dataUnit = NULL;
@@ -398,11 +402,11 @@
 		if (NULL != dataUnit && fileDes.Operation() != CSISFileDescription::EOpNull)
 			{
 			const CSISFileData& filedataref = dataUnit->FileData(fileDes.FileIndex());
-			aFiles.push_back(new InstallableFile(fileDes, new CSISFileData(dataUnit->FileData(fileDes.FileIndex())), aDrivePath, aInstallingDrive));
+			aFiles.push_back(new InstallableFile(fileDes, new CSISFileData(dataUnit->FileData(fileDes.FileIndex())), aDrivePath, aInstallingDrive, aSystemDrive, aGenerateRomStub));
 			}
 		else // for stubs, no file data
 			{
-			aFiles.push_back(new InstallableFile(fileDes, aDrivePath, aInstallingDrive));
+			aFiles.push_back(new InstallableFile(fileDes, aDrivePath, aInstallingDrive, aSystemDrive, aGenerateRomStub));
 			}
 		}
 	}
@@ -411,9 +415,11 @@
 								  InstallableFiles& aFiles, 
 								  ExpressionEvaluator& aEvaluator, 
 								  const std::wstring& aDrivePath,
-								  int aInstallingDrive) const
+								  int aInstallingDrive,
+								  const int aSystemDrive,
+								  const bool aGenerateRomStub) const
 	{
-	GetInstallableFiles(aFiles, aInstallBlock, aDrivePath, aInstallingDrive);
+	GetInstallableFiles(aFiles, aInstallBlock, aDrivePath, aInstallingDrive, aSystemDrive,aGenerateRomStub);
 
 	const CSISArray<CSISIf, CSISFieldRoot::ESISIf>& ifs = aInstallBlock.Ifs();
 	for (int i = 0; i < ifs.size(); ++i)
@@ -432,7 +438,7 @@
 		const bool processBlock = expressionResult.BoolValue();
 		if ( processBlock )
 			{
-			ProcessInstallBlock(ifBlock.InstallBlock(), aFiles, aEvaluator, aDrivePath, aInstallingDrive);
+			ProcessInstallBlock(ifBlock.InstallBlock(), aFiles, aEvaluator, aDrivePath, aInstallingDrive, aSystemDrive, aGenerateRomStub);
 			continue;
 			}
 		
@@ -442,11 +448,11 @@
 			const CSISElseIf& ifElseBlock = ifBlock.ElseIf(i) ;
 			if ( aEvaluator.Evaluate(ifElseBlock.Expression()).BoolValue())
 				{
-				ProcessInstallBlock(ifElseBlock.InstallBlock(), aFiles, aEvaluator, aDrivePath, aInstallingDrive);
+				ProcessInstallBlock(ifElseBlock.InstallBlock(), aFiles, aEvaluator, aDrivePath, aInstallingDrive, aSystemDrive, aGenerateRomStub);
 				break;	// Stop processing else if blocks
 				}
 			// Process the rest of the files
-			GetInstallableFiles(aFiles, ifElseBlock.InstallBlock(), aDrivePath, aInstallingDrive);
+			GetInstallableFiles(aFiles, ifElseBlock.InstallBlock(), aDrivePath, aInstallingDrive, aSystemDrive, aGenerateRomStub);
 			}
 		} 
 	}
@@ -501,3 +507,10 @@
 	contents.WriteSIS(aFileName);
 	}
 
+void SisFile::MakeSISRomStub(std::wstring& aFileName)
+	{
+	CSISContents contents = iContents;
+	contents.SetStub(CSISContents::EStubROM);
+	contents.WriteSIS(aFileName);
+	}
+