From f3e710394ade50508c4f16c79c1826d2e59cf34a Mon Sep 17 00:00:00 2001 From: Kornel Pal Date: Thu, 16 Dec 2021 06:57:39 +0100 Subject: [PATCH] PE: Set header size on 64-bit too --- src/p_w64pep.cpp | 5 +++++ src/p_w64pep.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/p_w64pep.cpp b/src/p_w64pep.cpp index 3a8adb4e..5ef28833 100644 --- a/src/p_w64pep.cpp +++ b/src/p_w64pep.cpp @@ -266,6 +266,11 @@ void PackW64Pep::defineSymbols(unsigned ncsection, unsigned upxsection, linker->defineSymbol("START", upxsection); } +void PackW64Pep::setOhHeaderSize(const pe_section_t *osection) +{ + oh.headersize = ALIGN_UP(pe_offset + sizeof(oh) + sizeof(*osection) * oh.objects, oh.filealign); +} + void PackW64Pep::pack(OutputFile *fo) { super::pack0(fo diff --git a/src/p_w64pep.h b/src/p_w64pep.h index cf1b409b..aac38156 100644 --- a/src/p_w64pep.h +++ b/src/p_w64pep.h @@ -51,7 +51,7 @@ public: unsigned sizeof_oh, unsigned isize_isplit, unsigned s1addr); virtual void setOhDataBase(const pe_section_t *) {} - virtual void setOhHeaderSize(const pe_section_t *) {} + virtual void setOhHeaderSize(const pe_section_t *osection); virtual void pack(OutputFile *fo); virtual bool canPack();