2
;Courtusy of the Tomahawk project (i.e. I shamelessly copied and pasted)
3
;www.tomahawk-player.com
5
;-----------------------------------------------------------------------------
6
; Some installer script options (comment-out options not required)
7
;-----------------------------------------------------------------------------
8
;!define OPTION_LICENSE_AGREEMENT
9
!define OPTION_UAC_PLUGIN_ENHANCED
10
!define OPTION_SECTION_SC_START_MENU
11
!define OPTION_SECTION_SC_DESKTOP
12
!define OPTION_SECTION_SC_QUICK_LAUNCH
13
!define OPTION_FINISHPAGE
14
!define OPTION_FINISHPAGE_LAUNCHER
15
!define OPTION_FINISHPAGE_RELEASE_NOTES
17
;-----------------------------------------------------------------------------
19
;-----------------------------------------------------------------------------
21
!define MING_PATH "/usr/i686-w64-mingw32/sys-root/mingw"
23
!define MING_BIN "${MING_PATH}/bin"
24
!define MING_LIB "${MING_PATH}/lib"
25
!define BUILD_PATH "@CMAKE_BINARY_DIR@"
26
!define SOURCE_PATH "@CMAKE_SOURCE_DIR@"
27
!define QT_DLL_PATH "${MING_BIN}"
28
!define SQLITE_DLL_PATH "${MING_LIB}/qt4/plugins/sqldrivers"
29
!define IMAGEFORMATS_DLL_PATH "${MING_LIB}/qt4/plugins/imageformats"
31
; We use official release plugins
32
; mingw32-vlc from obs misses a lot and has even broken ones probably
33
!define VLC_PATH "${SOURCE_PATH}\admin\win\vlc\" ; SIC! ^
34
!define VLC_BIN "${VLC_PATH}"
35
!define VLC_PLUGIN_PATH "${VLC_BIN}\plugins"
37
!define NSI_PATH "${SOURCE_PATH}/admin/win/nsi"
40
;-----------------------------------------------------------------------------
42
;-----------------------------------------------------------------------------
44
!define VER_MAJOR "@CPACK_PACKAGE_VERSION_MAJOR@"
45
!define VER_MINOR "@CPACK_PACKAGE_VERSION_MINOR@"
46
!define VER_BUILD "@CPACK_PACKAGE_VERSION_PATCH@"
47
!define VERSION "@CPACK_PACKAGE_VERSION@"
49
;-----------------------------------------------------------------------------
50
; Installer build timestamp.
51
;-----------------------------------------------------------------------------
52
!define /date BUILD_TIME "built on %Y/%m/%d at %I:%M %p"
54
;-----------------------------------------------------------------------------
55
; Initial installer setup and definitions.
56
;-----------------------------------------------------------------------------
57
Name "@CPACK_NSIS_PACKAGE_NAME@"
58
Caption "UDJ Installer"
59
BrandingText "UDJ ${VERSION} -- ${BUILD_TIME}"
60
OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
61
InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
62
InstallDirRegKey HKCU "Software\UDJ" ""
67
SetCompressor @CPACK_NSIS_COMPRESSOR@
68
RequestExecutionLevel user ;Now using the UAC plugin.
69
ReserveFile NSIS.InstallOptions.ini
70
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
72
@CPACK_NSIS_SECTION_SELECTED_VARS@
74
;-----------------------------------------------------------------------------
75
; Include some required header files.
76
;-----------------------------------------------------------------------------
77
!include LogicLib.nsh ;Used by APPDATA uninstaller.
78
!include nsDialogs.nsh ;Used by APPDATA uninstaller.
79
!include MUI2.nsh ;Used by APPDATA uninstaller.
80
!include InstallOptions.nsh ;Required by MUI2 to support old MUI_INSTALLOPTIONS.
81
!include Memento.nsh ;Remember user selections.
82
!include WinVer.nsh ;Windows version detection.
83
!include WordFunc.nsh ;Used by VersionCompare macro function.
84
!include UAC.nsh ;Used by the UAC elevation to install as user or admin.
86
;-----------------------------------------------------------------------------
87
; Memento selections stored in registry.
88
;-----------------------------------------------------------------------------
89
!define MEMENTO_REGISTRY_ROOT HKLM
90
!define MEMENTO_REGISTRY_KEY Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ
92
;-----------------------------------------------------------------------------
93
; Modern User Interface (MUI) defintions and setup.
94
;-----------------------------------------------------------------------------
95
!define MUI_ABORTWARNING
96
!define MUI_ICON ${NSI_PATH}\installer.ico
97
!define MUI_UNICON ${NSI_PATH}\installer.ico
98
!define MUI_WELCOMEFINISHPAGE_BITMAP ${NSI_PATH}\welcome.png
99
!define MUI_WELCOMEPAGE_TITLE "@CPACK_PACKAGE_NAME@ ${VERSION} Setup$\r$\nInstaller"
100
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation.$\r$\n$\r$\n$_CLICK"
101
!define MUI_HEADERIMAGE
102
!define MUI_HEADERIMAGE_BITMAP ${NSI_PATH}\page_header.jpg
103
!define MUI_COMPONENTSPAGE_SMALLDESC
104
!define MUI_FINISHPAGE_TITLE "@CPACK_PACKAGE_NAME@ Install Completed"
105
!define MUI_FINISHPAGE_LINK "Click here to visit the @CPACK_PACKAGE_NAME@ website."
106
!define MUI_FINISHPAGE_LINK_LOCATION "http://@UDJ_ORGANIZATION_DOMAIN@"
107
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
108
!ifdef OPTION_FINISHPAGE_RELEASE_NOTES
109
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
110
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\NOTES.txt"
111
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Show release notes"
113
!ifdef OPTION_FINISHPAGE_LAUNCHER
114
!define MUI_FINISHPAGE_NOAUTOCLOSE
115
!define MUI_FINISHPAGE_RUN
116
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchUDJ"
119
;-----------------------------------------------------------------------------
121
;-----------------------------------------------------------------------------
122
!insertmacro MUI_PAGE_WELCOME
123
!ifdef OPTION_LICENSE_AGREEMENT
124
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
126
Page custom PageReinstall PageLeaveReinstall
127
!insertmacro MUI_PAGE_COMPONENTS
128
!insertmacro MUI_PAGE_DIRECTORY
129
!insertmacro MUI_PAGE_INSTFILES
130
!ifdef OPTION_FINISHPAGE
131
!insertmacro MUI_PAGE_FINISH
133
!insertmacro MUI_UNPAGE_CONFIRM
134
UninstPage custom un.UnPageUserAppData un.UnPageUserAppDataLeave
135
!insertmacro MUI_UNPAGE_INSTFILES
137
;-----------------------------------------------------------------------------
139
;-----------------------------------------------------------------------------
140
!insertmacro MUI_LANGUAGE "English"
142
##############################################################################
144
# FINISH PAGE LAUNCHER FUNCTIONS #
146
##############################################################################
149
${UAC.CallFunctionAsUser} LaunchUDJAsUser
152
Function LaunchUDJAsUser
153
Exec "$INSTDIR\UDJ.exe"
156
##############################################################################
158
# PROCESS HANDLING FUNCTIONS AND MACROS #
160
##############################################################################
162
!macro CheckForProcess processName gotoWhenFound gotoWhenNotFound
163
Processes::FindProcess ${processName}
164
StrCmp $R0 "0" ${gotoWhenNotFound} ${gotoWhenFound}
167
!macro ConfirmEndProcess processName
168
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
169
"Found ${processName} process(s) which need to be stopped.$\nDo you want the installer to stop these for you?" \
170
IDYES process_${processName}_kill IDNO process_${processName}_ended
171
process_${processName}_kill:
172
DetailPrint "Killing ${processName} processes."
173
Processes::KillProcess ${processName}
175
StrCmp $R0 "1" process_${processName}_ended
176
DetailPrint "Process to kill not found!"
177
process_${processName}_ended:
180
!macro CheckAndConfirmEndProcess processName
181
!insertmacro CheckForProcess ${processName} 0 no_process_${processName}_to_end
182
!insertmacro ConfirmEndProcess ${processName}
183
no_process_${processName}_to_end:
186
Function EnsureUDJShutdown
187
!insertmacro CheckAndConfirmEndProcess "UDJ.exe"
190
##############################################################################
192
# RE-INSTALLER FUNCTIONS #
194
##############################################################################
196
Function PageReinstall
197
ReadRegStr $R0 HKLM "Software\UDJ" ""
202
ReadRegDWORD $R0 HKLM "Software\UDJ" "VersionMajor"
203
IntCmp $R0 ${VER_MAJOR} minor_check new_version older_version
205
ReadRegDWORD $R0 HKLM "Software\UDJ" "VersionMinor"
206
IntCmp $R0 ${VER_MINOR} build_check new_version older_version
208
ReadRegDWORD $R0 HKLM "Software\UDJ" "VersionBuild"
209
IntCmp $R0 ${VER_BUILD} same_version new_version older_version
212
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" "An older version of UDJ is installed on your system. It is recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue."
213
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" "Uninstall before installing"
214
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" "Do not uninstall"
215
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install UDJ."
220
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" "A newer version of UDJ is already installed! It is not recommended that you install an older version. If you really want to install this older version, it is better to uninstall the current version first. Select the operation you want to perform and click Next to continue."
221
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" "Uninstall before installing"
222
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" "Do not uninstall"
223
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install UDJ."
228
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" "UDJ ${VERSION} is already installed.\r\nSelect the operation you want to perform and click Next to continue."
229
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" "Add/Reinstall components"
230
!insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" "Uninstall UDJ"
231
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
235
!insertmacro INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
238
Function PageLeaveReinstall
239
!insertmacro INSTALLOPTIONS_READ $R1 "NSIS.InstallOptions.ini" "Field 2" "State"
241
StrCmp $R1 "1" reinst_uninstall reinst_done
243
StrCmp $R1 "1" reinst_done reinst_uninstall
245
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "UninstallString"
248
ExecWait '$R1 _?=$INSTDIR'
249
IfErrors no_remove_uninstaller
250
IfFileExists "$INSTDIR\UDJ.exe" no_remove_uninstaller
253
no_remove_uninstaller:
261
##############################################################################
263
# INSTALLER SECTIONS #
265
##############################################################################
266
Section "UDJ Player" SEC_UDJ_PLAYER
268
SetDetailsPrint listonly
270
SetDetailsPrint textonly
271
DetailPrint "Installing UDJ Player essentials."
272
SetDetailsPrint listonly
273
SetOutPath "$INSTDIR"
277
File "${INSTALL_PATH}\bin\UDJ.exe"
282
File "${BUILD_PATH}\src\UDJ.exe"
286
;License & release notes.
287
File "@CPACK_RESOURCE_FILE_LICENSE@"
288
File /oname=NOTES.txt ${NSI_PATH}\RELEASE_NOTES.txt
291
File "${QT_DLL_PATH}\QtCore4.dll"
292
File "${QT_DLL_PATH}\QtGui4.dll"
293
File "${QT_DLL_PATH}\QtNetwork4.dll"
294
File "${QT_DLL_PATH}\QtSql4.dll"
295
File "${QT_DLL_PATH}\QtXml4.dll"
298
SetOutPath "$INSTDIR\sqldrivers"
299
File "${SQLITE_DLL_PATH}\qsqlite4.dll"
300
SetOutPath "$INSTDIR"
303
SetOutPath "$INSTDIR\imageformats"
304
File "${IMAGEFORMATS_DLL_PATH}\qgif4.dll"
305
File "${IMAGEFORMATS_DLL_PATH}\qjpeg4.dll"
306
SetOutPath "$INSTDIR"
309
;File "${MING_BIN}\cygmad-0.dll"
310
;File "${MING_BIN}\libgcc_s_dw2-1.dll"
311
;File "${MING_BIN}\mingwm10.dll"
312
File "${MING_BIN}\libgcc_s_sjlj-1.dll"
313
File "${MING_BIN}\libstdc++-6.dll"
316
File "${MING_BIN}\libphonon.dll"
317
SetOutPath "$INSTDIR\phonon_backend"
318
File "${VLC_BIN}\phonon_backend\phonon_vlc.dll"
319
SetOutPath "$INSTDIR"
322
File "${VLC_BIN}\libvlc.dll"
323
File "${VLC_BIN}\libvlccore.dll"
324
SetOutPath "$INSTDIR\plugins"
325
File /r "${VLC_PLUGIN_PATH}\*.dll"
326
SetOutPath "$INSTDIR"
329
File "${MING_BIN}\libtag.dll"
330
File "${MING_BIN}\libpng15-15.dll"
331
File "${MING_BIN}\libjpeg-8.dll"
332
File "${MING_BIN}\zlib1.dll"
333
File "${MING_BIN}\libqtsparkle.dll"
338
File "${MING_BIN}\libssl-8.dll"
339
File "${MING_BIN}\libcrypto-8.dll"
343
SectionGroup "Shortcuts"
345
!ifdef OPTION_SECTION_SC_START_MENU
346
${MementoSection} "Start Menu Program Group" SEC_START_MENU
348
SetDetailsPrint textonly
349
DetailPrint "Adding shortcuts for the UDJ program group to the Start Menu."
350
SetDetailsPrint listonly
351
SetShellVarContext all
352
RMDir /r "$SMPROGRAMS\UDJ"
353
CreateDirectory "$SMPROGRAMS\UDJ"
354
CreateShortCut "$SMPROGRAMS\UDJ\LICENSE.lnk" "$INSTDIR\LICENSE.txt"
355
CreateShortCut "$SMPROGRAMS\UDJ\UDJ.lnk" "$INSTDIR\UDJ.exe"
356
CreateShortCut "$SMPROGRAMS\UDJ\Release notes.lnk" "$INSTDIR\NOTES.txt"
357
CreateShortCut "$SMPROGRAMS\UDJ\Uninstall.lnk" "$INSTDIR\uninstall.exe"
358
SetShellVarContext current
362
!ifdef OPTION_SECTION_SC_DESKTOP
363
${MementoSection} "Desktop Shortcut" SEC_DESKTOP
365
SetDetailsPrint textonly
366
DetailPrint "Creating Desktop Shortcuts"
367
SetDetailsPrint listonly
368
CreateShortCut "$DESKTOP\UDJ.lnk" "$INSTDIR\UDJ.exe"
372
!ifdef OPTION_SECTION_SC_QUICK_LAUNCH
373
${MementoSection} "Quick Launch Shortcut" SEC_QUICK_LAUNCH
375
SetDetailsPrint textonly
376
DetailPrint "Creating Quick Launch Shortcut"
377
SetDetailsPrint listonly
378
CreateShortCut "$QUICKLAUNCH\UDJ.lnk" "$INSTDIR\UDJ.exe"
384
${MementoSectionDone}
386
; Installer section descriptions
387
;--------------------------------
388
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
389
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_UDJ_PLAYER} "UDJ player essentials."
390
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_START_MENU} "UDJ program group."
391
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} "Desktop shortcut for UDJ."
392
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QUICK_LAUNCH} "Quick Launch shortcut for UDJ."
393
!insertmacro MUI_FUNCTION_DESCRIPTION_END
398
SetDetailsPrint textonly
399
DetailPrint "Writing Uninstaller"
400
SetDetailsPrint listonly
401
WriteUninstaller $INSTDIR\uninstall.exe
403
;Registry keys required for installer version handling and uninstaller.
404
SetDetailsPrint textonly
405
DetailPrint "Writing Installer Registry Keys"
406
SetDetailsPrint listonly
408
;Version numbers used to detect existing installation version for comparisson.
409
WriteRegStr HKLM "Software\UDJ" "" $INSTDIR
410
WriteRegDWORD HKLM "Software\UDJ" "VersionMajor" "${VER_MAJOR}"
411
WriteRegDWORD HKLM "Software\UDJ" "VersionMinor" "${VER_MINOR}"
412
WriteRegDWORD HKLM "Software\UDJ" "VersionRevision" "${REVISION}"
413
WriteRegDWORD HKLM "Software\UDJ" "VersionBuild" "${VER_BUILD}"
415
;Add or Remove Programs entry.
416
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "UninstallString" '"$INSTDIR\Uninstall.exe"'
417
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "InstallLocation" "$INSTDIR"
418
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "DisplayName" "UDJ"
419
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "Publisher" "UDJ-player.org"
420
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"
421
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "DisplayVersion" "${VERSION}"
422
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "VersionMajor" "${VER_MAJOR}"
423
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "VersionMinor" "${VER_MINOR}.${REVISION}"
424
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "URLInfoAbout" "http://UDJ-player.org/"
425
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "HelpLink" "http://UDJ-player.org/"
426
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "NoModify" "1"
427
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "NoRepair" "1"
429
; Register UDJ:// protocol handler
430
WriteRegStr HKCR "UDJ" "" "URL:UDJ Protocol"
431
WriteRegStr HKCR "UDJ" "URL Protocol" ""
432
WriteRegStr HKCR "UDJ\DefaultIcon" "" $INSTDIR\UDJ.exe,1
433
WriteRegStr HKCR "UDJ\shell" "" "open"
434
WriteRegStr HKCR "UDJ\shell\open\command" "" '"$INSTDIR\UDJ.exe" "%1"'
436
SetDetailsPrint textonly
437
DetailPrint "Finsihed."
440
##############################################################################
442
# UNINSTALLER SECTION #
444
##############################################################################
446
Var UnPageUserAppDataDialog
447
Var UnPageUserAppDataCheckbox
448
Var UnPageUserAppDataCheckbox_State
449
Var UnPageUserAppDataEditBox
451
Function un.UnPageUserAppData
452
!insertmacro MUI_HEADER_TEXT "Uninstall UDJ" "Remove UDJ's data folder from your computer."
453
nsDialogs::Create /NOUNLOAD 1018
454
Pop $UnPageUserAppDataDialog
456
${If} $UnPageUserAppDataDialog == error
460
${NSD_CreateLabel} 0 0 100% 12u "Do you want to delete UDJ's data folder?"
463
${NSD_CreateText} 0 13u 100% 12u "$LOCALAPPDATA\UDJ"
464
Pop $UnPageUserAppDataEditBox
465
SendMessage $UnPageUserAppDataEditBox ${EM_SETREADONLY} 1 0
467
${NSD_CreateLabel} 0 46u 100% 24u "Leave unchecked to keep the data folder for later use or check to delete the data folder."
470
${NSD_CreateCheckbox} 0 71u 100% 8u "Yes, delete this data folder."
471
Pop $UnPageUserAppDataCheckbox
476
Function un.UnPageUserAppDataLeave
477
${NSD_GetState} $UnPageUserAppDataCheckbox $UnPageUserAppDataCheckbox_State
481
IfFileExists "$INSTDIR\UDJ.exe" UDJ_installed
482
MessageBox MB_YESNO "It does not appear that UDJ is installed in the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" IDYES UDJ_installed
483
Abort "Uninstall aborted by user"
486
;Delete registry keys.
487
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ"
488
DeleteRegValue HKLM "Software\UDJ" "VersionBuild"
489
DeleteRegValue HKLM "Software\UDJ" "VersionMajor"
490
DeleteRegValue HKLM "Software\UDJ" "VersionMinor"
491
DeleteRegValue HKLM "Software\UDJ" "VersionRevision"
492
DeleteRegValue HKLM "Software\UDJ" ""
493
DeleteRegKey HKLM "Software\UDJ"
495
DeleteRegKey HKCR "UDJ"
497
;Start menu shortcuts.
498
!ifdef OPTION_SECTION_SC_START_MENU
499
SetShellVarContext all
500
RMDir /r "$SMPROGRAMS\UDJ"
501
SetShellVarContext current
505
!ifdef OPTION_SECTION_SC_DESKTOP
506
IfFileExists "$DESKTOP\UDJ.lnk" 0 +2
507
Delete "$DESKTOP\UDJ.lnk"
510
;Quick Launch shortcut.
511
!ifdef OPTION_SECTION_SC_QUICK_LAUNCH
512
IfFileExists "$QUICKLAUNCH\UDJ.lnk" 0 +2
513
Delete "$QUICKLAUNCH\UDJ.lnk"
516
;Remove all the Program Files.
519
;Uninstall User Data if option is checked, otherwise skip.
520
${If} $UnPageUserAppDataCheckbox_State == ${BST_CHECKED}
521
RMDir /r "$LOCALAPPDATA\UDJ"
524
SetDetailsPrint textonly
525
DetailPrint "Finsihed."
528
##############################################################################
530
# NSIS Installer Event Handler Functions #
532
##############################################################################
535
!insertmacro INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
537
;Remove Quick Launch option from Windows 7, as no longer applicable - usually.
538
${IfNot} ${AtMostWinVista}
539
SectionSetText ${SEC_QUICK_LAUNCH} "Quick Launch Shortcut (N/A)"
540
SectionSetFlags ${SEC_QUICK_LAUNCH} ${SF_RO}
541
SectionSetInstTypes ${SEC_QUICK_LAUNCH} 0
544
${MementoSectionRestore}
548
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
549
StrCmp 0 $0 0 UAC_Err ; Error?
550
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
554
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
557
UAC_ElevationAborted:
561
StrCmp 1 $3 +4 ;Admin?
562
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
563
MessageBox MB_ICONSTOP "This installer requires admin access, try again"
566
;Prevent multiple instances.
567
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "UDJInstaller") i .r1 ?e'
570
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
573
;Use available InstallLocation when possible. This is useful in the uninstaller
574
;via re-install, which would otherwise use a default location - a bug.
575
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UDJ" "InstallLocation"
576
StrCmp $R0 "" SkipSetInstDir
580
;Shutdown UDJ in case Add/Remove re-installer option used.
581
Call EnsureUDJShutdown
584
Function .onInstSuccess
585
${MementoSectionSave}
586
UAC::Unload ;Must call unload!
589
Function .onInstFailed
590
UAC::Unload ;Must call unload!
593
##############################################################################
595
# NSIS Uninstaller Event Handler Functions #
597
##############################################################################
602
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
603
StrCmp 0 $0 0 UAC_Err ; Error?
604
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
608
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
611
UAC_ElevationAborted:
615
StrCmp 1 $3 +4 ;Admin?
616
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
617
MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
620
;Prevent multiple instances.
621
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "UDJUninstaller") i .r1 ?e'
624
MessageBox MB_OK|MB_ICONEXCLAMATION "This uninstaller is already running."
628
Function un.onUnInstSuccess
629
UAC::Unload ;Must call unload!
632
Function un.onUnInstFailed
633
UAC::Unload ;Must call unload!