📄 vlc.win32.nsi.in
字号:
"${PRODUCT_WEB_SITE}/doc/" FileWrite $UninstallLog "Documentation.url$\r$\n" WriteIniStr "$INSTDIR\New_Skins.url" "InternetShortcut" "URL" \ "${PRODUCT_WEB_SITE}/vlc/skins.php" FileWrite $UninstallLog "New_Skins.url$\r$\n" !insertmacro CloseUninstallLog ; Add VLC to "recomended 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\Play "" $ContextMenuEntry_PlayWith WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \ '$INSTDIR\vlc.exe --started-from-file "%1"' !insertmacro MacroAllExtensions WriteRegStrSupportedTypes; Vista Registration ; Vista detection ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion StrCpy $R1 $R0 3 StrCmp $R1 '6.0' lbl_vista lbl_done lbl_vista: 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" lbl_done:SectionEndSection $Name_Section02a SEC02a SectionIn 1 2 3 CreateDirectory "$SMPROGRAMS\VideoLAN" CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings" CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Audio" CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to DirectX (default).lnk" \ "$INSTDIR\vlc.exe" "--aout aout_directx --save-config vlc://quit" CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to Waveout.lnk" \ "$INSTDIR\vlc.exe" "--aout waveout --save-config vlc://quit" CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Interface" CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Skinnable.lnk" \ "$INSTDIR\vlc.exe" "-I skins --save-config vlc://quit" CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Qt (default).lnk" \ "$INSTDIR\vlc.exe" "-I qt --save-config vlc://quit" CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Video" ; FIXME add detection for Vista. Direct3D will be default there, for all others it's DirectX CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D.lnk" \ "$INSTDIR\vlc.exe" "--vout direct3d --overlay --directx-hw-yuv --save-config vlc://quit" CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D (no hardware acceleration).lnk" \ "$INSTDIR\vlc.exe" "--vout direct3d --overlay --no-directx-hw-yuv --save-config vlc://quit" CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX.lnk" \ "$INSTDIR\vlc.exe" "--vout directx --overlay --directx-hw-yuv --save-config vlc://quit" CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no hardware acceleration).lnk" \ "$INSTDIR\vlc.exe" "--vout directx --no-overlay --no-directx-hw-yuv --save-config vlc://quit" CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no video overlay).lnk" \ "$INSTDIR\vlc.exe" "--vout directx --no-overlay --directx-hw-yuv --save-config vlc://quit" CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to OpenGL.lnk" \ "$INSTDIR\vlc.exe" "--vout opengl --overlay --save-config vlc://quit" CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Reset VLC media player preferences and cache files.lnk" \ "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache vlc://quit" CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \ "$INSTDIR\Documentation.url" CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \ "$INSTDIR\NEWS.txt" "" CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \ "$INSTDIR\${PRODUCT_GROUP} Website.url" CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \ "$INSTDIR\vlc.exe" ""SectionEndSection $Name_Section02b SEC02b SectionIn 1 2 3 CreateShortCut "$DESKTOP\VLC media player.lnk" \ "$INSTDIR\vlc.exe" ""SectionEndSection /o $Name_Section03 SEC03 SectionIn 3 SetOutPath "$INSTDIR" !insertmacro OpenUninstallLog !insertmacro InstallFile mozilla\npvlc.dll !insertmacro CloseUninstallLog !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}" WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin" WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll" WriteRegStr HKLM ${Moz} "Product" "VLC media player" WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN" WriteRegStr HKLM ${Moz} "Version" "${VERSION}" ; for very old version of mozilla, these lines may be needed ;Push $R0 ;Push $R1 ;Push $R2 ;!define Index 'Line${__LINE__}' ;StrCpy $R1 "0" ;"${Index}-Loop:" ; ; Check for Key ; EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1" ; StrCmp $R0 "" "${Index}-End" ; IntOp $R1 $R1 + 1 ; ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins" ; StrCmp $R2 "" "${Index}-Loop" "" ; CopyFiles "$INSTDIR\npvlc.dll" "$R2" ; !ifdef LIBVLC_DLL ; CopyFiles ${LIBVLC_DLL} "$R2" ; !endif ; !ifdef LIBVLC_CONTROL_DLL ; CopyFiles ${LIBVLC_CONTROL_DLL} "$R2" ; !endif ; Goto "${Index}-Loop" ;"${Index}-End:" ;!undef IndexSectionEndSection $Name_Section04 SEC04 SectionIn 1 3 SetOutPath "$INSTDIR" !insertmacro OpenUninstallLog !insertmacro InstallFile activex\axvlc.dll !insertmacro CloseUninstallLog RegDLL "$INSTDIR\axvlc.dll"SectionEndSection $Name_Section05 SEC05 SectionIn 1 2 3 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \ "$INSTDIR\vlc.exe --started-from-file cdda://%1" WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \ "$INSTDIR\vlc.exe --started-from-file dvd://%1" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" "" 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" "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" "Provider" "VideoLAN VLC media player" WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie" WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play" WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \ '$INSTDIR\vlc.exe --started-from-file dvd://%1' WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0' WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio" WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play" WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \ '$INSTDIR\vlc.exe --started-from-file cdda://%1' WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'SectionEndSectionGroup $Name_Section06 SEC06 SectionGroup $Name_SectionGroupAudio !insertmacro MacroAudioExtensions RegisterExtensionSection SectionGroupEnd SectionGroup $Name_SectionGroupVideo !insertmacro MacroVideoExtensions RegisterExtensionSection SectionGroupEnd SectionGroup $Name_SectionGroupOther !insertmacro MacroOtherExtensions RegisterExtensionSection SectionGroupEndSectionGroupEndSection $Name_Section07 SEC07 SectionIn 3 !insertmacro MacroAllExtensions AddContextMenu !insertmacro AddContextMenuExt "Directory"SectionEndSection $Name_Section08 SEC08 !insertmacro delprefsSectionEnd; Installer section descriptions!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $Desc_Section01 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} $Desc_Section02a !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} $Desc_Section02b !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $Desc_Section03 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $Desc_Section04 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $Desc_Section05 !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $Desc_Section06 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $Desc_Section07 !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} $Desc_Section08!insertmacro MUI_FUNCTION_DESCRIPTION_END;;; Start functionFunction .onInit !insertmacro MUI_LANGDLL_DISPLAY !include "languages\english.nsh" StrCmp $LANGUAGE ${LANG_FRENCH} French 0 StrCmp $LANGUAGE ${LANG_FINNISH} Finnish EndLanguageCmp French: !include "languages\french.nsh" Goto EndLanguageCmp Finnish: !include "languages\finnish.nsh" EndLanguageCmp: ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \ "UninstallString" StrCmp $R0 "" done MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled IDNO done ;Run the uninstaller ;uninst: ClearErrors ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file done: FunctionEnd;; End functionSection -Post WriteUninstaller "$INSTDIR\uninstall.exe" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \ "DisplayName" "$(^Name)" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \ "UninstallString" "$INSTDIR\uninstall.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \ "DisplayIcon" "$INSTDIR\vlc.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \ "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \ "URLInfoAbout" "${PRODUCT_WEB_SITE}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \ "Publisher" "${PRODUCT_PUBLISHER}"SectionEnd;;;;;;;;;;;;;;;;;;;;;;;;; Uninstaller sections ;;;;;;;;;;;;;;;;;;;;;;;;;; TrimNewlines (copied from NSIS documentation); input, top of stack (e.g. whatever$\r$\n); output, top of stack (replaces, with e.g. whatever); modifies no other variables.Function un.TrimNewlines Exch $R0 Push $R1 Push $R2 StrCpy $R1 0 loop: IntOp $R1 $R1 - 1 StrCpy $R2 $R0 1 $R1 StrCmp $R2 "$\r" loop StrCmp $R2 "$\n" loop IntOp $R1 $R1 + 1 IntCmp $R1 0 no_trim_needed StrCpy $R0 $R0 $R1 no_trim_needed: Pop $R2 Pop $R1 Exch $R0FunctionEndFunction un.RemoveEmptyDirs Pop $9 !define Index 'Line${__LINE__}' FindFirst $0 $1 "$INSTDIR$9*" StrCmp $0 "" "${Index}-End" "${Index}-Loop:" StrCmp $1 "" "${Index}-End" StrCmp $1 "." "${Index}-Next" StrCmp $1 ".." "${Index}-Next" Push $0 Push $1 Push $9 Push "$9$1\" Call un.RemoveEmptyDirs Pop $9 Pop $1 Pop $0 "${Index}-Remove:" RMDir "$INSTDIR$9$1" "${Index}-Next:" FindNext $0 $1 Goto "${Index}-Loop" "${Index}-End:" FindClose $0 !undef IndexFunctionEndSection "un.$Name_Section91" SEC91 SectionIn 1 2 3 RO SetShellVarContext all !insertmacro MacroAllExtensions DeleteContextMenu !insertmacro MacroAllExtensions UnRegisterExtensionSection !insertmacro DeleteContextMenuExt "Directory" ;remove activex plugin UnRegDLL "$INSTDIR\axvlc.dll" Delete /REBOOTOK "$INSTDIR\axvlc.dll" ;remove mozilla plugin Push $R0 Push $R1 Push $R2 !define Index 'Line${__LINE__}' StrCpy $R1 "0" "${Index}-Loop:" ; Check for Key EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1" StrCmp $R0 "" "${Index}-End" IntOp $R1 $R1 + 1 ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins" StrCmp $R2 "" "${Index}-Loop" "" ; old files (0.8.5 and before) that may be lying around Delete /REBOOTOK "$R2\npvlc.dll" Delete /REBOOTOK "$R2\libvlc.dll" Delete /REBOOTOK "$R2\vlcintf.xpt" Goto "${Index}-Loop" "${Index}-End:" !undef Index Delete /REBOOTOK "$INSTDIR\npvlc.dll" RMDir "$SMPROGRAMS\VideoLAN" RMDir /r $SMPROGRAMS\VideoLAN FileOpen $UninstallLog "$INSTDIR\uninstall.log" r UninstallLoop: ClearErrors FileRead $UninstallLog $R0 IfErrors UninstallEnd Push $R0 Call un.TrimNewLines Pop $R0 Delete "$INSTDIR\$R0" Goto UninstallLoop UninstallEnd: FileClose $UninstallLog Delete "$INSTDIR\uninstall.log" Delete "$INSTDIR\uninstall.exe" Push "\" Call un.RemoveEmptyDirs RMDir "$INSTDIR" DeleteRegKey HKLM Software\VideoLAN DeleteRegKey HKCR Applications\vlc.exe DeleteRegKey HKCR AudioCD\shell\PlayWithVLC DeleteRegKey HKCR DVD\shell\PlayWithVLC DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival 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 DeleteRegKey HKCR "VLC.MediaFile" DeleteRegKey HKLM \ "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}" DeleteRegKey HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" Delete "$DESKTOP\VLC media player.lnk" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" SetAutoClose trueSectionEndSection /o "un.$Name_Section92" SEC92 !insertmacro delprefsSectionEnd; Uninstaller section descriptions!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} $Desc_Section91 !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.";FunctionEndFunction un.onInit !insertmacro MUI_UNGETLANGUAGE !include "languages\english.nsh" StrCmp $LANGUAGE ${LANG_FRENCH} French EndLanguageCmp French: !include "languages\french.nsh" EndLanguageCmp: FunctionEnd
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -