PETrim broking InnoSetup files

Started by jgutierrez, December 31, 2012, 01:21:21 PM

Previous topic - Next topic

jgutierrez

PETrim is broking InnoSetup files. Looking for additional switches to preserve overlay information, I have found no clue.
Any hints? Is it a bug on PETrim?

Jeremy Collake

PECompact can handle overlays with its new overlay emulation (in the beta). Try using it with overlay emulation turned on, if that is an option.

The problem is that even if if PETrim puts the overlay back, it ends up at a different physical offset. A small minority of installer/SFX archive decompression stubs dynamically calculate the offset for the overlay at runtime, and they work fine. Unfortunately, the MAJORITY of these stubs use a stupid hard-coded physical offset. Well, after the size of the base PE has been reduced, the overlay is clearly at a different offset.

This hard coded offset problem is what PECompact's overlay emulation addresses.

For the few installers and SFX archives that are available.

I can add a new option to PETrim so that it can preserve the overlay. Whether it then works for Innosetup files, I don't know. There isn't much revenue (well, none) coming in from the freeware PE Suite tools, but this won't take long to amend. If you want to 'sponser' the work, then send $50 and you're more likely to get my attention faster ;p. (sorry, I have bills :o). Otherwise, I have maintenance coming up and will try to slap this on in.

Another option is to find the Innosetup SFX/stub that is used by Innosetup when creating an installer and run PETrim on it. Soimetimes it is sitting around as a stand-alone file, other times it is in the resources. Depending on how InnoSetup works, this may or may not work correctly afterwards.
Software Engineer. Bitsum LLC.

suni93

 Unfortunately, the MAJORITY of these stubs use a stupid hard-coded physical offset. Well, after the size of the base PE has been reduced, the overlay is clearly at a different offset.
Check out the latest [url=http://www.testking.org/501-01.htm]Testking 501-01[/url] exam questions and answers written by our [url=http://www.the-bac.edu/]Boston Architectural College[/url]
dumps certified team to help you pass [url=http://www.arm.com/]ARM[/url]
exam in first try.

Morgulus

It's not really a bug in PETrim, more a limitation of how it works. Inno Setup stores its data after the executable (the overlay), and its stub looks for that data at a hard-coded offset. As soon as PETrim shrinks the PE, the overlay shifts and the installer can no longer find it. There was no switch to preserve it: the author offered to add one, with no guarantee it would work for Inno Setup, and the thread (2012) doesn't say whether he ever did.

My advice: don't run PETrim on an already-compiled installer. To make it smaller, compress directly in the Inno Setup script (solid LZMA2), or compress the executable before embedding it.