From efaafdaf4a18b5f2f4dd743aa3f0e609d428b15a Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Thu, 5 Mar 2015 14:39:17 +0100 Subject: [PATCH] Add binary to saved archive --- src/core/InformationManager.cxx | 15 +++++++++++++++ src/core/InformationManager.hxx | 1 + 2 files changed, 16 insertions(+) diff --git a/src/core/InformationManager.cxx b/src/core/InformationManager.cxx index 1ea4ba0..73ea5ef 100644 --- a/src/core/InformationManager.cxx +++ b/src/core/InformationManager.cxx @@ -21,6 +21,7 @@ InformationManager::~InformationManager() { } void InformationManager::reset(const std::string& filename) { + this->filename = filename; disassembler.reset(createLLVMDisassembler(filename, this)); if (disassembler.get() != NULL) disassembler.get()->start(); @@ -32,6 +33,20 @@ void InformationManager::save(const QString& filename) { zip.setComment("FRIDA 0.0"); QuaZipFile outZipFile(&zip); + { + QFile binary(this->filename.c_str()); + binary.open(QIODevice::ReadOnly); + QuaZipNewInfo zipinfo("binary"); + zipinfo.setPermissions(static_cast(0x6444)); + outZipFile.open(QIODevice::WriteOnly, zipinfo); + QByteArray buffer; + while (!binary.atEnd()) { + buffer = binary.read(4096); + outZipFile.write(buffer); + } + outZipFile.close(); + } + for (auto funpair : functions) { Function* fun = funpair.second; QuaZipNewInfo zipinfo(fun->getName().c_str()); diff --git a/src/core/InformationManager.hxx b/src/core/InformationManager.hxx index 243ca94..2e9358c 100644 --- a/src/core/InformationManager.hxx +++ b/src/core/InformationManager.hxx @@ -91,6 +91,7 @@ private: std::unique_ptr disassembler; std::map functions; std::map blocks; + std::string filename; log4cxx::LoggerPtr logger; }; -- 2.39.2