OSDN Git Service

Updated web-site URL.
[lamexp/LameXP.git] / etc / NSIS / setup.nsi
index d7786e2..1e5f3ba 100644 (file)
@@ -1,6 +1,6 @@
 ; ///////////////////////////////////////////////////////////////////////////////
 ; // LameXP - Audio Encoder Front-End
-; // Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
+; // Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
 ; //
 ; // 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
 ; // http://www.gnu.org/licenses/gpl-2.0.txt
 ; ///////////////////////////////////////////////////////////////////////////////
 
+
 ;--------------------------------
 ;Basic Defines
 ;--------------------------------
 
+!ifndef NSIS_UNICODE
+  !error "NSIS_UNICODE is undefined, please compile with Unicode NSIS !!!"
+!endif
+
 !ifndef LAMEXP_VERSION
   !error "LAMEXP_VERSION is not defined !!!"
 !endif
 !ifndef LAMEXP_BUILD
   !error "LAMEXP_BUILD is not defined !!!"
 !endif
-!ifndef LAMEXP_SUFFIX
-  !error "LAMEXP_SUFFIX is not defined !!!"
+!ifndef LAMEXP_INSTTYPE
+  !error "LAMEXP_INSTTYPE is not defined !!!"
+!endif
+!ifndef LAMEXP_PATCH
+  !error "LAMEXP_PATCH is not defined !!!"
 !endif
 !ifndef LAMEXP_DATE
   !error "LAMEXP_DATE is not defined !!!"
 !define MyRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FBD7A67D-D700-4043-B54F-DD106D00F308}"
 
 ;Web-Site
-!define MyWebSite "http://mulder.dummwiedeutsch.de/"
+!define MyWebSite "http://muldersoft.com/"
+
+
+;--------------------------------
+;Check for Pre-Release
+;--------------------------------
+
+!define LAMEXP_IS_PRERELEASE
+
+!if '${LAMEXP_INSTTYPE}' == 'Final'
+  !undef LAMEXP_IS_PRERELEASE
+!endif
+!if '${LAMEXP_INSTTYPE}' == 'Hotfix'
+  !undef LAMEXP_IS_PRERELEASE
+!endif
+
 
 ;--------------------------------
 ;Includes
 
 !include `MUI2.nsh`
 !include `WinVer.nsh`
-!include `UAC.nsh`
-!include `parameters.nsh`
+!include `x64.nsh`
+!include `StdUtils.nsh`
 
 
 ;--------------------------------
 ;Installer Attributes
 ;--------------------------------
 
-RequestExecutionLevel user
+RequestExecutionLevel admin
 ShowInstDetails show
 ShowUninstDetails show
-Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_SUFFIX} [Build #${LAMEXP_BUILD}]"
+Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
 OutFile "${LAMEXP_OUTPUT_FILE}"
 BrandingText "Date created: ${LAMEXP_DATE} [Build #${LAMEXP_BUILD}]"
 InstallDir "$PROGRAMFILES\MuldeR\LameXP v${LAMEXP_VERSION}"
@@ -89,11 +112,16 @@ SetCompressorDictSize 64
 ;Reserved Files
 ;--------------------------------
 
-ReserveFile "${NSISDIR}\Plugins\UAC.dll"
-ReserveFile "${NSISDIR}\Plugins\System.dll"
+ReserveFile "${NSISDIR}\Plugins\Aero.dll"
+ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
+ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
+ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
 ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
-ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
+ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
+ReserveFile "${NSISDIR}\Plugins\System.dll"
+ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
+ReserveFile "checkproc.exe"
 
 
 ;--------------------------------
@@ -113,14 +141,14 @@ VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
 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."
 VIAddVersionKey "CompanyName" "Free Software Foundation"
-VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_SUFFIX} [Build #${LAMEXP_BUILD}]"
+VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
-VIAddVersionKey "LegalCopyright" "Copyright 2004-2011 LoRd_MuldeR"
+VIAddVersionKey "LegalCopyright" "Copyright 2004-2013 LoRd_MuldeR"
 VIAddVersionKey "LegalTrademarks" "GNU"
 VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.exe"
 VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
 VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
-VIAddVersionKey "Website" "http://mulder.at.gg/"
+VIAddVersionKey "Website" "${MyWebSite}"
 
 
 ;--------------------------------
@@ -145,14 +173,14 @@ VIAddVersionKey "Website" "http://mulder.at.gg/"
 !define MUI_FINISHPAGE_LINK_LOCATION ${MyWebSite}
 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
-!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
-!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp"
+!define MUI_WELCOMEFINISHPAGE_BITMAP "wizard.bmp"
+!define MUI_UNWELCOMEFINISHPAGE_BITMAP "wizard-un.bmp"
 !define MUI_HEADERIMAGE
-!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
-!define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp"
+!define MUI_HEADERIMAGE_BITMAP "header.bmp"
+!define MUI_HEADERIMAGE_UNBITMAP "header-un.bmp"
 !define MUI_LANGDLL_ALLLANGUAGES
-!define MUI_CUSTOMFUNCTION_GUIINIT MyUacInit
-!define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyUacInit
+!define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
+!define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyGuiInit
 !define MUI_LANGDLL_ALWAYSSHOW
 
 
@@ -161,6 +189,7 @@ VIAddVersionKey "Website" "http://mulder.at.gg/"
 ;--------------------------------
 
 ;Installer
+!define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckForPreRelease
 !define MUI_WELCOMEPAGE_TITLE_3LINES
 !define MUI_FINISHPAGE_TITLE_3LINES
 !insertmacro MUI_PAGE_WELCOME
@@ -175,7 +204,9 @@ Page Custom LockedListShow
 ;Uninstaller
 !define MUI_WELCOMEPAGE_TITLE_3LINES
 !define MUI_FINISHPAGE_TITLE_3LINES
+!define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
 !insertmacro MUI_UNPAGE_WELCOME
+!define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
 !insertmacro MUI_UNPAGE_CONFIRM
 UninstPage Custom un.LockedListShow
 !insertmacro MUI_UNPAGE_INSTFILES
@@ -190,6 +221,7 @@ UninstPage Custom un.LockedListShow
 !insertmacro MUI_LANGUAGE "German"
 !insertmacro MUI_LANGUAGE "Spanish"
 !insertmacro MUI_LANGUAGE "Russian"
+!insertmacro MUI_LANGUAGE "Ukrainian"
 
 ; !insertmacro MUI_LANGUAGE "French"
 ; !insertmacro MUI_LANGUAGE "SpanishInternational"
@@ -200,7 +232,6 @@ UninstPage Custom un.LockedListShow
 ; !insertmacro MUI_LANGUAGE "Dutch"
 ; !insertmacro MUI_LANGUAGE "Greek"
 ; !insertmacro MUI_LANGUAGE "Polish"
-; !insertmacro MUI_LANGUAGE "Ukrainian"
 ; !insertmacro MUI_LANGUAGE "Hungarian"
 ; !insertmacro MUI_LANGUAGE "Romanian"
 ; !insertmacro MUI_LANGUAGE "Serbian"
@@ -228,94 +259,126 @@ UninstPage Custom un.LockedListShow
 ;Russian
 !include "..\Translation\LameXP_RU.nsh"
 
+;Ukrainian
+!include "..\Translation\LameXP_UK.nsh"
+
+
 ;--------------------------------
 ;Installer initialization
 ;--------------------------------
 
 Function .onInit
-       ${If} ${UAC_IsInnerInstance}
-               !insertmacro MUI_LANGDLL_DISPLAY
-       ${Else}
-               System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
-               Pop $0
-               StrCmp $0 0 +3
+       System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
+       Pop $0
+       ${If} $0 <> 0
                MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the installer is already running!"
                Quit
-       ${EndIf}  
+       ${EndIf}
 
-       ${If} ${IsNT}
-               Goto OS_Windows_NT
-       ${Else}
-               MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, the Windows 9x series (including ME) is not supported by this application!"
+       ; --------
+       
+       # Running on Windows NT family?
+       ${IfNot} ${IsNT}
+               MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does *not* support Windows 9x or Windows ME!"
+               ExecShell "open" "http://windows.microsoft.com/"
                Quit
        ${EndIf}
-  
-       OS_Windows_NT:
-       ${If} ${AtMostWinNT4}
-               MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, Windows NT 4.0 (and older) is not supported by this application!"
+
+       # Running on Windows XP or later?
+       ${If} ${AtMostWin2000}
+               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)."
+               ExecShell "open" "http://windows.microsoft.com/"
                Quit
        ${EndIf}
+
+       # If on Windows XP, is the required Service Pack installed?
+       ${If} ${IsWinXP}
+               ${IfNot} ${RunningX64} # Windows XP 32-Bit, requires Service Pack 3
+               ${AndIf} ${AtMostServicePack} 2
+                       MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Windows XP with Service Pack 3 installed.$\nWindows XP *without* Service Pack 3 reached end-of-life on 2010-07-13.$\nCurrent Windows XP (Service Pack 3) will be supported until 2014-04-08.$\n$\nPlease install Service Pack 3 now or just run Windows Update!"
+                       ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 3 for Windows XP now?" IDYES`
+                               ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=24"
+                       ${Else}
+                               ExecShell "open" "http://windowsupdate.microsoft.com/"
+                       ${EndIf}
+                       Quit
+               ${EndIf}
+               ${If} ${RunningX64} # Windows XP 64-Bit, requires Service Pack 2
+               ${AndIf} ${AtMostServicePack} 1
+                       MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Windows XP x64 Edition with Service Pack 2 installed.$\nWindows XP x64 Edition *without* Service Pack 2 reached end-of-life on 2009-04-14.$\nCurrent Windows XP x64 Edition (Service Pack 2) will be supported until 2014-04-08.$\n$\nPlease install Service Pack 2 now or just run Windows Update!"
+                       ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 2 for Windows XP x64 Edition now?" IDYES`
+                               ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=17791"
+                       ${Else}
+                               ExecShell "open" "http://windowsupdate.microsoft.com/"
+                       ${EndIf}
+                       Quit
+               ${EndIf}
+       ${EndIf}
+
+       ; --------
+
+       ${StdUtils.GetParameter} $R0 "Update" "?"
+       ${If} "$R0" == "?"
+               !insertmacro MUI_LANGDLL_DISPLAY
+       ${EndIf}
+
+       ; --------
+
+       UserInfo::GetAccountType
+       Pop $0
+       ${If} $0 != "Admin"
+               MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
+               SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
+               Quit
+       ${EndIf}
+       
+       ; --------
+
+       InitPluginsDir
+       File "/oname=$PLUGINSDIR\checkproc.exe" "checkproc.exe"
+       nsExec::Exec /TIMEOUT=5000 '"$PLUGINSDIR\checkproc.exe" Softonic Brothersoft Afreecodec'
+       Pop $0
 FunctionEnd
 
 Function un.onInit
-       ${If} ${UAC_IsInnerInstance}
-               !insertmacro MUI_LANGDLL_DISPLAY
-       ${Else}
-               System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
-               Pop $0
-               StrCmp $0 0 +3
+       System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
+       Pop $0
+       ${If} $0 <> 0
                MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the un-installer is already running!"
                Quit
-       ${EndIf}  
+       ${EndIf}
+
+       ${StdUtils.GetParameter} $R0 "Force" "?"
+       ${If} "$R0" == "?"
+               !insertmacro MUI_LANGDLL_DISPLAY
+       ${EndIf}
+       
+       ; --------
+
+       UserInfo::GetAccountType
+       Pop $0
+       ${If} $0 != "Admin"
+               MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
+               SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
+               Quit
+       ${EndIf}
 FunctionEnd
 
 
 ;--------------------------------
-;UAC initialization
+;GUI initialization
 ;--------------------------------
 
-Function MyUacInit
-       UAC_TryAgain:
-       !insertmacro UAC_RunElevated
-       ${Switch} $0
-       ${Case} 0
-               ${IfThen} $1 = 1 ${|} Quit ${|}
-               ${IfThen} $3 <> 0 ${|} ${Break} ${|}
-               ${If} $1 = 3
-                       MessageBox MB_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND|MB_OKCANCEL "This installer requires admin access, please try again!" /SD IDCANCEL IDOK UAC_TryAgain
-               ${EndIf}
-       ${Case} 1223
-               MessageBox MB_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND|MB_OKCANCEL "This installer requires admin privileges, please try again!" /SD IDCANCEL IDOK UAC_TryAgain
-               Quit
-       ${Case} 1062
-               MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Logon service not running, aborting!"
-               Quit
-       ${Default}
-               MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Unable to elevate installer! (Error code: $0)"
-               Quit
-       ${EndSwitch}
+Function MyGuiInit
+       StrCpy $0 $HWNDPARENT
+       System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
+       Aero::Apply
 FunctionEnd
 
-Function un.MyUacInit
-       UAC_TryAgain:
-       !insertmacro UAC_RunElevated
-       ${Switch} $0
-       ${Case} 0
-               ${IfThen} $1 = 1 ${|} Quit ${|}
-               ${IfThen} $3 <> 0 ${|} ${Break} ${|}
-               ${If} $1 = 3
-                       MessageBox MB_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND|MB_OKCANCEL "This un-installer requires admin access, please try again!" /SD IDCANCEL IDOK UAC_TryAgain
-               ${EndIf}
-       ${Case} 1223
-               MessageBox MB_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND|MB_OKCANCEL "This un-installer requires admin privileges, please try again!" /SD IDCANCEL IDOK UAC_TryAgain
-               Quit
-       ${Case} 1062
-               MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Logon service not running, aborting!"
-               Quit
-       ${Default}
-               MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "Unable to elevate installer! (Error code: $0)"
-               Quit
-       ${EndSwitch}
+Function un.MyGuiInit
+       StrCpy $0 $HWNDPARENT
+       System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
+       Aero::Apply
 FunctionEnd
 
 
@@ -354,48 +417,15 @@ Function _CreateWebLink
        SetFileAttributes "$0" FILE_ATTRIBUTE_READONLY
 FunctionEnd
 
-!macro TrimStr VarName
-       Push ${VarName}
-       Call _TrimStr
-       Pop ${VarName}
+!macro GetExecutableName OutVar
+       ${StdUtils.GetParameter} ${OutVar} "Update" ""
+       ${StdUtils.TrimStr} ${OutVar}
+       ${IfThen} "${OutVar}" == "" ${|} StrCpy ${OutVar} "LameXP.exe" ${|}
 !macroend
 
-Function _TrimStr
-       Exch $R1
-       Push $R2
-       TrimLoop1:
-       StrCpy $R2 "$R1" 1
-       StrCmp "$R2" " " TrimLeft
-       StrCmp "$R2" "$\r" TrimLeft
-       StrCmp "$R2" "$\n" TrimLeft
-       StrCmp "$R2" "$\t" TrimLeft
-       Goto TrimLoop2
-       TrimLeft:       
-       StrCpy $R1 "$R1" "" 1
-       Goto TrimLoop1
-       TrimLoop2:
-       StrCpy $R2 "$R1" 1 -1
-       StrCmp "$R2" " " TrimRight
-       StrCmp "$R2" "$\r" TrimRight
-       StrCmp "$R2" "$\n" TrimRight
-       StrCmp "$R2" "$\t" TrimRight
-       Goto TrimDone
-       TrimRight:      
-       StrCpy $R1 "$R1" -1
-       Goto TrimLoop2
-       TrimDone:
-       Pop $R2
-       Exch $R1
-FunctionEnd
-
-!macro GetExecutableName OutVar
-       !insertmacro GetCommandlineParameter "Update" "LameXP.exe" ${OutVar}
-       !insertmacro TrimStr ${OutVar}
-       StrCmp ${OutVar} "" 0 +2
-       StrCpy ${OutVar} "LameXP.exe"
+!macro DisableNextButton TmpVar
+       GetDlgItem ${TmpVar} $HWNDPARENT 1
+       EnableWindow ${TmpVar} 0
 !macroend
 
 
@@ -404,6 +434,7 @@ FunctionEnd
 ;--------------------------------
 
 Section "-PreInit"
+       SetShellVarContext all
        SetOutPath "$INSTDIR"
 SectionEnd
 
@@ -413,19 +444,36 @@ Section "!Install Files"
        Delete "$INSTDIR\Changelog.htm"
        Delete "$INSTDIR\Changelog.html"
        Delete "$INSTDIR\Contributors.txt"
+       Delete "$INSTDIR\Copying.txt"
        Delete "$INSTDIR\FAQ.html"
        Delete "$INSTDIR\Howto.html"
+       Delete "$INSTDIR\LameEnc.sys"
        Delete "$INSTDIR\LameXP.exe"
        Delete "$INSTDIR\LameXP.exe.sig"
+       Delete "$INSTDIR\LameXP-Portable.exe"
        Delete "$INSTDIR\License.txt"
+       Delete "$INSTDIR\Manual.html"
+       Delete "$INSTDIR\Readme.htm"
        Delete "$INSTDIR\ReadMe.txt"
+       Delete "$INSTDIR\PRE_RELEASE_INFO.txt"
+       Delete "$INSTDIR\Settings.cfg"
        Delete "$INSTDIR\Translate.html"
        Delete "$INSTDIR\Uninstall.exe"
 
        !insertmacro GetExecutableName $R0
-       File `/oname=$R0` `${LAMEXP_SOURCE_PATH}\LameXP.exe`
-       File `${LAMEXP_SOURCE_PATH}\*.txt`
-       File `${LAMEXP_SOURCE_PATH}\*.html`
+
+       DeleteOldBinary:
+       ClearErrors
+       Delete "$INSTDIR\$R0"
+       
+       ${If} ${Errors}
+               MessageBox MB_TOPMOST|MB_ICONSTOP|MB_RETRYCANCEL 'Could not delete old "$R0" file. Is LameXP still running?' IDRETRY DeleteOldBinary
+               Abort "Could not delete old binary!"
+       ${EndIf}
+       
+       File /a `/oname=$R0` `${LAMEXP_SOURCE_PATH}\LameXP.exe`
+       File /a `${LAMEXP_SOURCE_PATH}\*.txt`
+       File /a `${LAMEXP_SOURCE_PATH}\*.html`
 SectionEnd
 
 Section "-Write Uinstaller"
@@ -438,37 +486,63 @@ Section "-Create Shortcuts"
                !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_SHORTCUTS)"
                CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
                
+               SetShellVarContext current
+               
                Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
                Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
                Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
                
-               CreateShortCut "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" "$INSTDIR\LameXP.exe" "" "$INSTDIR\LameXP.exe" 0
+               SetShellVarContext all
+               
+               Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
+               Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
+               Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
+
+               !insertmacro GetExecutableName $R0
+               
+               CreateShortCut "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" "$INSTDIR\$R0" "" "$INSTDIR\$R0" 0
                CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_LICENSE).lnk" "$INSTDIR\License.txt"
                CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_CHANGELOG).lnk" "$INSTDIR\Changelog.html"
                CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_TRANSLATE).lnk" "$INSTDIR\Translate.html"
                CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_FAQ).lnk" "$INSTDIR\FAQ.html"
+               CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_MANUAL).lnk" "$INSTDIR\Manual.html"
                CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_UNINSTALL).lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
                
                !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Official LameXP Homepage.url" "http://mulder.dummwiedeutsch.de/"
                !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Doom9's Forum.url" "http://forum.doom9.org/"
                !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\RareWares.org.url" "http://rarewares.org/"
                !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Hydrogenaudio Forums.url" "http://www.hydrogenaudio.org/"
+
+               ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
+                       ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
+                       DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
+               ${EndIf}
        !insertmacro MUI_STARTMENU_WRITE_END
 SectionEnd
 
 Section "-Update Registry"
        !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_REGISTRY)"
+
+       !insertmacro GetExecutableName $R0
        WriteRegStr HKLM "${MyRegPath}" "InstallLocation" "$INSTDIR"
+       WriteRegStr HKLM "${MyRegPath}" "ExecutableName" "$R0"
+       WriteRegStr HKLM "${MyRegPath}" "DisplayIcon" "$INSTDIR\$R0,0"
        WriteRegStr HKLM "${MyRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
-       WriteRegStr HKLM "${MyRegPath}" "DisplayName" "LameXP"
+       WriteRegStr HKLM "${MyRegPath}" "DisplayName" "LameXP v${LAMEXP_VERSION}"
+       WriteRegStr HKLM "${MyRegPath}" "Publisher" "LoRd_MuldeR <mulder2@gmx.de>"
+       WriteRegStr HKLM "${MyRegPath}" "DisplayVersion" "${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
+       WriteRegStr HKLM "${MyRegPath}" "URLInfoAbout" "${MyWebSite}"
+       WriteRegStr HKLM "${MyRegPath}" "URLUpdateInfo" "${MyWebSite}"
 SectionEnd
 
 Section "-Finished"
        !insertmacro PrintProgress "$(MUI_TEXT_FINISH_TITLE)."
-       
-       ; ---- POLL ----
-       ; !insertmacro UAC_AsUser_ExecShell "" "http://mulder.brhack.net/temp/style_poll/" "" "" SW_SHOWNORMAL
-       ; ---- POLL ----
+
+!ifdef LAMEXP_IS_PRERELEASE
+       ${If} ${FileExists} "$INSTDIR\PRE_RELEASE_INFO.txt"
+               ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\PRE_RELEASE_INFO.txt" "open" ""
+       ${EndIf}
+!endif
 SectionEnd
 
 
@@ -480,35 +554,75 @@ Section "Uninstall"
        SetOutPath "$INSTDIR"
        !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_UNINSTALL)"
 
+       ; --------------
+       ; Startmenu
+       ; --------------
+       
+       !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
+       ${IfNot} "$StartMenuFolder" == ""
+               SetShellVarContext current
+               ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
+                       ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
+                       DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
+               ${EndIf}
+               ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
+                       Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
+                       Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
+                       RMDir "$SMPROGRAMS\$StartMenuFolder"
+               ${EndIf}
+               
+               SetShellVarContext all
+               ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
+                       ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
+                       DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
+               ${EndIf}
+               ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
+                       Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
+                       Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
+                       RMDir "$SMPROGRAMS\$StartMenuFolder"
+               ${EndIf}
+       ${EndIf}
+
+       ; --------------
+       ; Files
+       ; --------------
+
+       ReadRegStr $R0 HKLM "${MyRegPath}" "ExecutableName"
+       ${IfThen} "$R0" == "" ${|} StrCpy $R0 "LameXP.exe" ${|}
+
        Delete /REBOOTOK "$INSTDIR\LameXP.exe"
+       Delete /REBOOTOK "$INSTDIR\$R0"
        Delete /REBOOTOK "$INSTDIR\LameXP-Portable.exe"
        Delete /REBOOTOK "$INSTDIR\LameXP.exe.sig"
-       Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
+       Delete /REBOOTOK "$INSTDIR\LameXP*"
+       
        Delete /REBOOTOK "$INSTDIR\Changelog.htm"
        Delete /REBOOTOK "$INSTDIR\Changelog.html"
-       Delete /REBOOTOK "$INSTDIR\Translate.html"
+       Delete /REBOOTOK "$INSTDIR\Contributors.txt"
+       Delete /REBOOTOK "$INSTDIR\Copying.txt"
        Delete /REBOOTOK "$INSTDIR\FAQ.html"
        Delete /REBOOTOK "$INSTDIR\Howto.html"
+       Delete /REBOOTOK "$INSTDIR\LameEnc.sys"
        Delete /REBOOTOK "$INSTDIR\License.txt"
-       Delete /REBOOTOK "$INSTDIR\Contributors.txt"
+       Delete /REBOOTOK "$INSTDIR\Manual.html"
+       Delete /REBOOTOK "$INSTDIR\Readme.htm"
        Delete /REBOOTOK "$INSTDIR\ReadMe.txt"
+       Delete /REBOOTOK "$INSTDIR\PRE_RELEASE_INFO.txt"
+       Delete /REBOOTOK "$INSTDIR\Settings.cfg"
+       Delete /REBOOTOK "$INSTDIR\Translate.html"
+       Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
 
        RMDir "$INSTDIR"
 
-       !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
-       StrCmp "$StartMenuFolder" "" NoStartmenuFolder
-       IfFileExists "$SMPROGRAMS\$StartMenuFolder\*.*" 0 NoStartmenuFolder
-       Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
-       Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
-       RMDir "$SMPROGRAMS\$StartMenuFolder"
-
-       NoStartmenuFolder:
-
-       DeleteRegValue HKLM "${MyRegPath}" "InstallLocation"
-       DeleteRegValue HKLM "${MyRegPath}" "UninstallString"
-       DeleteRegValue HKLM "${MyRegPath}" "DisplayName"
-       DeleteRegValue HKLM "${MyRegPath}" "StartmenuFolder"
-       DeleteRegValue HKLM "${MyRegPath}" "SetupLanguage"
+       ; --------------
+       ; Registry
+       ; --------------
+       
+       DeleteRegKey HKLM "${MyRegPath}"
+       DeleteRegKey HKCU "${MyRegPath}"
+
+       DeleteRegKey HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
+       DeleteRegKey HKCU "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
        
        MessageBox MB_YESNO|MB_TOPMOST "$(LAMEXP_LANG_UNINST_PERSONAL)" IDNO +3
        Delete "$LOCALAPPDATA\LoRd_MuldeR\LameXP - Audio Encoder Front-End\config.ini"
@@ -523,17 +637,12 @@ SectionEnd
 ;--------------------------------
 
 Function CheckForUpdate
-       !insertmacro GetCommandlineParameter "Update" "?" $R0
-       StrCmp $R0 "?" 0 EnableUpdateMode
-
-       StrCmp "$INSTDIR" "" 0 +2
-       Return
-       IfFileExists "$INSTDIR\*.*" +2
-       Return
-       StrCmp "$EXEDIR" "$INSTDIR" 0 +2
-       Return
-       IfFileExists "$INSTDIR\LameXP.exe" +2
-       Return
+       ${StdUtils.GetParameter} $R0 "Update" "?"
+       ${IfNotThen} "$R0" == "?" ${|} Goto EnableUpdateMode ${|}
+
+       ${IfThen} "$INSTDIR" == "" ${|} Return ${|}
+       ${IfThen} "$INSTDIR" == "$EXEDIR" ${|} Return ${|}
+       ${IfNotThen} ${FileExists} "$INSTDIR\LameXP.exe" ${|} Return ${|}
 
        EnableUpdateMode:
 
@@ -546,6 +655,26 @@ Function CheckForUpdate
        EnableWindow $R1 0
 FunctionEnd
 
+Function un.CheckForcedUninstall
+       ${StdUtils.GetParameter} $R0 "Force" "?"
+       ${IfNotThen} "$R0" == "?" ${|} Abort ${|}
+FunctionEnd
+
+
+;--------------------------------
+;Check For Pre-Release
+;--------------------------------
+
+Function CheckForPreRelease
+       !ifdef LAMEXP_IS_PRERELEASE
+               ${StdUtils.GetParameter} $R0 "Update" "?"
+               StrCmp $R0 "?" 0 SkipPrereleaseWarning
+               MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(LAMEXP_LANG_PRERELEASE_WARNING)" /SD IDOK IDOK +2
+               Quit
+               SkipPrereleaseWarning:
+       !endif
+FunctionEnd
+
 
 ;--------------------------------
 ;Locked List
@@ -575,14 +704,13 @@ FunctionEnd
 ;--------------------------------
 
 Function RunAppFunction
+       !insertmacro DisableNextButton $R0
        !insertmacro GetExecutableName $R0
-       !insertmacro UAC_AsUser_ExecShell "explore" "$INSTDIR" "" "" SW_SHOWNORMAL
-       !insertmacro UAC_AsUser_ExecShell "open" "$INSTDIR\$R0" "" "$INSTDIR" SW_SHOWNORMAL
+       ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR" "explore" ""
+       ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
 FunctionEnd
 
 Function ShowReadmeFunction
-       !insertmacro UAC_AsUser_ExecShell "open" "$INSTDIR\Changelog.html" "" "" SW_SHOWNORMAL
-       !insertmacro UAC_AsUser_ExecShell "open" "$INSTDIR\FAQ.html" "" "" SW_SHOWNORMAL
-       !insertmacro UAC_AsUser_ExecShell "open" "$INSTDIR\Translate.html" "" "" SW_SHOWNORMAL
+       !insertmacro DisableNextButton $R0
+       ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\FAQ.html" "open" ""
 FunctionEnd
-