1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // LameXP - Audio Encoder Front-End
3 ; // Copyright (C) 2004-2023 LoRd_MuldeR <MuldeR2@GMX.de>
5 ; // This program is free software; you can redistribute it and/or modify
6 ; // it under the terms of the GNU GENERAL PUBLIC LICENSE as published by
7 ; // the Free Software Foundation; either version 2 of the License, or
8 ; // (at your option) any later version; always including the non-optional
9 ; // LAMEXP GNU GENERAL PUBLIC LICENSE ADDENDUM. See "License.txt" file!
11 ; // This program is distributed in the hope that it will be useful,
12 ; // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ; // GNU General Public License for more details.
16 ; // You should have received a copy of the GNU General Public License along
17 ; // with this program; if not, write to the Free Software Foundation, Inc.,
18 ; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 ; // http://www.gnu.org/licenses/gpl-2.0.txt
21 ; ///////////////////////////////////////////////////////////////////////////////
23 ;--------------------------------
25 ;--------------------------------
28 !error "NSIS_UNICODE is undefined, please compile with Unicode NSIS !!!"
31 !ifndef LAMEXP_VERSION
32 !error "LAMEXP_VERSION is not defined !!!"
35 !error "LAMEXP_BUILD is not defined !!!"
37 !ifndef LAMEXP_INSTTYPE
38 !error "LAMEXP_INSTTYPE is not defined !!!"
41 !error "LAMEXP_PATCH is not defined !!!"
44 !error "LAMEXP_DATE is not defined !!!"
46 !ifndef LAMEXP_OUTPUT_FILE
47 !error "LAMEXP_OUTPUT_FILE is not defined !!!"
49 !ifndef LAMEXP_SOURCE_PATH
50 !error "LAMEXP_SOURCE_PATH is not defined !!!"
54 !define MyRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FBD7A67D-D700-4043-B54F-DD106D00F308}"
57 !define AppPaths "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"
60 !define MyWebSite "http://muldersoft.com/"
63 !define PrerequisitesDir "..\..\..\Prerequisites"
65 ;--------------------------------
66 ;Check for Pre-Release
67 ;--------------------------------
69 !define LAMEXP_IS_PRERELEASE
71 !if '${LAMEXP_INSTTYPE}' == 'Final'
72 !undef LAMEXP_IS_PRERELEASE
74 !if '${LAMEXP_INSTTYPE}' == 'Hotfix'
75 !undef LAMEXP_IS_PRERELEASE
79 ;--------------------------------
81 ;--------------------------------
84 !packhdr "${PACKHDRTEMP}" '"${PrerequisitesDir}\MSVC\redist\bin\mt.exe" -manifest "setup.manifest" -outputresource:"${PACKHDRTEMP};1" && "${PrerequisitesDir}\UPX\upx.exe" --brute "${PACKHDRTEMP}"'
87 ;--------------------------------
89 ;--------------------------------
94 !include `StdUtils.nsh`
97 ;--------------------------------
99 ;--------------------------------
101 RequestExecutionLevel admin
103 ShowUninstDetails show
104 Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
105 OutFile "${LAMEXP_OUTPUT_FILE}"
106 BrandingText "Date created: ${LAMEXP_DATE} [Build #${LAMEXP_BUILD}]"
107 InstallDir "$PROGRAMFILES\MuldeR\LameXP"
108 InstallDirRegKey HKLM "${MyRegPath}" "InstallLocation"
111 ;--------------------------------
113 ;--------------------------------
115 SetCompressor /SOLID LZMA
116 SetCompressorDictSize 64
119 ;--------------------------------
121 ;--------------------------------
123 ReserveFile "${NSISDIR}\Plugins\Aero.dll"
124 ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
125 ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
126 ReserveFile "${NSISDIR}\Plugins\LockedList64.dll"
127 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
128 ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
129 ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
130 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
131 ReserveFile "${NSISDIR}\Plugins\System.dll"
132 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
135 ;--------------------------------
137 ;--------------------------------
142 ;--------------------------------
144 ;--------------------------------
146 !searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
147 VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
149 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
150 VIAddVersionKey "Comments" "This program is free software; you can redistribute it and/or modify it under the terms of the GNU GENERAL PUBLIC LICENSE as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version; always including the non-optional LAMEXP GNU GENERAL PUBLIC LICENSE ADDENDUM."
151 VIAddVersionKey "CompanyName" "Free Software Foundation"
152 VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
153 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
154 VIAddVersionKey "LegalCopyright" "Copyright 2004-2023 LoRd_MuldeR"
155 VIAddVersionKey "LegalTrademarks" "GNU"
156 VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.exe"
157 VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
158 VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
159 VIAddVersionKey "Website" "${MyWebSite}"
162 ;--------------------------------
163 ;MUI2 Interface Settings
164 ;--------------------------------
166 !define MUI_ABORTWARNING
167 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
168 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${MyRegPath}"
169 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartmenuFolder"
170 !define MUI_LANGDLL_REGISTRY_ROOT HKLM
171 !define MUI_LANGDLL_REGISTRY_KEY "${MyRegPath}"
172 !define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
173 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LameXP v${LAMEXP_VERSION}"
174 !define MUI_FINISHPAGE_NOAUTOCLOSE
175 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
176 !define MUI_FINISHPAGE_RUN
177 !define MUI_FINISHPAGE_RUN_FUNCTION RunAppFunction
178 !define MUI_FINISHPAGE_SHOWREADME
179 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadmeFunction
180 !define MUI_FINISHPAGE_LINK ${MyWebSite}
181 !define MUI_FINISHPAGE_LINK_LOCATION ${MyWebSite}
182 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
183 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
184 !define MUI_WELCOMEFINISHPAGE_BITMAP "wizard.bmp"
185 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "wizard-un.bmp"
186 !define MUI_HEADERIMAGE
187 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
188 !define MUI_HEADERIMAGE_UNBITMAP "header-un.bmp"
189 !define MUI_LANGDLL_ALLLANGUAGES
190 !define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
191 !define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyGuiInit
192 !define MUI_LANGDLL_ALWAYSSHOW
195 ;--------------------------------
196 ;MUI2 Pages (Installer)
197 ;--------------------------------
200 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
201 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckForPreRelease
202 !define MUI_WELCOMEPAGE_TITLE_3LINES
203 !define MUI_FINISHPAGE_TITLE_3LINES
204 !insertmacro MUI_PAGE_WELCOME
207 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
208 !insertmacro MUI_PAGE_LICENSE "license.rtf"
211 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
212 !define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
213 !insertmacro MUI_PAGE_DIRECTORY
216 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
217 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
220 Page Custom LockedListShow
223 !insertmacro MUI_PAGE_INSTFILES
226 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
227 !insertmacro MUI_PAGE_FINISH
230 ;--------------------------------
231 ;MUI2 Pages (Uninstaller)
232 ;--------------------------------
235 !define MUI_WELCOMEPAGE_TITLE_3LINES
236 !define MUI_FINISHPAGE_TITLE_3LINES
237 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
238 !insertmacro MUI_UNPAGE_WELCOME
241 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
242 !insertmacro MUI_UNPAGE_CONFIRM
245 UninstPage Custom un.LockedListShow
248 !insertmacro MUI_UNPAGE_INSTFILES
251 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
252 !insertmacro MUI_UNPAGE_FINISH
255 ;--------------------------------
257 ;--------------------------------
259 !insertmacro MUI_LANGUAGE "English" ;first language is the default language
260 !insertmacro MUI_LANGUAGE "Bulgarian"
261 !insertmacro MUI_LANGUAGE "German"
262 !insertmacro MUI_LANGUAGE "Hungarian"
263 !insertmacro MUI_LANGUAGE "Japanese"
264 !insertmacro MUI_LANGUAGE "Polish"
265 !insertmacro MUI_LANGUAGE "Russian"
266 !insertmacro MUI_LANGUAGE "Spanish"
267 !insertmacro MUI_LANGUAGE "Ukrainian"
269 ; !insertmacro MUI_LANGUAGE "Afrikaans"
270 ; !insertmacro MUI_LANGUAGE "Arabic"
271 ; !insertmacro MUI_LANGUAGE "Dutch"
272 ; !insertmacro MUI_LANGUAGE "French"
273 ; !insertmacro MUI_LANGUAGE "Greek"
274 ; !insertmacro MUI_LANGUAGE "Indonesian"
275 ; !insertmacro MUI_LANGUAGE "Italian"
276 ; !insertmacro MUI_LANGUAGE "Malay"
277 ; !insertmacro MUI_LANGUAGE "Portuguese"
278 ; !insertmacro MUI_LANGUAGE "Romanian"
279 ; !insertmacro MUI_LANGUAGE "Serbian"
280 ; !insertmacro MUI_LANGUAGE "SerbianLatin"
281 ; !insertmacro MUI_LANGUAGE "SimpChinese"
282 ; !insertmacro MUI_LANGUAGE "SpanishInternational"
283 ; !insertmacro MUI_LANGUAGE "TradChinese"
286 ;--------------------------------
288 ;--------------------------------
291 !include "..\Translation\Blank.nsh" ;first language is the default language
294 !include "..\Translation\LameXP_BG.nsh"
297 !include "..\Translation\LameXP_DE.nsh"
300 !include "..\Translation\LameXP_HU.nsh"
303 !include "..\Translation\LameXP_JA.nsh"
306 !include "..\Translation\LameXP_PL.nsh"
309 !include "..\Translation\LameXP_RU.nsh"
312 !include "..\Translation\LameXP_ES.nsh"
315 !include "..\Translation\LameXP_UK.nsh"
318 ;--------------------------------
320 ;--------------------------------
322 !macro _UnattendedMode _a _b _t _f
323 !insertmacro _LOGICLIB_TEMP
324 ${StdUtils.TestParameter} $_LOGICLIB_TEMP "Update"
325 StrCmp "$_LOGICLIB_TEMP" "true" `${_t}` `${_f}`
327 !define UnattendedMode `"" UnattendedMode ""`
329 !macro _ForcedMode _a _b _t _f
330 !insertmacro _LOGICLIB_TEMP
331 ${StdUtils.TestParameter} $_LOGICLIB_TEMP "Force"
332 StrCmp "$_LOGICLIB_TEMP" "true" `${_t}` `${_f}`
334 !define ForcedMode `"" ForcedMode ""`
336 !macro _ValidFileName _a _b _t _f
337 !insertmacro _LOGICLIB_TEMP
338 ${StdUtils.ValidFileName} $_LOGICLIB_TEMP `${_b}`
339 StrCmp "$_LOGICLIB_TEMP" "ok" `${_t}` `${_f}`
341 !define ValidFileName `"" ValidFileName`
344 ;--------------------------------
345 ;Installer initialization
346 ;--------------------------------
353 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
356 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the installer is already running!"
362 # Running on Windows NT family?
364 MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does *not* support Windows 9x/ME!"
365 ExecShell "open" "http://windows.microsoft.com/"
369 # Running on Windows XP or later?
370 ${If} ${AtMostWin2000}
371 MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, but your operating system is *not* supported anymore.$\nInstallation will be aborted!$\n$\nThe minimum required platform is Windows XP (Service Pack 3)."
372 ExecShell "open" "http://windows.microsoft.com/"
376 # If on Windows XP, is the required Service Pack installed?
378 ${IfNot} ${RunningX64} # Windows XP 32-Bit, requires Service Pack 3
379 ${AndIf} ${AtMostServicePack} 2
380 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Service Pack 3 for Windows XP.$\nPlease install the required Service Pack and retry!"
383 ${If} ${RunningX64} # Windows XP 64-Bit, requires Service Pack 2
384 ${AndIf} ${AtMostServicePack} 1
385 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Service Pack 2 for Windows XP x64.$\nPlease install the required Service Pack and retry!"
388 ${IfNot} ${UnattendedMode}
389 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL|MB_DEFBUTTON2 "It appears that you are still running Windows XP, which reached $\"end of life$\" in April 2014 and therefore will not receive any updates or bug fixes anymore - not even for critical security vulnerabilities! We highly recommend updating to a contemporary operating system.$\n$\nClick 'OK' to proceed with the installation, or click 'Cancel' to abort." IDCANCEL`
395 # Running on Windows Vista?
397 ${If} ${AtMostServicePack} 1
398 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Service Pack 2 for Windows Vista.$\nPlease install the required Service Pack and retry!"
401 ${IfNot} ${UnattendedMode}
402 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL|MB_DEFBUTTON2 "It appears that you are still running Windows Vista, which reached $\"end of life$\" in April 2017 and therefore will not receive any updates or bug fixes anymore - not even for critical security vulnerabilities! We highly recommend updating to a contemporary operating system.$\n$\nClick 'OK' to proceed with the installation, or click 'Cancel' to abort." IDCANCEL`
410 ${IfNot} ${UnattendedMode}
411 !insertmacro MUI_LANGDLL_DISPLAY
416 UserInfo::GetAccountType
419 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
420 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
426 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
429 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the un-installer is already running!"
433 ${IfNot} ${ForcedMode}
434 !insertmacro MUI_LANGDLL_DISPLAY
439 UserInfo::GetAccountType
442 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
443 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
449 ;--------------------------------
451 ;--------------------------------
454 StrCpy $0 $HWNDPARENT
455 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
459 Function un.MyGuiInit
460 StrCpy $0 $HWNDPARENT
461 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
466 ;--------------------------------
467 ;Macros & Auxiliary Functions
468 ;--------------------------------
470 !macro PrintProgress Text
471 SetDetailsPrint textonly
472 DetailPrint '${Text}'
473 SetDetailsPrint listonly
477 !macro CreateWebLink ShortcutFile TargetURL
480 StrCpy $0 "${ShortcutFile}"
481 StrCpy $1 "${TargetURL}"
487 Function _CreateWebLink
489 SetFileAttributes "$0" FILE_ATTRIBUTE_NORMAL
490 DeleteINISec "$0" "DEFAULT"
491 DeleteINISec "$0" "InternetShortcut"
492 WriteINIStr "$0" "DEFAULT" "BASEURL" "$1"
493 WriteINIStr "$0" "InternetShortcut" "ORIGURL" "$1"
494 WriteINIStr "$0" "InternetShortcut" "URL" "$1"
495 WriteINIStr "$0" "InternetShortcut" "IconFile" "$SYSDIR\SHELL32.dll"
496 WriteINIStr "$0" "InternetShortcut" "IconIndex" "150"
498 SetFileAttributes "$0" FILE_ATTRIBUTE_READONLY
501 !macro GetExecutableName OutVar
502 ${StdUtils.GetParameter} ${OutVar} "Update" ""
503 ${StdUtils.TrimStr} ${OutVar}
504 ${If} "${OutVar}" == ""
505 ${OrIfNot} ${ValidFileName} "${OutVar}"
506 StrCpy ${OutVar} "LameXP.exe"
510 !macro DisableNextButton TmpVar
511 GetDlgItem ${TmpVar} $HWNDPARENT 1
512 EnableWindow ${TmpVar} 0
515 !macro DisableBackButton TmpVar
516 GetDlgItem ${TmpVar} $HWNDPARENT 3
517 EnableWindow ${TmpVar} 0
520 !macro CleanUpFiles options
521 Delete ${options} "$INSTDIR\Changelog.htm"
522 Delete ${options} "$INSTDIR\Changelog.html"
523 Delete ${options} "$INSTDIR\Contributors.txt"
524 Delete ${options} "$INSTDIR\Copying.txt"
525 Delete ${options} "$INSTDIR\FAQ.html"
526 Delete ${options} "$INSTDIR\Howto.html"
527 Delete ${options} "$INSTDIR\LameEnc.sys"
528 Delete ${options} "$INSTDIR\LameXP*.exe"
529 Delete ${options} "$INSTDIR\LameXP*.exe.sig"
530 Delete ${options} "$INSTDIR\LameXP*.rcc"
531 Delete ${options} "$INSTDIR\LameXP*.VisualElementsManifest.xml"
532 Delete ${options} "$INSTDIR\LameXP*.tag"
533 Delete ${options} "$INSTDIR\License.txt"
534 Delete ${options} "$INSTDIR\Manual.html"
535 Delete ${options} "$INSTDIR\Readme.htm"
536 Delete ${options} "$INSTDIR\Readme.html"
537 Delete ${options} "$INSTDIR\ReadMe.txt"
538 Delete ${options} "$INSTDIR\PRE_RELEASE_INFO.txt"
539 Delete ${options} "$INSTDIR\Settings.cfg"
540 Delete ${options} "$INSTDIR\Translate.html"
541 Delete ${options} "$INSTDIR\Uninstall.exe"
542 Delete ${options} "$INSTDIR\Qt*.dll"
543 Delete ${options} "$INSTDIR\MUtils*.dll"
544 Delete ${options} "$INSTDIR\msvcr*.dll"
545 Delete ${options} "$INSTDIR\msvcp*.dll"
546 Delete ${options} "$INSTDIR\concrt*.dll"
547 Delete ${options} "$INSTDIR\vcruntime*.dll"
548 Delete ${options} "$INSTDIR\vccorlib*.dll"
549 Delete ${options} "$INSTDIR\api-ms-*.dll"
550 Delete ${options} "$INSTDIR\ucrtbase.dll"
552 RMDir /r ${options} "$INSTDIR\cache"
553 RMDir /r ${options} "$INSTDIR\img"
554 RMDir /r ${options} "$INSTDIR\imageformats"
555 RMDir /r ${options} "$INSTDIR\redist"
558 !macro InstallRedist srcdir filename
559 File /a `/oname=$PLUGINSDIR\${filename}` `${srcdir}\${filename}`
560 ExecWait `"$PLUGINSDIR\${filename}" /passive`
563 ;--------------------------------
565 ;--------------------------------
568 SetShellVarContext all
569 SetOutPath "$INSTDIR"
572 Section "-Clean Up Old Cruft"
573 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_CLEANUP)"
574 !insertmacro CleanUpFiles ""
577 Section "!Install Files"
578 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_INSTFILES)"
581 !insertmacro GetExecutableName $R0
583 Delete "$INSTDIR\$R0"
586 MessageBox MB_TOPMOST|MB_ICONSTOP|MB_RETRYCANCEL 'Could not delete old "$R0" file. Is LameXP still running?' IDRETRY DeleteOldBinary
587 Abort "Could not delete old binary!"
590 File /a `/oname=$R0` `${LAMEXP_SOURCE_PATH}\LameXP.exe`
591 File /nonfatal /a /r `${LAMEXP_SOURCE_PATH}\*.dll`
592 File /nonfatal /a /r `${LAMEXP_SOURCE_PATH}\*.rcc`
594 ${StdUtils.GetFileNamePart} $R1 "$R0"
595 File /a `/oname=$R1.VisualElementsManifest.xml` `${LAMEXP_SOURCE_PATH}\LameXP.VisualElementsManifest.xml`
596 File /a `/oname=$R1.tag` `${LAMEXP_SOURCE_PATH}\LameXP.tag`
598 File /a /r `${LAMEXP_SOURCE_PATH}\*.txt`
599 File /a /r `${LAMEXP_SOURCE_PATH}\*.html`
600 File /a /r `${LAMEXP_SOURCE_PATH}\*.png`
603 Section "-Write Uninstaller"
604 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_MAKEUNINST)"
605 WriteUninstaller "$INSTDIR\Uninstall.exe"
608 Section "-Install Runtime Libraries"
610 ${AndIfNot} ${FileExists} `$SYSDIR\normaliz.dll`
611 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_VCREDIST)"
613 !insertmacro InstallRedist '${PrerequisitesDir}\IDNMInstaller' 'idndl.x64.exe'
615 !insertmacro InstallRedist '${PrerequisitesDir}\IDNMInstaller' 'idndl.x86.exe'
620 Section "-Create Shortcuts"
621 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
622 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_SHORTCUTS)"
623 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
625 SetShellVarContext current
627 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
628 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
629 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
631 SetShellVarContext all
633 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
634 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
635 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
637 !insertmacro GetExecutableName $R0
639 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" "$INSTDIR\$R0" "" "$INSTDIR\$R0" 0
640 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_LICENSE).lnk" "$INSTDIR\License.txt"
641 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_CHANGELOG).lnk" "$INSTDIR\Changelog.html"
642 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_TRANSLATE).lnk" "$INSTDIR\Translate.html"
643 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_MANUAL).lnk" "$INSTDIR\Manual.html"
644 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_UNINSTALL).lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
646 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Official LameXP Homepage.url" "${MyWebSite}"
647 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Doom9's Forum.url" "http://forum.doom9.org/"
648 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Bug Tracker.url" "https://github.com/lordmulder/LameXP/issues"
649 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\RareWares.org.url" "http://rarewares.org/"
650 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Hydrogenaudio Forums.url" "http://www.hydrogenaudio.org/"
652 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
653 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ShellVerb.PinToTaskbar}
654 DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
656 !insertmacro MUI_STARTMENU_WRITE_END
659 Section "-Update Registry"
660 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_REGISTRY)"
662 !insertmacro GetExecutableName $R0
663 WriteRegStr HKLM "${MyRegPath}" "InstallLocation" "$INSTDIR"
664 WriteRegStr HKLM "${MyRegPath}" "ExecutableName" "$R0"
665 WriteRegStr HKLM "${MyRegPath}" "DisplayIcon" "$INSTDIR\$R0,0"
666 WriteRegStr HKLM "${MyRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
667 WriteRegStr HKLM "${MyRegPath}" "DisplayName" "LameXP v${LAMEXP_VERSION}"
668 WriteRegStr HKLM "${MyRegPath}" "Publisher" "LoRd_MuldeR <mulder2@gmx.de>"
669 WriteRegStr HKLM "${MyRegPath}" "DisplayVersion" "${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
670 WriteRegStr HKLM "${MyRegPath}" "URLInfoAbout" "${MyWebSite}"
671 WriteRegStr HKLM "${MyRegPath}" "URLUpdateInfo" "${MyWebSite}"
673 DeleteRegKey HKCU "${AppPaths}\LameXP.exe"
674 WriteRegStr HKLM "${AppPaths}\LameXP.exe" "" "$INSTDIR\$R0"
675 WriteRegStr HKLM "${AppPaths}\LameXP.exe" "Path" "$INSTDIR"
679 !insertmacro PrintProgress "$(MUI_TEXT_FINISH_TITLE)."
681 !ifdef LAMEXP_IS_PRERELEASE
682 ${If} ${FileExists} "$INSTDIR\PRE_RELEASE_INFO.txt"
683 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\PRE_RELEASE_INFO.txt" "open" ""
687 ${IfThen} ${UnattendedMode} ${|} SetAutoClose true ${|}
691 ;--------------------------------
693 ;--------------------------------
697 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_UNINSTALL)"
703 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
704 ${IfNot} "$StartMenuFolder" == ""
705 SetShellVarContext current
706 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
707 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ShellVerb.UnpinFromTaskbar}
708 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
710 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
711 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
712 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
713 RMDir "$SMPROGRAMS\$StartMenuFolder"
716 SetShellVarContext all
717 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
718 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ShellVerb.UnpinFromTaskbar}
719 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
721 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
722 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
723 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
724 RMDir "$SMPROGRAMS\$StartMenuFolder"
732 ReadRegStr $R0 HKLM "${MyRegPath}" "ExecutableName"
733 ${IfThen} "$R0" == "" ${|} StrCpy $R0 "LameXP.exe" ${|}
734 ExecWait '"$INSTDIR\$R0" --uninstall'
736 Delete /REBOOTOK "$INSTDIR\$R0"
737 !insertmacro CleanUpFiles /REBOOTOK
744 DeleteRegKey HKLM "${MyRegPath}"
745 DeleteRegKey HKCU "${MyRegPath}"
747 DeleteRegKey HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
748 DeleteRegKey HKCU "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
750 DeleteRegKey HKLM "${AppPaths}\LameXP.exe"
751 DeleteRegKey HKCU "${AppPaths}\LameXP.exe"
753 MessageBox MB_YESNO|MB_TOPMOST "$(LAMEXP_LANG_UNINST_PERSONAL)" IDNO +3
754 Delete "$LOCALAPPDATA\LoRd_MuldeR\LameXP - Audio Encoder Front-End\config.ini"
755 Delete "$INSTDIR\*.ini"
757 !insertmacro PrintProgress "$(MUI_UNTEXT_FINISH_TITLE)."
761 ;--------------------------------
762 ;Check For Update Mode
763 ;--------------------------------
765 Function SkipIfUnattended
766 ${IfThen} ${UnattendedMode} ${|} Abort ${|}
769 Function CheckForUpdate
770 ${If} "$INSTDIR" == ""
771 ${OrIf} "$INSTDIR" == "$EXEDIR"
772 ${OrIfNot} ${FileExists} "$INSTDIR\LameXP.exe"
776 FindWindow $R0 "#32770" "" $HWNDPARENT
777 GetDlgItem $R1 $R0 1019
780 FindWindow $R0 "#32770" "" $HWNDPARENT
781 GetDlgItem $R1 $R0 1001
785 Function un.CheckForcedUninstall
786 ${IfThen} ${ForcedMode} ${|} Abort ${|}
790 ;--------------------------------
791 ;Check For Pre-Release
792 ;--------------------------------
794 Function CheckForPreRelease
795 !ifdef LAMEXP_IS_PRERELEASE
796 ${IfNot} ${UnattendedMode}
797 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(LAMEXP_LANG_PRERELEASE_WARNING)" /SD IDOK IDOK +2
804 ;--------------------------------
806 ;--------------------------------
808 !macro _LockedListShow uinst
809 !insertmacro MUI_HEADER_TEXT "$(LAMEXP_LANG_LOCKEDLIST_HEADER)" "$(LAMEXP_LANG_LOCKEDLIST_TEXT)"
810 ${If} ${UnattendedMode}
811 !insertmacro DisableBackButton $R0
815 File /oname=$PLUGINSDIR\LockedList64.dll `${NSISDIR}\Plugins\LockedList64.dll`
817 !insertmacro GetExecutableName $R0
818 LockedList::AddModule "\$R0"
819 ${If} "$R0" != "LameXP.exe"
820 LockedList::AddModule "\LameXP.exe"
822 LockedList::AddModule "\Uninstall.exe"
824 LockedList::AddModule "\Au_.exe"
826 #LockedList::AddFolder "$INSTDIR"
827 LockedList::Dialog /autonext /heading "$(LAMEXP_LANG_LOCKEDLIST_HEADING)" /noprograms "$(LAMEXP_LANG_LOCKEDLIST_NOPROG)" /searching "$(LAMEXP_LANG_LOCKEDLIST_SEARCH)" /colheadings "$(LAMEXP_LANG_LOCKEDLIST_COLHDR1)" "$(LAMEXP_LANG_LOCKEDLIST_COLHDR2)"
831 Function LockedListShow
832 !insertmacro _LockedListShow 0
835 Function un.LockedListShow
836 !insertmacro _LockedListShow 1
840 ;--------------------------------
842 ;--------------------------------
844 Function RunAppFunction
845 !insertmacro DisableNextButton $R0
846 !insertmacro GetExecutableName $R0
847 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR" "explore" ""
848 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
851 Function ShowReadmeFunction
852 !insertmacro DisableNextButton $R0
853 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\Manual.html" "open" ""
856 Function .onInstSuccess
857 ${If} ${UnattendedMode}
858 !insertmacro GetExecutableName $R0
859 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"