Skip to content

Commit

Permalink
MzHeader and PeHeader classes in PELIB were replaced by ImageLoader c…
Browse files Browse the repository at this point in the history
…lass (avast#812)

* ImageLoader: Import Directory 1

* ImageLoader: Import & IAT

* Image Loader: IAT

* ImageLoader: Debug Directory

* ImageLoader: TLS Directory

* ImageLoader: Resources

* ImageLoader : Relocations + COM directory

* ImageLoader: Regression Tests 1

* ImageLoader: Last regression test remaining to solve

* ImageLoader: Finalizing

* ImageLoader: Regression tests passed

* ImageLoader: Tests OK

* ImageLoader: Complete

* Linux build: Removed _cdecl

* Linux Build: reference solved

* Linux Build

* Commiting all changes to cloud

* Solved the mystery of image header mapping under Windows XP

* Unpackers: UPX (progress)

* Unpackers: Progress

* Unpacker: UPX complete

* Unpacker: MPRESS complete

* Make linux-doxygen build happy

* Fixing Mac build

* Fixing doxygen build

* Fixing Mac build

* Cleaning up

* Cleaning up

* Fixing doxugen build regression

* cosmetic

* Fixing build

* Final version ImageLoader also testes on Windows Vista and Windows 8/8.1

* Post-apocalypse fix after OpenSSL has been removed

* Changes requested in review

Co-authored-by: Ladislav Zezula <ladislav.zezula@avast.com>
  • Loading branch information
ladislav-zezula and Ladislav Zezula authored Jul 21, 2020
1 parent 36d0e65 commit 60ea783
Show file tree
Hide file tree
Showing 76 changed files with 6,840 additions and 10,436 deletions.
14 changes: 5 additions & 9 deletions include/retdec/fileformat/file_format/pe/pe_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#define RETDEC_FILEFORMAT_FILE_FORMAT_PE_PE_FORMAT_H

#include "retdec/fileformat/file_format/file_format.h"
#include "retdec/fileformat/file_format/pe/pe_format_parser/pe_format_parser.h"
#include "retdec/fileformat/file_format/pe/pe_format_parser.h"
#include "retdec/fileformat/types/dotnet_headers/blob_stream.h"
#include "retdec/fileformat/types/dotnet_headers/guid_stream.h"
#include "retdec/fileformat/types/dotnet_headers/metadata_stream.h"
#include "retdec/fileformat/types/dotnet_headers/string_stream.h"
#include "retdec/fileformat/types/dotnet_headers/user_string_stream.h"
#include "retdec/fileformat/types/dotnet_types/dotnet_class.h"
#include "retdec/fileformat/types/visual_basic/visual_basic_info.h"
#include "retdec/pelib/PeLib.h"
#include "retdec/pelib/PeFile.h"

// Forward declare OpenSSL structures used in this header.
typedef struct pkcs7_st PKCS7;
Expand All @@ -32,7 +32,6 @@ class PeFormat : public FileFormat
{
private:
PeFormatParser *formatParser; ///< parser of PE file
PeLib::MzHeader mzHeader; ///< MZ header
std::unique_ptr<CLRHeader> clrHeader; ///< .NET CLR header
std::unique_ptr<MetadataHeader> metadataHeader; ///< .NET metadata header
std::unique_ptr<MetadataStream> metadataStream; ///< .NET metadata stream
Expand Down Expand Up @@ -123,9 +122,7 @@ class PeFormat : public FileFormat
void scanForOptHeaderAnomalies();
/// @}
protected:
PeLib::PeFile *file; ///< PeLib representation of PE file
PeLib::PeHeaderT<32> *peHeader32; ///< header of 32-bit PE file
PeLib::PeHeaderT<64> *peHeader64; ///< header of 64-bit PE file
PeLib::PeFileT *file; ///< PeLib representation of PE file
public:
PeFormat(const std::string & pathToFile, const std::string & dllListFile, LoadFlags loadFlags = LoadFlags::NONE);
PeFormat(std::istream &inputStream, LoadFlags loadFlags = LoadFlags::NONE);
Expand Down Expand Up @@ -162,10 +159,11 @@ class PeFormat : public FileFormat

/// @name Detection methods
/// @{
const PeLib::MzHeader & getMzHeader() const;
const PeLib::ImageLoader & getImageLoader() const;
std::size_t getMzHeaderSize() const;
std::size_t getOptionalHeaderSize() const;
std::size_t getPeHeaderOffset() const;
std::size_t getImageBitability() const;
std::size_t getCoffSymbolTableOffset() const;
std::size_t getNumberOfCoffSymbols() const;
std::size_t getSizeOfStringTable() const;
Expand All @@ -191,8 +189,6 @@ class PeFormat : public FileFormat
bool dllListFailedToLoad() const;
bool initDllList(const std::string & dllListFile);

PeLib::PeFile32* isPe32() const;
PeLib::PeFile64* isPe64() const;
bool isDotNet() const;
bool isPackedDotNet() const;
bool isVisualBasic(unsigned long long &version) const;
Expand Down
Loading

0 comments on commit 60ea783

Please sign in to comment.