Manually add Windows 10 compat manifest to the installer, to make Aero plug-in work...
[LameXP.git] / etc / NSIS / setup.nsi
blob05c04cba55c4a8848a0c005aad26eb5bfa971ccd
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
55 !ifndef LAMEXP_REDIST
56 !error "LAMEXP_REDIST is not defined !!!"
57 !endif
59 ;UUID
60 !define MyRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FBD7A67D-D700-4043-B54F-DD106D00F308}"
62 ;App Paths
63 !define AppPaths "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"
65 ;Web-Site
66 !define MyWebSite "http://muldersoft.com/"
69 ;--------------------------------
70 ;Check for Pre-Release
71 ;--------------------------------
73 !define LAMEXP_IS_PRERELEASE
75 !if '${LAMEXP_INSTTYPE}' == 'Final'
76 !undef LAMEXP_IS_PRERELEASE
77 !endif
78 !if '${LAMEXP_INSTTYPE}' == 'Hotfix'
79 !undef LAMEXP_IS_PRERELEASE
80 !endif
83 ;--------------------------------
84 ;Manifest
85 ;--------------------------------
87 !packhdr "$%TEMP%\~exehead.tmp" `"..\Utilities\ResHacker.exe" -addoverwrite "$%TEMP%\~exehead.tmp", "$%TEMP%\~exehead.tmp", "setup.manifest", 24,1,1033`
89 !delfile "..\Utilities\ResHacker.log"
90 !delfile "..\Utilities\ResHacker.ini"
93 ;--------------------------------
94 ;Includes
95 ;--------------------------------
97 !include `MUI2.nsh`
98 !include `WinVer.nsh`
99 !include `x64.nsh`
100 !include `StdUtils.nsh`
103 ;--------------------------------
104 ;Installer Attributes
105 ;--------------------------------
107 RequestExecutionLevel admin
108 ShowInstDetails show
109 ShowUninstDetails show
110 Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
111 OutFile "${LAMEXP_OUTPUT_FILE}"
112 BrandingText "Date created: ${LAMEXP_DATE} [Build #${LAMEXP_BUILD}]"
113 InstallDir "$PROGRAMFILES\MuldeR\LameXP v${LAMEXP_VERSION}"
114 InstallDirRegKey HKLM "${MyRegPath}" "InstallLocation"
117 ;--------------------------------
118 ;Compressor
119 ;--------------------------------
121 SetCompressor /SOLID LZMA
122 SetCompressorDictSize 64
124 #!packhdr "$%TEMP%\exehead.tmp" '"${LAMEXP_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
127 ;--------------------------------
128 ;Reserved Files
129 ;--------------------------------
131 ReserveFile "${NSISDIR}\Plugins\Aero.dll"
132 ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
133 ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
134 ReserveFile "${NSISDIR}\Plugins\LockedList64.dll"
135 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
136 ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
137 ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
138 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
139 ReserveFile "${NSISDIR}\Plugins\System.dll"
140 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
143 ;--------------------------------
144 ;Variables
145 ;--------------------------------
147 Var StartMenuFolder
150 ;--------------------------------
151 ;Version Info
152 ;--------------------------------
154 !searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
155 VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
157 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
158 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."
159 VIAddVersionKey "CompanyName" "Free Software Foundation"
160 VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
161 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
162 VIAddVersionKey "LegalCopyright" "Copyright 2004-2015 LoRd_MuldeR"
163 VIAddVersionKey "LegalTrademarks" "GNU"
164 VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.exe"
165 VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
166 VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
167 VIAddVersionKey "Website" "${MyWebSite}"
170 ;--------------------------------
171 ;MUI2 Interface Settings
172 ;--------------------------------
174 !define MUI_ABORTWARNING
175 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
176 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${MyRegPath}"
177 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartmenuFolder"
178 !define MUI_LANGDLL_REGISTRY_ROOT HKLM
179 !define MUI_LANGDLL_REGISTRY_KEY "${MyRegPath}"
180 !define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
181 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LameXP v${LAMEXP_VERSION}"
182 !define MUI_FINISHPAGE_NOAUTOCLOSE
183 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
184 !define MUI_FINISHPAGE_RUN
185 !define MUI_FINISHPAGE_RUN_FUNCTION RunAppFunction
186 !define MUI_FINISHPAGE_SHOWREADME
187 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadmeFunction
188 !define MUI_FINISHPAGE_LINK ${MyWebSite}
189 !define MUI_FINISHPAGE_LINK_LOCATION ${MyWebSite}
190 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
191 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
192 !define MUI_WELCOMEFINISHPAGE_BITMAP "wizard.bmp"
193 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "wizard-un.bmp"
194 !define MUI_HEADERIMAGE
195 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
196 !define MUI_HEADERIMAGE_UNBITMAP "header-un.bmp"
197 !define MUI_LANGDLL_ALLLANGUAGES
198 !define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
199 !define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyGuiInit
200 !define MUI_LANGDLL_ALWAYSSHOW
203 ;--------------------------------
204 ;MUI2 Pages (Installer)
205 ;--------------------------------
207 ;Welcome
208 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
209 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckForPreRelease
210 !define MUI_WELCOMEPAGE_TITLE_3LINES
211 !define MUI_FINISHPAGE_TITLE_3LINES
212 !insertmacro MUI_PAGE_WELCOME
214 ;License
215 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
216 !insertmacro MUI_PAGE_LICENSE "license.rtf"
218 ;Directory
219 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
220 !define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
221 !insertmacro MUI_PAGE_DIRECTORY
223 ;Startmenu
224 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
225 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
227 ;LockedList
228 Page Custom LockedListShow
230 ;Install Files
231 !insertmacro MUI_PAGE_INSTFILES
233 ;Finish
234 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
235 !insertmacro MUI_PAGE_FINISH
238 ;--------------------------------
239 ;MUI2 Pages (Uninstaller)
240 ;--------------------------------
242 ;Welcome
243 !define MUI_WELCOMEPAGE_TITLE_3LINES
244 !define MUI_FINISHPAGE_TITLE_3LINES
245 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
246 !insertmacro MUI_UNPAGE_WELCOME
248 ;Confirm
249 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
250 !insertmacro MUI_UNPAGE_CONFIRM
252 ;LockedList
253 UninstPage Custom un.LockedListShow
255 ;Uninstall
256 !insertmacro MUI_UNPAGE_INSTFILES
258 ;Finish
259 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
260 !insertmacro MUI_UNPAGE_FINISH
263 ;--------------------------------
264 ;Languages
265 ;--------------------------------
267 !insertmacro MUI_LANGUAGE "English" ;first language is the default language
268 !insertmacro MUI_LANGUAGE "German"
269 !insertmacro MUI_LANGUAGE "Spanish"
270 !insertmacro MUI_LANGUAGE "Russian"
271 !insertmacro MUI_LANGUAGE "Ukrainian"
272 !insertmacro MUI_LANGUAGE "Polish"
273 !insertmacro MUI_LANGUAGE "Hungarian"
275 ; !insertmacro MUI_LANGUAGE "French"
276 ; !insertmacro MUI_LANGUAGE "SpanishInternational"
277 ; !insertmacro MUI_LANGUAGE "SimpChinese"
278 ; !insertmacro MUI_LANGUAGE "TradChinese"
279 ; !insertmacro MUI_LANGUAGE "Japanese"
280 ; !insertmacro MUI_LANGUAGE "Italian"
281 ; !insertmacro MUI_LANGUAGE "Dutch"
282 ; !insertmacro MUI_LANGUAGE "Greek"
283 ; !insertmacro MUI_LANGUAGE "Romanian"
284 ; !insertmacro MUI_LANGUAGE "Serbian"
285 ; !insertmacro MUI_LANGUAGE "SerbianLatin"
286 ; !insertmacro MUI_LANGUAGE "Arabic"
287 ; !insertmacro MUI_LANGUAGE "Portuguese"
288 ; !insertmacro MUI_LANGUAGE "Afrikaans"
289 ; !insertmacro MUI_LANGUAGE "Malay"
290 ; !insertmacro MUI_LANGUAGE "Indonesian"
293 ;--------------------------------
294 ;Translation
295 ;--------------------------------
297 ;English
298 !include "..\Translation\Blank.nsh"
300 ;German
301 !include "..\Translation\LameXP_DE.nsh"
303 ;Spanish
304 !include "..\Translation\LameXP_ES.nsh"
306 ;Russian
307 !include "..\Translation\LameXP_RU.nsh"
309 ;Ukrainian
310 !include "..\Translation\LameXP_UK.nsh"
312 ;Polish
313 !include "..\Translation\LameXP_PL.nsh"
315 ;Hungarian
316 !include "..\Translation\LameXP_HU.nsh"
319 ;--------------------------------
320 ;LogicLib Extensions
321 ;--------------------------------
323 !macro _UnattendedMode _a _b _t _f
324 !insertmacro _LOGICLIB_TEMP
325 ${StdUtils.TestParameter} $_LOGICLIB_TEMP "Update"
326 StrCmp "$_LOGICLIB_TEMP" "true" `${_t}` `${_f}`
327 !macroend
328 !define UnattendedMode `"" UnattendedMode ""`
330 !macro _ForcedMode _a _b _t _f
331 !insertmacro _LOGICLIB_TEMP
332 ${StdUtils.TestParameter} $_LOGICLIB_TEMP "Force"
333 StrCmp "$_LOGICLIB_TEMP" "true" `${_t}` `${_f}`
334 !macroend
335 !define ForcedMode `"" ForcedMode ""`
337 !macro _ValidFileName _a _b _t _f
338 !insertmacro _LOGICLIB_TEMP
339 ${StdUtils.ValidFileName} $_LOGICLIB_TEMP `${_b}`
340 StrCmp "$_LOGICLIB_TEMP" "ok" `${_t}` `${_f}`
341 !macroend
342 !define ValidFileName `"" ValidFileName`
345 ;--------------------------------
346 ;Installer initialization
347 ;--------------------------------
349 Function .onInit
350 InitPluginsDir
352 ; --------
354 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
355 Pop $0
356 ${If} $0 <> 0
357 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the installer is already running!"
358 Quit
359 ${EndIf}
361 ; --------
363 # Running on Windows NT family?
364 ${IfNot} ${IsNT}
365 MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does *not* support Windows 9x or Windows ME!"
366 ExecShell "open" "http://windows.microsoft.com/"
367 Quit
368 ${EndIf}
370 # Running on Windows XP or later?
371 ${If} ${AtMostWin2000}
372 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)."
373 ExecShell "open" "http://windows.microsoft.com/"
374 Quit
375 ${EndIf}
377 # If on Windows XP, is the required Service Pack installed?
378 ${If} ${IsWinXP}
379 ${IfNot} ${RunningX64} # Windows XP 32-Bit, requires Service Pack 3
380 ${AndIf} ${AtMostServicePack} 2
381 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Windows XP with Service Pack 3 installed!"
382 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 3 for Windows XP now?" IDYES`
383 ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=24"
384 ${Else}
385 ExecShell "open" "http://windowsupdate.microsoft.com/"
386 ${EndIf}
387 Quit
388 ${EndIf}
389 ${If} ${RunningX64} # Windows XP 64-Bit, requires Service Pack 2
390 ${AndIf} ${AtMostServicePack} 1
391 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Windows XP x64 Edition with Service Pack 2 installed!"
392 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 2 for Windows XP x64 Edition now?" IDYES`
393 ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=17791"
394 ${Else}
395 ExecShell "open" "http://windowsupdate.microsoft.com/"
396 ${EndIf}
397 Quit
398 ${EndIf}
399 ${EndIf}
401 ; --------
403 ${IfNot} ${UnattendedMode}
404 !insertmacro MUI_LANGDLL_DISPLAY
405 ${EndIf}
407 ; --------
409 UserInfo::GetAccountType
410 Pop $0
411 ${If} $0 != "Admin"
412 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
413 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
414 Quit
415 ${EndIf}
416 FunctionEnd
418 Function un.onInit
419 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
420 Pop $0
421 ${If} $0 <> 0
422 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the un-installer is already running!"
423 Quit
424 ${EndIf}
426 ${IfNot} ${ForcedMode}
427 !insertmacro MUI_LANGDLL_DISPLAY
428 ${EndIf}
430 ; --------
432 UserInfo::GetAccountType
433 Pop $0
434 ${If} $0 != "Admin"
435 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
436 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
437 Quit
438 ${EndIf}
439 FunctionEnd
442 ;--------------------------------
443 ;GUI initialization
444 ;--------------------------------
446 Function MyGuiInit
447 StrCpy $0 $HWNDPARENT
448 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
449 Aero::Apply
450 FunctionEnd
452 Function un.MyGuiInit
453 StrCpy $0 $HWNDPARENT
454 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
455 Aero::Apply
456 FunctionEnd
459 ;--------------------------------
460 ;Macros & Auxiliary Functions
461 ;--------------------------------
463 !macro PrintProgress Text
464 SetDetailsPrint textonly
465 DetailPrint '${Text}'
466 SetDetailsPrint listonly
467 Sleep 1000
468 !macroend
470 !macro CreateWebLink ShortcutFile TargetURL
471 Push $0
472 Push $1
473 StrCpy $0 "${ShortcutFile}"
474 StrCpy $1 "${TargetURL}"
475 Call _CreateWebLink
476 Pop $1
477 Pop $0
478 !macroend
480 Function _CreateWebLink
481 FlushINI "$0"
482 SetFileAttributes "$0" FILE_ATTRIBUTE_NORMAL
483 DeleteINISec "$0" "DEFAULT"
484 DeleteINISec "$0" "InternetShortcut"
485 WriteINIStr "$0" "DEFAULT" "BASEURL" "$1"
486 WriteINIStr "$0" "InternetShortcut" "ORIGURL" "$1"
487 WriteINIStr "$0" "InternetShortcut" "URL" "$1"
488 WriteINIStr "$0" "InternetShortcut" "IconFile" "$SYSDIR\SHELL32.dll"
489 WriteINIStr "$0" "InternetShortcut" "IconIndex" "150"
490 FlushINI "$0"
491 SetFileAttributes "$0" FILE_ATTRIBUTE_READONLY
492 FunctionEnd
494 !macro GetExecutableName OutVar
495 ${StdUtils.GetParameter} ${OutVar} "Update" ""
496 ${StdUtils.TrimStr} ${OutVar}
497 ${If} "${OutVar}" == ""
498 ${OrIfNot} ${ValidFileName} "${OutVar}"
499 StrCpy ${OutVar} "LameXP.exe"
500 ${EndIf}
501 !macroend
503 !macro DisableNextButton TmpVar
504 GetDlgItem ${TmpVar} $HWNDPARENT 1
505 EnableWindow ${TmpVar} 0
506 !macroend
508 !macro DisableBackButton TmpVar
509 GetDlgItem ${TmpVar} $HWNDPARENT 3
510 EnableWindow ${TmpVar} 0
511 !macroend
513 !macro CleanUpFiles options
514 Delete ${options} "$INSTDIR\Changelog.htm"
515 Delete ${options} "$INSTDIR\Changelog.html"
516 Delete ${options} "$INSTDIR\Contributors.txt"
517 Delete ${options} "$INSTDIR\Copying.txt"
518 Delete ${options} "$INSTDIR\FAQ.html"
519 Delete ${options} "$INSTDIR\Howto.html"
520 Delete ${options} "$INSTDIR\LameEnc.sys"
521 Delete ${options} "$INSTDIR\LameXP.exe"
522 Delete ${options} "$INSTDIR\LameXP.exe.sig"
523 Delete ${options} "$INSTDIR\LameXP-Portable.exe"
524 Delete ${options} "$INSTDIR\License.txt"
525 Delete ${options} "$INSTDIR\Manual.html"
526 Delete ${options} "$INSTDIR\Readme.htm"
527 Delete ${options} "$INSTDIR\ReadMe.txt"
528 Delete ${options} "$INSTDIR\PRE_RELEASE_INFO.txt"
529 Delete ${options} "$INSTDIR\Settings.cfg"
530 Delete ${options} "$INSTDIR\Translate.html"
531 Delete ${options} "$INSTDIR\Uninstall.exe"
532 Delete ${options} "$INSTDIR\Qt*.dll"
533 Delete ${options} "$INSTDIR\msvcr*.dll"
534 Delete ${options} "$INSTDIR\msvcp*.dll"
535 Delete ${options} "$INSTDIR\concrt*.dll"
536 Delete ${options} "$INSTDIR\vcruntime*.dll"
537 Delete ${options} "$INSTDIR\vccorlib*.dll"
539 RMDir /r ${options} "$INSTDIR\cache"
540 RMDir /r ${options} "$INSTDIR\img"
541 RMDir /r ${options} "$INSTDIR\imageformats"
542 RMDir /r ${options} "$INSTDIR\redist"
543 !macroend
545 ;--------------------------------
546 ;Install Files
547 ;--------------------------------
549 Section "-PreInit"
550 SetShellVarContext all
551 SetOutPath "$INSTDIR"
552 SectionEnd
554 Section "!Clean Up Old Cruft"
555 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_CLEANUP)"
556 !insertmacro CleanUpFiles ""
557 SectionEnd
559 Section "!Install Files"
560 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_INSTFILES)"
562 DeleteOldBinary:
563 !insertmacro GetExecutableName $R0
564 ClearErrors
565 Delete "$INSTDIR\$R0"
567 ${If} ${Errors}
568 MessageBox MB_TOPMOST|MB_ICONSTOP|MB_RETRYCANCEL 'Could not delete old "$R0" file. Is LameXP still running?' IDRETRY DeleteOldBinary
569 Abort "Could not delete old binary!"
570 ${EndIf}
572 File /a `/oname=$R0` `${LAMEXP_SOURCE_PATH}\LameXP.exe`
573 File /nonfatal /a /r `${LAMEXP_SOURCE_PATH}\*.dll`
575 File /a /r `${LAMEXP_SOURCE_PATH}\*.txt`
576 File /a /r `${LAMEXP_SOURCE_PATH}\*.html`
577 File /a /r `${LAMEXP_SOURCE_PATH}\*.png`
578 SectionEnd
580 !if ${LAMEXP_REDIST} != 0
581 Section "-Install VCRedist"
582 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_VCREDIST)"
583 File /a `/oname=$PLUGINSDIR\vcredist_x86.exe` `${LAMEXP_SOURCE_PATH}\redist\vcredist_x86.exe`
584 ExecWait '"$PLUGINSDIR\vcredist_x86.exe" /install /passive /norestart'
585 SectionEnd
586 !endif
588 Section "-Write Uninstaller"
589 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_MAKEUNINST)"
590 WriteUninstaller "$INSTDIR\Uninstall.exe"
591 SectionEnd
593 Section "-Create Shortcuts"
594 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
595 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_SHORTCUTS)"
596 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
598 SetShellVarContext current
600 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
601 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
602 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
604 SetShellVarContext all
606 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
607 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
608 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
610 !insertmacro GetExecutableName $R0
612 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" "$INSTDIR\$R0" "" "$INSTDIR\$R0" 0
613 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_LICENSE).lnk" "$INSTDIR\License.txt"
614 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_CHANGELOG).lnk" "$INSTDIR\Changelog.html"
615 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_TRANSLATE).lnk" "$INSTDIR\Translate.html"
616 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_MANUAL).lnk" "$INSTDIR\Manual.html"
617 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_UNINSTALL).lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
619 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Official LameXP Homepage.url" "${MyWebSite}"
620 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Doom9's Forum.url" "http://forum.doom9.org/"
621 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Bug Tracker.url" "https://github.com/lordmulder/LameXP/issues"
622 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\RareWares.org.url" "http://rarewares.org/"
623 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Hydrogenaudio Forums.url" "http://www.hydrogenaudio.org/"
625 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
626 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
627 DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
628 ${EndIf}
629 !insertmacro MUI_STARTMENU_WRITE_END
630 SectionEnd
632 Section "-Update Registry"
633 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_REGISTRY)"
635 !insertmacro GetExecutableName $R0
636 WriteRegStr HKLM "${MyRegPath}" "InstallLocation" "$INSTDIR"
637 WriteRegStr HKLM "${MyRegPath}" "ExecutableName" "$R0"
638 WriteRegStr HKLM "${MyRegPath}" "DisplayIcon" "$INSTDIR\$R0,0"
639 WriteRegStr HKLM "${MyRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
640 WriteRegStr HKLM "${MyRegPath}" "DisplayName" "LameXP v${LAMEXP_VERSION}"
641 WriteRegStr HKLM "${MyRegPath}" "Publisher" "LoRd_MuldeR <mulder2@gmx.de>"
642 WriteRegStr HKLM "${MyRegPath}" "DisplayVersion" "${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
643 WriteRegStr HKLM "${MyRegPath}" "URLInfoAbout" "${MyWebSite}"
644 WriteRegStr HKLM "${MyRegPath}" "URLUpdateInfo" "${MyWebSite}"
646 WriteRegStr HKLM "${AppPaths}\LameXP.exe" "" "$INSTDIR\$R0"
647 WriteRegStr HKLM "${AppPaths}\LameXP.exe" "Path" "$INSTDIR"
648 SectionEnd
650 Section "-Finished"
651 !insertmacro PrintProgress "$(MUI_TEXT_FINISH_TITLE)."
653 !ifdef LAMEXP_IS_PRERELEASE
654 ${If} ${FileExists} "$INSTDIR\PRE_RELEASE_INFO.txt"
655 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\PRE_RELEASE_INFO.txt" "open" ""
656 ${EndIf}
657 !endif
659 ${IfThen} ${UnattendedMode} ${|} SetAutoClose true ${|}
660 SectionEnd
663 ;--------------------------------
664 ;Uninstaller
665 ;--------------------------------
667 Section "Uninstall"
668 SetOutPath "$EXEDIR"
669 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_UNINSTALL)"
671 ; --------------
672 ; Startmenu
673 ; --------------
675 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
676 ${IfNot} "$StartMenuFolder" == ""
677 SetShellVarContext current
678 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
679 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
680 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
681 ${EndIf}
682 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
683 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
684 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
685 RMDir "$SMPROGRAMS\$StartMenuFolder"
686 ${EndIf}
688 SetShellVarContext all
689 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
690 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
691 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
692 ${EndIf}
693 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
694 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
695 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
696 RMDir "$SMPROGRAMS\$StartMenuFolder"
697 ${EndIf}
698 ${EndIf}
700 ; --------------
701 ; Files
702 ; --------------
704 ReadRegStr $R0 HKLM "${MyRegPath}" "ExecutableName"
705 ${IfThen} "$R0" == "" ${|} StrCpy $R0 "LameXP.exe" ${|}
707 Delete /REBOOTOK "$INSTDIR\$R0"
708 !insertmacro CleanUpFiles /REBOOTOK
709 RMDir "$INSTDIR"
711 ; --------------
712 ; Registry
713 ; --------------
715 DeleteRegKey HKLM "${MyRegPath}"
716 DeleteRegKey HKCU "${MyRegPath}"
718 DeleteRegKey HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
719 DeleteRegKey HKCU "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
721 DeleteRegKey HKLM "${AppPaths}\LameXP.exe"
722 DeleteRegKey HKCU "${AppPaths}\LameXP.exe"
724 MessageBox MB_YESNO|MB_TOPMOST "$(LAMEXP_LANG_UNINST_PERSONAL)" IDNO +3
725 Delete "$LOCALAPPDATA\LoRd_MuldeR\LameXP - Audio Encoder Front-End\config.ini"
726 Delete "$INSTDIR\*.ini"
728 !insertmacro PrintProgress "$(MUI_UNTEXT_FINISH_TITLE)."
729 SectionEnd
732 ;--------------------------------
733 ;Check For Update Mode
734 ;--------------------------------
736 Function SkipIfUnattended
737 ${IfThen} ${UnattendedMode} ${|} Abort ${|}
738 FunctionEnd
740 Function CheckForUpdate
741 ${If} "$INSTDIR" == ""
742 ${OrIf} "$INSTDIR" == "$EXEDIR"
743 ${OrIfNot} ${FileExists} "$INSTDIR\LameXP.exe"
744 Return
745 ${EndIf}
747 FindWindow $R0 "#32770" "" $HWNDPARENT
748 GetDlgItem $R1 $R0 1019
749 EnableWindow $R1 0
751 FindWindow $R0 "#32770" "" $HWNDPARENT
752 GetDlgItem $R1 $R0 1001
753 EnableWindow $R1 0
754 FunctionEnd
756 Function un.CheckForcedUninstall
757 ${IfThen} ${ForcedMode} ${|} Abort ${|}
758 FunctionEnd
761 ;--------------------------------
762 ;Check For Pre-Release
763 ;--------------------------------
765 Function CheckForPreRelease
766 !ifdef LAMEXP_IS_PRERELEASE
767 ${IfNot} ${UnattendedMode}
768 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(LAMEXP_LANG_PRERELEASE_WARNING)" /SD IDOK IDOK +2
769 Quit
770 ${EndIf}
771 !endif
772 FunctionEnd
775 ;--------------------------------
776 ;Locked List
777 ;--------------------------------
779 !macro _LockedListShow uinst
780 !insertmacro MUI_HEADER_TEXT "$(LAMEXP_LANG_LOCKEDLIST_HEADER)" "$(LAMEXP_LANG_LOCKEDLIST_TEXT)"
781 ${If} ${UnattendedMode}
782 !insertmacro DisableBackButton $R0
783 ${EndIf}
784 ${If} ${RunningX64}
785 InitPluginsDir
786 File /oname=$PLUGINSDIR\LockedList64.dll `${NSISDIR}\Plugins\LockedList64.dll`
787 ${EndIf}
788 !insertmacro GetExecutableName $R0
789 LockedList::AddModule "\$R0"
790 ${If} "$R0" != "LameXP.exe"
791 LockedList::AddModule "\LameXP.exe"
792 ${EndIf}
793 LockedList::AddModule "\Uninstall.exe"
794 !if ${uinst} < 1
795 LockedList::AddModule "\Au_.exe"
796 !endif
797 LockedList::AddFolder "$INSTDIR"
798 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)"
799 Pop $R0
800 !macroend
802 Function LockedListShow
803 !insertmacro _LockedListShow 0
804 FunctionEnd
806 Function un.LockedListShow
807 !insertmacro _LockedListShow 1
808 FunctionEnd
811 ;--------------------------------
812 ;Install Success
813 ;--------------------------------
815 Function RunAppFunction
816 !insertmacro DisableNextButton $R0
817 !insertmacro GetExecutableName $R0
818 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR" "explore" ""
819 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
820 FunctionEnd
822 Function ShowReadmeFunction
823 !insertmacro DisableNextButton $R0
824 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\Manual.html" "open" ""
825 FunctionEnd
827 Function .onInstSuccess
828 ${If} ${UnattendedMode}
829 !insertmacro GetExecutableName $R0
830 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
831 ${EndIf}
832 FunctionEnd