InstType $Name_InstTypeMinimum
InstType $Name_InstTypeFull
+RequestExecutionLevel user
+!addincludedir NSIS
+!addplugindir NSIS
+!include UAC.nsh
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NSIS Modern User Interface configuration ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
!define MUI_WELCOMEPAGE_TITLE_3LINES
!insertmacro MUI_PAGE_WELCOME
; License page
+ !define MUI_LICENSEPAGE_BUTTON $(^NextBtn)
!insertmacro MUI_PAGE_LICENSE "COPYING.txt"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
- !define MUI_FINISHPAGE_RUN "$INSTDIR\vlc.exe"
+
+ Function ExecAppFile
+ Exec '$INSTDIR\vlc.exe'
+ FunctionEnd
+
+ Function AppRunAs
+ !insertmacro UAC.CallFunctionAsUser ExecAppFile
+ FunctionEnd
+
+ !define MUI_FINISHPAGE_RUN
+ !define MUI_FINISHPAGE_RUN_FUNCTION AppRunAs
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_LINK $Link_VisitWebsite
!insertmacro ${_action} ".oma"
!insertmacro ${_action} ".oga"
!insertmacro ${_action} ".spx"
+ !insertmacro ${_action} ".tta"
!insertmacro ${_action} ".wav"
!insertmacro ${_action} ".wma"
!insertmacro ${_action} ".wv"
!insertmacro ${_action} ".rmvb"
!insertmacro ${_action} ".ts"
!insertmacro ${_action} ".vob"
+ !insertmacro ${_action} ".vro"
!insertmacro ${_action} ".wmv"
!macroend
!insertmacro ${_action} ".asx"
!insertmacro ${_action} ".bin"
!insertmacro ${_action} ".cue"
+ !insertmacro ${_action} ".ifo"
!insertmacro ${_action} ".m3u"
!insertmacro ${_action} ".pls"
+ !insertmacro ${_action} ".sdp"
!insertmacro ${_action} ".vlc"
!insertmacro ${_action} ".xspf"
!macroend
!macroend
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; 3. Delete prefs and cache ;
+; 3. Delete prefs ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
!macro delprefs
; VLC.exe, libvlc.dll
!insertmacro InstallFile vlc.exe
!insertmacro InstallFile vlc.exe.manifest
+ !insertmacro InstallFile vlc-cache-gen.exe
; All dlls
!insertmacro InstallFile *.dll
@BUILD_HTTPD_TRUE@ !insertmacro InstallFolder http
@BUILD_LUA_TRUE@ !insertmacro InstallFolder lua
+ ; Generate the cache and add it to uninstall.log
+ ExecWait "$INSTDIR\vlc-cache-gen.exe $INSTDIR\plugins"
+ FindFirst $0 $1 "$INSTDIR\plugins\*.dat"
+ FileWrite $UninstallLog "plugins\$1$\r$\n"
+ FindClose $0
+
+
; URLs
WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
!insertmacro CloseUninstallLog
- ; Add VLC to "recomended programs" for the following extensions
+ ; Add VLC to "recommended programs" for the following extensions
WriteRegStr HKCR Applications\vlc.exe "" ""
WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
WriteRegStr HKCR Applications\vlc.exe\shell\Open "" $ContextMenuEntry_PlayWith
WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
+ WriteRegStr HKLM "Software\Clients\Media\VLC" "" "VLC media player"
+ WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "HideIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /HideIcons /S"
+ WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ShowIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /ShowIcons /S"
+ WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ReinstallCommand" "$\"$INSTDIR\spad-setup.exe$\" /Reinstall /S"
+ WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 0x001
lbl_done:
SectionEnd
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" $Action_OnArrivalDVD
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "play"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "Open"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" $Action_OnArrivalAudioCD
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "Open"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Open"
;;; Start function
Function .onInit
+
+UAC_Elevate:
+ UAC::RunElevated
+ StrCmp 1223 $0 UAC_ElevationAborted
+ StrCmp 0 $0 0 UAC_Err
+ StrCmp 1 $1 0 UAC_Success
+ Quit
+
+UAC_Err:
+ MessageBox mb_iconstop "Unable to elevate, error $0"
+ Abort
+
+UAC_ElevationAborted:
+ MessageBox mb_iconstop "This installer requires admin access, aborting!"
+ Abort
+
+UAC_Success:
+ StrCmp 1 $3 +4
+ StrCmp 3 $1 0 UAC_ElevationAborted
+ MessageBox mb_iconstop "This installer requires admin access, try again"
+ goto UAC_Elevate
!insertmacro MUI_LANGDLL_DISPLAY
!include "languages\english.nsh"
FunctionEnd
+Function .OnInstFailed
+ UAC::Unload
+FunctionEnd
+
+Function .OnInstSuccess
+ UAC::Unload
+FunctionEnd
;; End function
Section -Post
WriteUninstaller "$INSTDIR\uninstall.exe"
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
DeleteRegKey HKLM Software\Clients\Media\VLC
+ DeleteRegValue HKLM "Software\RegisteredApplications" "VLC"
DeleteRegKey HKCR "VLC.MediaFile"
DeleteRegKey HKLM \
!insertmacro MUI_DESCRIPTION_TEXT ${SEC92} $Desc_Section92
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END
-;Function un.onUninstSuccess
-; HideWindow
-; MessageBox MB_ICONINFORMATION|MB_OK \
-; "$(^Name) was successfully removed from your computer."
-;FunctionEnd
+Function un.OnUnInstFailed
+ UAC::Unload
+FunctionEnd
+
+Function un.OnUnInstSuccess
+ UAC::Unload
+ Delete "$INSTDIR\UAC.dll"
+FunctionEnd
Function un.onInit
+
+UAC_Elevate:
+ UAC::RunElevated
+ StrCmp 1223 $0 UAC_ElevationAborted
+ StrCmp 0 $0 0 UAC_Err
+ StrCmp 1 $1 0 UAC_Success
+ Quit
+
+UAC_Err:
+ MessageBox mb_iconstop "Unable to elevate, error $0"
+ Abort
+
+UAC_ElevationAborted:
+ MessageBox mb_iconstop "This installer requires admin access, aborting!"
+ Abort
+
+UAC_Success:
+ StrCmp 1 $3 +4
+ StrCmp 3 $1 0 UAC_ElevationAborted
+ MessageBox mb_iconstop "This installer requires admin access, try again"
+ goto UAC_Elevate
+
!insertmacro MUI_UNGETLANGUAGE
!include "languages\english.nsh"