OSDN Git Service

Fixed web-update tool. After the recent update of the Inetc plug-in, the updater...
[lamexp/LameXP.git] / etc / NSIS / setup.nsi
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // LameXP - Audio Encoder Front-End
3 ; // Copyright (C) 2004-2011 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 ; ///////////////////////////////////////////////////////////////////////////////
21
22 ;--------------------------------
23 ;Basic Defines
24 ;--------------------------------
25
26 !ifndef LAMEXP_VERSION
27   !error "LAMEXP_VERSION is not defined !!!"
28 !endif
29 !ifndef LAMEXP_BUILD
30   !error "LAMEXP_BUILD is not defined !!!"
31 !endif
32 !ifndef LAMEXP_INSTTYPE
33   !error "LAMEXP_INSTTYPE is not defined !!!"
34 !endif
35 !ifndef LAMEXP_PATCH
36   !error "LAMEXP_PATCH is not defined !!!"
37 !endif
38 !ifndef LAMEXP_DATE
39   !error "LAMEXP_DATE is not defined !!!"
40 !endif
41 !ifndef LAMEXP_OUTPUT_FILE
42   !error "LAMEXP_OUTPUT_FILE is not defined !!!"
43 !endif
44 !ifndef LAMEXP_SOURCE_PATH
45   !error "LAMEXP_SOURCE_PATH is not defined !!!"
46 !endif
47 !ifndef LAMEXP_UPX_PATH
48   !error "LAMEXP_UPX_PATH is not defined !!!"
49 !endif
50
51 ;UUID
52 !define MyRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FBD7A67D-D700-4043-B54F-DD106D00F308}"
53
54 ;Web-Site
55 !define MyWebSite "http://mulder.at.gg/"
56
57
58 ;--------------------------------
59 ;Check for Pre-Release
60 ;--------------------------------
61
62 !define LAMEXP_IS_PRERELEASE
63
64 !if '${LAMEXP_INSTTYPE}' == 'Final'
65   !undef LAMEXP_IS_PRERELEASE
66 !endif
67 !if '${LAMEXP_INSTTYPE}' == 'Hotfix'
68   !undef LAMEXP_IS_PRERELEASE
69 !endif
70
71
72 ;--------------------------------
73 ;Includes
74 ;--------------------------------
75
76 !include `MUI2.nsh`
77 !include `WinVer.nsh`
78 !include `StdUtils.nsh`
79
80
81 ;--------------------------------
82 ;Installer Attributes
83 ;--------------------------------
84
85 RequestExecutionLevel admin
86 ShowInstDetails show
87 ShowUninstDetails show
88 Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
89 OutFile "${LAMEXP_OUTPUT_FILE}"
90 BrandingText "Date created: ${LAMEXP_DATE} [Build #${LAMEXP_BUILD}]"
91 InstallDir "$PROGRAMFILES\MuldeR\LameXP v${LAMEXP_VERSION}"
92 InstallDirRegKey HKLM "${MyRegPath}" "InstallLocation"
93
94
95 ;--------------------------------
96 ;Compressor
97 ;--------------------------------
98
99 SetCompressor /SOLID LZMA
100 SetCompressorDictSize 64
101
102 !packhdr "$%TEMP%\exehead.tmp" '"${LAMEXP_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
103
104
105 ;--------------------------------
106 ;Reserved Files
107 ;--------------------------------
108
109 ReserveFile "${NSISDIR}\Plugins\Aero.dll"
110 ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
111 ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
112 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
113 ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
114 ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
115 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
116 ReserveFile "${NSISDIR}\Plugins\System.dll"
117 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
118 ReserveFile "checkproc.exe"
119
120
121 ;--------------------------------
122 ;Variables
123 ;--------------------------------
124
125 Var StartMenuFolder
126
127
128 ;--------------------------------
129 ;Version Info
130 ;--------------------------------
131
132 !searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
133 VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
134
135 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
136 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."
137 VIAddVersionKey "CompanyName" "Free Software Foundation"
138 VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
139 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
140 VIAddVersionKey "LegalCopyright" "Copyright 2004-2011 LoRd_MuldeR"
141 VIAddVersionKey "LegalTrademarks" "GNU"
142 VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.exe"
143 VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
144 VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
145 VIAddVersionKey "Website" "${MyWebSite}"
146
147
148 ;--------------------------------
149 ;MUI2 Interface Settings
150 ;--------------------------------
151
152 !define MUI_ABORTWARNING
153 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
154 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${MyRegPath}"
155 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartmenuFolder"
156 !define MUI_LANGDLL_REGISTRY_ROOT HKLM
157 !define MUI_LANGDLL_REGISTRY_KEY "${MyRegPath}"
158 !define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
159 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LameXP v${LAMEXP_VERSION}"
160 !define MUI_FINISHPAGE_NOAUTOCLOSE
161 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
162 !define MUI_FINISHPAGE_RUN
163 !define MUI_FINISHPAGE_RUN_FUNCTION RunAppFunction
164 !define MUI_FINISHPAGE_SHOWREADME
165 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadmeFunction
166 !define MUI_FINISHPAGE_LINK ${MyWebSite}
167 !define MUI_FINISHPAGE_LINK_LOCATION ${MyWebSite}
168 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
169 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
170 !define MUI_WELCOMEFINISHPAGE_BITMAP "wizard.bmp"
171 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "wizard-un.bmp"
172 !define MUI_HEADERIMAGE
173 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
174 !define MUI_HEADERIMAGE_UNBITMAP "header-un.bmp"
175 !define MUI_LANGDLL_ALLLANGUAGES
176 !define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
177 !define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyGuiInit
178 !define MUI_LANGDLL_ALWAYSSHOW
179
180
181 ;--------------------------------
182 ;MUI2 Pages
183 ;--------------------------------
184
185 ;Installer
186 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckForPreRelease
187 !define MUI_WELCOMEPAGE_TITLE_3LINES
188 !define MUI_FINISHPAGE_TITLE_3LINES
189 !insertmacro MUI_PAGE_WELCOME
190 !insertmacro MUI_PAGE_LICENSE "license.rtf"
191 !define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
192 !insertmacro MUI_PAGE_DIRECTORY
193 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
194 Page Custom LockedListShow
195 !insertmacro MUI_PAGE_INSTFILES
196 !insertmacro MUI_PAGE_FINISH
197
198 ;Uninstaller
199 !define MUI_WELCOMEPAGE_TITLE_3LINES
200 !define MUI_FINISHPAGE_TITLE_3LINES
201 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
202 !insertmacro MUI_UNPAGE_WELCOME
203 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
204 !insertmacro MUI_UNPAGE_CONFIRM
205 UninstPage Custom un.LockedListShow
206 !insertmacro MUI_UNPAGE_INSTFILES
207 !insertmacro MUI_UNPAGE_FINISH
208
209
210 ;--------------------------------
211 ;Languages
212 ;--------------------------------
213  
214 !insertmacro MUI_LANGUAGE "English" ;first language is the default language
215 !insertmacro MUI_LANGUAGE "German"
216 !insertmacro MUI_LANGUAGE "Spanish"
217 !insertmacro MUI_LANGUAGE "Russian"
218 !insertmacro MUI_LANGUAGE "Ukrainian"
219
220 ; !insertmacro MUI_LANGUAGE "French"
221 ; !insertmacro MUI_LANGUAGE "SpanishInternational"
222 ; !insertmacro MUI_LANGUAGE "SimpChinese"
223 ; !insertmacro MUI_LANGUAGE "TradChinese"
224 ; !insertmacro MUI_LANGUAGE "Japanese"
225 ; !insertmacro MUI_LANGUAGE "Italian"
226 ; !insertmacro MUI_LANGUAGE "Dutch"
227 ; !insertmacro MUI_LANGUAGE "Greek"
228 ; !insertmacro MUI_LANGUAGE "Polish"
229 ; !insertmacro MUI_LANGUAGE "Hungarian"
230 ; !insertmacro MUI_LANGUAGE "Romanian"
231 ; !insertmacro MUI_LANGUAGE "Serbian"
232 ; !insertmacro MUI_LANGUAGE "SerbianLatin"
233 ; !insertmacro MUI_LANGUAGE "Arabic"
234 ; !insertmacro MUI_LANGUAGE "Portuguese"
235 ; !insertmacro MUI_LANGUAGE "Afrikaans"
236 ; !insertmacro MUI_LANGUAGE "Malay"
237 ; !insertmacro MUI_LANGUAGE "Indonesian"
238
239
240 ;--------------------------------
241 ;Translation
242 ;--------------------------------
243
244 ;English
245 !include "..\Translation\Blank.nsh"
246
247 ;German
248 !include "..\Translation\LameXP_DE.nsh"
249
250 ;Spanish
251 !include "..\Translation\LameXP_ES.nsh"
252
253 ;Russian
254 !include "..\Translation\LameXP_RU.nsh"
255
256 ;Ukrainian
257 !include "..\Translation\LameXP_UK.nsh"
258
259
260 ;--------------------------------
261 ;Installer initialization
262 ;--------------------------------
263
264 Function .onInit
265         System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
266         Pop $0
267         ${If} $0 <> 0
268                 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the installer is already running!"
269                 Quit
270         ${EndIf}
271
272         ${StdUtils.GetParameter} $R0 "Update" "?"
273         ${If} "$R0" == "?"
274                 !insertmacro MUI_LANGDLL_DISPLAY
275         ${EndIf}
276
277         ; --------
278         
279         ${IfNot} ${IsNT}
280                 MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does NOT support Windows 9x or Windows ME!"
281                 Quit
282         ${EndIf}
283
284         ${If} ${AtMostWinNT4}
285                 ${StdUtils.GetParameter} $R0 "Update" "?"
286                 ${If} $R0 == "?"
287                         MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, your platform is not supported anymore. Installation aborted!$\nThe minimum required platform is Windows 2000."
288                 ${Else}
289                         MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, your platform is not supported anymore. Update not possible!$\nThe minimum required platform is Windows 2000."
290                 ${EndIf}
291                 Quit
292         ${EndIf}
293         
294         ; --------
295
296         UserInfo::GetAccountType
297         Pop $0
298         ${If} $0 != "Admin"
299                 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
300                 Quit
301         ${EndIf}
302         
303         ; --------
304
305         InitPluginsDir
306         File "/oname=$PLUGINSDIR\checkproc.exe" "checkproc.exe"
307         nsExec::Exec /TIMEOUT=5000 '"$PLUGINSDIR\checkproc.exe" Softonic Brothersoft'
308         Pop $0
309 FunctionEnd
310
311 Function un.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 un-installer is already running!"
316                 Quit
317         ${EndIf}
318
319         ${StdUtils.GetParameter} $R0 "Force" "?"
320         ${If} "$R0" == "?"
321                 !insertmacro MUI_LANGDLL_DISPLAY
322         ${EndIf}
323         
324         ; --------
325
326         UserInfo::GetAccountType
327         Pop $0
328         ${If} $0 != "Admin"
329                 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
330                 Quit
331         ${EndIf}
332 FunctionEnd
333
334
335 ;--------------------------------
336 ;GUI initialization
337 ;--------------------------------
338
339 Function MyGuiInit
340         StrCpy $0 $HWNDPARENT
341         System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
342         Aero::Apply
343 FunctionEnd
344
345 Function un.MyGuiInit
346         StrCpy $0 $HWNDPARENT
347         System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
348         Aero::Apply
349 FunctionEnd
350
351
352 ;--------------------------------
353 ;Macros & Auxiliary Functions
354 ;--------------------------------
355
356 !macro PrintProgress Text
357         SetDetailsPrint textonly
358         DetailPrint '${Text}'
359         SetDetailsPrint listonly
360         Sleep 1000
361 !macroend
362
363 !macro CreateWebLink ShortcutFile TargetURL
364         Push $0
365         Push $1
366         StrCpy $0 "${ShortcutFile}"
367         StrCpy $1 "${TargetURL}"
368         Call _CreateWebLink
369         Pop $1
370         Pop $0
371 !macroend
372
373 Function _CreateWebLink
374         FlushINI "$0"
375         SetFileAttributes "$0" FILE_ATTRIBUTE_NORMAL
376         DeleteINISec "$0" "DEFAULT"
377         DeleteINISec "$0" "InternetShortcut"
378         WriteINIStr "$0" "DEFAULT" "BASEURL" "$1"
379         WriteINIStr "$0" "InternetShortcut" "ORIGURL" "$1"
380         WriteINIStr "$0" "InternetShortcut" "URL" "$1"
381         WriteINIStr "$0" "InternetShortcut" "IconFile" "$SYSDIR\SHELL32.dll"
382         WriteINIStr "$0" "InternetShortcut" "IconIndex" "150"
383         FlushINI "$0"
384         SetFileAttributes "$0" FILE_ATTRIBUTE_READONLY
385 FunctionEnd
386
387 !macro GetExecutableName OutVar
388         ${StdUtils.GetParameter} ${OutVar} "Update" ""
389         ${StdUtils.TrimStr} ${OutVar}
390         ${IfThen} "${OutVar}" == "" ${|} StrCpy ${OutVar} "LameXP.exe" ${|}
391 !macroend
392
393 !macro DisableNextButton TmpVar
394         GetDlgItem ${TmpVar} $HWNDPARENT 1
395         EnableWindow ${TmpVar} 0
396 !macroend
397
398
399 ;--------------------------------
400 ;Install Files
401 ;--------------------------------
402
403 Section "-PreInit"
404         SetShellVarContext all
405         SetOutPath "$INSTDIR"
406 SectionEnd
407
408 Section "!Install Files"
409         !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_INSTFILES)"
410
411         Delete "$INSTDIR\Changelog.htm"
412         Delete "$INSTDIR\Changelog.html"
413         Delete "$INSTDIR\Contributors.txt"
414         Delete "$INSTDIR\FAQ.html"
415         Delete "$INSTDIR\Howto.html"
416         Delete "$INSTDIR\LameEnc.sys"
417         Delete "$INSTDIR\LameXP.exe"
418         Delete "$INSTDIR\LameXP.exe.sig"
419         Delete "$INSTDIR\License.txt"
420         Delete "$INSTDIR\Readme.htm"
421         Delete "$INSTDIR\ReadMe.txt"
422         Delete "$INSTDIR\Settings.cfg"
423         Delete "$INSTDIR\Translate.html"
424         Delete "$INSTDIR\Uninstall.exe"
425
426         !insertmacro GetExecutableName $R0
427
428         DeleteOldBinary:
429         ClearErrors
430         Delete "$INSTDIR\$R0"
431         
432         ${If} ${Errors}
433                 MessageBox MB_TOPMOST|MB_ICONSTOP|MB_RETRYCANCEL 'Could not delete old "$R0" file. Is LameXP still running?' IDRETRY DeleteOldBinary
434                 Abort "Could not delete old binary!"
435         ${EndIf}
436         
437         File `/oname=$R0` `${LAMEXP_SOURCE_PATH}\LameXP.exe`
438         File `${LAMEXP_SOURCE_PATH}\*.txt`
439         File `${LAMEXP_SOURCE_PATH}\*.html`
440 SectionEnd
441
442 Section "-Write Uinstaller"
443         !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_MAKEUNINST)"
444         WriteUninstaller "$INSTDIR\Uninstall.exe"
445 SectionEnd
446
447 Section "-Create Shortcuts"
448         !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
449                 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_SHORTCUTS)"
450                 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
451                 
452                 SetShellVarContext current
453                 
454                 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
455                 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
456                 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
457                 
458                 SetShellVarContext all
459                 
460                 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
461                 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
462                 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
463
464                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" "$INSTDIR\LameXP.exe" "" "$INSTDIR\LameXP.exe" 0
465                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_LICENSE).lnk" "$INSTDIR\License.txt"
466                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_CHANGELOG).lnk" "$INSTDIR\Changelog.html"
467                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_TRANSLATE).lnk" "$INSTDIR\Translate.html"
468                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_FAQ).lnk" "$INSTDIR\FAQ.html"
469                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_UNINSTALL).lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
470                 
471                 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Official LameXP Homepage.url" "http://mulder.dummwiedeutsch.de/"
472                 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Doom9's Forum.url" "http://forum.doom9.org/"
473                 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\RareWares.org.url" "http://rarewares.org/"
474                 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Hydrogenaudio Forums.url" "http://www.hydrogenaudio.org/"
475         !insertmacro MUI_STARTMENU_WRITE_END
476 SectionEnd
477
478 Section "-Update Registry"
479         !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_REGISTRY)"
480         WriteRegStr HKLM "${MyRegPath}" "InstallLocation" "$INSTDIR"
481         WriteRegStr HKLM "${MyRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
482         WriteRegStr HKLM "${MyRegPath}" "DisplayName" "LameXP"
483 SectionEnd
484
485 Section "-Finished"
486         !insertmacro PrintProgress "$(MUI_TEXT_FINISH_TITLE)."
487
488         ; ---- POLL ----
489         ; !insertmacro UAC_AsUser_ExecShell "" "http://mulder.brhack.net/temp/style_poll/" "" "" SW_SHOWNORMAL
490         ; ---- POLL ----
491 SectionEnd
492
493
494 ;--------------------------------
495 ;Uninstaller
496 ;--------------------------------
497
498 Section "Uninstall"
499         SetOutPath "$INSTDIR"
500         !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_UNINSTALL)"
501
502         Delete /REBOOTOK "$INSTDIR\LameXP.exe"
503         Delete /REBOOTOK "$INSTDIR\LameXP-Portable.exe"
504         Delete /REBOOTOK "$INSTDIR\LameXP.exe.sig"
505         Delete /REBOOTOK "$INSTDIR\LameXP*"
506         Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
507         Delete /REBOOTOK "$INSTDIR\Changelog.htm"
508         Delete /REBOOTOK "$INSTDIR\Changelog.html"
509         Delete /REBOOTOK "$INSTDIR\Translate.html"
510         Delete /REBOOTOK "$INSTDIR\FAQ.html"
511         Delete /REBOOTOK "$INSTDIR\Howto.html"
512         Delete /REBOOTOK "$INSTDIR\License.txt"
513         Delete /REBOOTOK "$INSTDIR\Contributors.txt"
514         Delete /REBOOTOK "$INSTDIR\ReadMe.txt"
515
516         RMDir "$INSTDIR"
517
518         !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
519         StrCmp "$StartMenuFolder" "" NoStartmenuFolder
520         IfFileExists "$SMPROGRAMS\$StartMenuFolder\*.*" 0 NoStartmenuFolder
521         Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
522         Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
523         RMDir "$SMPROGRAMS\$StartMenuFolder"
524
525         NoStartmenuFolder:
526
527         DeleteRegValue HKLM "${MyRegPath}" "InstallLocation"
528         DeleteRegValue HKLM "${MyRegPath}" "UninstallString"
529         DeleteRegValue HKLM "${MyRegPath}" "DisplayName"
530         DeleteRegValue HKLM "${MyRegPath}" "StartmenuFolder"
531         DeleteRegValue HKLM "${MyRegPath}" "SetupLanguage"
532         
533         MessageBox MB_YESNO|MB_TOPMOST "$(LAMEXP_LANG_UNINST_PERSONAL)" IDNO +3
534         Delete "$LOCALAPPDATA\LoRd_MuldeR\LameXP - Audio Encoder Front-End\config.ini"
535         Delete "$INSTDIR\*.ini"
536
537         !insertmacro PrintProgress "$(MUI_UNTEXT_FINISH_TITLE)."
538 SectionEnd
539
540
541 ;--------------------------------
542 ;Check For Update Mode
543 ;--------------------------------
544
545 Function CheckForUpdate
546         ${StdUtils.GetParameter} $R0 "Update" "?"
547         ${IfNotThen} "$R0" == "?" ${|} Goto EnableUpdateMode ${|}
548
549         ${IfThen} "$INSTDIR" == "" ${|} Return ${|}
550         ${IfThen} "$INSTDIR" == "$EXEDIR" ${|} Return ${|}
551         ${IfNotThen} ${FileExists} "$INSTDIR\LameXP.exe" ${|} Return ${|}
552
553         EnableUpdateMode:
554
555         FindWindow $R0 "#32770" "" $HWNDPARENT
556         GetDlgItem $R1 $R0 1019
557         EnableWindow $R1 0
558
559         FindWindow $R0 "#32770" "" $HWNDPARENT
560         GetDlgItem $R1 $R0 1001
561         EnableWindow $R1 0
562 FunctionEnd
563
564 Function un.CheckForcedUninstall
565         ${StdUtils.GetParameter} $R0 "Force" "?"
566         ${IfNotThen} "$R0" == "?" ${|} Abort ${|}
567 FunctionEnd
568
569
570 ;--------------------------------
571 ;Check For Pre-Release
572 ;--------------------------------
573
574 Function CheckForPreRelease
575         !ifdef LAMEXP_IS_PRERELEASE
576                 ${StdUtils.GetParameter} $R0 "Update" "?"
577                 StrCmp $R0 "?" 0 SkipPrereleaseWarning
578                 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(LAMEXP_LANG_PRERELEASE_WARNING)" /SD IDOK IDOK +2
579                 Quit
580                 SkipPrereleaseWarning:
581         !endif
582 FunctionEnd
583
584
585 ;--------------------------------
586 ;Locked List
587 ;--------------------------------
588
589 Function LockedListShow
590         !insertmacro MUI_HEADER_TEXT "$(LAMEXP_LANG_LOCKEDLIST_HEADER)" "$(LAMEXP_LANG_LOCKEDLIST_TEXT)"
591         !insertmacro GetExecutableName $R0
592         LockedList::AddModule "\$R0"
593         LockedList::AddModule "\Uninstall.exe"
594         LockedList::AddModule "\Au_.exe"
595         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)"
596         Pop $R0
597 FunctionEnd
598
599 Function un.LockedListShow
600         !insertmacro MUI_HEADER_TEXT "$(LAMEXP_LANG_LOCKEDLIST_HEADER)" "$(LAMEXP_LANG_LOCKEDLIST_TEXT)"
601         LockedList::AddModule "\LameXP.exe"
602         LockedList::AddModule "\Uninstall.exe"
603         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)"
604         Pop $R0
605 FunctionEnd
606
607
608 ;--------------------------------
609 ;Install Success
610 ;--------------------------------
611
612 Function RunAppFunction
613         !insertmacro DisableNextButton $R0
614         !insertmacro GetExecutableName $R0
615         ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR" "explore" ""
616         ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
617 FunctionEnd
618
619 Function ShowReadmeFunction
620         !insertmacro DisableNextButton $R0
621         ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\FAQ.html" "open" ""
622 FunctionEnd