Skip to content
⌘ NSIS Forum Archive

!packhdr and using reshacker for automatic adding manifest at compile installer exe

13 posts

sfx09#

!packhdr and using reshacker for automatic adding manifest at compile installer exe

Hello!

I need to add my own installer.manifest to result installer exe. Please, explain me, how I need use !packhdr and reshacker for automatic adding manifest at compile NSIS-installer exe. I don't find any info in manual. Adding manifest into exe after compiling manually via reshacker tool - no passing CRC-check on start exe. Thank you and sorry for my English. =)
JasonFriday13#
There is an old thread that might be relevant: https://forums.winamp.com/forum/deve...-8-to-manifest.

There are a couple of manifest related commands you can use in your script (DPI and OS support, if I remember correctly).
sfx09#
JasonFriday13 Thank you! I'll try info from it's post.


Anders​ I would like change its:

1. <assemblyIdentity name
2. <description>
3. <trustInfo xmlns

I would like use a standart manifest, which our team used in the other our programs.
Anders#
For the first two, !packhdr is your only option.

For the last one, there is an undocumented attribute you can use:

RequestExecutionLevel None
ManifestSupportedOS None
XPStyle On
ManifestAppendCustomString "/assembly" '<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"/></requestedPrivileges></security></trustInfo>' 
but as I don't feel like debugging SxS problems, you are on your own if you do this. Do something wrong and the installer will refuse to run or it can bluescreen Windows XP.
sfx09#edited
Thank's for aswer.
But !packhdr not work in my installer. In the end of source file I've added this:

!include Packhdr.nsh
!define ResHacker "C:\Program Files (x86)\Resource Hacker\ResourceHacker.exe"
!tempfile tmpexe
!packhdr "${tmpexe}" '"${ResHacker}" -addoverwrite "${tmpexe}", "${tmpexe}", "${resdir}\Custom.manifest", 24, 1, 1033'
!delfile "${tmpexe}" 
Unpack to NSIS folder packhdr.zip.
In NSIS\Include - Packhdr.nsh is present.
In NSIS\Packhdr with zip-archive files added both ResourceHacker.exe and renamed ResHacker.exe
Upx.exe added too. =)

But on compile - Error: calling packer on "C:\Users\SFX\AppData\Local\Temp\nst8763.tmp"

Maybe, I'm missing some important things?
Anders#
I think the Resource Hacker command line syntax changed at some point or their documentation just sucks.

!define ResHacker "C:\something\something\ResHacker.exe" ; Change this
!define resdir "${__FILE__}\.."
!delfile /nonfatal "${resdir}\Custom.manifest"
!appendfile "${resdir}\Custom.manifest" "<!xml><Hello>I'm a invalid manifest</Hello" ; Silly example
!tempfile tmpexe
!packhdr "${tmpexe}" '"${ResHacker}" -open "${tmpexe}" -save "${tmpexe}" -action addoverwrite -res "${resdir}\Custom.manifest" -mask 24,1'
!delfile "${tmpexe}" 
sfx09#
I think the Resource Hacker command line syntax changed at some point or their documentation just sucks.
Right! Thank you, all work for me, but with .RES - file, not .manifest:
!packhdr "${tmpexe}" '"${ResHacker}" -open "${tmpexe}" -save "${tmpexe}" -action addoverwrite -res "${resdir}\Manifest1.res" -mask MANIFEST' 
Big thanks, Anders and JasonFriday13! 👍
sfx09#
Hello!

Can I read somewhere how window scaling works in NSIS MUI2? Manual or some information.
Maybe there are some possibilities to manage him?

I'm trying to edit the manifest (<dpiAware>, removing entries in <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>) - but this does not yet solve my problems with scaling NSIS in Windows 8.1 (maybe in some other version) in the scaling range from 101 to 125%. The problem is made worse by the fact that I'm using my own GUI plugin. Its visual controls are scaled, but NSIS MUI2 does not scale at the same time in Win8.1 and in the range of 101-125%.

Any information on managing scaling in NSIS would be very helpful.

Thanks.
Anders#
My recommendation is to just don't declare yourself DPI aware and accept that the installer will be blurry on some systems.

Alternatively, if you have no custom pages (nor MUI Welcome,Finish) you can be Per Monitor v2 aware on Win10 1703+

ManifestDPIAware False
ManifestDPIAwareness "PerMonitorV2,Unaware" 
sfx09#
Hello, DPI aware (ManifestDPIAware True) works fine for me, except plugin ToggleInstFiles.
It's possible to fix scaling progress bar and toggle-button? Or I've only one way: I'll be forced to change source and rebuild ToggleInstFiles plugin?
Thanks for the help.


Click image for larger version

Name:	image001.png
Views:	102
Size:	48.5 KB
ID:	4641830
Anders#
Yes you need to change the source. You could perhaps copy the size of the OK button with GetDlgItem+GetWindowRect.
sfx09#
Originally Posted by Anders View Post
Yes you need to change the source. You could perhaps copy the size of the OK button with GetDlgItem+GetWindowRect.
Thank you! I'm applied the scale factor (it's calculated via Cancel button rect) to the progress bar and the toggle button - all works fine!