hllapi.nsi.in 3.05 KB
!include "MUI2.nsh"
!include "x64.nsh"
!include "FileFunc.nsh"

Name "@PACKAGE@"
Caption "@PACKAGE@ - @PACKAGE_DESCRIPTION@"
outfile "@PACKAGE@-@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@.@PACKAGE_MAJOR_RELEASE@.@PACKAGE_MINOR_RELEASE@-@host_cpu@.exe"

XPStyle on

installDir "$@PROGRAMFILES@\@PACKAGE@"

# Get installation folder from registry if available
InstallDirRegKey HKLM "Software\@PACKAGE@" "InstallLocation"

RequestExecutionLevel admin

# Properties
VIProductVersion "@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@.@PACKAGE_MAJOR_RELEASE@.@PACKAGE_MINOR_RELEASE@"
VIFileVersion "@WIN32_VERSION@"

VIAddVersionKey "ProductVersion" "@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@.@PACKAGE_MAJOR_RELEASE@.@PACKAGE_MINOR_RELEASE@"
VIAddVersionKey "FileVersion" "@WIN32_VERSION@"

VIAddVersionKey "ProductName" "@PACKAGE_NAME@"
VIAddVersionKey "FileDescription" "@PACKAGE_DESCRIPTION@"
VIAddVersionKey "LegalCopyright" "GPL-2.0"

# Interface

!define MUI_ABORTWARNING
# !insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

# !insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# !insertmacro MUI_UNPAGE_FINISH

# Languages
!insertmacro MUI_LANGUAGE "English"

# Section scripts
!include Sections.nsh

# default section
SubSection "@PACKAGE@" SecMain

	Section "Core" SecCore

		# define the output path for this file
		setOutPath $SYSDIR
		SetShellVarContext all

		SetRegView @WINARCH@
		${@NSISREDIR@}

		file "/oname=$SYSDIR\hllapi.dll" "libhllapi.dll"

		# For compatibility with old scripts.
		file "/oname=$SYSDIR\libhllapi.dll" "libhllapi.dll"

		# define uninstaller name
		SetRegView 32

		writeUninstaller $INSTDIR\uninstall.exe

		WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \
			         "DisplayName" "@PACKAGE@ - @PACKAGE_DESCRIPTION@"

		WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \
			         "DisplayVersion" "@PACKAGE_VERSION@"

		WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \
			         "UninstallString" "$INSTDIR\uninstall.exe"

		WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \
			         "InstallLocation" "$INSTDIR"

		WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \
			         "NoModify" "1"

		WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \
			         "NoRepair" "1"

		# Save instalation dir
		WriteRegStr HKCU "Software\@PACKAGE@" "" $INSTDIR

	sectionEnd

SubSectionEnd

Section "Uninstall"

	# Always delete uninstaller first
	delete $INSTDIR\uninstaller.exe

	# delete installed files
	${@NSISREDIR@}
	delete $SYSDIR\hllapi.dll
	delete $SYSDIR\libhllapi.dll

	# Remove registry
	SetRegView 32
	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@"
	DeleteRegKey HKLM "Software\@PACKAGE@"
	
	SetRegView @WINARCH@
	DeleteRegKey HKLM "Software\@PACKAGE@"

SectionEnd