PE: fix SizeOfHeaders value of Optional Header field

This commit is contained in:
bitraid
2021-03-25 21:41:49 +02:00
committed by Markus F.X.J. Oberhumer
parent 78f48d65d5
commit 1518e5bc98
4 changed files with 3 additions and 12 deletions
+1 -2
View File
@@ -278,8 +278,7 @@ void PackW32Pe::setOhDataBase(const pe_section_t *osection)
void PackW32Pe::setOhHeaderSize(const pe_section_t *osection) void PackW32Pe::setOhHeaderSize(const pe_section_t *osection)
{ {
(void)osection; oh.headersize = ALIGN_UP(pe_offset + sizeof(oh) + sizeof(osection) * oh.objects, oh.filealign);
oh.headersize = rvamin; // FIXME
} }
void PackW32Pe::pack(OutputFile *fo) void PackW32Pe::pack(OutputFile *fo)
-6
View File
@@ -266,12 +266,6 @@ void PackW64Pep::defineSymbols(unsigned ncsection, unsigned upxsection,
linker->defineSymbol("START", upxsection); linker->defineSymbol("START", upxsection);
} }
void PackW64Pep::setOhHeaderSize(const pe_section_t *osection)
{
(void)osection;
oh.headersize = rvamin; // FIXME
}
void PackW64Pep::pack(OutputFile *fo) void PackW64Pep::pack(OutputFile *fo)
{ {
// FIXME: Relocation stripping disabled for now - Stefan Widmann // FIXME: Relocation stripping disabled for now - Stefan Widmann
+1 -1
View File
@@ -51,7 +51,7 @@ public:
unsigned sizeof_oh, unsigned isize_isplit, unsigned sizeof_oh, unsigned isize_isplit,
unsigned s1addr); unsigned s1addr);
virtual void setOhDataBase(const pe_section_t *) {} virtual void setOhDataBase(const pe_section_t *) {}
virtual void setOhHeaderSize(const pe_section_t *osection); virtual void setOhHeaderSize(const pe_section_t *) {}
virtual void pack(OutputFile *fo); virtual void pack(OutputFile *fo);
virtual bool canPack(); virtual bool canPack();
+1 -3
View File
@@ -2997,9 +2997,7 @@ void PeFile::unpack0(OutputFile *fo, const ht &ih, ht &oh,
ODADDR(PEDIR_BOUNDIM) = 0; ODADDR(PEDIR_BOUNDIM) = 0;
ODSIZE(PEDIR_BOUNDIM) = 0; ODSIZE(PEDIR_BOUNDIM) = 0;
// oh.headersize = osection[0].rawdataptr; setOhHeaderSize(osection);
// oh.headersize = ALIGN_UP(pe_offset + sizeof(oh) + sizeof(pe_section_t) * objs, oh.filealign);
oh.headersize = rvamin;
oh.chksum = 0; oh.chksum = 0;
// write decompressed file // write decompressed file