Services/AM: Detect encrypted CIAs

This commit is contained in:
shinyquagsire23 2017-11-20 20:45:21 -07:00
parent c0eb233bf1
commit 70ff3c72f1

View file

@ -297,6 +297,14 @@ InstallStatus InstallCIA(const std::string& path,
Service::AM::CIAFile installFile(
Service::AM::GetTitleMediaType(container.GetTitleMetadata().GetTitleID()));
for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
if (container.GetTitleMetadata().GetContentTypeByIndex(i) &
FileSys::TMDContentTypeFlag::Encrypted) {
LOG_ERROR(Service_AM, "File %s is encrypted! Aborting...", path.c_str());
return InstallStatus::ErrorEncrypted;
}
}
FileUtil::IOFile file(path, "rb");
if (!file.IsOpen())
return InstallStatus::ErrorFailedToOpenFile;