Using !packhdr: Difference between revisions
(Created page with '{{PageAuthor|Afrow UK}} == !packhdr == !packhdr is a useful compile time directive which allows modifications to the built installer executable header before it is written to th…') |
m (→Usage) |
||
Line 30: | Line 30: | ||
Simply place the following at the top of your NSIS scripts: | Simply place the following at the top of your NSIS scripts: | ||
<highlight-nsis> | <highlight-nsis> | ||
!packhdr $%TEMP%\exehead.tmp `"${NSISDIR}\ | !packhdr $%TEMP%\exehead.tmp `"${NSISDIR}\Packhdr\upx.bat" "$%TEMP%\exehead.tmp"` | ||
</highlight-nsis> | </highlight-nsis> | ||
You can substitute ''upx.bat'' with ''upx+noicon.bat'' depending on your requirement for the particular installer. I use ''upx+noicon.bat'' for utility executables that are written in NSIS but do not serve a purpose as an installation wizard (i.e. ''SilentInstall silent''). | You can substitute ''upx.bat'' with ''upx+noicon.bat'' depending on your requirement for the particular installer. I use ''upx+noicon.bat'' for utility executables that are written in NSIS but do not serve a purpose as an installation wizard (i.e. ''SilentInstall silent''). | ||
[[Category:Tutorials]] | [[Category:Tutorials]] |
Revision as of 14:30, 20 March 2010
Author: Afrow UK (talk, contrib) |
!packhdr
!packhdr is a useful compile time directive which allows modifications to the built installer executable header before it is written to the finished installer executable file. It can be used to pack the executable header using UPX or edit resources using Resource Hacker. I have used !packhdr for many years in conjunction with some useful batch files to:
- Pack the header (UPX)
- Pack the header (UPX) and remove the installer icon (Resource Hacker)
The batch files
Firstly you will need to download UPX and Resource Hacker and copy upx.exe and reshacker.exe to a new NSIS\Packhdr folder. Then place the following batch files in the NSIS\Packhdr folder:
upx.bat
cd /d %~dp0 upx --best %1
upx+noicon.bat
cd /d %~dp0 ResHacker -delete %1, %1, icongroup,103, del ResHacker.log upx --best %1
Usage
Simply place the following at the top of your NSIS scripts:
!packhdr $%TEMP%\exehead.tmp `"${NSISDIR}\Packhdr\upx.bat" "$%TEMP%\exehead.tmp"`
You can substitute upx.bat with upx+noicon.bat depending on your requirement for the particular installer. I use upx+noicon.bat for utility executables that are written in NSIS but do not serve a purpose as an installation wizard (i.e. SilentInstall silent).