rainmeter-studio/Build/Installer/Installer.nsi

960 lines
26 KiB
Plaintext
Raw Normal View History

2012-05-05 16:31:28 +00:00
/*
Copyright (C) 2012 Birunthan Mohanathas
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.
*/
2012-03-14 19:18:19 +00:00
!verbose 3
!addplugindir ".\"
2012-04-29 11:21:49 +00:00
!include "MUI2.nsh"
!include "x64.nsh"
!include "FileFunc.nsh"
!include "WordFunc.nsh"
!include "WinVer.nsh"
!include "UAC.nsh"
2013-10-19 13:15:20 +00:00
!ifndef OUTFILE
!define OUTFILE "Rainmeter-test.exe"
!define VERSION_FULL "0.0.0.0"
!define VERSION_SHORT "0.0"
!define VERSION_REVISION "000"
2012-04-28 17:39:58 +00:00
!else
!define INCLUDEFILES
2012-03-14 19:18:19 +00:00
!endif
Name "Rainmeter"
VIAddVersionKey "ProductName" "Rainmeter"
VIAddVersionKey "FileDescription" "Rainmeter Installer"
2013-10-19 13:15:20 +00:00
VIAddVersionKey "FileVersion" "${VERSION_FULL}"
VIAddVersionKey "ProductVersion" "${VERSION_FULL}"
2012-03-14 19:18:19 +00:00
VIAddVersionKey "OriginalFilename" "${OUTFILE}"
2013-10-19 13:15:20 +00:00
VIAddVersionKey "LegalCopyright" "Copyright (C) 2009-2013 - All authors"
VIProductVersion "${VERSION_FULL}"
2012-03-14 19:18:19 +00:00
BrandingText " "
SetCompressor /SOLID lzma
RequestExecutionLevel user
InstallDirRegKey HKLM "SOFTWARE\Rainmeter" ""
ShowInstDetails nevershow
2012-06-26 17:05:35 +00:00
AllowSkipFiles off
2012-03-14 19:18:19 +00:00
XPStyle on
OutFile "..\${OUTFILE}"
ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
ReserveFile "${NSISDIR}\Plugins\System.dll"
ReserveFile ".\UAC.dll"
2012-04-29 11:21:49 +00:00
!define REQUIREDSPACE 5 ; Minimum required space for install (in MB)
; 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
2012-03-14 19:18:19 +00:00
; Additional Windows definitions
2012-03-14 19:18:19 +00:00
!define BCM_SETSHIELD 0x0000160c
!define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
!define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
2012-03-14 19:18:19 +00:00
!define MUI_ICON ".\Icon.ico"
!define MUI_UNICON ".\Icon.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\Wizard.bmp"
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION FinishRun
!define MUI_WELCOMEPAGE ; For language strings
2012-03-14 19:18:19 +00:00
Page custom PageWelcome PageWelcomeOnLeave
2012-03-14 19:18:19 +00:00
Page custom PageOptions PageOptionsOnLeave
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
UninstPage custom un.PageOptions un.GetOptions
!insertmacro MUI_UNPAGE_INSTFILES
2012-04-28 17:39:58 +00:00
; Include languages
2012-03-14 19:18:19 +00:00
!macro IncludeLanguage LANGUAGE CUSTOMLANGUAGE
2012-04-28 17:39:58 +00:00
!insertmacro MUI_LANGUAGE ${LANGUAGE}
2012-03-14 19:18:19 +00:00
!insertmacro LANGFILE_INCLUDE "..\..\Language\${CUSTOMLANGUAGE}.nsh"
!macroend
2012-04-28 17:39:58 +00:00
!define IncludeLanguage "!insertmacro IncludeLanguage"
2012-03-14 19:18:19 +00:00
!include "Languages.nsh"
Var NonDefaultLanguage
Var AutoStartup
Var Install64Bit
Var InstallPortable
Var un.DeleteAll
2012-03-14 19:18:19 +00:00
; Install
; --------------------------------------
Function .onInit
${If} ${RunningX64}
${EnableX64FSRedirection}
${EndIf}
${IfNot} ${UAC_IsInnerInstance}
${If} ${IsWin2000}
2012-07-23 15:38:07 +00:00
${OrIf} ${IsWinXP}
2012-03-14 19:18:19 +00:00
${AndIf} ${AtMostServicePack} 1
2012-07-23 15:38:07 +00:00
${OrIf} ${IsWin2003}
2012-03-14 19:18:19 +00:00
${AndIf} ${AtMostServicePack} 0
2012-04-29 11:21:49 +00:00
${IfNot} ${Silent}
2013-10-19 13:15:20 +00:00
MessageBox MB_OK|MB_ICONSTOP "Rainmeter requires Windows XP SP2 or later."
2012-03-14 19:18:19 +00:00
${EndIf}
2012-04-29 11:21:49 +00:00
SetErrorLevel ${ERROR_UNSUPPORTED}
2012-03-14 19:18:19 +00:00
Quit
${EndIf}
2012-07-23 15:20:02 +00:00
System::Call 'kernel32::IsProcessorFeaturePresent(i${PF_XMMI_INSTRUCTIONS_AVAILABLE})i.r0'
2012-07-23 15:38:07 +00:00
${If} $0 = 0
2012-07-23 15:20:02 +00:00
${IfNot} ${Silent}
2013-10-19 13:15:20 +00:00
MessageBox MB_OK|MB_ICONSTOP "Rainmeter requires a Pentium III or later processor."
2012-07-23 15:20:02 +00:00
${EndIf}
SetErrorLevel ${ERROR_UNSUPPORTED}
Quit
${EndIf}
ReadRegStr $0 HKLM "SOFTWARE\Rainmeter" "Language"
ReadRegDWORD $NonDefaultLanguage HKLM "SOFTWARE\Rainmeter" "NonDefault"
2012-03-14 19:18:19 +00:00
${IfNot} ${Silent}
${If} $0 == ""
2012-07-23 15:38:07 +00:00
${OrIf} $0 <> $LANGUAGE
${AndIf} $NonDefaultLanguage != 1
; New install or better match
LangDLL::LangDialog "$(^SetupCaption)" "Please select the installer language.$\n$(SELECTLANGUAGE)" AC ${LANGDLL_PARAMS} ""
Pop $0
${If} $0 == "cancel"
Abort
${EndIf}
2012-03-14 19:18:19 +00:00
2012-07-23 15:38:07 +00:00
${If} $0 <> $LANGUAGE
; User selected non-default language
StrCpy $NonDefaultLanguage 1
${EndIf}
2012-03-14 19:18:19 +00:00
${EndIf}
StrCpy $LANGUAGE $0
2012-03-14 19:18:19 +00:00
${Else}
${If} $0 != ""
StrCpy $LANGUAGE $0
${EndIf}
2012-03-14 19:18:19 +00:00
${GetParameters} $R1
ClearErrors
${GetOptions} $R1 "/LANGUAGE=" $0
${IfNot} ${Errors}
${If} $LANGUAGE != $0
StrCpy $NonDefaultLanguage 1
${EndIf}
2012-03-14 19:18:19 +00:00
StrCpy $LANGUAGE $0
2012-03-14 19:18:19 +00:00
${EndIf}
${GetOptions} $R1 "/STARTUP=" $0
${If} $0 = 1
StrCpy $AutoStartup 1
2012-03-14 19:18:19 +00:00
${EndIf}
${GetOptions} $R1 "/PORTABLE=" $0
${If} $0 = 1
StrCpy $InstallPortable 1
2012-03-14 19:18:19 +00:00
${Else}
${IfNot} ${UAC_IsAdmin}
SetErrorLevel ${ERROR_NOTADMIN}
Quit
${EndIf}
${EndIf}
${GetOptions} $R1 "/VERSION=" $0
${If} $0 = 64
StrCpy $Install64Bit 1
2012-03-14 19:18:19 +00:00
${If} $INSTDIR == ""
StrCpy $INSTDIR "$PROGRAMFILES64\Rainmeter"
${EndIf}
${Else}
${If} $INSTDIR == ""
StrCpy $INSTDIR "$PROGRAMFILES\Rainmeter"
${EndIf}
${EndIf}
ClearErrors
CreateDirectory "$INSTDIR"
2012-04-29 11:21:49 +00:00
WriteINIStr "$INSTDIR\writetest~.rm" "1" "1" "1"
Delete "$INSTDIR\writetest~.rm"
2012-03-14 19:18:19 +00:00
${If} ${Errors}
RMDir "$INSTDIR"
2012-03-14 19:18:19 +00:00
SetErrorLevel ${ERROR_WRITEFAIL}
Quit
${EndIf}
${EndIf}
; If the language was set to a non-existent language, reset it back to English.
${WordFind} ",${LANGUAGE_IDS}" ",$LANGUAGE," "E+1{" $0
${If} ${Errors}
StrCpy $LANGUAGE "1033"
${EndIf}
2012-03-14 19:18:19 +00:00
${Else}
; Exchange settings with user instance
!insertmacro UAC_AsUser_Call Function ExchangeSettings ${UAC_SYNCREGISTERS}
StrCpy $AutoStartup $1
StrCpy $Install64Bit $2
StrCpy $NonDefaultLanguage $3
StrCpy $LANGUAGE $4
StrCpy $INSTDIR $5
2012-03-14 19:18:19 +00:00
${EndIf}
FunctionEnd
Function ExchangeSettings
StrCpy $1 $AutoStartup
StrCpy $2 $Install64Bit
StrCpy $3 $NonDefaultLanguage
StrCpy $4 $LANGUAGE
StrCpy $5 $INSTDIR
2012-03-14 19:18:19 +00:00
HideWindow
FunctionEnd
Function PageWelcome
2012-03-14 19:18:19 +00:00
${If} ${UAC_IsInnerInstance}
${If} ${UAC_IsAdmin}
; Skip page
Abort
2012-03-14 19:18:19 +00:00
${Else}
MessageBox MB_OK|MB_ICONSTOP "$(ADMINERROR) (Inner)"
Quit
${EndIf}
${EndIf}
!insertmacro MUI_HEADER_TEXT "$(INSTALLOPTIONS)" "$(^ComponentsSubText1)"
nsDialogs::Create 1044
Pop $0
2012-03-14 19:18:19 +00:00
nsDialogs::SetRTL $(^RTL)
SetCtlColors $0 "" "${MUI_BGCOLOR}"
2012-03-14 19:18:19 +00:00
${NSD_CreateBitmap} 0u 0u 109u 193u ""
Pop $0
2012-04-29 11:21:49 +00:00
${NSD_SetImage} $0 "$PLUGINSDIR\modern-wizard.bmp" $R0
2012-03-14 19:18:19 +00:00
${NSD_CreateLabel} 120u 10u 195u 38u "$(MUI_TEXT_WELCOME_INFO_TITLE)"
Pop $0
SetCtlColors $0 "" "${MUI_BGCOLOR}"
CreateFont $1 "$(^Font)" "12" "700"
SendMessage $0 ${WM_SETFONT} $1 0
2012-03-14 19:18:19 +00:00
${NSD_CreateLabel} 120u 55u 195u 12u "$(^ComponentsSubText1)"
Pop $0
SetCtlColors $0 "" "${MUI_BGCOLOR}"
2012-03-14 19:18:19 +00:00
${NSD_CreateRadioButton} 120u 70u 205u 12u "$(STANDARDINST)"
2012-04-28 16:39:51 +00:00
Pop $R1
SetCtlColors $R1 "" "${MUI_BGCOLOR}"
${NSD_AddStyle} $R1 ${WS_GROUP}
SendMessage $R1 ${WM_SETFONT} $mui.Header.Text.Font 0
2012-03-14 19:18:19 +00:00
${NSD_CreateLabel} 132u 82u 185u 24u "$(STANDARDINSTDESC)"
2012-03-14 19:18:19 +00:00
Pop $0
SetCtlColors $0 "" "${MUI_BGCOLOR}"
2012-03-14 19:18:19 +00:00
${NSD_CreateRadioButton} 120u 106u 310u 12u "$(PORTABLEINST)"
2012-04-28 16:39:51 +00:00
Pop $R2
SetCtlColors $R2 "" "${MUI_BGCOLOR}"
${NSD_AddStyle} $R2 ${WS_TABSTOP}
SendMessage $R2 ${WM_SETFONT} $mui.Header.Text.Font 0
2012-03-14 19:18:19 +00:00
${NSD_CreateLabel} 132u 118u 185u 52u "$(PORTABLEINSTDESC)"
2012-03-14 19:18:19 +00:00
Pop $0
SetCtlColors $0 "" "${MUI_BGCOLOR}"
2012-03-14 19:18:19 +00:00
2012-07-23 15:38:07 +00:00
${If} $InstallPortable = 1
2012-04-28 16:39:51 +00:00
${NSD_Check} $R2
${Else}
2012-04-28 16:39:51 +00:00
${NSD_Check} $R1
${EndIf}
2012-03-14 19:18:19 +00:00
Call muiPageLoadFullWindow
2012-03-14 19:18:19 +00:00
nsDialogs::Show
${NSD_FreeImage} $R0
FunctionEnd
2012-03-14 19:18:19 +00:00
Function PageWelcomeOnLeave
2012-04-28 16:39:51 +00:00
${NSD_GetState} $R2 $InstallPortable
Call muiPageUnloadFullWindow
FunctionEnd
Function PageOptions
${If} ${UAC_IsInnerInstance}
${AndIf} ${UAC_IsAdmin}
; Skip page
Abort
${EndIf}
!insertmacro MUI_HEADER_TEXT "$(INSTALLOPTIONS)" "$(INSTALLOPTIONSDESC)"
nsDialogs::Create 1018
nsDialogs::SetRTL $(^RTL)
${NSD_CreateGroupBox} 0 0u -1u 36u "$(^DirSubText)"
${NSD_CreateDirRequest} 6u 14u 232u 14u ""
Pop $R0
${NSD_OnChange} $R0 PageOptionsDirectoryOnChange
2012-03-14 19:18:19 +00:00
${NSD_CreateBrowseButton} 242u 14u 50u 14u "$(^BrowseBtn)"
Pop $R1
${NSD_OnClick} $R1 PageOptionsBrowseOnClick
StrCpy $1 0
StrCpy $R2 0
${If} ${RunningX64}
${If} $InstallPortable = 1
${OrIf} $INSTDIR == ""
${NSD_CreateCheckBox} 6u 54u 285u 12u "$(INSTALL64BIT)"
Pop $R2
StrCpy $1 30u
${EndIf}
${EndIf}
2012-07-23 15:38:07 +00:00
${If} $InstallPortable <> 1
${If} $1 = 0
StrCpy $0 54u
StrCpy $1 30u
${Else}
StrCpy $0 66u
StrCpy $1 42u
2012-03-14 19:18:19 +00:00
${EndIf}
${NSD_CreateCheckbox} 6u $0 285u 12u "$(AUTOSTARTUP)"
Pop $R3
${If} $INSTDIR == ""
${NSD_Check} $R3
${Else}
SetShellVarContext all
${If} ${FileExists} "$SMSTARTUP\Rainmeter.lnk"
${NSD_Check} $R3
${EndIf}
SetShellVarContext current
${If} ${FileExists} "$SMSTARTUP\Rainmeter.lnk"
${NSD_Check} $R3
${EndIf}
2012-03-14 19:18:19 +00:00
${EndIf}
${Else}
StrCpy $R3 0
${EndIf}
2012-07-23 15:38:07 +00:00
${If} $1 <> 0
${NSD_CreateGroupBox} 0 42u -1u $1 "$(ADDITIONALOPTIONS)"
${EndIf}
; Set default directory
2012-07-23 15:38:07 +00:00
${If} $InstallPortable = 1
${GetRoot} "$WINDIR" $0
${NSD_SetText} $R0 "$0\Rainmeter"
${Else}
; Disable Directory editbox and Browse button if already installed
SendMessage $R0 ${EM_SETREADONLY} 1 0
${If} $INSTDIR != ""
EnableWindow $R1 0
${NSD_SetText} $R0 "$INSTDIR"
${Else}
; Fresh install
${If} ${RunningX64}
${NSD_SetText} $R0 "$PROGRAMFILES64\Rainmeter"
${NSD_Check} $R2
${Else}
${NSD_SetText} $R0 "$PROGRAMFILES\Rainmeter"
${EndIf}
${EndIf}
${EndIf}
2012-04-28 16:39:51 +00:00
; Show UAC shield on Install button if requiredd
GetDlgItem $0 $HWNDPARENT 1
2012-07-23 15:38:07 +00:00
${If} $InstallPortable = 1
SendMessage $0 ${BCM_SETSHIELD} 0 0
2012-03-14 19:18:19 +00:00
${Else}
SendMessage $0 ${BCM_SETSHIELD} 0 1
; Hide Back button
GetDlgItem $0 $HWNDPARENT 3
ShowWindow $0 ${SW_HIDE}
2012-03-14 19:18:19 +00:00
${EndIf}
nsDialogs::Show
FunctionEnd
Function PageOptionsDirectoryOnChange
${NSD_GetText} $R0 $0
2012-03-14 19:18:19 +00:00
2012-04-29 11:21:49 +00:00
; Disable Install button if not enough space
GetDlgItem $1 $HWNDPARENT 1
${GetRoot} $0 $2
${DriveSpace} "$2\" "/D=F /S=M" $3
${If} $3 < ${REQUIREDSPACE}
2012-04-29 11:21:49 +00:00
EnableWindow $1 0
${Else}
EnableWindow $1 1
${EndIf}
StrCpy $Install64Bit 0
2012-03-14 19:18:19 +00:00
${If} ${RunningX64}
${If} ${FileExists} "$0\Rainmeter.exe"
MoreInfo::GetProductVersion "$0\Rainmeter.exe"
2012-03-14 19:18:19 +00:00
Pop $0
StrCpy $0 $0 2 -7
${If} $0 == 64
StrCpy $Install64Bit 1
${EndIf}
2012-03-14 19:18:19 +00:00
2012-04-29 11:21:49 +00:00
${If} $R2 != 0
${NSD_SetState} $R2 $Install64Bit
EnableWindow $R2 0
2012-03-14 19:18:19 +00:00
${EndIf}
${Else}
2012-04-29 11:21:49 +00:00
${If} $R2 != 0
EnableWindow $R2 1
${EndIf}
2012-03-14 19:18:19 +00:00
${EndIf}
${EndIf}
FunctionEnd
Function PageOptionsBrowseOnClick
${NSD_GetText} $R0 $0
nsDialogs::SelectFolderDialog "$(^DirBrowseText)" $0
Pop $1
${If} $1 != error
${NSD_SetText} $R0 $1
${EndIf}
FunctionEnd
2012-03-14 19:18:19 +00:00
Function PageOptionsOnLeave
; Verify that selected folder is writable
${NSD_GetText} $R0 $0
2012-07-23 15:38:07 +00:00
${If} $InstallPortable = 1
ClearErrors
CreateDirectory "$0"
WriteINIStr "$0\writetest~.rm" "1" "1" "1"
Delete "$0\writetest~.rm"
${If} ${Errors}
RMDir "$0"
MessageBox MB_OK|MB_ICONEXCLAMATION "$(WRITEERROR)"
Abort
${EndIf}
RMDir "$0"
2012-03-14 19:18:19 +00:00
${EndIf}
StrCpy $INSTDIR $0
2012-03-14 19:18:19 +00:00
GetDlgItem $0 $HWNDPARENT 1
EnableWindow $0 0
${If} $R2 != 0
${NSD_GetState} $R2 $Install64Bit
2012-03-14 19:18:19 +00:00
${EndIf}
${If} $R3 != 0
${NSD_GetState} $R3 $AutoStartup
2012-03-14 19:18:19 +00:00
${EndIf}
2012-07-23 15:38:07 +00:00
${If} $InstallPortable <> 1
2012-03-14 19:18:19 +00:00
${IfNot} ${UAC_IsAdmin}
; UAC_IsAdmin seems to return incorrect result sometimes. Recheck with UserInfo::GetAccountType to be sure.
UserInfo::GetAccountType
Pop $0
${If} $0 != "Admin"
UAC_TryAgain:
!insertmacro UAC_RunElevated
${Switch} $0
${Case} 0
${IfThen} $1 = 1 ${|} Quit ${|}
${IfThen} $3 <> 0 ${|} ${Break} ${|}
${If} $1 = 3
MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "$(ADMINERROR)" /SD IDNO IDOK UAC_TryAgain IDNO 0
${EndIf}
${Case} 1223
Quit
${Case} 1062
MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "$(LOGONERROR)"
Quit
${Default}
MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "$(UACERROR) ($0)"
Quit
${EndSwitch}
${EndIf}
${EndIf}
${EndIf}
FunctionEnd
!macro InstallFiles DIR ARCH
SetOutPath "$INSTDIR"
File "..\..\${DIR}-Release\Rainmeter.exe"
File "..\..\${DIR}-Release\Rainmeter.dll"
File "..\..\${DIR}-Release\SkinInstaller.exe"
File "..\..\${DIR}-Release\SkinInstaller.dll"
2012-03-14 19:18:19 +00:00
SetOutPath "$INSTDIR\Plugins"
File /x *Example*.dll "..\..\${DIR}-Release\Plugins\*.dll"
SetOutPath "$INSTDIR\Runtime"
2013-11-29 16:42:12 +00:00
File "$%VS110COMNTOOLS%..\..\VC\redist\${ARCH}\Microsoft.VC120.CRT\msvcp120.dll"
File "$%VS110COMNTOOLS%..\..\VC\redist\${ARCH}\Microsoft.VC120.CRT\msvcr120.dll"
2012-03-14 19:18:19 +00:00
!macroend
!macro RemoveStartMenuShortcuts STARTMENUPATH
Delete "${STARTMENUPATH}\Rainmeter.lnk"
Delete "${STARTMENUPATH}\Rainmeter Help.lnk"
Delete "${STARTMENUPATH}\Rainmeter Help.URL"
Delete "${STARTMENUPATH}\Remove Rainmeter.lnk"
Delete "${STARTMENUPATH}\RainThemes.lnk"
Delete "${STARTMENUPATH}\RainThemes Help.lnk"
Delete "${STARTMENUPATH}\RainBrowser.lnk"
Delete "${STARTMENUPATH}\RainBackup.lnk"
Delete "${STARTMENUPATH}\Rainstaller.lnk"
Delete "${STARTMENUPATH}\Skin Installer.lnk"
Delete "${STARTMENUPATH}\Rainstaller Help.lnk"
RMDir "${STARTMENUPATH}"
2012-03-14 19:18:19 +00:00
!macroend
Section
SetOutPath "$PLUGINSDIR"
SetShellVarContext current
Var /GLOBAL InstArc
2012-07-23 15:38:07 +00:00
${If} $Install64Bit = 1
StrCpy $InstArc "x64"
${Else}
StrCpy $InstArc "x86"
${EndIf}
2012-07-23 15:38:07 +00:00
${If} $InstallPortable <> 1
${AndIfNot} ${AtLeastWinVista}
; Download and install .NET if required
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" "Install"
${If} $0 <> 1
${If} $Install64Bit <> 1
NSISdl::download /TIMEOUT=30000 "http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe" "$PLUGINSDIR\dotnetfx.exe"
${Else}
NSISdl::download /TIMEOUT=30000 "http://download.microsoft.com/download/a/3/f/a3f1bf98-18f3-4036-9b68-8e6de530ce0a/NetFx64.exe" "$PLUGINSDIR\dotnetfx.exe"
${EndIf}
Pop $0
${If} $0 == "success"
ExecWait '"$PLUGINSDIR\dotnetfx.exe" /q:a /c:"install /q"' $0
Delete "$PLUGINSDIR\dotnetfx.exe"
${If} $0 = 3010
SetRebootFlag true
${ElseIf} $0 <> 0
MessageBox MB_OK|MB_ICONSTOP "$(DOTNETINSTERROR)"
Quit
${EndIf}
${ElseIf} $0 == "cancel"
Quit
${Else}
MessageBox MB_OK|MB_ICONSTOP "$(DOTNETINSTERROR)"
Quit
${EndIf}
${EndIf}
2012-03-14 19:18:19 +00:00
${EndIf}
SetOutPath "$INSTDIR"
2012-04-17 06:57:05 +00:00
; Close Rainmeter (and wait up to five seconds)
${ForEach} $0 10 0 - 1
FindWindow $1 "DummyRainWClass" "Rainmeter control window"
ClearErrors
Delete "$INSTDIR\Rainmeter.exe"
2012-07-23 15:38:07 +00:00
${If} $1 = 0
${AndIfNot} ${Errors}
2012-04-17 06:57:05 +00:00
${Break}
${EndIf}
SendMessage $1 ${WM_CLOSE} 0 0
2012-07-23 15:38:07 +00:00
${If} $0 = 0
2012-04-17 06:57:05 +00:00
${If} ${Silent}
SetErrorLevel ${ERROR_CLOSEFAIL}
Quit
${Else}
MessageBox MB_RETRYCANCEL|MB_ICONSTOP "$(RAINMETERCLOSEERROR)" IDRETRY +2
Quit
2012-03-14 19:18:19 +00:00
${EndIf}
2012-04-17 06:57:05 +00:00
${EndIf}
Sleep 500
${Next}
2012-03-14 19:18:19 +00:00
; Move Rainmeter.ini to %APPDATA% if needed
2012-03-14 19:18:19 +00:00
${IfNot} ${Silent}
${AndIf} ${FileExists} "$INSTDIR\Rainmeter.ini"
2012-07-23 15:38:07 +00:00
${If} $InstallPortable <> 1
${If} $Install64Bit = 1
${AndIf} "$INSTDIR" == "$PROGRAMFILES64\Rainmeter"
${OrIf} "$INSTDIR" == "$PROGRAMFILES\Rainmeter"
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(SETTINGSFILEERROR)" IDNO SkipIniMove
StrCpy $0 1
!insertmacro UAC_AsUser_Call Function CopyIniToAppData ${UAC_SYNCREGISTERS}
2012-07-23 15:38:07 +00:00
${If} $0 = 1
; Copy succeeded
Delete "$INSTDIR\Rainmeter.ini"
2012-04-29 13:29:18 +00:00
${Else}
MessageBox MB_OK|MB_ICONSTOP "$(SETTINGSMOVEERROR)"
${EndIf}
SkipIniMove:
2012-03-14 19:18:19 +00:00
${EndIf}
${Else}
ReadINIStr $0 "$INSTDIR\Rainmeter.ini" "Rainmeter" "SkinPath"
${If} $0 == "$INSTDIR\Skins\"
DeleteINIStr "$INSTDIR\Rainmeter.ini" "Rainmeter" "SkinPath"
${EndIf}
${EndIf}
${EndIf}
SetOutPath "$INSTDIR"
; Cleanup old stuff
2012-03-14 19:18:19 +00:00
Delete "$INSTDIR\Rainmeter.chm"
Delete "$INSTDIR\Default.ini"
2012-06-11 13:15:03 +00:00
Delete "$INSTDIR\Launcher.exe"
Delete "$INSTDIR\Defaults\Plugins\FileView.dll"
RMDir /r "$INSTDIR\Addons\Rainstaller"
RMDir /r "$INSTDIR\Addons\RainBackup"
2012-07-23 15:38:07 +00:00
${If} $InstallPortable <> 1
CreateDirectory "$INSTDIR\Defaults"
Rename "$INSTDIR\Skins" "$INSTDIR\Defaults\Skins"
2012-10-06 12:05:07 +00:00
Rename "$INSTDIR\Themes" "$INSTDIR\Defaults\Layouts"
Rename "$INSTDIR\Defaults\Themes" "$INSTDIR\Defaults\Layouts"
${Locate} "$INSTDIR\Defaults\Layouts" "/L=F /M=Rainmeter.thm /G=1" "RenameToRainmeterIni"
${If} ${FileExists} "$INSTDIR\Addons\Backup"
${OrIf} ${FileExists} "$INSTDIR\Plugins\Backup"
CreateDirectory "$INSTDIR\Defaults\Backup"
Rename "$INSTDIR\Addons\Backup" "$INSTDIR\Defaults\Backup\Addons"
Rename "$INSTDIR\Plugins\Backup" "$INSTDIR\Defaults\Backup\Plugins"
${EndIf}
Rename "$INSTDIR\Addons" "$INSTDIR\Defaults\Addons"
${Locate} "$INSTDIR\Plugins" "/L=F /M=*.dll /G=0" "MoveNonDefaultPlugins"
${EndIf}
2012-04-28 17:39:58 +00:00
!ifdef INCLUDEFILES
2013-10-19 09:26:33 +00:00
File "..\..\Application\Rainmeter.exe.config"
2012-03-14 19:18:19 +00:00
${If} $instArc == "x86"
!insertmacro InstallFiles "x32" "x86"
2012-03-14 19:18:19 +00:00
${Else}
!insertmacro InstallFiles "x64" "x64"
2012-03-14 19:18:19 +00:00
${EndIf}
RMDir /r "$INSTDIR\Languages"
SetOutPath "$INSTDIR\Languages"
File "..\..\x32-Release\Languages\*.*"
2012-03-14 19:18:19 +00:00
SetOutPath "$INSTDIR\Defaults\Skins"
2012-03-14 19:18:19 +00:00
RMDir /r "$INSTDIR\Skins\illustro"
Delete "$INSTDIR\Skins\*.txt"
2012-04-28 18:19:32 +00:00
File /r "..\Skins\*.*"
2012-03-14 19:18:19 +00:00
2012-10-06 12:05:07 +00:00
SetOutPath "$INSTDIR\Defaults\Layouts"
2013-10-20 12:35:56 +00:00
File /r "..\Layouts\*.*"
2012-04-28 17:39:58 +00:00
!endif
2012-03-14 19:18:19 +00:00
SetOutPath "$INSTDIR"
2012-07-23 15:38:07 +00:00
${If} $InstallPortable <> 1
2012-03-14 19:18:19 +00:00
ReadRegStr $0 HKLM "SOFTWARE\Rainmeter" ""
WriteRegStr HKLM "SOFTWARE\Rainmeter" "" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\Rainmeter" "Language" "$LANGUAGE"
WriteRegDWORD HKLM "SOFTWARE\Rainmeter" "NonDefault" $NonDefaultLanguage
2012-03-14 19:18:19 +00:00
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "DisplayName" "Rainmeter"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "DisplayIcon" "$INSTDIR\Rainmeter.exe,0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "URLInfoAbout" "http://rainmeter.net"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "UninstallString" "$INSTDIR\uninst.exe"
!ifdef BETA
2013-10-19 13:15:20 +00:00
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "DisplayVersion" "${VERSION_SHORT} beta r${VERSION_REVISION}"
2012-03-14 19:18:19 +00:00
!else
2013-10-19 13:15:20 +00:00
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "DisplayVersion" "${VERSION_SHORT} r${VERSION_REVISION}"
2012-03-14 19:18:19 +00:00
!endif
2012-06-17 13:29:34 +00:00
; Create .rmskin association
WriteRegStr HKCR ".rmskin" "" "Rainmeter.SkinInstaller"
DeleteRegKey HKCR "Rainmeter skin" ; Old key
WriteRegStr HKCR "Rainmeter.SkinInstaller" "" "Rainmeter Skin Installer"
WriteRegStr HKCR "Rainmeter.SkinInstaller\shell" "" "open"
WriteRegStr HKCR "Rainmeter.SkinInstaller\DefaultIcon" "" "$INSTDIR\SkinInstaller.exe,0"
WriteRegStr HKCR "Rainmeter.SkinInstaller\shell\open\command" "" '"$INSTDIR\SkinInstaller.exe" %1'
WriteRegStr HKCR "Rainmeter.SkinInstaller\shell\edit" "" "Install Rainmeter skin"
WriteRegStr HKCR "Rainmeter.SkinInstaller\shell\edit\command" "" '"$INSTDIR\SkinInstaller.exe" %1'
2012-03-14 19:18:19 +00:00
; If .inc isn't associated, use the .ini association for it.
ReadRegStr $1 HKCR ".inc" ""
${If} $1 == ""
ReadRegStr $1 HKCR ".ini" ""
${If} $1 != ""
WriteRegStr HKCR ".inc" "" "$1"
${EndIf}
${EndIf}
2012-03-14 19:18:19 +00:00
; Refresh shell icons if new install
${If} $0 == ""
${RefreshShellIcons}
2012-03-14 19:18:19 +00:00
${EndIf}
; Remove all start menu shortcuts
SetShellVarContext all
Call RemoveStartMenuShortcuts
2012-03-14 19:18:19 +00:00
2012-04-29 15:19:34 +00:00
StrCpy $0 "$SMPROGRAMS\Rainmeter.lnk"
${If} ${FileExists} "$SMPROGRAMS\Rainmeter"
StrCpy $0 "$SMPROGRAMS\Rainmeter\Rainmeter.lnk"
${EndIf}
CreateShortcut "$0" "$INSTDIR\Rainmeter.exe" "" "$INSTDIR\Rainmeter.exe" 0
2012-03-14 19:18:19 +00:00
2012-07-23 15:38:07 +00:00
${If} $AutoStartup = 1
${If} ${FileExists} "$SMSTARTUP\Rainmeter.lnk"
; Remove user shortcut to prevent duplicate with all users shortcut
!insertmacro UAC_AsUser_Call Function RemoveUserStartupShortcut ${UAC_SYNCREGISTERS}
${Else}
!insertmacro UAC_AsUser_Call Function CreateUserStartupShortcut ${UAC_SYNCREGISTERS}
${EndIf}
2012-03-14 19:18:19 +00:00
${EndIf}
SetShellVarContext current
Call RemoveStartMenuShortcuts
!insertmacro UAC_AsUser_Call Function RemoveStartMenuShortcuts ${UAC_SYNCREGISTERS}
2012-03-14 19:18:19 +00:00
WriteUninstaller "$INSTDIR\uninst.exe"
${Else}
${IfNot} ${FileExists} "Rainmeter.ini"
CopyFiles /SILENT "$INSTDIR\Defaults\Layouts\illustro default\Rainmeter.ini" "$INSTDIR\Rainmeter.ini"
2012-03-14 19:18:19 +00:00
${EndIf}
WriteINIStr "$INSTDIR\Rainmeter.ini" "Rainmeter" "Language" "$LANGUAGE"
${EndIf}
SectionEnd
Function CopyIniToAppData
ClearErrors
CreateDirectory "$APPDATA\Rainmeter"
CopyFiles /SILENT "$INSTDIR\Rainmeter.ini" "$APPDATA\Rainmeter\Rainmeter.ini"
${If} ${Errors}
StrCpy $0 0
${EndIf}
FunctionEnd
2012-10-06 12:05:07 +00:00
Function RenameToRainmeterIni
${If} ${FileExists} "$R8\Rainmeter.ini"
Delete "$R8\Rainmeter.thm"
${Else}
Rename "$R9" "$R8\Rainmeter.ini"
${EndIf}
Push $0
FunctionEnd
Function MoveNonDefaultPlugins
${If} $R7 != "AdvancedCPU.dll"
${AndIf} $R7 != "CoreTemp.dll"
${AndIf} $R7 != "FileView.dll"
${AndIf} $R7 != "FolderInfo.dll"
${AndIf} $R7 != "InputText.dll"
${AndIf} $R7 != "iTunesPlugin.dll"
${AndIf} $R7 != "MediaKey.dll"
${AndIf} $R7 != "NowPlaying.dll"
${AndIf} $R7 != "PerfMon.dll"
${AndIf} $R7 != "PingPlugin.dll"
${AndIf} $R7 != "PowerPlugin.dll"
${AndIf} $R7 != "Process.dll"
${AndIf} $R7 != "QuotePlugin.dll"
${AndIf} $R7 != "RecycleManager.dll"
${AndIf} $R7 != "ResMon.dll"
${AndIf} $R7 != "SpeedFanPlugin.dll"
${AndIf} $R7 != "SysInfo.dll"
${AndIf} $R7 != "VirtualDesktops.dll"
${AndIf} $R7 != "WebParser.dll"
${AndIf} $R7 != "WifiStatus.dll"
${AndIf} $R7 != "Win7AudioPlugin.dll"
${AndIf} $R7 != "WindowMessagePlugin.dll"
CreateDirectory "$INSTDIR\Defaults\Plugins"
2012-10-06 17:03:04 +00:00
Delete "$INSTDIR\Defaults\Plugins\$R7"
Rename "$R9" "$INSTDIR\Defaults\Plugins\$R7"
${EndIf}
Push $0
FunctionEnd
Function RemoveStartMenuShortcuts
!insertmacro RemoveStartMenuShortcuts "$SMPROGRAMS\Rainmeter"
FunctionEnd
Function CreateUserStartupShortcut
SetShellVarContext current
CreateShortcut "$SMSTARTUP\Rainmeter.lnk" "$INSTDIR\Rainmeter.exe" "" "$INSTDIR\Rainmeter.exe" 0
FunctionEnd
Function RemoveUserStartupShortcut
SetShellVarContext current
Delete "$SMSTARTUP\Rainmeter.lnk"
2012-03-14 19:18:19 +00:00
FunctionEnd
Function FinishRun
!insertmacro UAC_AsUser_ExecShell "" "$INSTDIR\Rainmeter.exe" "" "" ""
FunctionEnd
; Uninstall
; --------------------------------------
Function un.onInit
UAC_TryAgain:
; Request administrative rights
!insertmacro UAC_RunElevated
${Switch} $0
${Case} 0
${IfThen} $1 = 1 ${|} Quit ${|}
${IfThen} $3 <> 0 ${|} ${Break} ${|}
${If} $1 = 3
MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "$(ADMINERROR)" /SD IDNO IDOK UAC_TryAgain IDNO 0
${EndIf}
${Case} 1223
Quit
${Case} 1062
MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "$(LOGONERROR)"
Quit
${Default}
MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND "$(UACERROR) ($0)"
Quit
${EndSwitch}
ReadRegStr $0 HKLM "SOFTWARE\Rainmeter" "Language"
${If} $0 != ""
StrCpy $LANGUAGE $0
${EndIf}
FunctionEnd
Function un.PageOptions
!insertmacro MUI_HEADER_TEXT "$(UNSTALLOPTIONS)" "$(UNSTALLOPTIONSDESC)"
nsDialogs::Create 1018
nsDialogs::SetRTL $(^RTL)
${NSD_CreateCheckbox} 0 0u 95% 12u "$(UNSTALLRAINMETER)"
Pop $0
EnableWindow $0 0
${NSD_Check} $0
${NSD_CreateCheckbox} 0 15u 70% 12u "$(UNSTALLSETTINGS)"
Pop $R0
2012-03-14 19:18:19 +00:00
${NSD_CreateLabel} 16 26u 95% 12u "$(UNSTALLSETTINGSDESC)"
nsDialogs::Show
FunctionEnd
Function un.GetOptions
${NSD_GetState} $R0 $un.DeleteAll
2012-03-14 19:18:19 +00:00
FunctionEnd
Section Uninstall
2012-04-17 06:57:05 +00:00
; Close Rainmeter (and wait up to five seconds)
${ForEach} $0 10 0 - 1
FindWindow $1 "DummyRainWClass" "Rainmeter control window"
ClearErrors
Delete "$INSTDIR\Rainmeter.exe"
2012-07-23 15:38:07 +00:00
${If} $1 = 0
${AndIfNot} ${Errors}
2012-04-17 06:57:05 +00:00
${Break}
${EndIf}
SendMessage $1 ${WM_CLOSE} 0 0
2012-07-23 15:38:07 +00:00
${If} $0 = 0
2012-04-17 06:57:05 +00:00
${If} ${Silent}
SetErrorLevel ${ERROR_CLOSEFAIL}
Quit
${Else}
2012-03-14 19:18:19 +00:00
MessageBox MB_RETRYCANCEL|MB_ICONSTOP "$(RAINMETERCLOSEERROR)" IDRETRY +2
Quit
${EndIf}
2012-04-17 06:57:05 +00:00
${EndIf}
Sleep 500
${Next}
2012-03-14 19:18:19 +00:00
2013-10-19 13:15:20 +00:00
; Old stuff
RMDir /r "$INSTDIR\Addons"
RMDir /r "$INSTDIR\Fonts"
RMDir /r "$INSTDIR\Defaults"
2012-03-14 19:18:19 +00:00
RMDir /r "$INSTDIR\Languages"
RMDir /r "$INSTDIR\Plugins"
RMDir /r "$INSTDIR\Runtime"
2012-06-26 17:05:35 +00:00
RMDir /r "$INSTDIR\Skins"
Delete "$INSTDIR\Rainmeter.dll"
Delete "$INSTDIR\Rainmeter.exe"
Delete "$INSTDIR\Rainmeter.exe.config"
Delete "$INSTDIR\SkinInstaller.exe"
Delete "$INSTDIR\SkinInstaller.dll"
2012-06-26 17:05:35 +00:00
Delete "$INSTDIR\uninst.exe"
2012-03-14 19:18:19 +00:00
2012-06-26 17:05:35 +00:00
RMDir "$INSTDIR"
2012-03-14 19:18:19 +00:00
SetShellVarContext all
RMDir /r "$APPDATA\Rainstaller"
SetShellVarContext current
Call un.RemoveShortcuts
2012-07-23 15:38:07 +00:00
${If} $un.DeleteAll = 1
2012-03-14 19:18:19 +00:00
RMDir /r "$APPDATA\Rainmeter"
RMDir /r "$DOCUMENTS\Rainmeter\Skins"
RMDir "$DOCUMENTS\Rainmeter"
RMDir /r "$1\Rainmeter"
${EndIf}
!insertmacro UAC_AsUser_Call Function un.RemoveShortcuts ${UAC_SYNCREGISTERS}
2012-07-23 15:38:07 +00:00
${If} $un.DeleteAll = 1
2012-03-14 19:18:19 +00:00
RMDir /r "$APPDATA\Rainmeter"
RMDir /r "$DOCUMENTS\Rainmeter\Skins"
RMDir "$DOCUMENTS\Rainmeter"
${EndIf}
SetShellVarContext all
Call un.RemoveShortcuts
Delete "$SMPROGRAMS\Rainmeter.lnk"
2012-03-14 19:18:19 +00:00
DeleteRegKey HKLM "SOFTWARE\Rainmeter"
DeleteRegKey HKCR ".rmskin"
2012-06-26 17:05:35 +00:00
DeleteRegKey HKCR "Rainmeter.SkinInstaller"
2012-03-14 19:18:19 +00:00
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter"
${RefreshShellIcons}
2012-03-14 19:18:19 +00:00
SectionEnd
Function un.RemoveShortcuts
!insertmacro RemoveStartMenuShortcuts "$SMPROGRAMS\Rainmeter"
Delete "$SMSTARTUP\Rainmeter.lnk"
Delete "$DESKTOP\Rainmeter.lnk"
2012-03-14 19:18:19 +00:00
FunctionEnd