2010-11-29 20:36:27 +01:00
; ///////////////////////////////////////////////////////////////////////////////
; // LameXP - Audio Encoder Front-End
; // Copyright (C) 2004-2010 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
; // the Free Software Foundation; either version 2 of the License, or
; // (at your option) any later version.
; //
; // This program is distributed in the hope that it will be useful,
; // but WITHOUT ANY WARRANTY; without even the implied warranty of
; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; // GNU General Public License for more details.
; //
; // You should have received a copy of the GNU General Public License along
; // with this program; if not, write to the Free Software Foundation, Inc.,
; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
; //
; // http://www.gnu.org/licenses/gpl-2.0.txt
; ///////////////////////////////////////////////////////////////////////////////
RequestExecutionLevel user
BrandingText `Date created: ${LAMEXP_DATE}`
ShowInstDetails show
2010-11-10 17:03:01 +01:00
!define ZIP2EXE_NAME `LameXP v${LAMEXP_VERSION} ${LAMEXP_SUFFIX} [Build #${LAMEXP_BUILD}]`
2010-11-10 00:59:50 +01:00
!define ZIP2EXE_OUTFILE `${LAMEXP_OUTPUT_FILE}`
!define ZIP2EXE_COMPRESSOR_LZMA
!define ZIP2EXE_COMPRESSOR_SOLID
!define ZIP2EXE_INSTALLDIR `$PROGRAMFILES\${ZIP2EXE_NAME}`
2010-11-29 14:00:27 +01:00
2010-11-29 20:36:27 +01:00
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
2010-11-29 14:00:27 +01:00
!define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
2010-11-29 22:06:54 +01:00
!searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
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 "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
VIAddVersionKey "LegalCopyright" "Copyright 2004-2010 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/"
2010-11-29 21:42:39 +01:00
2010-11-29 14:00:27 +01:00
!include `UAC.nsh`
!include `parameters.nsh`
2010-11-10 00:59:50 +01:00
!include `${NSISDIR}\Contrib\zip2exe\Base.nsh`
!include `${NSISDIR}\Contrib\zip2exe\Modern.nsh`
2010-11-29 14:00:27 +01:00
Function .onInit
UAC_TryAgain:
!insertmacro UAC_RunElevated
${Switch} $0
${Case} 0
${IfThen} $1 = 1 ${|} Quit ${|}
${IfThen} $3 <> 0 ${|} ${Break} ${|}
${If} $1 = 3
2010-11-29 20:36:27 +01:00
MessageBox MB_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND|MB_OKCANCEL "This installer requires admin access, please try again!" /SD IDCANCEL IDOK UAC_TryAgain
2010-11-29 14:00:27 +01:00
${EndIf}
${Case} 1223
2010-11-29 20:36:27 +01:00
MessageBox MB_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND|MB_OKCANCEL "This installer requires admin privileges, please try again!" /SD IDCANCEL IDOK UAC_TryAgain
2010-11-29 14:00:27 +01:00
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}
FunctionEnd
Function .onInstSuccess
2010-11-29 21:42:39 +01:00
!insertmacro UAC_AsUser_Call Function LaunchApplication ${UAC_SYNCINSTDIR}
2010-11-29 14:00:27 +01:00
FunctionEnd
2010-11-10 00:59:50 +01:00
!insertmacro SECTION_BEGIN
2010-11-29 14:00:27 +01:00
File /r `${LAMEXP_SOURCE_PATH}\*.*`
2010-11-10 00:59:50 +01:00
!insertmacro SECTION_END
2010-11-29 14:00:27 +01:00
Function CheckForUpdate
!insertmacro GetCommandlineParameter "Update" "error" $R0
StrCmp $R0 "error" 0 +2
Return
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1019
SendMessage $R1 ${EM_SETREADONLY} 1 0
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1001
EnableWindow $R1 0
GetDlgItem $R1 $HWNDPARENT 1
SendMessage $R1 ${WM_SETTEXT} 0 "STR:Update"
FunctionEnd
2010-11-29 21:42:39 +01:00
Function LaunchApplication
ExecShell "explore" "$INSTDIR"
Exec '"$INSTDIR\LameXP.exe"'
FunctionEnd