- NSIS Discussion
- Unable to Add Windows 8 to Manifest
Archive: Unable to Add Windows 8 to Manifest
greenaj
1st December 2012 00:40 UTC
Unable to Add Windows 8 to Manifest
Hello, I am hoping to add Windows 8 to the supportedOs values in the application manifest. I have heard that !packhdr can be used to do this.
From !packhdr I call mt.exe to set the manifest using my custom manfiest. It seems that makensis again calls MT.exe to reset the manifest.
I would like to add clear steps on how to do this in my blog. If anyone could provide help with this, it would be greatly appreciated. All of the posting on this mention !packhdr and resource hacker, but there are no clear stops. I think that the Microsoft manifest tool, mt.exe might be able to be used instead.
Thanks,
greenaj
Anders
1st December 2012 07:14 UTC
makensis does not use mt.exe
greenaj
1st December 2012 17:19 UTC
OK, but makensis seems that it will overwrite any manifest that you add to the generated NSIS installer issuing a call to Resource Hacker or mt.exe from of !packhdr. I am trying to determine if that the only way top fix this would be to rebuild NSIS from source and fix makensis.exe. If there is another way, I would please like to know so that my client does not fell their build depends on a tweaked version of NSIS.
Thanks
aerDNA
1st December 2012 19:10 UTC
makensis seems that it will overwrite any manifest that you add to the generated NSIS installer issuing a call to Resource Hacker or mt.exe from of !packhdr
You must be doing something wrong as I've successfully changed the manifest before.
!packhdr "$%TEMP%\exehead.tmp" '"%ProgramFiles%\Resource Hacker\ResHacker.exe" -addoverwrite "%TEMP%\exehead.tmp", "%TEMP%\exehead.tmp", "Custom.manifest", 24,1,1033'
Anders
1st December 2012 19:27 UTC
Works fine for me:
!define ResHacker "c:\ResHacker\ResHacker.exe"
!tempfile tmpmanifest
!tempfile tmpexe
!appendfile "${tmpmanifest}" '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>...snipped...<supportedOS Id="whateveryouwant"/></application></compatibility></assembly>'
!packhdr "${tmpexe}" '"${ResHacker}" -addoverwrite "${tmpexe}", "${tmpexe}", "${tmpmanifest}", 24, 1, '
!delfile "${tmpexe}"
Other options:
- ResHack the stubs in NSIS\Stubs
- Compile from SVN, it supports Win8 and any other GUID you want
aerDNA
2nd December 2012 13:50 UTC
@greenaj: keep in mind that when using a custom manifest, RequestExecutionLevel attribute in the script will have no consequence, you need to account for that in your manifest. Attached is the standard NSIS manifest with Win8 support added and corresponding level attributes.
Usage example:
OutFile "NSIS_installer_with_Win8_support.exe"
Caption "NSIS installer with Win8 support"
!define ResHacker "%ProgramFiles%\Resource Hacker\ResHacker.exe"
!define ManifDir "${NSISDIR}\Contrib\Manifests"
!define Manifest NSIS_2.46_Win8
!define RequestExecutionLevel User
Function .onInit
MessageBox MB_OK|MB_ICONINFORMATION "What the caption says."
Abort
FunctionEnd
Section Blank
SectionEnd
!ifdef ResHacker & ManifDir & Manifest & RequestExecutionLevel
!packhdr "$%TEMP%\exehead.tmp" '"${Reshacker}" -addoverwrite "%TEMP%\exehead.tmp", "%TEMP%\exehead.tmp", "${ManifDir}\${Manifest}_${RequestExecutionLevel}.manifest", 24,1,1033'
!endif
greenaj
3rd December 2012 05:09 UTC
Thanks a lot. I figured out where I was going wrong and got things to work. I was trying to use !packhdr to update the resultant binary in the output directory, which of course has not bee created yet. So, I did this:
!packhdr "$%TEMP%\Setup.exe" 'header.cmd'
In header.cmd, I have:
mt.exe -manifest WinCompat.manifest -outputresource:%TEMP%\Setup.exe;1
Instead of Reshacker, I got mt.exe to work. I just put the whole manifest in WinCompat.manifest. Now, I guest if you want, you could use a partial manifest instead, keeping the
RequestExecutionLevel admin
instruction at the top of the NSIS script. Then you let makensis write out the Windows Common Controls dependency and the requestExecutionLevel stuff. Then I guess I'd use
mt.exe -manifest WinCompat.manifest -updateresource:%TEMP%\Setup.exe;1
where mt.exe will merge the results into the existing manifest. It seems that mt.exe is an alternative to ResHacker if you don't have ResHacker and want to just use what ships with the MS SDK and Visual Studio. Thanks a lot.
greenaj
5th December 2012 04:54 UTC
I added some more details in my blog at http://www.level533.com/2012/12/add-...sis-installer/