* modules/control/telnet.c: a few fixes + coding style changes.
[vlc.git] / vlc.win32.nsi
blobfa41aaa720bc359e05d61b7979ed1bad057cfe73
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ; NSIS installer script for vlc ;
3 ; (http://nsis.sourceforge.net) ;
4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6 !define PRODUCT_NAME "VLC media player"
7 !define PRODUCT_VERSION '${VERSION}'
8 !define PRODUCT_GROUP "VideoLAN"
9 !define PRODUCT_PUBLISHER "VideoLAN Team"
10 !define PRODUCT_WEB_SITE "http://www.videolan.org"
11 !define PRODUCT_DIR_REGKEY "Software\VideoLAN\VLC"
12 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
13 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
15 ;;;;;;;;;;;;;;;;;;;;;;;;;
16 ; General configuration ;
17 ;;;;;;;;;;;;;;;;;;;;;;;;;
19 Name "${PRODUCT_GROUP} ${PRODUCT_NAME} ${PRODUCT_VERSION}"
20 OutFile ..\vlc-${VERSION}-win32.exe
21 InstallDir "$PROGRAMFILES\VideoLAN\VLC"
22 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "Install_Dir"
23 SetCompressor lzma
24 ShowInstDetails show
25 ShowUnInstDetails show
26 SetOverwrite ifnewer
27 CRCCheck on
29 InstType "Normal"
30 InstType "Full"
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
33 ; NSIS Modern User Interface configuration ;
34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
36 ; MUI 1.67 compatible ------
37 !include "MUI.nsh"
39 ; MUI Settings
40 !define MUI_ABORTWARNING
41 !define MUI_ICON "vlc48x48.ico"
42 !define MUI_UNICON "vlc48x48.ico"
43 !define MUI_COMPONENTSPAGE_SMALLDESC
45 ; Welcome page
46 !insertmacro MUI_PAGE_WELCOME
47 ; License page
48 !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
49 ; Components page
50 !insertmacro MUI_PAGE_COMPONENTS
51 ; Directory page
52 !insertmacro MUI_PAGE_DIRECTORY
53 ; Instfiles page
54 !insertmacro MUI_PAGE_INSTFILES
55 ; Finish page
56 !define MUI_FINISHPAGE_RUN "$INSTDIR\vlc.exe"
57 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
58 !insertmacro MUI_PAGE_FINISH
60 ; Uninstaller pages
61 !insertmacro MUI_UNPAGE_INSTFILES
63 ; Language files
64 !insertmacro MUI_LANGUAGE "English"
66 ; Reserve files
67 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
69 ; MUI end ------
71 ;;;;;;;;;;;;;;;;;;;;;;;;;;
72 ; File type associations ;
73 ;;;;;;;;;;;;;;;;;;;;;;;;;;
75 Function RegisterExtension
76 ; back up old value for extension $R0 (eg. ".opt")
77 ReadRegStr $1 HKCR "$R0" ""
78 StrCmp $1 "" NoBackup
79 StrCmp $1 "VLC$R0" "NoBackup"
80 WriteRegStr HKCR "$R0" "VLC.backup" $1
81 NoBackup:
82 WriteRegStr HKCR "$R0" "" "VLC$R0"
83 ReadRegStr $0 HKCR "VLC$R0" ""
84 WriteRegStr HKCR "VLC$R0" "" "VLC media file"
85 WriteRegStr HKCR "VLC$R0\shell" "" "Play"
86 WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '$INSTDIR\vlc.exe "%1"'
87 WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
88 FunctionEnd
90 Function un.RegisterExtension
91 ;start of restore script
92 ReadRegStr $1 HKCR "$R0" ""
93 StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
94 ReadRegStr $1 HKCR "$R0" "VLC.backup"
95 StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
96 DeleteRegKey HKCR "$R0"
97 Goto NoOwn
98 Restore:
99 WriteRegStr HKCR "$R0" "" $1
100 DeleteRegValue HKCR "$R0" "VLC.backup"
101 NoOwn:
102 DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
103 FunctionEnd
105 !macro RegisterExtensionSection EXT
106 Section /o ${EXT}
107 Push $R0
108 StrCpy $R0 ${EXT}
109 Call RegisterExtension
110 Pop $R0
111 SectionEnd
112 !macroend
114 !macro UnRegisterExtensionSection EXT
115 Push $R0
116 StrCpy $R0 ${EXT}
117 Call un.RegisterExtension
118 Pop $R0
119 !macroend
121 ;;;;;;;;;;;;;;;;;;;;;;
122 ; Installer sections ;
123 ;;;;;;;;;;;;;;;;;;;;;;
125 Section "Media player (required)" SEC01
126 SectionIn 1 2 3 RO
127 SetShellVarContext all
128 SetOutPath "$INSTDIR"
130 File vlc.exe
131 File vlc.exe.manifest
132 File *.txt
134 File /r plugins
135 File /r locale
136 File /r skins
137 File /r http
139 WriteRegStr HKCR Applications\vlc.exe "" ""
140 WriteRegStr HKCR Applications\vlc.exe\shell "" "Play"
141 WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \
142 '$INSTDIR\vlc.exe "%1"'
144 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player"
145 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
146 "$INSTDIR\vlc.exe cdda:%1"
147 WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player"
148 WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
149 "$INSTDIR\vlc.exe dvd:%1"
151 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
152 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie"
153 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
154 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Invoke.ProgID" "VLC.MediaFile"
155 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "play"
156 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
158 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
159 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio"
160 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
161 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Invoke.ProgID" "VLC.MediaFile"
162 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
163 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
164 WriteRegStr HKCR "VLC.MediaFile" "" "VLC media file"
165 WriteRegStr HKCR "VLC.MediaFile\shell" "" "Play"
166 WriteRegStr HKCR "VLC.MediaFile\shell\Play\command" "" \
167 '$INSTDIR\vlc.exe "%1"'
168 WriteRegStr HKCR "VLC.MediaFile\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
170 SectionEnd
172 Section "Start Menu + Desktop Shortcut" SEC02
173 SectionIn 1 2 3
174 CreateDirectory "$SMPROGRAMS\VideoLAN"
175 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
176 "$INSTDIR\vlc.exe" "--intf wxwin --wxwin-embed"
177 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player (alt).lnk" \
178 "$INSTDIR\vlc.exe" "--intf wxwin --no-wxwin-embed"
179 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player (skins).lnk" \
180 "$INSTDIR\vlc.exe" "--intf skins"
181 CreateShortCut "$DESKTOP\VLC media player.lnk" \
182 "$INSTDIR\vlc.exe" "--intf wxwin"
183 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" \
184 "${PRODUCT_WEB_SITE}"
185 CreateShortCut "$SMPROGRAMS\VideoLAN\Website.lnk" \
186 "$INSTDIR\${PRODUCT_NAME}.url"
187 SectionEnd
189 Section /o "Mozilla plugin" SEC03
190 SectionIn 2 3
191 File /r mozilla
193 WriteRegStr HKLM \
194 SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION} \
195 "Path" '"$INSTDIR\mozilla\npvlc.dll"'
196 SectionEnd
198 SubSection "File type associations" SEC04
199 ; Make sure we have the same list in uninstall
200 !insertmacro RegisterExtensionSection ".a52"
201 !insertmacro RegisterExtensionSection ".aac"
202 !insertmacro RegisterExtensionSection ".ac3"
203 !insertmacro RegisterExtensionSection ".asf"
204 !insertmacro RegisterExtensionSection ".asx"
205 !insertmacro RegisterExtensionSection ".avi"
206 !insertmacro RegisterExtensionSection ".bin"
207 !insertmacro RegisterExtensionSection ".cue"
208 !insertmacro RegisterExtensionSection ".divx"
209 !insertmacro RegisterExtensionSection ".dts"
210 !insertmacro RegisterExtensionSection ".dv"
211 !insertmacro RegisterExtensionSection ".flac"
212 !insertmacro RegisterExtensionSection ".m1v"
213 !insertmacro RegisterExtensionSection ".m2v"
214 !insertmacro RegisterExtensionSection ".m3u"
215 !insertmacro RegisterExtensionSection ".mka"
216 !insertmacro RegisterExtensionSection ".mkv"
217 !insertmacro RegisterExtensionSection ".mov"
218 !insertmacro RegisterExtensionSection ".mp1"
219 !insertmacro RegisterExtensionSection ".mp2"
220 !insertmacro RegisterExtensionSection ".mp3"
221 !insertmacro RegisterExtensionSection ".mp4"
222 !insertmacro RegisterExtensionSection ".mpeg"
223 !insertmacro RegisterExtensionSection ".mpeg1"
224 !insertmacro RegisterExtensionSection ".mpeg2"
225 !insertmacro RegisterExtensionSection ".mpeg4"
226 !insertmacro RegisterExtensionSection ".mpg"
227 !insertmacro RegisterExtensionSection ".ogg"
228 !insertmacro RegisterExtensionSection ".ogm"
229 !insertmacro RegisterExtensionSection ".pls"
230 !insertmacro RegisterExtensionSection ".spx"
231 !insertmacro RegisterExtensionSection ".vob"
232 !insertmacro RegisterExtensionSection ".vlc"
233 !insertmacro RegisterExtensionSection ".wav"
234 !insertmacro RegisterExtensionSection ".wma"
235 !insertmacro RegisterExtensionSection ".wmv"
236 SubSectionEnd
238 Section -Post
239 WriteUninstaller "$INSTDIR\uninstall.exe"
240 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
241 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
242 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
244 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
245 "DisplayName" "$(^Name)"
246 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
247 "UninstallString" "$INSTDIR\uninstall.exe"
248 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
249 "DisplayIcon" "$INSTDIR\vlc.exe"
250 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
251 "DisplayVersion" "${PRODUCT_VERSION}"
252 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
253 "URLInfoAbout" "${PRODUCT_WEB_SITE}"
254 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
255 "Publisher" "${PRODUCT_PUBLISHER}"
256 SectionEnd
258 ; Section descriptions
259 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
260 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} \
261 "The media player itself"
262 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} \
263 "Adds icons to your start menu and your desktop for easy access"
264 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} \
265 "The VLC mozilla plugin"
266 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} \
267 "Sets VLC media player as the default application for the specified file type"
268 !insertmacro MUI_FUNCTION_DESCRIPTION_END
271 Function un.onUninstSuccess
272 HideWindow
273 MessageBox MB_ICONINFORMATION|MB_OK \
274 "$(^Name) was successfully removed from your computer."
275 FunctionEnd
277 Function un.onInit
278 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
279 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
280 Abort
281 FunctionEnd
283 Section Uninstall
284 SetShellVarContext all
286 ; Make sure we have the same list in install
287 !insertmacro UnRegisterExtensionSection ".a52"
288 !insertmacro UnRegisterExtensionSection ".aac"
289 !insertmacro UnRegisterExtensionSection ".ac3"
290 !insertmacro UnRegisterExtensionSection ".asf"
291 !insertmacro UnRegisterExtensionSection ".asx"
292 !insertmacro UnRegisterExtensionSection ".avi"
293 !insertmacro UnRegisterExtensionSection ".bin"
294 !insertmacro UnRegisterExtensionSection ".cue"
295 !insertmacro UnRegisterExtensionSection ".divx"
296 !insertmacro UnRegisterExtensionSection ".dts"
297 !insertmacro UnRegisterExtensionSection ".dv"
298 !insertmacro UnRegisterExtensionSection ".flac"
299 !insertmacro UnRegisterExtensionSection ".m1v"
300 !insertmacro UnRegisterExtensionSection ".m2v"
301 !insertmacro UnRegisterExtensionSection ".m3u"
302 !insertmacro UnRegisterExtensionSection ".mka"
303 !insertmacro UnRegisterExtensionSection ".mkv"
304 !insertmacro UnRegisterExtensionSection ".mov"
305 !insertmacro UnRegisterExtensionSection ".mp1"
306 !insertmacro UnRegisterExtensionSection ".mp2"
307 !insertmacro UnRegisterExtensionSection ".mp3"
308 !insertmacro UnRegisterExtensionSection ".mp4"
309 !insertmacro UnRegisterExtensionSection ".mpeg"
310 !insertmacro UnRegisterExtensionSection ".mpeg1"
311 !insertmacro UnRegisterExtensionSection ".mpeg2"
312 !insertmacro UnRegisterExtensionSection ".mpeg4"
313 !insertmacro UnRegisterExtensionSection ".mpg"
314 !insertmacro UnRegisterExtensionSection ".ogg"
315 !insertmacro UnRegisterExtensionSection ".ogm"
316 !insertmacro UnRegisterExtensionSection ".pls"
317 !insertmacro UnRegisterExtensionSection ".spx"
318 !insertmacro UnRegisterExtensionSection ".vob"
319 !insertmacro UnRegisterExtensionSection ".vlc"
320 !insertmacro UnRegisterExtensionSection ".wav"
321 !insertmacro UnRegisterExtensionSection ".wma"
322 !insertmacro UnRegisterExtensionSection ".wmv"
324 RMDir "$SMPROGRAMS\VideoLAN"
325 RMDir /r $SMPROGRAMS\VideoLAN
326 RMDir /r $INSTDIR
327 DeleteRegKey HKLM Software\VideoLAN
329 DeleteRegKey HKCR Applications\vlc.exe
330 DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
331 DeleteRegKey HKCR DVD\shell\PlayWithVLC
332 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
333 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
334 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
335 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
336 DeleteRegKey HKCR "VLC.MediaFile"
338 DeleteRegKey HKLM \
339 SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}
341 DeleteRegKey HKLM \
342 Software\Microsoft\Windows\CurrentVersion\Uninstall\VideoLAN
344 Delete "$DESKTOP\VLC media player.lnk"
346 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
347 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
348 SetAutoClose true
349 SectionEnd