Honor dos_header_t.e_cparhdr for small header

... and cleanup PackDjgpp2::readFileHeader()
https://github.com/upx/upx/issues/881

	modified:   p_djgpp2.cpp
	modified:   p_djgpp2.h
This commit is contained in:
John Reiser
2025-02-11 10:29:53 -08:00
committed by Markus F.X.J. Oberhumer
parent 8c9e04daaf
commit bd67677389
2 changed files with 21 additions and 15 deletions
+10
View File
@@ -62,6 +62,16 @@ protected:
unsigned coff_offset;
// based on https://dox.ipxe.org/PeImage_8h_source.html
struct alignas(1) dos_header_t {
LE16 e_magic;
LE16 e_cblp; // Bytes on last page of file
LE16 e_cp; // Pages in file
LE16 e_crlc; // Relocations
LE16 e_cparhdr; // Size of header in paragraphs
LE16 e_OMITTED[32 - 5 * 2];
}; // 64 bytes
struct alignas(1) external_scnhdr_t {
byte _[12]; // name, paddr
LE32 vaddr;