mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Added some debug print statements.
committer: mfx <mfx> 975558043 +0000
This commit is contained in:
parent
8ea765516c
commit
f26380b110
|
@ -123,6 +123,11 @@ void PackCom::patchLoader(OutputFile *fo,
|
||||||
fo->write(loader,e_len); // entry
|
fo->write(loader,e_len); // entry
|
||||||
fo->write(obuf,ph.c_len);
|
fo->write(obuf,ph.c_len);
|
||||||
fo->write(loader+e_len,d_len); // decompressor
|
fo->write(loader+e_len,d_len); // decompressor
|
||||||
|
#if 0
|
||||||
|
printf("%-13s: entry : %8ld bytes\n", getName(), (long) e_len);
|
||||||
|
printf("%-13s: compressed : %8ld bytes\n", getName(), (long) ph.c_len);
|
||||||
|
printf("%-13s: decompressor : %8ld bytes\n", getName(), (long) d_len);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -356,6 +356,11 @@ void PackDjgpp2::pack(OutputFile *fo)
|
||||||
fo->write(&coff_hdr,sizeof(coff_hdr));
|
fo->write(&coff_hdr,sizeof(coff_hdr));
|
||||||
fo->write(loader,lsize);
|
fo->write(loader,lsize);
|
||||||
fo->write(obuf,data->size);
|
fo->write(obuf,data->size);
|
||||||
|
#if 0
|
||||||
|
printf("%-13s: coff hdr : %8ld bytes\n", getName(), (long) sizeof(coff_hdr));
|
||||||
|
printf("%-13s: loader : %8ld bytes\n", getName(), (long) lsize);
|
||||||
|
printf("%-13s: compressed : %8ld bytes\n", getName(), (long) data->size);
|
||||||
|
#endif
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
verifyOverlappingDecompression(&obuf, overlapoh);
|
verifyOverlappingDecompression(&obuf, overlapoh);
|
||||||
|
|
|
@ -509,6 +509,13 @@ void PackExe::pack(OutputFile *fo)
|
||||||
fo->write(obuf,packedsize);
|
fo->write(obuf,packedsize);
|
||||||
fo->write(loader+e_len,d_len); // decompressor
|
fo->write(loader+e_len,d_len); // decompressor
|
||||||
fo->write(extra_info,eisize);
|
fo->write(extra_info,eisize);
|
||||||
|
#if 0
|
||||||
|
printf("%-13s: program hdr : %8ld bytes\n", getName(), (long) sizeof(oh));
|
||||||
|
printf("%-13s: entry : %8ld bytes\n", getName(), (long) e_len);
|
||||||
|
printf("%-13s: compressed : %8ld bytes\n", getName(), (long) packedsize);
|
||||||
|
printf("%-13s: decompressor : %8ld bytes\n", getName(), (long) d_len);
|
||||||
|
printf("%-13s: extra info : %8ld bytes\n", getName(), (long) eisize);
|
||||||
|
#endif
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
verifyOverlappingDecompression(&obuf, overlapoh);
|
verifyOverlappingDecompression(&obuf, overlapoh);
|
||||||
|
|
|
@ -1638,7 +1638,7 @@ void PackW32Pe::pack(OutputFile *fo)
|
||||||
obuf.allocForCompression(ph.u_len);
|
obuf.allocForCompression(ph.u_len);
|
||||||
ph.u_len -= rvamin;
|
ph.u_len -= rvamin;
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
// filter
|
// filter
|
||||||
Filter ft(opt->level);
|
Filter ft(opt->level);
|
||||||
if (allow_filter)
|
if (allow_filter)
|
||||||
|
@ -1656,6 +1656,7 @@ void PackW32Pe::pack(OutputFile *fo)
|
||||||
buildLoader(&ft);
|
buildLoader(&ft);
|
||||||
#else
|
#else
|
||||||
// new version using compressWithFilters()
|
// new version using compressWithFilters()
|
||||||
|
// FIXME - this does not work yet !!!
|
||||||
|
|
||||||
// prepare packheader
|
// prepare packheader
|
||||||
ph.filter = 0;
|
ph.filter = 0;
|
||||||
|
@ -1714,6 +1715,10 @@ void PackW32Pe::pack(OutputFile *fo)
|
||||||
ic = identsize - identsplit;
|
ic = identsize - identsplit;
|
||||||
|
|
||||||
const unsigned clen = ((ph.c_len + ic) & 15) == 0 ? ph.c_len : ph.c_len + 16 - ((ph.c_len + ic) & 15);
|
const unsigned clen = ((ph.c_len + ic) & 15) == 0 ? ph.c_len : ph.c_len + 16 - ((ph.c_len + ic) & 15);
|
||||||
|
|
||||||
|
// FIXME: Laszlo: what about this memset ?
|
||||||
|
//memset(obuf + ph.c_len, 0, clen - ph.c_len);
|
||||||
|
|
||||||
const unsigned s1size = ALIGN_UP(ic + clen + codesize,4) + sotls;
|
const unsigned s1size = ALIGN_UP(ic + clen + codesize,4) + sotls;
|
||||||
const unsigned s1addr = (newvsize - (ic + clen) + oam1) &~ oam1;
|
const unsigned s1addr = (newvsize - (ic + clen) + oam1) &~ oam1;
|
||||||
|
|
||||||
|
@ -1722,9 +1727,9 @@ void PackW32Pe::pack(OutputFile *fo)
|
||||||
const unsigned myimport = ncsection + soresources - rvamin;
|
const unsigned myimport = ncsection + soresources - rvamin;
|
||||||
|
|
||||||
// patch loader
|
// patch loader
|
||||||
unsigned jmp_pos;
|
|
||||||
if (ih.entry)
|
if (ih.entry)
|
||||||
{
|
{
|
||||||
|
unsigned jmp_pos;
|
||||||
jmp_pos = ptr_diff(find_le32(loader,codesize + 4,get_le32("JMPO")),loader);
|
jmp_pos = ptr_diff(find_le32(loader,codesize + 4,get_le32("JMPO")),loader);
|
||||||
patch_le32(loader,codesize + 4,"JMPO",ih.entry - upxsection - jmp_pos - 4);
|
patch_le32(loader,codesize + 4,"JMPO",ih.entry - upxsection - jmp_pos - 4);
|
||||||
}
|
}
|
||||||
|
@ -1911,6 +1916,19 @@ void PackW32Pe::pack(OutputFile *fo)
|
||||||
if ((ic = fo->getBytesWritten() & (oh.filealign-1)) != 0)
|
if ((ic = fo->getBytesWritten() & (oh.filealign-1)) != 0)
|
||||||
fo->write(ibuf,oh.filealign - ic);
|
fo->write(ibuf,oh.filealign - ic);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
printf("%-13s: program hdr : %8ld bytes\n", getName(), (long) sizeof(oh));
|
||||||
|
printf("%-13s: sections : %8ld bytes\n", getName(), (long) sizeof(osection));
|
||||||
|
printf("%-13s: ident : %8ld bytes\n", getName(), (long) identsize);
|
||||||
|
printf("%-13s: compressed : %8ld bytes\n", getName(), (long) clen);
|
||||||
|
printf("%-13s: decompressor : %8ld bytes\n", getName(), (long) codesize);
|
||||||
|
printf("%-13s: tls : %8ld bytes\n", getName(), (long) sotls);
|
||||||
|
printf("%-13s: resources : %8ld bytes\n", getName(), (long) soresources);
|
||||||
|
printf("%-13s: imports : %8ld bytes\n", getName(), (long) soimpdlls);
|
||||||
|
printf("%-13s: exports : %8ld bytes\n", getName(), (long) soexport);
|
||||||
|
printf("%-13s: relocs : %8ld bytes\n", getName(), (long) soxrelocs);
|
||||||
|
#endif
|
||||||
|
|
||||||
// copy the overlay
|
// copy the overlay
|
||||||
copyOverlay(fo, overlay, &obuf);
|
copyOverlay(fo, overlay, &obuf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user