Compile fix
[vlc/vlc-skelet.git] / vlc.win32.nsi.in
blob8a4a5dc84c9566ed47afe44b1d0430690062aa24
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"
14 !define PRODUCT_ID "{ea92ef52-afe4-4212-bacb-dfe9fca94cd6}"
16 !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
17 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_DIR_REGKEY}"
18 !define MUI_LANGDLL_REGISTRY_VALUENAME "Language"
20 @FILE_LIBVLC_DLL@
21 @FILE_LIBVLC_CONTROL_DLL@
23 ;;;;;;;;;;;;;;;;;;;;;;;;;
24 ; General configuration ;
25 ;;;;;;;;;;;;;;;;;;;;;;;;;
27 Name "${PRODUCT_GROUP} ${PRODUCT_NAME} ${PRODUCT_VERSION}"
28 OutFile ..\vlc-${VERSION}-win32.exe
29 InstallDir "$PROGRAMFILES\VideoLAN\VLC"
30 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
31 !ifdef NSIS_LZMA_COMPRESS_WHOLE
32 SetCompressor lzma
33 !else
34 SetCompressor /SOLID lzma
35 !endif
36 ;ShowInstDetails show
37 ;ShowUnInstDetails show
38 SetOverwrite ifnewer
39 CRCCheck on
41 InstType "Recommended"
42 InstType "Minimum"
43 InstType "Full"
45 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46 ; NSIS Modern User Interface configuration ;
47 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
49 ; MUI 1.67 compatible ------
50 !include "MUI.nsh"
52 ; MUI Settings
53 !define MUI_ABORTWARNING
54 !define MUI_ICON "vlc48x48.ico"
55 !define MUI_UNICON "vlc48x48.ico"
56 !define MUI_COMPONENTSPAGE_SMALLDESC
58 ; Installer pages
59 ; Welcome page
60 !define MUI_WELCOMEPAGE_TITLE_3LINES
61 !insertmacro MUI_PAGE_WELCOME
62 ; License page
63 !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
64 ; Components page
65 !insertmacro MUI_PAGE_COMPONENTS
66 ; Directory page
67 !insertmacro MUI_PAGE_DIRECTORY
68 ; Instfiles page
69 !insertmacro MUI_PAGE_INSTFILES
70 ; Finish page
71 !define MUI_FINISHPAGE_RUN "$INSTDIR\vlc.exe"
72 !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
73 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
74 !define MUI_FINISHPAGE_LINK "Visit the VideoLAN VLC media player Website"
75 !define MUI_FINISHPAGE_LINK_LOCATION "http://www.videolan.org/vlc/"
76 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
77 !insertmacro MUI_PAGE_FINISH
79 ; Uninstaller pages
80 !insertmacro MUI_UNPAGE_CONFIRM
81 !insertmacro MUI_UNPAGE_COMPONENTS
82 !insertmacro MUI_UNPAGE_INSTFILES
83 !insertmacro MUI_UNPAGE_FINISH
85 ; Language files
86 !insertmacro MUI_LANGUAGE "English" # first language is the default language
87 !insertmacro MUI_LANGUAGE "French"
88 !insertmacro MUI_LANGUAGE "German"
89 !insertmacro MUI_LANGUAGE "Spanish"
90 !insertmacro MUI_LANGUAGE "SimpChinese"
91 !insertmacro MUI_LANGUAGE "TradChinese"
92 !insertmacro MUI_LANGUAGE "Japanese"
93 !insertmacro MUI_LANGUAGE "Korean"
94 !insertmacro MUI_LANGUAGE "Italian"
95 !insertmacro MUI_LANGUAGE "Dutch"
96 !insertmacro MUI_LANGUAGE "Danish"
97 !insertmacro MUI_LANGUAGE "Swedish"
98 !insertmacro MUI_LANGUAGE "Norwegian"
99 !insertmacro MUI_LANGUAGE "Finnish"
100 !insertmacro MUI_LANGUAGE "Greek"
101 !insertmacro MUI_LANGUAGE "Russian"
102 !insertmacro MUI_LANGUAGE "Portuguese"
103 !insertmacro MUI_LANGUAGE "Arabic"
104 !insertmacro MUI_LANGUAGE "Polish"
105 !insertmacro MUI_LANGUAGE "Romanian"
107 !insertmacro MUI_RESERVEFILE_LANGDLL
109 ; Reserve files
110 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
112 ; MUI end ------
114 ;;;;;;;;;;;;;;;;;;;
115 ; Extension lists ;
116 ;;;;;;;;;;;;;;;;;;;
118 !macro MacroAudioExtensions _action
119 !insertmacro ${_action} ".a52"
120 !insertmacro ${_action} ".aac"
121 !insertmacro ${_action} ".ac3"
122 !insertmacro ${_action} ".dts"
123 !insertmacro ${_action} ".flac"
124 !insertmacro ${_action} ".mka"
125 !insertmacro ${_action} ".mp1"
126 !insertmacro ${_action} ".mp2"
127 !insertmacro ${_action} ".mp3"
128 !insertmacro ${_action} ".ogg"
129 !insertmacro ${_action} ".spx"
130 !insertmacro ${_action} ".wav"
131 !insertmacro ${_action} ".wma"
132 !macroend
134 !macro MacroVideoExtensions _action
135 !insertmacro ${_action} ".asf"
136 !insertmacro ${_action} ".avi"
137 !insertmacro ${_action} ".divx"
138 !insertmacro ${_action} ".dv"
139 !insertmacro ${_action} ".m1v"
140 !insertmacro ${_action} ".m2v"
141 !insertmacro ${_action} ".mkv"
142 !insertmacro ${_action} ".mov"
143 !insertmacro ${_action} ".mp4"
144 !insertmacro ${_action} ".mpeg"
145 !insertmacro ${_action} ".mpeg1"
146 !insertmacro ${_action} ".mpeg2"
147 !insertmacro ${_action} ".mpeg4"
148 !insertmacro ${_action} ".mpg"
149 !insertmacro ${_action} ".mxf"
150 !insertmacro ${_action} ".ps"
151 !insertmacro ${_action} ".ts"
152 !insertmacro ${_action} ".ogm"
153 !insertmacro ${_action} ".vob"
154 !insertmacro ${_action} ".wmv"
155 !macroend
157 !macro MacroOtherExtensions _action
158 !insertmacro ${_action} ".asx"
159 !insertmacro ${_action} ".bin"
160 !insertmacro ${_action} ".cue"
161 !insertmacro ${_action} ".m3u"
162 !insertmacro ${_action} ".pls"
163 !insertmacro ${_action} ".vlc"
164 !macroend
166 !macro MacroAllExtensions _action
167 !insertmacro MacroAudioExtensions ${_action}
168 !insertmacro MacroVideoExtensions ${_action}
169 !insertmacro MacroOtherExtensions ${_action}
170 !macroend
172 ;;;;;;;;;;;;;;;;;;;;;;;;;;
173 ; File type associations ;
174 ;;;;;;;;;;;;;;;;;;;;;;;;;;
176 Function RegisterExtension
177 ; back up old value for extension $R0 (eg. ".opt")
178 ReadRegStr $1 HKCR "$R0" ""
179 StrCmp $1 "" NoBackup
180 StrCmp $1 "VLC$R0" "NoBackup"
181 WriteRegStr HKCR "$R0" "VLC.backup" $1
182 NoBackup:
183 WriteRegStr HKCR "$R0" "" "VLC$R0"
184 ReadRegStr $0 HKCR "VLC$R0" ""
185 WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
186 WriteRegStr HKCR "VLC$R0\shell" "" "Play"
187 WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
188 WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
190 ; Vista detection
191 ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
192 StrCpy $R2 $R1 3
193 StrCmp $R2 '6.0' ForVista ToEnd
194 ForVista:
195 WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
196 ToEnd:
198 FunctionEnd
200 Function un.RegisterExtension
201 ;start of restore script
202 ReadRegStr $1 HKCR "$R0" ""
203 StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
204 ReadRegStr $1 HKCR "$R0" "VLC.backup"
205 StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
206 DeleteRegKey HKCR "$R0"
207 Goto NoOwn
208 Restore:
209 WriteRegStr HKCR "$R0" "" $1
210 DeleteRegValue HKCR "$R0" "VLC.backup"
211 NoOwn:
212 DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
213 FunctionEnd
215 !macro RegisterExtensionSection EXT
216 Section ${EXT}
217 SectionIn 1 3
218 Push $R0
219 StrCpy $R0 ${EXT}
220 Call RegisterExtension
221 Pop $R0
222 SectionEnd
223 !macroend
225 !macro UnRegisterExtensionSection EXT
226 Push $R0
227 StrCpy $R0 ${EXT}
228 Call un.RegisterExtension
229 Pop $R0
230 !macroend
232 !macro WriteRegStrSupportedTypes EXT
233 WriteRegStr HKCR Applications\vlc.exe\SupportedTypes ${EXT} ""
234 !macroend
236 ;;;;;;;;;;;;;;;;;;;;;;;;
237 ; Context menu entries ;
238 ;;;;;;;;;;;;;;;;;;;;;;;;
240 !macro AddContextMenuExt EXT
241 WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" "Play with VLC media player"
242 WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '$INSTDIR\vlc.exe --started-from-file --no-playlist-enqueue "%1"'
244 WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" "Add to VLC media player's Playlist"
245 WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --started-from-file --playlist-enqueue "%1"'
246 !macroend
248 !macro AddContextMenu EXT
249 Push $R0
250 ReadRegStr $R0 HKCR ${EXT} ""
251 !insertmacro AddContextMenuExt $R0
252 Pop $R0
253 !macroend
255 !macro DeleteContextMenuExt EXT
256 DeleteRegKey HKCR ${EXT}\shell\PlayWithVLC
257 DeleteRegKey HKCR ${EXT}\shell\AddToPlaylistVLC
258 !macroend
260 !macro DeleteContextMenu EXT
261 Push $R0
262 ReadRegStr $R0 HKCR ${EXT} ""
263 !insertmacro DeleteContextMenuExt $R0
264 Pop $R0
265 !macroend
267 ;;;;;;;;;;;;;;;;;;;;;;;;;;
268 ; Delete prefs and cache ;
269 ;;;;;;;;;;;;;;;;;;;;;;;;;;
271 !macro delprefs
272 StrCpy $0 0
273 !define Index 'Line${__LINE__}'
274 "${Index}-Loop:"
275 ; FIXME
276 ; this will loop through all the logged users and "virtual" windows users
277 ; (it looks like users are only present in HKEY_USERS when they are logged in)
278 ClearErrors
279 EnumRegKey $1 HKU "" $0
280 StrCmp $1 "" "${Index}-End"
281 IntOp $0 $0 + 1
282 ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
283 StrCmp $2 "" "${Index}-Loop"
284 RMDir /r "$2\vlc"
285 Goto "${Index}-Loop"
286 "${Index}-End:"
287 !undef Index
288 !macroend
290 Var UninstallLog
292 !macro OpenUninstallLog
293 FileOpen $UninstallLog "$INSTDIR\uninstall.log" a
294 FileSeek $UninstallLog 0 END
295 !macroend
297 !macro CloseUninstallLog
298 FileClose $UninstallLog
299 SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
300 !macroend
302 !macro InstallFile FILEREGEX
303 File "${FILEREGEX}"
304 !define Index 'Line${__LINE__}'
305 FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
306 StrCmp $0 "" "${Index}-End"
307 "${Index}-Loop:"
308 StrCmp $1 "" "${Index}-End"
309 FileWrite $UninstallLog "$1$\r$\n"
310 FindNext $0 $1
311 Goto "${Index}-Loop"
312 "${Index}-End:"
313 !undef Index
314 !macroend
316 !macro InstallFolder FOLDER
317 File /r "${FOLDER}"
318 Push "${FOLDER}"
319 Call InstallFolderInternal
320 !macroend
322 Function InstallFolderInternal
323 Pop $9
324 !define Index 'Line${__LINE__}'
325 FindFirst $0 $1 "$INSTDIR\$9\*"
326 StrCmp $0 "" "${Index}-End"
327 "${Index}-Loop:"
328 StrCmp $1 "" "${Index}-End"
329 StrCmp $1 "." "${Index}-Next"
330 StrCmp $1 ".." "${Index}-Next"
331 IfFileExists "$9\$1\*" 0 "${Index}-Write"
332 Push $0
333 Push $9
334 Push "$9\$1"
335 Call InstallFolderInternal
336 Pop $9
337 Pop $0
338 Goto "${Index}-Next"
339 "${Index}-Write:"
340 FileWrite $UninstallLog "$9\$1$\r$\n"
341 "${Index}-Next:"
342 FindNext $0 $1
343 Goto "${Index}-Loop"
344 "${Index}-End:"
345 !undef Index
346 FunctionEnd
349 ;;;;;;;;;;;;;;;;;;;;;;
350 ; Installer sections ;
351 ;;;;;;;;;;;;;;;;;;;;;;
353 Section "Media player (required)" SEC01
354 SectionIn 1 2 3 RO
355 SetShellVarContext all
356 SetOutPath "$INSTDIR"
358 !insertmacro OpenUninstallLog
360 !insertmacro InstallFile vlc.exe
361 !insertmacro InstallFile vlc.exe.manifest
362 !ifdef LIBVLC_DLL
363 !insertmacro InstallFile ${LIBVLC_DLL}
364 !endif
365 !ifdef LIBVLC_CONTROL_DLL
366 !insertmacro InstallFile ${LIBVLC_CONTROL_DLL}
367 !endif
368 !insertmacro InstallFile *.txt
370 !insertmacro InstallFolder plugins
371 !insertmacro InstallFolder locale
372 !insertmacro InstallFolder osdmenu
373 !insertmacro InstallFolder skins
374 !insertmacro InstallFolder http
375 !insertmacro InstallFolder share
377 WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
378 "${PRODUCT_WEB_SITE}"
379 FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
380 WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
381 "${PRODUCT_WEB_SITE}/doc/"
382 FileWrite $UninstallLog "Documentation.url$\r$\n"
384 !insertmacro CloseUninstallLog
386 ; Add VLC to "recomended programs" for the following extensions
387 WriteRegStr HKCR Applications\vlc.exe "" ""
388 WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
389 WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC"
390 WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \
391 '$INSTDIR\vlc.exe --started-from-file "%1"'
392 !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
394 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player"
395 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
396 "$INSTDIR\vlc.exe --started-from-file cdda:%1"
397 WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player"
398 WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
399 "$INSTDIR\vlc.exe --started-from-file dvd:%1"
401 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
402 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie"
403 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
404 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
405 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "play"
406 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
408 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
409 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio"
410 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --started-from-file",0'
411 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
412 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
413 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
414 WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
415 WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play"
416 WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \
417 '$INSTDIR\vlc.exe --started-from-file dvd:%1'
418 WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
419 WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
420 WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play"
421 WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \
422 '$INSTDIR\vlc.exe --started-from-file cdda:%1'
423 WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
425 ; Vista detection
426 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
427 StrCpy $R1 $R0 3
428 StrCmp $R1 '6.0' lbl_vista lbl_done
430 lbl_vista:
431 WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
432 WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
433 WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
435 lbl_done:
437 SectionEnd
439 Section "Start Menu Shortcut" SEC02a
440 SectionIn 1 2 3
441 CreateDirectory "$SMPROGRAMS\VideoLAN"
442 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings"
443 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Audio"
444 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to DirectX (default).lnk" \
445 "$INSTDIR\vlc.exe" "--aout aout_directx --save-config vlc:quit"
446 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to Waveout.lnk" \
447 "$INSTDIR\vlc.exe" "--aout waveout --save-config vlc:quit"
448 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Interface"
449 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Skinnable.lnk" \
450 "$INSTDIR\vlc.exe" "-I skins --save-config vlc:quit"
451 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to wxWidgets (default).lnk" \
452 "$INSTDIR\vlc.exe" "-I wxwin --save-config vlc:quit"
453 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Video"
454 ; FIXME add detection for Vista. Direct3D will be default there, for all others it's DirectX
455 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D.lnk" \
456 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --directx-hw-yuv --save-config vlc:quit"
457 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D (no hardware acceleration).lnk" \
458 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --no-directx-hw-yuv --save-config vlc:quit"
459 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX.lnk" \
460 "$INSTDIR\vlc.exe" "--vout directx --overlay --directx-hw-yuv --save-config vlc:quit"
461 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no hardware acceleration).lnk" \
462 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --no-directx-hw-yuv --save-config vlc:quit"
463 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no video overlay).lnk" \
464 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --directx-hw-yuv --save-config vlc:quit"
465 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to OpenGL.lnk" \
466 "$INSTDIR\vlc.exe" "--vout opengl --overlay --save-config vlc:quit"
467 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Reset VLC media player preferences and cache files.lnk" \
468 "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache --save-config vlc:quit"
469 CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
470 "$INSTDIR\Documentation.url"
471 CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
472 "$INSTDIR\NEWS.txt" ""
473 CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
474 "$INSTDIR\${PRODUCT_GROUP} Website.url"
475 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
476 "$INSTDIR\vlc.exe" ""
477 SectionEnd
479 Section "Desktop Shortcut" SEC02b
480 SectionIn 1 2 3
481 CreateShortCut "$DESKTOP\VLC media player.lnk" \
482 "$INSTDIR\vlc.exe" ""
483 SectionEnd
485 Section /o "Mozilla plugin" SEC03
486 SectionIn 3
488 SetOutPath "$INSTDIR"
489 !insertmacro OpenUninstallLog
490 !insertmacro InstallFile mozilla\npvlc.dll
491 !insertmacro CloseUninstallLog
493 !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
494 WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
495 WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
496 WriteRegStr HKLM ${Moz} "Product" "VLC media player"
497 WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
498 WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
500 ; for very old version of mozilla, these lines may be needed
501 ;Push $R0
502 ;Push $R1
503 ;Push $R2
505 ;!define Index 'Line${__LINE__}'
506 ;StrCpy $R1 "0"
508 ;"${Index}-Loop:"
510 ; ; Check for Key
511 ; EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
512 ; StrCmp $R0 "" "${Index}-End"
513 ; IntOp $R1 $R1 + 1
514 ; ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
515 ; StrCmp $R2 "" "${Index}-Loop" ""
517 ; CopyFiles "$INSTDIR\npvlc.dll" "$R2"
518 ; !ifdef LIBVLC_DLL
519 ; CopyFiles ${LIBVLC_DLL} "$R2"
520 ; !endif
521 ; !ifdef LIBVLC_CONTROL_DLL
522 ; CopyFiles ${LIBVLC_CONTROL_DLL} "$R2"
523 ; !endif
524 ; Goto "${Index}-Loop"
526 ;"${Index}-End:"
527 ;!undef Index
529 SectionEnd
531 Section "ActiveX plugin" SEC04
532 SectionIn 1 3
533 SetOutPath "$INSTDIR"
534 !insertmacro OpenUninstallLog
535 !insertmacro InstallFile activex\axvlc.dll
536 !insertmacro CloseUninstallLog
537 RegDLL "$INSTDIR\axvlc.dll"
538 SectionEnd
540 SectionGroup "File type associations" SEC06
541 SectionGroup "Audio Files"
542 !insertmacro MacroAudioExtensions RegisterExtensionSection
543 SectionGroupEnd
544 SectionGroup "Video Files"
545 !insertmacro MacroVideoExtensions RegisterExtensionSection
546 SectionGroupEnd
547 SectionGroup "Other"
548 !insertmacro MacroOtherExtensions RegisterExtensionSection
549 SectionGroupEnd
550 SectionGroupEnd
552 Section /o "Context Menus" SEC05
553 SectionIn 3
554 !insertmacro MacroAllExtensions AddContextMenu
555 !insertmacro AddContextMenuExt "Directory"
556 SectionEnd
558 Section /o "Delete preferences and cache" SEC07
559 !insertmacro delprefs
560 SectionEnd
562 ; Installer section descriptions
563 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
564 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} \
565 "The media player itself"
566 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} \
567 "Adds icons to your start menu for easy access"
568 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} \
569 "Adds icon to your desktop for easy access"
570 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} \
571 "The VLC Mozilla and Mozilla Firefox plugin"
572 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} \
573 "The VLC ActiveX plugin"
574 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} \
575 "Add context menu items ('Play With VLC' and 'Add To VLC's Playlist')"
576 !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} \
577 "Sets VLC media player as the default application for the specified file type"
578 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} \
579 "Deletes VLC media player preferences and cache files leftover from previous installations"
580 !insertmacro MUI_FUNCTION_DESCRIPTION_END
582 Function .onInit
583 ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
584 "UninstallString"
585 StrCmp $R0 "" done
587 MessageBox MB_YESNO|MB_ICONEXCLAMATION \
588 "VLC media player has already been installed. $\nDo you want to remove \
589 the previous version before installing $(^Name) ?" \
590 IDNO done
592 ;Run the uninstaller
593 ;uninst:
594 ClearErrors
595 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
596 done:
597 !insertmacro MUI_LANGDLL_DISPLAY
598 FunctionEnd
600 Section -Post
601 WriteUninstaller "$INSTDIR\uninstall.exe"
602 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
603 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
604 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
606 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
607 "DisplayName" "$(^Name)"
608 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
609 "UninstallString" "$INSTDIR\uninstall.exe"
610 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
611 "DisplayIcon" "$INSTDIR\vlc.exe"
612 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
613 "DisplayVersion" "${PRODUCT_VERSION}"
614 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
615 "URLInfoAbout" "${PRODUCT_WEB_SITE}"
616 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
617 "Publisher" "${PRODUCT_PUBLISHER}"
618 SectionEnd
620 ;;;;;;;;;;;;;;;;;;;;;;;;
621 ; Uninstaller sections ;
622 ;;;;;;;;;;;;;;;;;;;;;;;;
624 ; TrimNewlines (copied from NSIS documentation)
625 ; input, top of stack (e.g. whatever$\r$\n)
626 ; output, top of stack (replaces, with e.g. whatever)
627 ; modifies no other variables.
629 Function un.TrimNewlines
630 Exch $R0
631 Push $R1
632 Push $R2
633 StrCpy $R1 0
635 loop:
636 IntOp $R1 $R1 - 1
637 StrCpy $R2 $R0 1 $R1
638 StrCmp $R2 "$\r" loop
639 StrCmp $R2 "$\n" loop
640 IntOp $R1 $R1 + 1
641 IntCmp $R1 0 no_trim_needed
642 StrCpy $R0 $R0 $R1
644 no_trim_needed:
645 Pop $R2
646 Pop $R1
647 Exch $R0
648 FunctionEnd
650 Function un.RemoveEmptyDirs
651 Pop $9
652 !define Index 'Line${__LINE__}'
653 FindFirst $0 $1 "$INSTDIR$9*"
654 StrCmp $0 "" "${Index}-End"
655 "${Index}-Loop:"
656 StrCmp $1 "" "${Index}-End"
657 StrCmp $1 "." "${Index}-Next"
658 StrCmp $1 ".." "${Index}-Next"
659 Push $0
660 Push $1
661 Push $9
662 Push "$9$1\"
663 Call un.RemoveEmptyDirs
664 Pop $9
665 Pop $1
666 Pop $0
667 "${Index}-Remove:"
668 RMDir "$INSTDIR$9$1"
669 "${Index}-Next:"
670 FindNext $0 $1
671 Goto "${Index}-Loop"
672 "${Index}-End:"
673 FindClose $0
674 !undef Index
675 FunctionEnd
677 Section "Uninstall" SEC91
678 SectionIn 1 2 3 RO
679 SetShellVarContext all
681 !insertmacro MacroAllExtensions DeleteContextMenu
682 !insertmacro MacroAllExtensions UnRegisterExtensionSection
683 !insertmacro DeleteContextMenuExt "Directory"
685 ;remove activex plugin
686 UnRegDLL "$INSTDIR\axvlc.dll"
687 Delete /REBOOTOK "$INSTDIR\axvlc.dll"
689 ;remove mozilla plugin
690 Push $R0
691 Push $R1
692 Push $R2
694 !define Index 'Line${__LINE__}'
695 StrCpy $R1 "0"
697 "${Index}-Loop:"
699 ; Check for Key
700 EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
701 StrCmp $R0 "" "${Index}-End"
702 IntOp $R1 $R1 + 1
703 ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
704 StrCmp $R2 "" "${Index}-Loop" ""
706 ; old files (0.8.5 and before) that may be lying around
707 Delete /REBOOTOK "$R2\npvlc.dll"
708 Delete /REBOOTOK "$R2\libvlc.dll"
709 Delete /REBOOTOK "$R2\vlcintf.xpt"
710 Goto "${Index}-Loop"
712 "${Index}-End:"
713 !undef Index
714 Delete /REBOOTOK "$INSTDIR\npvlc.dll"
716 RMDir "$SMPROGRAMS\VideoLAN"
717 RMDir /r $SMPROGRAMS\VideoLAN
719 FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
720 UninstallLoop:
721 ClearErrors
722 FileRead $UninstallLog $R0
723 IfErrors UninstallEnd
724 Push $R0
725 Call un.TrimNewLines
726 Pop $R0
727 Delete "$INSTDIR\$R0"
728 Goto UninstallLoop
729 UninstallEnd:
730 FileClose $UninstallLog
731 Delete "$INSTDIR\uninstall.log"
732 Delete "$INSTDIR\uninstall.exe"
733 Push "\"
734 Call un.RemoveEmptyDirs
735 RMDir "$INSTDIR"
737 DeleteRegKey HKLM Software\VideoLAN
739 DeleteRegKey HKCR Applications\vlc.exe
740 DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
741 DeleteRegKey HKCR DVD\shell\PlayWithVLC
742 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
743 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
744 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
745 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
746 DeleteRegKey HKLM Software\Clients\Media\VLC
747 DeleteRegKey HKCR "VLC.MediaFile"
749 DeleteRegKey HKLM \
750 "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
752 DeleteRegKey HKLM \
753 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
755 Delete "$DESKTOP\VLC media player.lnk"
757 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
758 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
759 SetAutoClose true
760 SectionEnd
762 Section /o "un.Delete preferences and cache" SEC92
763 !insertmacro delprefs
764 SectionEnd
766 ; Uninstaller section descriptions
767 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
768 !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} \
769 "Uninstall VLC media player and all its components"
770 !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} \
771 "Deletes VLC media player preferences and cache files"
772 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
774 ;Function un.onUninstSuccess
775 ; HideWindow
776 ; MessageBox MB_ICONINFORMATION|MB_OK \
777 ; "$(^Name) was successfully removed from your computer."
778 ;FunctionEnd
780 Function un.onInit
781 !insertmacro MUI_UNGETLANGUAGE
782 FunctionEnd