Now using the MT tool for embedding the Manifest.
[LameXP.git] / etc / NSIS / setup.nsi
blob1a5ef3627d5d8deba2cc9a5af5f7a241418df937
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 !tempfile PACKHDRTEMP
88 !packhdr "${PACKHDRTEMP}" '"..\Utilities\MT.exe" -manifest "setup.manifest" -outputresource:"${PACKHDRTEMP};1"'
91 ;--------------------------------
92 ;Includes
93 ;--------------------------------
95 !include `MUI2.nsh`
96 !include `WinVer.nsh`
97 !include `x64.nsh`
98 !include `StdUtils.nsh`
101 ;--------------------------------
102 ;Installer Attributes
103 ;--------------------------------
105 RequestExecutionLevel admin
106 ShowInstDetails show
107 ShowUninstDetails show
108 Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
109 OutFile "${LAMEXP_OUTPUT_FILE}"
110 BrandingText "Date created: ${LAMEXP_DATE} [Build #${LAMEXP_BUILD}]"
111 InstallDir "$PROGRAMFILES\MuldeR\LameXP v${LAMEXP_VERSION}"
112 InstallDirRegKey HKLM "${MyRegPath}" "InstallLocation"
115 ;--------------------------------
116 ;Compressor
117 ;--------------------------------
119 SetCompressor /SOLID LZMA
120 SetCompressorDictSize 64
122 #!packhdr "$%TEMP%\exehead.tmp" '"${LAMEXP_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
125 ;--------------------------------
126 ;Reserved Files
127 ;--------------------------------
129 ReserveFile "${NSISDIR}\Plugins\Aero.dll"
130 ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
131 ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
132 ReserveFile "${NSISDIR}\Plugins\LockedList64.dll"
133 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
134 ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
135 ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
136 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
137 ReserveFile "${NSISDIR}\Plugins\System.dll"
138 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
141 ;--------------------------------
142 ;Variables
143 ;--------------------------------
145 Var StartMenuFolder
148 ;--------------------------------
149 ;Version Info
150 ;--------------------------------
152 !searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
153 VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
155 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
156 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."
157 VIAddVersionKey "CompanyName" "Free Software Foundation"
158 VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
159 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
160 VIAddVersionKey "LegalCopyright" "Copyright 2004-2015 LoRd_MuldeR"
161 VIAddVersionKey "LegalTrademarks" "GNU"
162 VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.exe"
163 VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
164 VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
165 VIAddVersionKey "Website" "${MyWebSite}"
168 ;--------------------------------
169 ;MUI2 Interface Settings
170 ;--------------------------------
172 !define MUI_ABORTWARNING
173 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
174 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${MyRegPath}"
175 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartmenuFolder"
176 !define MUI_LANGDLL_REGISTRY_ROOT HKLM
177 !define MUI_LANGDLL_REGISTRY_KEY "${MyRegPath}"
178 !define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
179 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LameXP v${LAMEXP_VERSION}"
180 !define MUI_FINISHPAGE_NOAUTOCLOSE
181 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
182 !define MUI_FINISHPAGE_RUN
183 !define MUI_FINISHPAGE_RUN_FUNCTION RunAppFunction
184 !define MUI_FINISHPAGE_SHOWREADME
185 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadmeFunction
186 !define MUI_FINISHPAGE_LINK ${MyWebSite}
187 !define MUI_FINISHPAGE_LINK_LOCATION ${MyWebSite}
188 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
189 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
190 !define MUI_WELCOMEFINISHPAGE_BITMAP "wizard.bmp"
191 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "wizard-un.bmp"
192 !define MUI_HEADERIMAGE
193 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
194 !define MUI_HEADERIMAGE_UNBITMAP "header-un.bmp"
195 !define MUI_LANGDLL_ALLLANGUAGES
196 !define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
197 !define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyGuiInit
198 !define MUI_LANGDLL_ALWAYSSHOW
201 ;--------------------------------
202 ;MUI2 Pages (Installer)
203 ;--------------------------------
205 ;Welcome
206 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
207 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckForPreRelease
208 !define MUI_WELCOMEPAGE_TITLE_3LINES
209 !define MUI_FINISHPAGE_TITLE_3LINES
210 !insertmacro MUI_PAGE_WELCOME
212 ;License
213 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
214 !insertmacro MUI_PAGE_LICENSE "license.rtf"
216 ;Directory
217 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
218 !define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
219 !insertmacro MUI_PAGE_DIRECTORY
221 ;Startmenu
222 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
223 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
225 ;LockedList
226 Page Custom LockedListShow
228 ;Install Files
229 !insertmacro MUI_PAGE_INSTFILES
231 ;Finish
232 !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipIfUnattended
233 !insertmacro MUI_PAGE_FINISH
236 ;--------------------------------
237 ;MUI2 Pages (Uninstaller)
238 ;--------------------------------
240 ;Welcome
241 !define MUI_WELCOMEPAGE_TITLE_3LINES
242 !define MUI_FINISHPAGE_TITLE_3LINES
243 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
244 !insertmacro MUI_UNPAGE_WELCOME
246 ;Confirm
247 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
248 !insertmacro MUI_UNPAGE_CONFIRM
250 ;LockedList
251 UninstPage Custom un.LockedListShow
253 ;Uninstall
254 !insertmacro MUI_UNPAGE_INSTFILES
256 ;Finish
257 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
258 !insertmacro MUI_UNPAGE_FINISH
261 ;--------------------------------
262 ;Languages
263 ;--------------------------------
265 !insertmacro MUI_LANGUAGE "English" ;first language is the default language
266 !insertmacro MUI_LANGUAGE "German"
267 !insertmacro MUI_LANGUAGE "Spanish"
268 !insertmacro MUI_LANGUAGE "Russian"
269 !insertmacro MUI_LANGUAGE "Ukrainian"
270 !insertmacro MUI_LANGUAGE "Polish"
271 !insertmacro MUI_LANGUAGE "Hungarian"
273 ; !insertmacro MUI_LANGUAGE "French"
274 ; !insertmacro MUI_LANGUAGE "SpanishInternational"
275 ; !insertmacro MUI_LANGUAGE "SimpChinese"
276 ; !insertmacro MUI_LANGUAGE "TradChinese"
277 ; !insertmacro MUI_LANGUAGE "Japanese"
278 ; !insertmacro MUI_LANGUAGE "Italian"
279 ; !insertmacro MUI_LANGUAGE "Dutch"
280 ; !insertmacro MUI_LANGUAGE "Greek"
281 ; !insertmacro MUI_LANGUAGE "Romanian"
282 ; !insertmacro MUI_LANGUAGE "Serbian"
283 ; !insertmacro MUI_LANGUAGE "SerbianLatin"
284 ; !insertmacro MUI_LANGUAGE "Arabic"
285 ; !insertmacro MUI_LANGUAGE "Portuguese"
286 ; !insertmacro MUI_LANGUAGE "Afrikaans"
287 ; !insertmacro MUI_LANGUAGE "Malay"
288 ; !insertmacro MUI_LANGUAGE "Indonesian"
291 ;--------------------------------
292 ;Translation
293 ;--------------------------------
295 ;English
296 !include "..\Translation\Blank.nsh"
298 ;German
299 !include "..\Translation\LameXP_DE.nsh"
301 ;Spanish
302 !include "..\Translation\LameXP_ES.nsh"
304 ;Russian
305 !include "..\Translation\LameXP_RU.nsh"
307 ;Ukrainian
308 !include "..\Translation\LameXP_UK.nsh"
310 ;Polish
311 !include "..\Translation\LameXP_PL.nsh"
313 ;Hungarian
314 !include "..\Translation\LameXP_HU.nsh"
317 ;--------------------------------
318 ;LogicLib Extensions
319 ;--------------------------------
321 !macro _UnattendedMode _a _b _t _f
322 !insertmacro _LOGICLIB_TEMP
323 ${StdUtils.TestParameter} $_LOGICLIB_TEMP "Update"
324 StrCmp "$_LOGICLIB_TEMP" "true" `${_t}` `${_f}`
325 !macroend
326 !define UnattendedMode `"" UnattendedMode ""`
328 !macro _ForcedMode _a _b _t _f
329 !insertmacro _LOGICLIB_TEMP
330 ${StdUtils.TestParameter} $_LOGICLIB_TEMP "Force"
331 StrCmp "$_LOGICLIB_TEMP" "true" `${_t}` `${_f}`
332 !macroend
333 !define ForcedMode `"" ForcedMode ""`
335 !macro _ValidFileName _a _b _t _f
336 !insertmacro _LOGICLIB_TEMP
337 ${StdUtils.ValidFileName} $_LOGICLIB_TEMP `${_b}`
338 StrCmp "$_LOGICLIB_TEMP" "ok" `${_t}` `${_f}`
339 !macroend
340 !define ValidFileName `"" ValidFileName`
343 ;--------------------------------
344 ;Installer initialization
345 ;--------------------------------
347 Function .onInit
348 InitPluginsDir
350 ; --------
352 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
353 Pop $0
354 ${If} $0 <> 0
355 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the installer is already running!"
356 Quit
357 ${EndIf}
359 ; --------
361 # Running on Windows NT family?
362 ${IfNot} ${IsNT}
363 MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does *not* support Windows 9x or Windows ME!"
364 ExecShell "open" "http://windows.microsoft.com/"
365 Quit
366 ${EndIf}
368 # Running on Windows XP or later?
369 ${If} ${AtMostWin2000}
370 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)."
371 ExecShell "open" "http://windows.microsoft.com/"
372 Quit
373 ${EndIf}
375 # If on Windows XP, is the required Service Pack installed?
376 ${If} ${IsWinXP}
377 ${IfNot} ${RunningX64} # Windows XP 32-Bit, requires Service Pack 3
378 ${AndIf} ${AtMostServicePack} 2
379 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Windows XP with Service Pack 3 installed!"
380 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 3 for Windows XP now?" IDYES`
381 ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=24"
382 ${Else}
383 ExecShell "open" "http://windowsupdate.microsoft.com/"
384 ${EndIf}
385 Quit
386 ${EndIf}
387 ${If} ${RunningX64} # Windows XP 64-Bit, requires Service Pack 2
388 ${AndIf} ${AtMostServicePack} 1
389 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Windows XP x64 Edition with Service Pack 2 installed!"
390 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 2 for Windows XP x64 Edition now?" IDYES`
391 ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=17791"
392 ${Else}
393 ExecShell "open" "http://windowsupdate.microsoft.com/"
394 ${EndIf}
395 Quit
396 ${EndIf}
397 ${EndIf}
399 ; --------
401 ${IfNot} ${UnattendedMode}
402 !insertmacro MUI_LANGDLL_DISPLAY
403 ${EndIf}
405 ; --------
407 UserInfo::GetAccountType
408 Pop $0
409 ${If} $0 != "Admin"
410 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
411 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
412 Quit
413 ${EndIf}
414 FunctionEnd
416 Function un.onInit
417 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
418 Pop $0
419 ${If} $0 <> 0
420 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the un-installer is already running!"
421 Quit
422 ${EndIf}
424 ${IfNot} ${ForcedMode}
425 !insertmacro MUI_LANGDLL_DISPLAY
426 ${EndIf}
428 ; --------
430 UserInfo::GetAccountType
431 Pop $0
432 ${If} $0 != "Admin"
433 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
434 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
435 Quit
436 ${EndIf}
437 FunctionEnd
440 ;--------------------------------
441 ;GUI initialization
442 ;--------------------------------
444 Function MyGuiInit
445 StrCpy $0 $HWNDPARENT
446 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
447 Aero::Apply
448 FunctionEnd
450 Function un.MyGuiInit
451 StrCpy $0 $HWNDPARENT
452 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
453 Aero::Apply
454 FunctionEnd
457 ;--------------------------------
458 ;Macros & Auxiliary Functions
459 ;--------------------------------
461 !macro PrintProgress Text
462 SetDetailsPrint textonly
463 DetailPrint '${Text}'
464 SetDetailsPrint listonly
465 Sleep 1000
466 !macroend
468 !macro CreateWebLink ShortcutFile TargetURL
469 Push $0
470 Push $1
471 StrCpy $0 "${ShortcutFile}"
472 StrCpy $1 "${TargetURL}"
473 Call _CreateWebLink
474 Pop $1
475 Pop $0
476 !macroend
478 Function _CreateWebLink
479 FlushINI "$0"
480 SetFileAttributes "$0" FILE_ATTRIBUTE_NORMAL
481 DeleteINISec "$0" "DEFAULT"
482 DeleteINISec "$0" "InternetShortcut"
483 WriteINIStr "$0" "DEFAULT" "BASEURL" "$1"
484 WriteINIStr "$0" "InternetShortcut" "ORIGURL" "$1"
485 WriteINIStr "$0" "InternetShortcut" "URL" "$1"
486 WriteINIStr "$0" "InternetShortcut" "IconFile" "$SYSDIR\SHELL32.dll"
487 WriteINIStr "$0" "InternetShortcut" "IconIndex" "150"
488 FlushINI "$0"
489 SetFileAttributes "$0" FILE_ATTRIBUTE_READONLY
490 FunctionEnd
492 !macro GetExecutableName OutVar
493 ${StdUtils.GetParameter} ${OutVar} "Update" ""
494 ${StdUtils.TrimStr} ${OutVar}
495 ${If} "${OutVar}" == ""
496 ${OrIfNot} ${ValidFileName} "${OutVar}"
497 StrCpy ${OutVar} "LameXP.exe"
498 ${EndIf}
499 !macroend
501 !macro DisableNextButton TmpVar
502 GetDlgItem ${TmpVar} $HWNDPARENT 1
503 EnableWindow ${TmpVar} 0
504 !macroend
506 !macro DisableBackButton TmpVar
507 GetDlgItem ${TmpVar} $HWNDPARENT 3
508 EnableWindow ${TmpVar} 0
509 !macroend
511 !macro CleanUpFiles options
512 Delete ${options} "$INSTDIR\Changelog.htm"
513 Delete ${options} "$INSTDIR\Changelog.html"
514 Delete ${options} "$INSTDIR\Contributors.txt"
515 Delete ${options} "$INSTDIR\Copying.txt"
516 Delete ${options} "$INSTDIR\FAQ.html"
517 Delete ${options} "$INSTDIR\Howto.html"
518 Delete ${options} "$INSTDIR\LameEnc.sys"
519 Delete ${options} "$INSTDIR\LameXP.exe"
520 Delete ${options} "$INSTDIR\LameXP.exe.sig"
521 Delete ${options} "$INSTDIR\LameXP-Portable.exe"
522 Delete ${options} "$INSTDIR\License.txt"
523 Delete ${options} "$INSTDIR\Manual.html"
524 Delete ${options} "$INSTDIR\Readme.htm"
525 Delete ${options} "$INSTDIR\ReadMe.txt"
526 Delete ${options} "$INSTDIR\PRE_RELEASE_INFO.txt"
527 Delete ${options} "$INSTDIR\Settings.cfg"
528 Delete ${options} "$INSTDIR\Translate.html"
529 Delete ${options} "$INSTDIR\Uninstall.exe"
530 Delete ${options} "$INSTDIR\Qt*.dll"
531 Delete ${options} "$INSTDIR\msvcr*.dll"
532 Delete ${options} "$INSTDIR\msvcp*.dll"
533 Delete ${options} "$INSTDIR\concrt*.dll"
534 Delete ${options} "$INSTDIR\vcruntime*.dll"
535 Delete ${options} "$INSTDIR\vccorlib*.dll"
537 RMDir /r ${options} "$INSTDIR\cache"
538 RMDir /r ${options} "$INSTDIR\img"
539 RMDir /r ${options} "$INSTDIR\imageformats"
540 RMDir /r ${options} "$INSTDIR\redist"
541 !macroend
543 ;--------------------------------
544 ;Install Files
545 ;--------------------------------
547 Section "-PreInit"
548 SetShellVarContext all
549 SetOutPath "$INSTDIR"
550 SectionEnd
552 Section "!Clean Up Old Cruft"
553 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_CLEANUP)"
554 !insertmacro CleanUpFiles ""
555 SectionEnd
557 Section "!Install Files"
558 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_INSTFILES)"
560 DeleteOldBinary:
561 !insertmacro GetExecutableName $R0
562 ClearErrors
563 Delete "$INSTDIR\$R0"
565 ${If} ${Errors}
566 MessageBox MB_TOPMOST|MB_ICONSTOP|MB_RETRYCANCEL 'Could not delete old "$R0" file. Is LameXP still running?' IDRETRY DeleteOldBinary
567 Abort "Could not delete old binary!"
568 ${EndIf}
570 File /a `/oname=$R0` `${LAMEXP_SOURCE_PATH}\LameXP.exe`
571 File /nonfatal /a /r `${LAMEXP_SOURCE_PATH}\*.dll`
573 File /a /r `${LAMEXP_SOURCE_PATH}\*.txt`
574 File /a /r `${LAMEXP_SOURCE_PATH}\*.html`
575 File /a /r `${LAMEXP_SOURCE_PATH}\*.png`
576 SectionEnd
578 !if ${LAMEXP_REDIST} != 0
579 Section "-Install VCRedist"
580 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_VCREDIST)"
581 File /a `/oname=$PLUGINSDIR\vcredist_x86.exe` `${LAMEXP_SOURCE_PATH}\redist\vcredist_x86.exe`
582 ExecWait '"$PLUGINSDIR\vcredist_x86.exe" /install /passive /norestart'
583 SectionEnd
584 !endif
586 Section "-Write Uninstaller"
587 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_MAKEUNINST)"
588 WriteUninstaller "$INSTDIR\Uninstall.exe"
589 SectionEnd
591 Section "-Create Shortcuts"
592 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
593 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_SHORTCUTS)"
594 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
596 SetShellVarContext current
598 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
599 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
600 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
602 SetShellVarContext all
604 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
605 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
606 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
608 !insertmacro GetExecutableName $R0
610 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" "$INSTDIR\$R0" "" "$INSTDIR\$R0" 0
611 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_LICENSE).lnk" "$INSTDIR\License.txt"
612 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_CHANGELOG).lnk" "$INSTDIR\Changelog.html"
613 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_TRANSLATE).lnk" "$INSTDIR\Translate.html"
614 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_MANUAL).lnk" "$INSTDIR\Manual.html"
615 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_UNINSTALL).lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
617 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Official LameXP Homepage.url" "${MyWebSite}"
618 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Doom9's Forum.url" "http://forum.doom9.org/"
619 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Bug Tracker.url" "https://github.com/lordmulder/LameXP/issues"
620 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\RareWares.org.url" "http://rarewares.org/"
621 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Hydrogenaudio Forums.url" "http://www.hydrogenaudio.org/"
623 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
624 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
625 DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
626 ${EndIf}
627 !insertmacro MUI_STARTMENU_WRITE_END
628 SectionEnd
630 Section "-Update Registry"
631 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_REGISTRY)"
633 !insertmacro GetExecutableName $R0
634 WriteRegStr HKLM "${MyRegPath}" "InstallLocation" "$INSTDIR"
635 WriteRegStr HKLM "${MyRegPath}" "ExecutableName" "$R0"
636 WriteRegStr HKLM "${MyRegPath}" "DisplayIcon" "$INSTDIR\$R0,0"
637 WriteRegStr HKLM "${MyRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
638 WriteRegStr HKLM "${MyRegPath}" "DisplayName" "LameXP v${LAMEXP_VERSION}"
639 WriteRegStr HKLM "${MyRegPath}" "Publisher" "LoRd_MuldeR <mulder2@gmx.de>"
640 WriteRegStr HKLM "${MyRegPath}" "DisplayVersion" "${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
641 WriteRegStr HKLM "${MyRegPath}" "URLInfoAbout" "${MyWebSite}"
642 WriteRegStr HKLM "${MyRegPath}" "URLUpdateInfo" "${MyWebSite}"
644 WriteRegStr HKLM "${AppPaths}\LameXP.exe" "" "$INSTDIR\$R0"
645 WriteRegStr HKLM "${AppPaths}\LameXP.exe" "Path" "$INSTDIR"
646 SectionEnd
648 Section "-Finished"
649 !insertmacro PrintProgress "$(MUI_TEXT_FINISH_TITLE)."
651 !ifdef LAMEXP_IS_PRERELEASE
652 ${If} ${FileExists} "$INSTDIR\PRE_RELEASE_INFO.txt"
653 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\PRE_RELEASE_INFO.txt" "open" ""
654 ${EndIf}
655 !endif
657 ${IfThen} ${UnattendedMode} ${|} SetAutoClose true ${|}
658 SectionEnd
661 ;--------------------------------
662 ;Uninstaller
663 ;--------------------------------
665 Section "Uninstall"
666 SetOutPath "$EXEDIR"
667 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_UNINSTALL)"
669 ; --------------
670 ; Startmenu
671 ; --------------
673 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
674 ${IfNot} "$StartMenuFolder" == ""
675 SetShellVarContext current
676 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
677 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
678 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
679 ${EndIf}
680 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
681 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
682 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
683 RMDir "$SMPROGRAMS\$StartMenuFolder"
684 ${EndIf}
686 SetShellVarContext all
687 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
688 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
689 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
690 ${EndIf}
691 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
692 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
693 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
694 RMDir "$SMPROGRAMS\$StartMenuFolder"
695 ${EndIf}
696 ${EndIf}
698 ; --------------
699 ; Files
700 ; --------------
702 ReadRegStr $R0 HKLM "${MyRegPath}" "ExecutableName"
703 ${IfThen} "$R0" == "" ${|} StrCpy $R0 "LameXP.exe" ${|}
705 Delete /REBOOTOK "$INSTDIR\$R0"
706 !insertmacro CleanUpFiles /REBOOTOK
707 RMDir "$INSTDIR"
709 ; --------------
710 ; Registry
711 ; --------------
713 DeleteRegKey HKLM "${MyRegPath}"
714 DeleteRegKey HKCU "${MyRegPath}"
716 DeleteRegKey HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
717 DeleteRegKey HKCU "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
719 DeleteRegKey HKLM "${AppPaths}\LameXP.exe"
720 DeleteRegKey HKCU "${AppPaths}\LameXP.exe"
722 MessageBox MB_YESNO|MB_TOPMOST "$(LAMEXP_LANG_UNINST_PERSONAL)" IDNO +3
723 Delete "$LOCALAPPDATA\LoRd_MuldeR\LameXP - Audio Encoder Front-End\config.ini"
724 Delete "$INSTDIR\*.ini"
726 !insertmacro PrintProgress "$(MUI_UNTEXT_FINISH_TITLE)."
727 SectionEnd
730 ;--------------------------------
731 ;Check For Update Mode
732 ;--------------------------------
734 Function SkipIfUnattended
735 ${IfThen} ${UnattendedMode} ${|} Abort ${|}
736 FunctionEnd
738 Function CheckForUpdate
739 ${If} "$INSTDIR" == ""
740 ${OrIf} "$INSTDIR" == "$EXEDIR"
741 ${OrIfNot} ${FileExists} "$INSTDIR\LameXP.exe"
742 Return
743 ${EndIf}
745 FindWindow $R0 "#32770" "" $HWNDPARENT
746 GetDlgItem $R1 $R0 1019
747 EnableWindow $R1 0
749 FindWindow $R0 "#32770" "" $HWNDPARENT
750 GetDlgItem $R1 $R0 1001
751 EnableWindow $R1 0
752 FunctionEnd
754 Function un.CheckForcedUninstall
755 ${IfThen} ${ForcedMode} ${|} Abort ${|}
756 FunctionEnd
759 ;--------------------------------
760 ;Check For Pre-Release
761 ;--------------------------------
763 Function CheckForPreRelease
764 !ifdef LAMEXP_IS_PRERELEASE
765 ${IfNot} ${UnattendedMode}
766 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(LAMEXP_LANG_PRERELEASE_WARNING)" /SD IDOK IDOK +2
767 Quit
768 ${EndIf}
769 !endif
770 FunctionEnd
773 ;--------------------------------
774 ;Locked List
775 ;--------------------------------
777 !macro _LockedListShow uinst
778 !insertmacro MUI_HEADER_TEXT "$(LAMEXP_LANG_LOCKEDLIST_HEADER)" "$(LAMEXP_LANG_LOCKEDLIST_TEXT)"
779 ${If} ${UnattendedMode}
780 !insertmacro DisableBackButton $R0
781 ${EndIf}
782 ${If} ${RunningX64}
783 InitPluginsDir
784 File /oname=$PLUGINSDIR\LockedList64.dll `${NSISDIR}\Plugins\LockedList64.dll`
785 ${EndIf}
786 !insertmacro GetExecutableName $R0
787 LockedList::AddModule "\$R0"
788 ${If} "$R0" != "LameXP.exe"
789 LockedList::AddModule "\LameXP.exe"
790 ${EndIf}
791 LockedList::AddModule "\Uninstall.exe"
792 !if ${uinst} < 1
793 LockedList::AddModule "\Au_.exe"
794 !endif
795 LockedList::AddFolder "$INSTDIR"
796 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)"
797 Pop $R0
798 !macroend
800 Function LockedListShow
801 !insertmacro _LockedListShow 0
802 FunctionEnd
804 Function un.LockedListShow
805 !insertmacro _LockedListShow 1
806 FunctionEnd
809 ;--------------------------------
810 ;Install Success
811 ;--------------------------------
813 Function RunAppFunction
814 !insertmacro DisableNextButton $R0
815 !insertmacro GetExecutableName $R0
816 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR" "explore" ""
817 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
818 FunctionEnd
820 Function ShowReadmeFunction
821 !insertmacro DisableNextButton $R0
822 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\Manual.html" "open" ""
823 FunctionEnd
825 Function .onInstSuccess
826 ${If} ${UnattendedMode}
827 !insertmacro GetExecutableName $R0
828 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
829 ${EndIf}
830 FunctionEnd