This commit is contained in:
Birunthan Mohanathas 2012-04-29 14:21:49 +03:00
parent e0d0f78ba1
commit 0ec27ccf6c

View File

@ -1,5 +1,12 @@
!verbose 3 !verbose 3
!addplugindir ".\" !addplugindir ".\"
!include "MUI2.nsh"
!include "x64.nsh"
!include "FileFunc.nsh"
!include "WordFunc.nsh"
!include "WinVer.nsh"
!include "UAC.nsh"
!ifndef VER !ifndef VER
!define VER "0.0" !define VER "0.0"
!define REV "000" !define REV "000"
@ -32,12 +39,14 @@ ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
ReserveFile "${NSISDIR}\Plugins\System.dll" ReserveFile "${NSISDIR}\Plugins\System.dll"
ReserveFile ".\UAC.dll" ReserveFile ".\UAC.dll"
!include "MUI2.nsh" !define REQUIREDSPACE 5 ; Minimum required space for install (in MB)
!include "x64.nsh"
!include "FileFunc.nsh" ; Error levels (for silent install)
!include "WordFunc.nsh" !define ERROR_UNSUPPORTED 3
!include "WinVer.nsh" !define ERROR_NOTADMIN 4
!include "UAC.nsh" !define ERROR_WRITEFAIL 5
!define ERROR_NOVCREDIST 6
!define ERROR_CLOSEFAIL 7
; Additional Windows definitions ; Additional Windows definitions
!define BCM_SETSHIELD 0x0000160c !define BCM_SETSHIELD 0x0000160c
@ -70,13 +79,6 @@ UninstPage custom un.PageOptions un.GetOptions
!define IncludeLanguage "!insertmacro IncludeLanguage" !define IncludeLanguage "!insertmacro IncludeLanguage"
!include "Languages.nsh" !include "Languages.nsh"
; Error levels (for silent install)
!define ERROR_UNSUPPORTED 3
!define ERROR_NOTADMIN 4
!define ERROR_WRITEFAIL 5
!define ERROR_NOVCREDIST 6
!define ERROR_CLOSEFAIL 7
Var NonDefaultLanguage Var NonDefaultLanguage
Var AutoStartup Var AutoStartup
Var Install64Bit Var Install64Bit
@ -92,27 +94,24 @@ Function .onInit
${IfNot} ${UAC_IsInnerInstance} ${IfNot} ${UAC_IsInnerInstance}
${If} ${IsWin2000} ${If} ${IsWin2000}
${If} ${Silent} ${IfNot} ${Silent}
SetErrorLevel ${ERROR_UNSUPPORTED}
${Else}
MessageBox MB_OK|MB_ICONINFORMATION "$(WIN2KERROR)" MessageBox MB_OK|MB_ICONINFORMATION "$(WIN2KERROR)"
${EndIf} ${EndIf}
SetErrorLevel ${ERROR_UNSUPPORTED}
Quit Quit
${ElseIf} ${IsWinXP} ${ElseIf} ${IsWinXP}
${AndIf} ${AtMostServicePack} 1 ${AndIf} ${AtMostServicePack} 1
${If} ${Silent} ${IfNot} ${Silent}
SetErrorLevel ${ERROR_UNSUPPORTED}
${Else}
MessageBox MB_OK|MB_ICONINFORMATION "$(WINXPS2ERROR)" MessageBox MB_OK|MB_ICONINFORMATION "$(WINXPS2ERROR)"
${EndIf} ${EndIf}
SetErrorLevel ${ERROR_UNSUPPORTED}
Quit Quit
${ElseIf} ${IsWin2003} ${ElseIf} ${IsWin2003}
${AndIf} ${AtMostServicePack} 0 ${AndIf} ${AtMostServicePack} 0
${If} ${Silent} ${IfNot} ${Silent}
SetErrorLevel ${ERROR_UNSUPPORTED}
${Else}
MessageBox MB_OK|MB_ICONINFORMATION "$(WIN2003SP1ERROR)" MessageBox MB_OK|MB_ICONINFORMATION "$(WIN2003SP1ERROR)"
${EndIf} ${EndIf}
SetErrorLevel ${ERROR_UNSUPPORTED}
Quit Quit
${EndIf} ${EndIf}
@ -184,8 +183,9 @@ Function .onInit
ClearErrors ClearErrors
CreateDirectory "$INSTDIR" CreateDirectory "$INSTDIR"
WriteINIStr "$INSTDIR\_rainmeter_writetest.tmp" "1" "1" "1" WriteINIStr "$INSTDIR\writetest~.rm" "1" "1" "1"
Delete "$INSTDIR\_rainmeter_writetest.tmp" Delete "$INSTDIR\writetest~.rm"
RMDir "$INSTDIR"
${If} ${Errors} ${If} ${Errors}
SetErrorLevel ${ERROR_WRITEFAIL} SetErrorLevel ${ERROR_WRITEFAIL}
@ -229,7 +229,7 @@ Function PageWelcome
${NSD_CreateBitmap} 0u 0u 109u 193u "" ${NSD_CreateBitmap} 0u 0u 109u 193u ""
Pop $0 Pop $0
${NSD_SetImage} $0 $PLUGINSDIR\modern-wizard.bmp $R0 ${NSD_SetImage} $0 "$PLUGINSDIR\modern-wizard.bmp" $R0
${NSD_CreateLabel} 120u 10u 195u 38u "$(MUI_TEXT_WELCOME_INFO_TITLE)" ${NSD_CreateLabel} 120u 10u 195u 38u "$(MUI_TEXT_WELCOME_INFO_TITLE)"
Pop $0 Pop $0
@ -381,6 +381,16 @@ FunctionEnd
Function PageOptionsDirectoryOnChange Function PageOptionsDirectoryOnChange
${NSD_GetText} $R0 $0 ${NSD_GetText} $R0 $0
; Disable Install button if not enough space
GetDlgItem $1 $HWNDPARENT 1
${GetRoot} $0 $2
${DriveSpace} "$2\" "/D=F /S=M" $3
${If} $3 < REQUIREDSPACE
EnableWindow $1 0
${Else}
EnableWindow $1 1
${EndIf}
StrCpy $Install64Bit 0 StrCpy $Install64Bit 0
${If} ${RunningX64} ${If} ${RunningX64}
${If} ${FileExists} "$0\Rainmeter.exe" ${If} ${FileExists} "$0\Rainmeter.exe"
@ -391,13 +401,13 @@ Function PageOptionsDirectoryOnChange
StrCpy $Install64Bit 1 StrCpy $Install64Bit 1
${EndIf} ${EndIf}
${If} $InstallPortable == 1 ${If} $R2 != 0
${NSD_SetState} $R3 $Install64Bit ${NSD_SetState} $R2 $Install64Bit
EnableWindow $R3 0 EnableWindow $R2 0
${EndIf} ${EndIf}
${Else} ${Else}
${If} $InstallPortable == 1 ${If} $R2 != 0
EnableWindow $R3 1 EnableWindow $R2 1
${EndIf} ${EndIf}
${EndIf} ${EndIf}
${EndIf} ${EndIf}
@ -839,7 +849,6 @@ Section Uninstall
RMDir /r "$INSTDIR\Addons\Rainstaller" RMDir /r "$INSTDIR\Addons\Rainstaller"
RMDir "$INSTDIR\Addons" RMDir "$INSTDIR\Addons"
Delete "$INSTDIR\Plugins\*.*" Delete "$INSTDIR\Plugins\*.*"
Delete "$INSTDIR\Plugins\Dependencies\*.*"
RMDir "$INSTDIR\Plugins" RMDir "$INSTDIR\Plugins"
RMDir /r "$INSTDIR\Languages" RMDir /r "$INSTDIR\Languages"
RMDir /r "$INSTDIR\Themes" RMDir /r "$INSTDIR\Themes"