]> git.sesse.net Git - vlc/blobdiff - extras/package/win32/vlc.win32.nsi.in
Win32: don't rebase UAC.dll
[vlc] / extras / package / win32 / vlc.win32.nsi.in
index 435e14d9709fcd6fedf366d84f4d452f0a58058c..051b3879663f48204696cee6ded615ef57f44617 100644 (file)
@@ -48,6 +48,11 @@ InstType $Name_InstTypeRecommended
 InstType $Name_InstTypeMinimum
 InstType $Name_InstTypeFull
 
+RequestExecutionLevel user
+!addincludedir NSIS
+!addplugindir NSIS
+!include UAC.nsh
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; NSIS Modern User Interface configuration ;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -66,6 +71,7 @@ InstType $Name_InstTypeFull
     !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
@@ -74,7 +80,17 @@ InstType $Name_InstTypeFull
   ; 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
@@ -218,6 +234,7 @@ FunctionEnd
   !insertmacro ${_action} ".oma"
   !insertmacro ${_action} ".oga"
   !insertmacro ${_action} ".spx"
+  !insertmacro ${_action} ".tta"
   !insertmacro ${_action} ".wav"
   !insertmacro ${_action} ".wma"
   !insertmacro ${_action} ".wv"
@@ -253,6 +270,7 @@ FunctionEnd
   !insertmacro ${_action} ".rmvb"
   !insertmacro ${_action} ".ts"
   !insertmacro ${_action} ".vob"
+  !insertmacro ${_action} ".vro"
   !insertmacro ${_action} ".wmv"
 !macroend
 
@@ -260,8 +278,10 @@ FunctionEnd
   !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
@@ -306,7 +326,7 @@ FunctionEnd
 !macroend
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; 3. Delete prefs and cache ;
+; 3. Delete prefs           ;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 !macro delprefs
@@ -409,6 +429,7 @@ Section $Name_Section01 SEC01
   ; VLC.exe, libvlc.dll
   !insertmacro InstallFile vlc.exe
   !insertmacro InstallFile vlc.exe.manifest
+  !insertmacro InstallFile vlc-cache-gen.exe
 
   ; All dlls
   !insertmacro InstallFile *.dll
@@ -424,6 +445,13 @@ Section $Name_Section01 SEC01
 @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" \
@@ -438,7 +466,7 @@ Section $Name_Section01 SEC01
 
   !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
@@ -456,6 +484,11 @@ Section $Name_Section01 SEC01
   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
@@ -581,14 +614,14 @@ Section $Name_Section05 SEC05
   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"
@@ -641,6 +674,27 @@ SectionEnd
 
 ;;; 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"
@@ -711,6 +765,13 @@ Function .onInit
 
 FunctionEnd
 
+Function .OnInstFailed
+    UAC::Unload
+FunctionEnd
+
+Function .OnInstSuccess
+    UAC::Unload
+FunctionEnd
 ;; End function
 Section -Post
   WriteUninstaller "$INSTDIR\uninstall.exe"
@@ -867,6 +928,7 @@ Section "un.$Name_Section91" SEC91
   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 \
@@ -892,13 +954,38 @@ SectionEnd
   !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"