Skip to content

Latest commit

 

History

History

nsis

NSIS Notes
Chris Ahlstrom
2021-12-11 to 2023-07-19

This directory contains files that allow Linux and Windows users to create
an NSIS installer for Seq66. The latest version adds application
shortcuts.

The Windows version of Seq66 is a 64-application, and the Linux
"makensis" program creates a 32-bit installer. One can also install
the latest NSIS on Windows, add the path to "makensis.exe" to the PATH
variable, and the build_release_package.bat script will detect and
use the Windows version of NSIS as of Seq66 version 0.99.5.

Here are some notes for creating an installer for a 64-bit version of Seq66.
The process involves modifications to the build-release DOS batch file and
the NSIS files in this directory.

Source:

    https://www.bojankomazec.com/2011/10/nsis-installer-for-64-bit-windows.html
    
    "Here are some tips for creating (32-bit) NSIS installer which installs
    64-bit application on 64-bit Windows."

Since NSIS is currently a 32-bit program, it would redirect installations by
default to "C:\Program Files (x86)" and uses, from the Windows Registry,
only "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node". We have updated that to
install to "C:\Program Files", since Seq66 can be built only as a 64-bit
application on our current development system.

NOTE: Currently we force the creation of a 64-bit Seq66, but still create
a 32-bit Seq66 installer.  The following material is for reference only at
this time. Read the release batch file for the most accurate information.

    ========================================================

The "x64" plug-in provides a macro, "RunningX64", which returns true if the
installer is running on 64-bit Windows under WoW64 emulation.  It can be
obtained from: "http:https://nsis.sourceforge.net/Include/x64.nsh".

Once detecting 64-bit host, we need to:

    -   Set "C:\Program Files" as the install directory, using $PROGRAMFILES64
        instead of $PROGRAMFILES.
    -   Enable access to the 64-bit Registry with the SetRegView NSIS command.

    Setup.nsi:

        !include x64.nsh

        ; Set the initial value for $INSTDIR.

        InstallDir "$PROGRAMFILES\${MY_COMPANY}\${MY_APP}"
        . . .
        ${If} ${RunningX64} 
            DetailPrint "Installer running on 64-bit host"

            ; Disable Registry redirection to enable access to th e64-bit
            ; portion of the Registry.

            SetRegView 64

            ; Change the install directory.

            StrCpy $INSTDIR "$PROGRAMFILES64\${MY_COMPANY}\${MY_APP}"

        ${EndIf}

    I think that is all we need.  The steps that follow require building
    code with Visual Studio, and we do not need it.

    ========================================================

    To detect whether some 64-bit process is running, use the FindProcDLL
    plug-in (there are couple of versions available but I found only this
    one - FindProcDLL_mod_by_hnedka.7z - working for me; please have a look
    at this forum thread). Download this archived file, unpack it and copy
    FindProcDLL.dll to your ..\NSIS\Plugins directory.

		${If} ${RunningX64}
		   FindProcDLL::FindProc "Some64BitProcess.exe"
		   ${If} $R0 == 1
			  DetailPrint "FindProcDLL::FindProc() returned 1 (process is running)"
		   ${ElseIf} $R0 == 0
			  DetailPrint "FindProcDLL::FindProc() returned 0 (process is not running)"
		   ${Else}
			  DetailPrint "FindProcDLL::FindProc() returned unexpected value"                               
		   ${Endif}                                                  
		${Else} 
		...

    "NSIS Unicode FindProc / KillProc plug-in", 'FindProc Unicode-source.zip':

        https://sourceforge.net/projects/findkillprocuni/files/

    FindProcDLL_mod_by_hnedka.7z can be found at:

        http:https://forums.winamp.com/attachment.php?attachmentid=48888&d=1307099823

Additional notes:

	If you need to install either a 32-bit or 64-bit file, you can do this:

	${If} ${RunningX64}
	File "/oname=MyFile.exe" "files\MyFile64.exe"
	${Else}
	File "files\MyFile.exe"
	${EndIf}

	If you need to register a DLL, you can do this:

	${If} ${RunningX64}
	ExecWait 'regsvr32.exe /s "$INSTDIR\MyDLL.dll"'
	${Else}
	RegDLL "$INSTDIR\MyDLL.dll"
	${EndIf}

	(Or use Library.nsh)

# vim: sw=4 ts=4 wm=8 et ft=sh