Merge pull request #5130 from B3n30/warn_if_cia_contend_is_encrypted
Show an error if CIA contend is encrypted
This commit is contained in:
commit
026a63bcf7
5 changed files with 77 additions and 5 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <cryptopp/aes.h>
|
||||
#include <cryptopp/modes.h>
|
||||
#include <fmt/format.h>
|
||||
#include "common/common_paths.h"
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/string_util.h"
|
||||
|
@ -373,6 +374,37 @@ InstallStatus InstallCIA(const std::string& path,
|
|||
installFile.Close();
|
||||
|
||||
LOG_INFO(Service_AM, "Installed {} successfully.", path);
|
||||
|
||||
const FileUtil::DirectoryEntryCallable callback =
|
||||
[&callback](u64* num_entries_out, const std::string& directory,
|
||||
const std::string& virtual_name) -> bool {
|
||||
const std::string physical_name = directory + DIR_SEP + virtual_name;
|
||||
const bool is_dir = FileUtil::IsDirectory(physical_name);
|
||||
if (!is_dir) {
|
||||
std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
|
||||
if (!loader) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool executable = false;
|
||||
const auto res = loader->IsExecutable(executable);
|
||||
if (res == Loader::ResultStatus::ErrorEncrypted) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return FileUtil::ForeachDirectoryEntry(nullptr, physical_name, callback);
|
||||
}
|
||||
};
|
||||
if (!FileUtil::ForeachDirectoryEntry(
|
||||
nullptr,
|
||||
GetTitlePath(
|
||||
Service::AM::GetTitleMediaType(container.GetTitleMetadata().GetTitleID()),
|
||||
container.GetTitleMetadata().GetTitleID()),
|
||||
callback)) {
|
||||
LOG_ERROR(Service_AM, "CIA {} contained encrypted files.", path);
|
||||
return InstallStatus::ErrorEncrypted;
|
||||
}
|
||||
return InstallStatus::Success;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue