MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / OpenAll

Method OpenAll

Bcore/src/main/cpp/dex/dex_file_loader.cc:266–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266bool DexFileLoader::OpenAll(
267 const uint8_t* base,
268 size_t size,
269 const std::string& location,
270 bool verify,
271 bool verify_checksum,
272 std::string* error_msg,
273 std::vector<std::unique_ptr<const DexFile>>* dex_files) const {
274 DCHECK(dex_files != nullptr) << "DexFile::Open: out-param is nullptr";
275 uint32_t magic = *reinterpret_cast<const uint32_t*>(base);
276 if (IsZipMagic(magic)) {
277 std::unique_ptr<DexZipArchive> zip_archive(DexZipArchive::Open(base, size, error_msg));
278 if (zip_archive.get() == nullptr) {
279 DCHECK(!error_msg->empty());
280 return false;
281 }
282 return OpenAllDexFilesFromZip(*zip_archive.get(),
283 location,
284 verify,
285 verify_checksum,
286 error_msg,
287 dex_files);
288 }
289 if (IsMagicValid(magic)) {
290 const DexFile::Header* dex_header = reinterpret_cast<const DexFile::Header*>(base);
291 std::unique_ptr<const DexFile> dex_file(Open(base,
292 size,
293 location,
294 dex_header->checksum_,
295 /*oat_dex_file*/ nullptr,
296 verify,
297 verify_checksum,
298 error_msg));
299 if (dex_file.get() != nullptr) {
300 dex_files->push_back(std::move(dex_file));
301 return true;
302 } else {
303 return false;
304 }
305 }
306 *error_msg = StringPrintf("Expected valid zip or dex file");
307 return false;
308}
309
310std::unique_ptr<DexFile> DexFileLoader::OpenCommon(const uint8_t* base,
311 size_t size,

Callers 2

handleDumpByDexFileFunction · 0.80
cookieDumpDexMethod · 0.80

Calls 4

IsZipMagicFunction · 0.85
StringPrintfFunction · 0.85
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected