Some installer updates, especially for /UPDATE mode.
[LameXP.git] / etc / NSIS / setup.nsi
blob4d656873bca94993b10916f1518ae644fbd5040a
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // LameXP - Audio Encoder Front-End
3 ; // Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
4 ; //
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.
9 ; //
10 ; // This program is distributed in the hope that it will be useful,
11 ; // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; // GNU General Public License for more details.
14 ; //
15 ; // You should have received a copy of the GNU General Public License along
16 ; // with this program; if not, write to the Free Software Foundation, Inc.,
17 ; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 ; //
19 ; // http://www.gnu.org/licenses/gpl-2.0.txt
20 ; ///////////////////////////////////////////////////////////////////////////////
23 ;--------------------------------
24 ;Basic Defines
25 ;--------------------------------
27 !ifndef NSIS_UNICODE
28 !error "NSIS_UNICODE is undefined, please compile with Unicode NSIS !!!"
29 !endif
31 !ifndef LAMEXP_VERSION
32 !error "LAMEXP_VERSION is not defined !!!"
33 !endif
34 !ifndef LAMEXP_BUILD
35 !error "LAMEXP_BUILD is not defined !!!"
36 !endif
37 !ifndef LAMEXP_INSTTYPE
38 !error "LAMEXP_INSTTYPE is not defined !!!"
39 !endif
40 !ifndef LAMEXP_PATCH
41 !error "LAMEXP_PATCH is not defined !!!"
42 !endif
43 !ifndef LAMEXP_DATE
44 !error "LAMEXP_DATE is not defined !!!"
45 !endif
46 !ifndef LAMEXP_OUTPUT_FILE
47 !error "LAMEXP_OUTPUT_FILE is not defined !!!"
48 !endif
49 !ifndef LAMEXP_SOURCE_PATH
50 !error "LAMEXP_SOURCE_PATH is not defined !!!"
51 !endif
52 !ifndef LAMEXP_UPX_PATH
53 !error "LAMEXP_UPX_PATH is not defined !!!"
54 !endif
56 ;UUID
57 !define MyRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FBD7A67D-D700-4043-B54F-DD106D00F308}"
59 ;App Paths
60 !define AppPaths "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"
62 ;Web-Site
63 !define MyWebSite "http://muldersoft.com/"
66 ;--------------------------------
67 ;Check for Pre-Release
68 ;--------------------------------
70 !define LAMEXP_IS_PRERELEASE
72 !if '${LAMEXP_INSTTYPE}' == 'Final'
73 !undef LAMEXP_IS_PRERELEASE
74 !endif
75 !if '${LAMEXP_INSTTYPE}' == 'Hotfix'
76 !undef LAMEXP_IS_PRERELEASE
77 !endif
80 ;--------------------------------
81 ;Includes
82 ;--------------------------------
84 !include `MUI2.nsh`
85 !include `WinVer.nsh`
86 !include `x64.nsh`
87 !include `StdUtils.nsh`
90 ;--------------------------------
91 ;Installer Attributes
92 ;--------------------------------
94 RequestExecutionLevel admin
95 ShowInstDetails show
96 ShowUninstDetails show
97 Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
98 OutFile "${LAMEXP_OUTPUT_FILE}"
99 BrandingText "Date created: ${LAMEXP_DATE} [Build #${LAMEXP_BUILD}]"
100 InstallDir "$PROGRAMFILES\MuldeR\LameXP v${LAMEXP_VERSION}"
101 InstallDirRegKey HKLM "${MyRegPath}" "InstallLocation"
104 ;--------------------------------
105 ;Compressor
106 ;--------------------------------
108 SetCompressor /SOLID LZMA
109 SetCompressorDictSize 64
111 !packhdr "$%TEMP%\exehead.tmp" '"${LAMEXP_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
114 ;--------------------------------
115 ;Reserved Files
116 ;--------------------------------
118 ReserveFile "${NSISDIR}\Plugins\Aero.dll"
119 ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
120 ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
121 ReserveFile "${NSISDIR}\Plugins\LockedList64.dll"
122 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
123 ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
124 ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
125 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
126 ReserveFile "${NSISDIR}\Plugins\System.dll"
127 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
128 ReserveFile "checkproc.exe"
131 ;--------------------------------
132 ;Variables
133 ;--------------------------------
135 Var StartMenuFolder
138 ;--------------------------------
139 ;Version Info
140 ;--------------------------------
142 !searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
143 VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
145 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
146 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."
147 VIAddVersionKey "CompanyName" "Free Software Foundation"
148 VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
149 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
150 VIAddVersionKey "LegalCopyright" "Copyright 2004-2015 LoRd_MuldeR"
151 VIAddVersionKey "LegalTrademarks" "GNU"
152 VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.exe"
153 VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
154 VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
155 VIAddVersionKey "Website" "${MyWebSite}"
158 ;--------------------------------
159 ;MUI2 Interface Settings
160 ;--------------------------------
162 !define MUI_ABORTWARNING
163 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
164 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${MyRegPath}"
165 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartmenuFolder"
166 !define MUI_LANGDLL_REGISTRY_ROOT HKLM
167 !define MUI_LANGDLL_REGISTRY_KEY "${MyRegPath}"
168 !define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
169 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LameXP v${LAMEXP_VERSION}"
170 !define MUI_FINISHPAGE_NOAUTOCLOSE
171 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
172 !define MUI_FINISHPAGE_RUN
173 !define MUI_FINISHPAGE_RUN_FUNCTION RunAppFunction
174 !define MUI_FINISHPAGE_SHOWREADME
175 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadmeFunction
176 !define MUI_FINISHPAGE_LINK ${MyWebSite}
177 !define MUI_FINISHPAGE_LINK_LOCATION ${MyWebSite}
178 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
179 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
180 !define MUI_WELCOMEFINISHPAGE_BITMAP "wizard.bmp"
181 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "wizard-un.bmp"
182 !define MUI_HEADERIMAGE
183 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
184 !define MUI_HEADERIMAGE_UNBITMAP "header-un.bmp"
185 !define MUI_LANGDLL_ALLLANGUAGES
186 !define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
187 !define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyGuiInit
188 !define MUI_LANGDLL_ALWAYSSHOW
191 ;--------------------------------
192 ;MUI2 Pages (Installer)
193 ;--------------------------------
195 ;Welcome
196 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUpdate
197 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckForPreRelease
198 !define MUI_WELCOMEPAGE_TITLE_3LINES
199 !define MUI_FINISHPAGE_TITLE_3LINES
200 !insertmacro MUI_PAGE_WELCOME
202 ;License
203 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUpdate
204 !insertmacro MUI_PAGE_LICENSE "license.rtf"
206 ;Directory
207 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUpdate
208 !define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
209 !insertmacro MUI_PAGE_DIRECTORY
211 ;Startmenu
212 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUpdate
213 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
215 ;LockedList
216 Page Custom LockedListShow
218 ;Install Files
219 !insertmacro MUI_PAGE_INSTFILES
221 ;Finish
222 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUpdate
223 !insertmacro MUI_PAGE_FINISH
226 ;--------------------------------
227 ;MUI2 Pages (Uninstaller)
228 ;--------------------------------
230 ;Welcome
231 !define MUI_WELCOMEPAGE_TITLE_3LINES
232 !define MUI_FINISHPAGE_TITLE_3LINES
233 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
234 !insertmacro MUI_UNPAGE_WELCOME
236 ;Confirm
237 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
238 !insertmacro MUI_UNPAGE_CONFIRM
240 ;LockedList
241 UninstPage Custom un.LockedListShow
243 ;Uninstall
244 !insertmacro MUI_UNPAGE_INSTFILES
246 ;Finish
247 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
248 !insertmacro MUI_UNPAGE_FINISH
251 ;--------------------------------
252 ;Languages
253 ;--------------------------------
255 !insertmacro MUI_LANGUAGE "English" ;first language is the default language
256 !insertmacro MUI_LANGUAGE "German"
257 !insertmacro MUI_LANGUAGE "Spanish"
258 !insertmacro MUI_LANGUAGE "Russian"
259 !insertmacro MUI_LANGUAGE "Ukrainian"
260 !insertmacro MUI_LANGUAGE "Polish"
261 !insertmacro MUI_LANGUAGE "Hungarian"
263 ; !insertmacro MUI_LANGUAGE "French"
264 ; !insertmacro MUI_LANGUAGE "SpanishInternational"
265 ; !insertmacro MUI_LANGUAGE "SimpChinese"
266 ; !insertmacro MUI_LANGUAGE "TradChinese"
267 ; !insertmacro MUI_LANGUAGE "Japanese"
268 ; !insertmacro MUI_LANGUAGE "Italian"
269 ; !insertmacro MUI_LANGUAGE "Dutch"
270 ; !insertmacro MUI_LANGUAGE "Greek"
271 ; !insertmacro MUI_LANGUAGE "Romanian"
272 ; !insertmacro MUI_LANGUAGE "Serbian"
273 ; !insertmacro MUI_LANGUAGE "SerbianLatin"
274 ; !insertmacro MUI_LANGUAGE "Arabic"
275 ; !insertmacro MUI_LANGUAGE "Portuguese"
276 ; !insertmacro MUI_LANGUAGE "Afrikaans"
277 ; !insertmacro MUI_LANGUAGE "Malay"
278 ; !insertmacro MUI_LANGUAGE "Indonesian"
281 ;--------------------------------
282 ;Translation
283 ;--------------------------------
285 ;English
286 !include "..\Translation\Blank.nsh"
288 ;German
289 !include "..\Translation\LameXP_DE.nsh"
291 ;Spanish
292 !include "..\Translation\LameXP_ES.nsh"
294 ;Russian
295 !include "..\Translation\LameXP_RU.nsh"
297 ;Ukrainian
298 !include "..\Translation\LameXP_UK.nsh"
300 ;Polish
301 !include "..\Translation\LameXP_PL.nsh"
303 ;Hungarian
304 !include "..\Translation\LameXP_HU.nsh"
307 ;--------------------------------
308 ;Installer initialization
309 ;--------------------------------
311 Function .onInit
312 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
313 Pop $0
314 ${If} $0 <> 0
315 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the installer is already running!"
316 Quit
317 ${EndIf}
319 ; --------
321 # Running on Windows NT family?
322 ${IfNot} ${IsNT}
323 MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does *not* support Windows 9x or Windows ME!"
324 ExecShell "open" "http://windows.microsoft.com/"
325 Quit
326 ${EndIf}
328 # Running on Windows XP or later?
329 ${If} ${AtMostWin2000}
330 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)."
331 ExecShell "open" "http://windows.microsoft.com/"
332 Quit
333 ${EndIf}
335 # If on Windows XP, is the required Service Pack installed?
336 ${If} ${IsWinXP}
337 ${IfNot} ${RunningX64} # Windows XP 32-Bit, requires Service Pack 3
338 ${AndIf} ${AtMostServicePack} 2
339 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Windows XP with Service Pack 3 installed!"
340 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 3 for Windows XP now?" IDYES`
341 ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=24"
342 ${Else}
343 ExecShell "open" "http://windowsupdate.microsoft.com/"
344 ${EndIf}
345 Quit
346 ${EndIf}
347 ${If} ${RunningX64} # Windows XP 64-Bit, requires Service Pack 2
348 ${AndIf} ${AtMostServicePack} 1
349 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Windows XP x64 Edition with Service Pack 2 installed!"
350 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 2 for Windows XP x64 Edition now?" IDYES`
351 ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=17791"
352 ${Else}
353 ExecShell "open" "http://windowsupdate.microsoft.com/"
354 ${EndIf}
355 Quit
356 ${EndIf}
357 ${EndIf}
359 ; --------
361 ${StdUtils.GetParameter} $R0 "Update" "?#@"
362 ${If} "$R0" == "?#@"
363 !insertmacro MUI_LANGDLL_DISPLAY
364 ${EndIf}
366 ; --------
368 UserInfo::GetAccountType
369 Pop $0
370 ${If} $0 != "Admin"
371 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
372 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
373 Quit
374 ${EndIf}
376 ; --------
378 InitPluginsDir
379 File "/oname=$PLUGINSDIR\checkproc.exe" "checkproc.exe"
380 nsExec::Exec /TIMEOUT=5000 '"$PLUGINSDIR\checkproc.exe" Softonic Brothersoft Afreecodec'
381 Pop $0
382 FunctionEnd
384 Function un.onInit
385 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
386 Pop $0
387 ${If} $0 <> 0
388 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the un-installer is already running!"
389 Quit
390 ${EndIf}
392 ${StdUtils.GetParameter} $R0 "Force" "?"
393 ${If} "$R0" == "?"
394 !insertmacro MUI_LANGDLL_DISPLAY
395 ${EndIf}
397 ; --------
399 UserInfo::GetAccountType
400 Pop $0
401 ${If} $0 != "Admin"
402 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
403 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
404 Quit
405 ${EndIf}
406 FunctionEnd
409 ;--------------------------------
410 ;GUI initialization
411 ;--------------------------------
413 Function MyGuiInit
414 StrCpy $0 $HWNDPARENT
415 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
416 Aero::Apply
417 FunctionEnd
419 Function un.MyGuiInit
420 StrCpy $0 $HWNDPARENT
421 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
422 Aero::Apply
423 FunctionEnd
426 ;--------------------------------
427 ;Macros & Auxiliary Functions
428 ;--------------------------------
430 !macro PrintProgress Text
431 SetDetailsPrint textonly
432 DetailPrint '${Text}'
433 SetDetailsPrint listonly
434 Sleep 1000
435 !macroend
437 !macro CreateWebLink ShortcutFile TargetURL
438 Push $0
439 Push $1
440 StrCpy $0 "${ShortcutFile}"
441 StrCpy $1 "${TargetURL}"
442 Call _CreateWebLink
443 Pop $1
444 Pop $0
445 !macroend
447 Function _CreateWebLink
448 FlushINI "$0"
449 SetFileAttributes "$0" FILE_ATTRIBUTE_NORMAL
450 DeleteINISec "$0" "DEFAULT"
451 DeleteINISec "$0" "InternetShortcut"
452 WriteINIStr "$0" "DEFAULT" "BASEURL" "$1"
453 WriteINIStr "$0" "InternetShortcut" "ORIGURL" "$1"
454 WriteINIStr "$0" "InternetShortcut" "URL" "$1"
455 WriteINIStr "$0" "InternetShortcut" "IconFile" "$SYSDIR\SHELL32.dll"
456 WriteINIStr "$0" "InternetShortcut" "IconIndex" "150"
457 FlushINI "$0"
458 SetFileAttributes "$0" FILE_ATTRIBUTE_READONLY
459 FunctionEnd
461 !macro GetExecutableName OutVar
462 ${StdUtils.GetParameter} ${OutVar} "Update" ""
463 ${StdUtils.TrimStr} ${OutVar}
464 ${IfThen} "${OutVar}" == "" ${|} StrCpy ${OutVar} "LameXP.exe" ${|}
465 !macroend
467 !macro DisableNextButton TmpVar
468 GetDlgItem ${TmpVar} $HWNDPARENT 1
469 EnableWindow ${TmpVar} 0
470 !macroend
473 ;--------------------------------
474 ;Install Files
475 ;--------------------------------
477 Section "-PreInit"
478 SetShellVarContext all
479 SetOutPath "$INSTDIR"
480 SectionEnd
482 Section "!Install Files"
483 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_INSTFILES)"
485 Delete "$INSTDIR\Changelog.htm"
486 Delete "$INSTDIR\Changelog.html"
487 Delete "$INSTDIR\Contributors.txt"
488 Delete "$INSTDIR\Copying.txt"
489 Delete "$INSTDIR\FAQ.html"
490 Delete "$INSTDIR\Howto.html"
491 Delete "$INSTDIR\LameEnc.sys"
492 Delete "$INSTDIR\LameXP.exe"
493 Delete "$INSTDIR\LameXP.exe.sig"
494 Delete "$INSTDIR\LameXP-Portable.exe"
495 Delete "$INSTDIR\License.txt"
496 Delete "$INSTDIR\Manual.html"
497 Delete "$INSTDIR\Readme.htm"
498 Delete "$INSTDIR\ReadMe.txt"
499 Delete "$INSTDIR\PRE_RELEASE_INFO.txt"
500 Delete "$INSTDIR\Settings.cfg"
501 Delete "$INSTDIR\Translate.html"
502 Delete "$INSTDIR\Uninstall.exe"
503 RMDir /r "$INSTDIR\img"
505 !insertmacro GetExecutableName $R0
507 DeleteOldBinary:
508 ClearErrors
509 Delete "$INSTDIR\$R0"
511 ${If} ${Errors}
512 MessageBox MB_TOPMOST|MB_ICONSTOP|MB_RETRYCANCEL 'Could not delete old "$R0" file. Is LameXP still running?' IDRETRY DeleteOldBinary
513 Abort "Could not delete old binary!"
514 ${EndIf}
516 File /a `/oname=$R0` `${LAMEXP_SOURCE_PATH}\LameXP.exe`
518 File /a /r `${LAMEXP_SOURCE_PATH}\*.txt`
519 File /a /r `${LAMEXP_SOURCE_PATH}\*.html`
520 File /a /r `${LAMEXP_SOURCE_PATH}\*.png`
521 SectionEnd
523 Section "-Write Uinstaller"
524 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_MAKEUNINST)"
525 WriteUninstaller "$INSTDIR\Uninstall.exe"
526 SectionEnd
528 Section "-Create Shortcuts"
529 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
530 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_SHORTCUTS)"
531 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
533 SetShellVarContext current
535 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
536 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
537 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
539 SetShellVarContext all
541 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
542 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
543 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
545 !insertmacro GetExecutableName $R0
547 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" "$INSTDIR\$R0" "" "$INSTDIR\$R0" 0
548 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_LICENSE).lnk" "$INSTDIR\License.txt"
549 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_CHANGELOG).lnk" "$INSTDIR\Changelog.html"
550 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_TRANSLATE).lnk" "$INSTDIR\Translate.html"
551 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_MANUAL).lnk" "$INSTDIR\Manual.html"
552 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_UNINSTALL).lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
554 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Official LameXP Homepage.url" "${MyWebSite}"
555 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Doom9's Forum.url" "http://forum.doom9.org/"
556 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Bug Tracker.url" "https://github.com/lordmulder/LameXP/issues"
557 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\RareWares.org.url" "http://rarewares.org/"
558 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Hydrogenaudio Forums.url" "http://www.hydrogenaudio.org/"
560 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
561 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
562 DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
563 ${EndIf}
564 !insertmacro MUI_STARTMENU_WRITE_END
565 SectionEnd
567 Section "-Update Registry"
568 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_REGISTRY)"
570 !insertmacro GetExecutableName $R0
571 WriteRegStr HKLM "${MyRegPath}" "InstallLocation" "$INSTDIR"
572 WriteRegStr HKLM "${MyRegPath}" "ExecutableName" "$R0"
573 WriteRegStr HKLM "${MyRegPath}" "DisplayIcon" "$INSTDIR\$R0,0"
574 WriteRegStr HKLM "${MyRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
575 WriteRegStr HKLM "${MyRegPath}" "DisplayName" "LameXP v${LAMEXP_VERSION}"
576 WriteRegStr HKLM "${MyRegPath}" "Publisher" "LoRd_MuldeR <mulder2@gmx.de>"
577 WriteRegStr HKLM "${MyRegPath}" "DisplayVersion" "${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
578 WriteRegStr HKLM "${MyRegPath}" "URLInfoAbout" "${MyWebSite}"
579 WriteRegStr HKLM "${MyRegPath}" "URLUpdateInfo" "${MyWebSite}"
581 WriteRegStr HKLM "${AppPaths}\LameXP.exe" "" "$INSTDIR\$R0"
582 WriteRegStr HKLM "${AppPaths}\LameXP.exe" "Path" "$INSTDIR"
583 SectionEnd
585 Section "-Finished"
586 !insertmacro PrintProgress "$(MUI_TEXT_FINISH_TITLE)."
588 !ifdef LAMEXP_IS_PRERELEASE
589 ${If} ${FileExists} "$INSTDIR\PRE_RELEASE_INFO.txt"
590 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\PRE_RELEASE_INFO.txt" "open" ""
591 ${EndIf}
592 !endif
594 ${StdUtils.GetParameter} $R0 "Update" "?#@"
595 ${IfNotThen} "$R0" == "?#@" ${|} SetAutoClose true ${|}
596 SectionEnd
599 ;--------------------------------
600 ;Uninstaller
601 ;--------------------------------
603 Section "Uninstall"
604 SetOutPath "$EXEDIR"
605 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_UNINSTALL)"
607 ; --------------
608 ; Startmenu
609 ; --------------
611 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
612 ${IfNot} "$StartMenuFolder" == ""
613 SetShellVarContext current
614 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
615 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
616 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
617 ${EndIf}
618 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
619 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
620 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
621 RMDir "$SMPROGRAMS\$StartMenuFolder"
622 ${EndIf}
624 SetShellVarContext all
625 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
626 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
627 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
628 ${EndIf}
629 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
630 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
631 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
632 RMDir "$SMPROGRAMS\$StartMenuFolder"
633 ${EndIf}
634 ${EndIf}
636 ; --------------
637 ; Files
638 ; --------------
640 ReadRegStr $R0 HKLM "${MyRegPath}" "ExecutableName"
641 ${IfThen} "$R0" == "" ${|} StrCpy $R0 "LameXP.exe" ${|}
643 Delete /REBOOTOK "$INSTDIR\LameXP.exe"
644 Delete /REBOOTOK "$INSTDIR\$R0"
645 Delete /REBOOTOK "$INSTDIR\LameXP-Portable.exe"
646 Delete /REBOOTOK "$INSTDIR\LameXP.exe.sig"
647 Delete /REBOOTOK "$INSTDIR\LameXP*"
649 Delete /REBOOTOK "$INSTDIR\Changelog.htm"
650 Delete /REBOOTOK "$INSTDIR\Changelog.html"
651 Delete /REBOOTOK "$INSTDIR\Contributors.txt"
652 Delete /REBOOTOK "$INSTDIR\Copying.txt"
653 Delete /REBOOTOK "$INSTDIR\FAQ.html"
654 Delete /REBOOTOK "$INSTDIR\Howto.html"
655 Delete /REBOOTOK "$INSTDIR\LameEnc.sys"
656 Delete /REBOOTOK "$INSTDIR\License.txt"
657 Delete /REBOOTOK "$INSTDIR\Manual.html"
658 Delete /REBOOTOK "$INSTDIR\Readme.htm"
659 Delete /REBOOTOK "$INSTDIR\ReadMe.txt"
660 Delete /REBOOTOK "$INSTDIR\PRE_RELEASE_INFO.txt"
661 Delete /REBOOTOK "$INSTDIR\Settings.cfg"
662 Delete /REBOOTOK "$INSTDIR\Translate.html"
663 Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
665 RMDir /r "$INSTDIR\img"
666 RMDir "$INSTDIR"
668 ; --------------
669 ; Registry
670 ; --------------
672 DeleteRegKey HKLM "${MyRegPath}"
673 DeleteRegKey HKCU "${MyRegPath}"
675 DeleteRegKey HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
676 DeleteRegKey HKCU "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
678 DeleteRegKey HKLM "${AppPaths}\LameXP.exe"
679 DeleteRegKey HKCU "${AppPaths}\LameXP.exe"
681 MessageBox MB_YESNO|MB_TOPMOST "$(LAMEXP_LANG_UNINST_PERSONAL)" IDNO +3
682 Delete "$LOCALAPPDATA\LoRd_MuldeR\LameXP - Audio Encoder Front-End\config.ini"
683 Delete "$INSTDIR\*.ini"
685 !insertmacro PrintProgress "$(MUI_UNTEXT_FINISH_TITLE)."
686 SectionEnd
689 ;--------------------------------
690 ;Check For Update Mode
691 ;--------------------------------
693 Function SkipIfUpdate
694 ${StdUtils.GetParameter} $R0 "Update" "?#@"
695 ${IfNotThen} "$R0" == "?#@" ${|} Abort ${|}
696 FunctionEnd
698 Function CheckForUpdate
699 ${If} "$INSTDIR" == ""
700 ${OrIf} "$INSTDIR" == "$EXEDIR"
701 ${OrIfNot} ${FileExists} "$INSTDIR\LameXP.exe"
702 Return
703 ${EndIf}
705 FindWindow $R0 "#32770" "" $HWNDPARENT
706 GetDlgItem $R1 $R0 1019
707 EnableWindow $R1 0
709 FindWindow $R0 "#32770" "" $HWNDPARENT
710 GetDlgItem $R1 $R0 1001
711 EnableWindow $R1 0
712 FunctionEnd
714 Function un.CheckForcedUninstall
715 ${StdUtils.GetParameter} $R0 "Force" "?#@"
716 ${IfNotThen} "$R0" == "?#@" ${|} Abort ${|}
717 FunctionEnd
720 ;--------------------------------
721 ;Check For Pre-Release
722 ;--------------------------------
724 Function CheckForPreRelease
725 !ifdef LAMEXP_IS_PRERELEASE
726 ${StdUtils.GetParameter} $R0 "Update" "?#@"
727 StrCmp $R0 "?#@" 0 SkipPrereleaseWarning
728 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(LAMEXP_LANG_PRERELEASE_WARNING)" /SD IDOK IDOK +2
729 Quit
730 SkipPrereleaseWarning:
731 !endif
732 FunctionEnd
735 ;--------------------------------
736 ;Locked List
737 ;--------------------------------
739 !macro _LockedListShow uinst
740 !insertmacro MUI_HEADER_TEXT "$(LAMEXP_LANG_LOCKEDLIST_HEADER)" "$(LAMEXP_LANG_LOCKEDLIST_TEXT)"
741 InitPluginsDir
742 ${If} ${RunningX64}
743 File /oname=$PLUGINSDIR\LockedList64.dll `${NSISDIR}\Plugins\LockedList64.dll`
744 ${EndIf}
745 !insertmacro GetExecutableName $R0
746 LockedList::AddFolder "$INSTDIR"
747 LockedList::AddModule "\$R0"
748 LockedList::AddModule "\Uninstall.exe"
749 !if ${uinst} < 1
750 LockedList::AddModule "\Au_.exe"
751 !endif
752 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)"
753 Pop $R0
754 !macroend
756 Function LockedListShow
757 !insertmacro _LockedListShow 0
758 FunctionEnd
760 Function un.LockedListShow
761 !insertmacro _LockedListShow 1
762 FunctionEnd
765 ;--------------------------------
766 ;Install Success
767 ;--------------------------------
769 Function RunAppFunction
770 !insertmacro DisableNextButton $R0
771 !insertmacro GetExecutableName $R0
772 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR" "explore" ""
773 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
774 FunctionEnd
776 Function ShowReadmeFunction
777 !insertmacro DisableNextButton $R0
778 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\Manual.html" "open" ""
779 FunctionEnd
781 Function .onInstSuccess
782 ${StdUtils.GetParameter} $R0 "Update" "?#@"
783 ${IfNot} "$R0" == "?#@"
784 !insertmacro GetExecutableName $R0
785 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
786 ${EndIf}
787 FunctionEnd