Archive: how to use upx to compress exe first before make installer


how to use upx to compress exe first before make installer
for example
I have a a.exe in disk c.
I wrote ExecWait("c:\upx -9 c:\a.exe") in a Section named a at the beginning of the script file, it is no use.
If I wrote same line in Section "Copy Files", it will excute when I run the installer and it is not what i want.


But what do you want exactly?

You can use UPX to compress the Header of the Installer by using the following command at the beginning of the script

!packhdr "temp.dat" "C:\Programme\NSIS\upx.exe --best temp.dat"

But if you want to compress a file that you want to include in the installer you have to do it either before you built the installer or you call UPX after file was installed.


but i don't think so

Originally posted by flizebogen
But what do you want exactly?


But if you want to compress a file that you want to include in the installer you have to do it either before you built the installer or you call UPX after file was installed.
YES1
Function .onInit
SetOutPath $TEMP
File /oname=spltmp.bmp "sarp.bmp"

File /oname=spltmp.exe "C:\program files\nsis\splash.exe"
ExecWait '"$TEMP\spltmp.exe" 1000 $HWNDPARENT $TEMP\spltmp'
Delete $TEMP\spltmp.exe
Delete $TEMP\spltmp.bmp
; Delete $TEMP\spltmp.wav
FunctionEnd

i dont fully understand if it is a question or not but if it were this would be the answer :)

!packhdr temp.exe "upx\upx --best temp.exe"

this will compress the header of the installer, hope that helps


Originally posted by Kreft
i dont fully understand if it is a question or not but if it were this would be the answer :)

!packhdr temp.exe "upx\upx --best temp.exe"

this will compress the header of the installer, hope that helps
Sorry For My Poor English.
What I need is to run a command to upx my own exe file first.
then create the installer.
eg.
My App includes
a.exe 1000K bytes
a.txt 1000k bytes
My Installer
Myapp.exe
I want the srcipt
do following steps
1. upx a.exe 1000K->400K
2. nsis compress a.exe(400K)->(390K)
+a.txt(1000k)->(200K)
3. nsis add header(40k)+some info(2k)+390K+200K
to Myapp.exe (632K)

i would check with your upx documentaion on how to compress your app then do so thru an execwait in your script and then use the code i gave you above to pack the nsis header


Hi!

What you need is a simple batch file that you run when you want to compile your installer.

Something like:

upx myapp.exe
upx mytext.txt
makensis myinstall.nsi


KiCHiK

Hi hotice,

  !System '[path to UPX]\UPX --best [path to MyProg]\MyProg.exe'
Stick this line of code at the start of your script for any files that need compressing. These files will then be compressed before they are packed into the installer.

Hope this helps!

This thread has not been replied to for over three and a half years :). I now use upx to compress the header of my installers. I added !packhdr to the nsisconf.nsh file so all installers are now packed by upx. The overhead usually goes down to 30KB from 47KB (these are approximate).