Archive: Upx & Nsis


Upx & Nsis
Hey!

I was just messing around with UPX 2.03 (http://upx.sourceforge.net/ OR http://en.wikipedia.org/wiki/UPX) and found I can compress almost 20KB out of some of Null soft installers, while I can dump 30kb-190kb out of my own.

Now, I know this is a complex question but:

Am I destroying the content of these installers? (I am making back ups before I UPX them)

Is it only the NSIS scripting language that is getting compressed inside the installers, or has UPX found the actual program that the installer is meant to install, and is compacting it as well?

Examples

nsis-2.24-setup.exe

1480945 bytes to 1467121 bytes (99.07%) = 13824 bytes / 13.5 KB smaller

Original File
http://i19.tinypic.com/402t2pz.png

UPX File
http://i5.tinypic.com/4btncsp.png

Stats

http://i13.tinypic.com/3zq5v29.png

Setup_Prime_TCS.exe

382761948 bytes to 382749148 bytes = 12800 Bytes / 12.5 KB smaller

Script
http://developer.valvesoftware.com/w...Mod_Installers

Before
http://i12.tinypic.com/30cnh1x.png

After
http://i19.tinypic.com/35lbtyh.png

Stats

http://i13.tinypic.com/4hrs4t2.png


UPX compresses the overhead, i.e. the execution code.

-Stu


You can also use UPX on your installer at compile time with the !packhdr command.


Because I normally use HM NSIS, where about would I stick !packhdr - and will that UPX the correct files at compile time, instead of having to run them through the external tool?

I also saw that UPX reserves its self a slice of ram at run time, would this be a hack way to safe guard your self against buffer over runs? Or is it the other way around, and will have a more significant chance of causing them?


You just put it in your script.
Documentation shows this example:

!packhdr "$%TEMP%\exehead.tmp" '"C:\Program Files\UPX\upx.exe" "$%TEMP%\exehead.tmp"'


-Stu