NSIS: Silently fails with RequestExecutionLevel user - nsis

I am less than experienced in Windows applications and even more, this is my first effort to create an installer so I am just reading around about UAC without being able to understand what is happening!
Anyway, I am trying to create an installer with RequestExecutionLevel user and it seems, whatever I tried, the installer silently fails on my Windows 10 machine... That means nothing is copied to the install folder although it seems that the installer finishes successfully and even worse, I can't find any local logs or problematic entries in the windows event logs...
This is my nsis script:
############################################################################################
# NSIS Installation Script created by NSIS Quick Setup Script Generator v1.09.18
# Entirely Edited with NullSoft Scriptable Installation System
# by Vlasis K. Barkas aka Red Wine red_wine#freemail.gr Sep 2006
############################################################################################
!define APP_NAME "..."
!define COMP_NAME "..."
!define WEB_SITE "..."
!define VERSION "00.00.00.00"
!define COPYRIGHT "..."
!define DESCRIPTION "Application"
!define INSTALLER_NAME "D:\PATH_TO\Installer.exe"
!define MAIN_APP_EXE "AppName.exe"
!define INSTALL_TYPE "SetShellVarContext current"
!define REG_ROOT "HKCU"
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_EXE}"
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
######################################################################
VIProductVersion "${VERSION}"
VIAddVersionKey "ProductName" "${APP_NAME}"
VIAddVersionKey "CompanyName" "${COMP_NAME}"
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
VIAddVersionKey "FileDescription" "${DESCRIPTION}"
VIAddVersionKey "FileVersion" "${VERSION}"
######################################################################
SetCompressor ZLIB
Name "${APP_NAME}"
Caption "${APP_NAME}"
OutFile "${INSTALLER_NAME}"
BrandingText "${APP_NAME}"
XPStyle on
InstallDirRegKey "${REG_ROOT}" "${REG_APP_PATH}" ""
InstallDir "$LOCALAPPDATA\Programs\ProductName\"
RequestExecutionLevel user
######################################################################
!include "MUI.nsh"
!define MUI_ABORTWARNING
!define MUI_UNABORTWARNING
!insertmacro MUI_PAGE_WELCOME
!ifdef LICENSE_TXT
!insertmacro MUI_PAGE_LICENSE "${LICENSE_TXT}"
!endif
!ifdef REG_START_MENU
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "AppName"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${REG_ROOT}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${UNINSTALL_PATH}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${REG_START_MENU}"
!insertmacro MUI_PAGE_STARTMENU Application $SM_Folder
!endif
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\${MAIN_APP_EXE}"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
######################################################################
Section -MainProgram
${INSTALL_TYPE}
SetOverwrite ifnewer
SetOutPath "$INSTDIR"
File "${FILES_PATH}test.txt"
SectionEnd
######################################################################
Section -Icons_Reg
SetOutPath "$INSTDIR"
WriteUninstaller "$INSTDIR\uninstall.exe"
!ifdef REG_START_MENU
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$SM_Folder"
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
!ifdef WEB_SITE
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url"
!endif
!insertmacro MUI_STARTMENU_WRITE_END
!endif
!ifndef REG_START_MENU
CreateDirectory "$SMPROGRAMS\AppName"
CreateShortCut "$SMPROGRAMS\AppName\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
!ifdef WEB_SITE
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
CreateShortCut "$SMPROGRAMS\AppName\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} website.url"
!endif
!endif
WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_EXE}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
!ifdef WEB_SITE
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "${WEB_SITE}"
!endif
SectionEnd
######################################################################
Section Uninstall
${INSTALL_TYPE}
Delete "$INSTDIR\test.txt"
!ifdef WEB_SITE
Delete "$INSTDIR\${APP_NAME} website.url"
!endif
RmDir "$INSTDIR"
!ifdef REG_START_MENU
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk"
!ifdef WEB_SITE
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk"
!endif
Delete "$DESKTOP\${APP_NAME}.lnk"
RmDir "$SMPROGRAMS\$SM_Folder"
!endif
!ifndef REG_START_MENU
Delete "$SMPROGRAMS\AppName\${APP_NAME}.lnk"
!ifdef WEB_SITE
Delete "$SMPROGRAMS\AppName\${APP_NAME} Website.lnk"
!endif
Delete "$DESKTOP\${APP_NAME}.lnk"
RmDir "$SMPROGRAMS\AppName"
!endif
DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}"
DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}"
SectionEnd
######################################################################
Do you spot anything strange? Seems like a permissions problem, but do you know how to debug this?
Thanks!
EDIT
As requested, I provided the entire script!

NSIS should display a retry/ignore/abort dialog if it is unable to extract a file.
After I made these changes:
!define FILES_PATH ".\"
!appendfile ".\test.txt" "Hello World$\r$\n"
...
!define APP_NAME "NsisTest"
!define MAIN_APP_EXE "NsisTest.exe"
then your code works just fine for me, both on Windows 8 and the latest Windows 10.
You have WriteUninstaller in your icons section which is a bit strange and you forgot Delete "$INSTDIR\uninstall.exe" in your uninstall section but these issues should not prevent it from writing anything.
Use Process Monitor to see where/if it extracts your files. Did you look in "%LOCALAPPDATA%\Programs\ProductName?

Related

How to load the files based on the locale and generate the installer using NSIS?

My requirement is, I have specific files (Dlls, chms, etc) for each Locale (Language). I need to load those files based on the locale and generate the installer.
And while uninstalling i should uninstall those files as well from the traget directory.
Here what i am doing is in .onInit function, using GetUserDefaultUILanguage() i am getting the locale and checking this locale and loading the files under this locale.
is it the correct way? Please provide any suggestions for this code.
And also do we need to use ;Pages section before the ;Languages section?
Because i am getting a warning to use ;Pages section before the ;Languages section when i am compiling.
Below is the code snippet i have written:
; LocaleDlls.nsi
;
;
; It will install LocaleDlls.nsi into a directory that the user selects.
;--------------------------------
!include LogicLib.nsh
!include "MUI2.nsh"
; The name of the installer in the path C:\Program Files\LocaleDlls
Name "LocaleDlls"
; The file to write in the path E:\Source\NULLSOFT\src
OutFile "LocaleDlls.exe"
; The default installation directory in the path C:\Program Files\LocaleDlls
InstallDir $PROGRAMFILES\LocaleDlls
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically) It shows the path the path C:\Program Files\LocaleDlls
InstallDirRegKey HKLM "Software\NSIS_LocaleDlls" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
; Pages
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;Pages
; Do we need to use PAGE macros before giving LANGUAGE as when compiling we are getting an error.
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English" ; The first language is the default language
!insertmacro MUI_LANGUAGE "PortugueseBR"
;--------------------------------
;Installer Functions
Function .onInit
System::Call 'kernel32::GetUserDefaultUILanguage() i.r10'
MessageBox MB_OK "Return value = $R0"
StrCpy $Language ${LANG_PORTUGUESEBR}
MessageBox MB_OK "Return value = $Language"
${If} $Language P= 1046
MessageBox MB_OK "Current Locale is Portuguese... Loading Portuguese Files"
${EndIf}
File E:\Source\NULLSOFT\src\EngPortuguese\Portuguese\AllowStandby.reg
File E:\Source\NULLSOFT\src\EngPortuguese\Portuguese\Test.chm
File E:\Source\NULLSOFT\src\EngPortuguese\Portuguese\Testdlg.dll
File E:\Source\NULLSOFT\src\EngPortuguese\Portuguese\resource.dll
FunctionEnd
;--------------------------------
; The stuff to install
Section "LocaleDlls (required)"
SectionIn RO
; Set output path to the installation directory. Here is the path C:\Program Files\LocaleDlls
SetOutPath $INSTDIR
; Give the File path
System::Call 'KERNEL32::AddDllDirectory(w "$INSTDIR")' ; Tell Windows we trust all .DLLs in this directory
System::Call 'KERNEL32::LoadLibrary(t "$INSTDIR\testdlg.dll.dll")p.r8 ?e'
Pop $7 ; Get ?e result
${IfThen} $8 P= 0 ${|} MessageBox MB_ICONSTOP "Failed to load pchuteres.dll, error $7" ${|}
${If} $8 P<> 0
MessageBox MB_OK 'Successfully loaded "$INSTDIR\testdlg.dll.dll" # $8'
${EndIf}
; Do the install
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\NSIS_DllTesting "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocaleDlls" "DisplayName" "NSIS LocaleDlls"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocaleDlls" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocaleDlls" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocaleDlls" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\LocaleDlls"
CreateShortcut "$SMPROGRAMS\LocaleDlls\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortcut "$SMPROGRAMS\LocaleDlls\LocaleDlls (MakeNSISW).lnk" "$INSTDIR\LocaleDlls.nsi" "" "$INSTDIR\LocaleDlls.nsi" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocaleDlls"
DeleteRegKey HKLM SOFTWARE\NSIS_LocaleDlls
; Remove files and uninstaller
Delete $INSTDIR\LocaleDlls.nsi
Delete $INSTDIR\uninstall.exe
; Remove shortcuts, if any
Delete "$SMPROGRAMS\LocaleDlls\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\LocaleDlls"
RMDir "$INSTDIR"
SectionEnd
;--------------------------------
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
You don't need to call GetUserDefaultUILanguage, NSIS calls GetUserDefaultUILanguage to try to set the default $language. If it cannot find a matching language, the first language specified in the .NSI is used. All of this happens before .onInit is called and you don't have to do anything. You can however change $language in .onInit if you are not happy with the language NSIS has chosen. You can also use !insertmacro MUI_LANGDLL_DISPLAY to display a language selection dialog.
Pages need to be inserted before the language when using MUI because the language macro needs to know which strings are required by the pages. It is important that you use the MUI page macros MUI_PAGE_* and not the native page:
!insertmacro MUI_PAGE_WELCOME
Page Custom MyPage ; There is no MUI_PAGE_* macro for this
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English" ; Must come after all MUI_PAGE_* macros.

How to display install page with the copy process as like in the image [NSIS script]

Outfile Test.exe
name "Test"
!include MUI2.nsh
!include LogicLib.nsh
!insertmacro MUI_PAGE_WELCOME
Page instfiles Installer
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Function Installer
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights to install application
MessageBox mb_iconstop "Administrator rights required!"
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${Else}
System::Call "kernel32::GetCurrentDirectory(i ${NSIS_MAX_STRLEN}, t .r0)"
CreateDirectory $3\pj
CopyFiles /SILENT \Source\*.* \destination\
${EndIf}
FunctionEnd
You have two InstFiles pages in your script, don't do that. You are also calling a function at the start of the InstFiles page but you should not perform file operations in page functions.
Your file operation itself makes no sense, you should not copy based on the current directory!
The "copy" progress from your screenshot is actually extracting files from the installer and you get that for free in NSIS:
RequestExecutionLevel Admin
InstallDir "$ProgramFiles\MyApp"
!include MUI2.nsh
!include LogicLib.nsh
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Function .onInit
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights to install application
MessageBox mb_iconstop "Administrator rights required!"
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${EndIf}
FunctionEnd
Section
SetOutPath "$InstDir"
File /r "c:\myfiles" ; This will display the extract progress
SectionEnd
If you actually want to copy files instead of extracting then you can just remove the /SILENT switch to display the normal Windows copy dialog.
If you must copy files with output similar to extraction you must manually walk the source directory with FindFirst+FindNext and use DetailPrint+CopyFiles /SILENT for each file...

Require Component Installation with MUI

As a new NSIS user, I have defaulted to the HM NIS Edit wizard to create my installers so far. The default output takes advantage of MUI, which has been very useful to me. It also, however, includes a components page from the MUI macro library, so I cannot pick and choose which components are mandatory. I have looked at this question: How to make a SectionGroup mandatory in NSIS script, but I'm not sure where to put it in my code below, or even how to modify the wizard's output code to include it. The installer is for several apps with distinct (selectable) executables that all require the same (ideally mandatory) support files.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Product"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\App1.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\Product"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Section "Support Files" SEC01
SetOutPath "$INSTDIR"
SetOverwrite try
File "..\Support\File\Path\file.txt"
SectionEnd
Section "App1" SEC02
SetOutPath "$INSTDIR"
SetOverwrite try
File "..\App1\File\Path\App1.exe"
SectionEnd
Section "App2" SEC03
SetOutPath "$INSTDIR"
SetOverwrite try
File "..\App2\File\Path\App2.exe"
SectionEnd
In short, I need to know how to make the Support Files section mandatory, without losing the GUI. My only experience, though, is with the above-mentioned wizard.
The SectionIn instruction is used to assign sections to install types (Combobox on the components page) but it can also make sections read-only:
Section "Support Files" SEC01
SectionIn RO ;Make it read-only
SetOutPath "$INSTDIR"
SetOverwrite try
File "..\Support\File\Path\file.txt"
SectionEnd

Files installed to C:\ instead of C:\folder\

My installer copies Uninstall.exe and /temp/ directory to the installation folder (for me it is C:\MyExample), but MyExample.dll/ico/exe, and success/error.wav are copied directly to C:\ and I can't get this working.
!include "MUI2.nsh"
;General
Function .onInit
ReadEnvStr $R0 SYSTEMDRIVE
StrCpy $INSTDIR `$R0\MyExample\`
FunctionEnd
Name "MyExample"
OutFile "Setup.exe"
RequestExecutionLevel admin
;--------------------------------
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!define MUI_FINISHPAGE_SHOWREADME ""
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy
File "MyExample.exe"
File "MyExample.ico"
File "error.wav"
File "success.wav"
File "MyExample.dll"
CreateDirectory $INSTDIR\temp
SetOutPath "$INSTDIR"
WriteRegStr HKCU "Software\MyExample" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Product\MyExample" \
"MyExample" "$\"$INSTDIR\uninstall.exe$\""
SectionEnd
Section "Uninstall"
# Always delete uninstaller first
delete $INSTDIR\uninstall.exe
delete $INSTDIR\MyExample.exe
delete $INSTDIR\MyExample.ico
delete $INSTDIR\error.wav
delete $INSTDIR\success.wav
delete $INSTDIR\MyExample.dll
SectionEnd
;--------------------------------
;Descriptions
LangString DESC_SecDummy ${LANG_ENGLISH} "Setup"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\MyExample"
SectionEnd
Function LaunchLink
ExecShell "" "$INSTDIR\MyExample.exe"
FunctionEnd
Function finishpageaction
CreateShortcut "$desktop\MyExample.lnk" "$instdir\MyExample.exe"
WriteRegStr HKEY_CURRENT_USER "Software\Microsoft\Windows\CurrentVersion\Run" \
"MyExample.exe" "$INSTDIR\MyExample.exe"
FunctionEnd
In your Dummy Section section, you are installing some files without telling the destination directory. I suppose that implicitly meant $INSTDIR, but you need to be explicit as a section might or might not be selected (when you have multiple sections), and they must not rely on side effects of previously executed sections (if ever).
Add the destination folder at the beginning of the section, before the File statements:
SetOutPath $INSTDIR

Empty box showing up in my installer? How do I remove it?

I'm using a pretty simple install script for my application and its showing an empty box on the section selection screen. I would like to remove it, or at least know what its for and fill it up.
here is a screenshot
and my install script
; example2.nsi
;
; This script is based on example1.nsi, but it remember the directory,
; has uninstall support and (optionally) installs start menu shortcuts.
;
; It will install ICV-MRI into a directory that the user selects,
;--------------------------------
!include "MUI.nsh"
; The name of the installer
Name "ICV-MRI"
; The file to write
OutFile "ICV-MRI_Setup.exe"
; The default installation directory
InstallDir $PROGRAMFILES\ICV-MRI
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\ICV-MRI" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
Function LaunchLink
ExecShell "" "$INSTDIR\mri.exe"
FunctionEnd
;--------------------------------
; Pages
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
; !insertmacro MUI_PAGE_WELCOME
; !insertmacro MUI_PAGE_DIRECTORY
; !insertmacro MUI_PAGE_INSTFILES
# These indented statements modify settings for MUI_PAGE_FINISH
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN_TEXT "Run MRI when the installer closes"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; The stuff to install
Section "ICV-MRI (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File "dist\bz2.pyd"
File "dist\library.zip"
File "dist\mri.exe"
File "dist\PyQt4.QtCore.pyd"
File "dist\PyQt4.QtGui.pyd"
File "dist\python26.dll"
File "dist\QtCore4.dll"
File "dist\QtGui4.dll"
File "dist\select.pyd"
File "dist\sip.pyd"
File "dist\unicodedata.pyd"
File "dist\w9xpopen.exe"
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\ICV-MRI "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ICV-MRI" "DisplayName" "ICV-MRI"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ICV-MRI" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ICV-MRI" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ICV-MRI" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\ICV-MRI"
CreateShortCut "$SMPROGRAMS\ICV-MRI\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\ICV-MRI\ICV-MRI.lnk" "$INSTDIR\mri.exe" "" "$INSTDIR\mri.exe" 0
SectionEnd
Section "Desktop Shortcuts"
CreateShortCut "$DESKTOP\ICV-MRI.lnk" "$INSTDIR\mri.exe" "" "$INSTDIR\mri.exe" 0
SectionEnd
;--------------------------------
If you want to remove it, !define MUI_COMPONENTSPAGE_NODESC at the top of your script
That box is for the section description.
Take a look at the Modern UI Basic.nsi file:
;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
;Store installation folder
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Read more Modern UI Readme, section on Components page descriptions.
The Modern UI components page has a text box in which a description can be shown when the user hovers the mouse over a component. If you don't want to use these descriptions, insert the MUI_COMPONENTSPAGE_NODESC interface setting.
To set a description for a section, an additional parameter needs to be added to Section commmand with a unique identifier for the section. This name can later be used to set the description for this section.

Resources