Fix make dist
[vlc.git] / vlc.win32.nsi.in
blobc6dfbab0c308238b267417ef71a2f9faa1569fb5
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"
106 !insertmacro MUI_RESERVEFILE_LANGDLL
108 ; Reserve files
109 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
111 ; MUI end ------
113 ;;;;;;;;;;;;;;;;;;;
114 ; Extension lists ;
115 ;;;;;;;;;;;;;;;;;;;
117 !macro MacroAudioExtensions _action
118 !insertmacro ${_action} ".a52"
119 !insertmacro ${_action} ".aac"
120 !insertmacro ${_action} ".ac3"
121 !insertmacro ${_action} ".dts"
122 !insertmacro ${_action} ".flac"
123 !insertmacro ${_action} ".mka"
124 !insertmacro ${_action} ".mp1"
125 !insertmacro ${_action} ".mp2"
126 !insertmacro ${_action} ".mp3"
127 !insertmacro ${_action} ".ogg"
128 !insertmacro ${_action} ".spx"
129 !insertmacro ${_action} ".wav"
130 !insertmacro ${_action} ".wma"
131 !macroend
133 !macro MacroVideoExtensions _action
134 !insertmacro ${_action} ".asf"
135 !insertmacro ${_action} ".avi"
136 !insertmacro ${_action} ".divx"
137 !insertmacro ${_action} ".dv"
138 !insertmacro ${_action} ".m1v"
139 !insertmacro ${_action} ".m2v"
140 !insertmacro ${_action} ".mkv"
141 !insertmacro ${_action} ".mov"
142 !insertmacro ${_action} ".mp4"
143 !insertmacro ${_action} ".mpeg"
144 !insertmacro ${_action} ".mpeg1"
145 !insertmacro ${_action} ".mpeg2"
146 !insertmacro ${_action} ".mpeg4"
147 !insertmacro ${_action} ".mpg"
148 !insertmacro ${_action} ".ps"
149 !insertmacro ${_action} ".ts"
150 !insertmacro ${_action} ".ogm"
151 !insertmacro ${_action} ".vob"
152 !insertmacro ${_action} ".wmv"
153 !macroend
155 !macro MacroOtherExtensions _action
156 !insertmacro ${_action} ".asx"
157 !insertmacro ${_action} ".bin"
158 !insertmacro ${_action} ".cue"
159 !insertmacro ${_action} ".m3u"
160 !insertmacro ${_action} ".pls"
161 !insertmacro ${_action} ".vlc"
162 !macroend
164 !macro MacroAllExtensions _action
165 !insertmacro MacroAudioExtensions ${_action}
166 !insertmacro MacroVideoExtensions ${_action}
167 !insertmacro MacroOtherExtensions ${_action}
168 !macroend
170 ;;;;;;;;;;;;;;;;;;;;;;;;;;
171 ; File type associations ;
172 ;;;;;;;;;;;;;;;;;;;;;;;;;;
174 Function RegisterExtension
175 ; back up old value for extension $R0 (eg. ".opt")
176 ReadRegStr $1 HKCR "$R0" ""
177 StrCmp $1 "" NoBackup
178 StrCmp $1 "VLC$R0" "NoBackup"
179 WriteRegStr HKCR "$R0" "VLC.backup" $1
180 NoBackup:
181 WriteRegStr HKCR "$R0" "" "VLC$R0"
182 ReadRegStr $0 HKCR "VLC$R0" ""
183 WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
184 WriteRegStr HKCR "VLC$R0\shell" "" "Play"
185 WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
186 WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
187 FunctionEnd
189 Function un.RegisterExtension
190 ;start of restore script
191 ReadRegStr $1 HKCR "$R0" ""
192 StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
193 ReadRegStr $1 HKCR "$R0" "VLC.backup"
194 StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
195 DeleteRegKey HKCR "$R0"
196 Goto NoOwn
197 Restore:
198 WriteRegStr HKCR "$R0" "" $1
199 DeleteRegValue HKCR "$R0" "VLC.backup"
200 NoOwn:
201 DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
202 FunctionEnd
204 !macro RegisterExtensionSection EXT
205 Section ${EXT}
206 SectionIn 1 3
207 Push $R0
208 StrCpy $R0 ${EXT}
209 Call RegisterExtension
210 Pop $R0
211 SectionEnd
212 !macroend
214 !macro UnRegisterExtensionSection EXT
215 Push $R0
216 StrCpy $R0 ${EXT}
217 Call un.RegisterExtension
218 Pop $R0
219 !macroend
221 !macro WriteRegStrSupportedTypes EXT
222 WriteRegStr HKCR Applications\vlc.exe\SupportedTypes ${EXT} ""
223 !macroend
225 ;;;;;;;;;;;;;;;;;;;;;;;;
226 ; Context menu entries ;
227 ;;;;;;;;;;;;;;;;;;;;;;;;
229 !macro AddContextMenuExt EXT
230 WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" "Play with VLC media player"
231 WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '$INSTDIR\vlc.exe --started-from-file --no-playlist-enqueue "%1"'
233 WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" "Add to VLC media player's Playlist"
234 WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --started-from-file --playlist-enqueue "%1"'
235 !macroend
237 !macro AddContextMenu EXT
238 Push $R0
239 ReadRegStr $R0 HKCR ${EXT} ""
240 !insertmacro AddContextMenuExt $R0
241 Pop $R0
242 !macroend
244 !macro DeleteContextMenuExt EXT
245 DeleteRegKey HKCR ${EXT}\shell\PlayWithVLC
246 DeleteRegKey HKCR ${EXT}\shell\AddToPlaylistVLC
247 !macroend
249 !macro DeleteContextMenu EXT
250 Push $R0
251 ReadRegStr $R0 HKCR ${EXT} ""
252 !insertmacro DeleteContextMenuExt $R0
253 Pop $R0
254 !macroend
256 ;;;;;;;;;;;;;;;;;;;;;;;;;;
257 ; Delete prefs and cache ;
258 ;;;;;;;;;;;;;;;;;;;;;;;;;;
260 !macro delprefs
261 StrCpy $0 0
262 !define Index 'Line${__LINE__}'
263 "${Index}-Loop:"
264 ; FIXME
265 ; this will loop through all the logged users and "virtual" windows users
266 ; (it looks like users are only present in HKEY_USERS when they are logged in)
267 ClearErrors
268 EnumRegKey $1 HKU "" $0
269 StrCmp $1 "" "${Index}-End"
270 IntOp $0 $0 + 1
271 ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
272 StrCmp $2 "" "${Index}-Loop"
273 RMDir /r "$2\vlc"
274 Goto "${Index}-Loop"
275 "${Index}-End:"
276 !undef Index
277 !macroend
279 Var UninstallLog
281 !macro OpenUninstallLog
282 FileOpen $UninstallLog "$INSTDIR\uninstall.log" a
283 FileSeek $UninstallLog 0 END
284 !macroend
286 !macro CloseUninstallLog
287 FileClose $UninstallLog
288 SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
289 !macroend
291 !macro InstallFile FILEREGEX
292 File "${FILEREGEX}"
293 !define Index 'Line${__LINE__}'
294 FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
295 StrCmp $0 "" "${Index}-End"
296 "${Index}-Loop:"
297 StrCmp $1 "" "${Index}-End"
298 FileWrite $UninstallLog "$1$\r$\n"
299 FindNext $0 $1
300 Goto "${Index}-Loop"
301 "${Index}-End:"
302 !undef Index
303 !macroend
305 !macro InstallFolder FOLDER
306 File /r "${FOLDER}"
307 Push "${FOLDER}"
308 Call InstallFolderInternal
309 !macroend
311 Function InstallFolderInternal
312 Pop $9
313 !define Index 'Line${__LINE__}'
314 FindFirst $0 $1 "$INSTDIR\$9\*"
315 StrCmp $0 "" "${Index}-End"
316 "${Index}-Loop:"
317 StrCmp $1 "" "${Index}-End"
318 StrCmp $1 "." "${Index}-Next"
319 StrCmp $1 ".." "${Index}-Next"
320 IfFileExists "$9\$1\*" 0 "${Index}-Write"
321 Push $0
322 Push $9
323 Push "$9\$1"
324 Call InstallFolderInternal
325 Pop $9
326 Pop $0
327 Goto "${Index}-Next"
328 "${Index}-Write:"
329 FileWrite $UninstallLog "$9\$1$\r$\n"
330 "${Index}-Next:"
331 FindNext $0 $1
332 Goto "${Index}-Loop"
333 "${Index}-End:"
334 !undef Index
335 FunctionEnd
338 ;;;;;;;;;;;;;;;;;;;;;;
339 ; Installer sections ;
340 ;;;;;;;;;;;;;;;;;;;;;;
342 Section "Media player (required)" SEC01
343 SectionIn 1 2 3 RO
344 SetShellVarContext all
345 SetOutPath "$INSTDIR"
347 !insertmacro OpenUninstallLog
349 !insertmacro InstallFile vlc.exe
350 !insertmacro InstallFile vlc.exe.manifest
351 !ifdef LIBVLC_DLL
352 !insertmacro InstallFile ${LIBVLC_DLL}
353 !endif
354 !ifdef LIBVLC_CONTROL_DLL
355 !insertmacro InstallFile ${LIBVLC_CONTROL_DLL}
356 !endif
357 !insertmacro InstallFile *.txt
359 !insertmacro InstallFolder plugins
360 !insertmacro InstallFolder locale
361 !insertmacro InstallFolder osdmenu
362 !insertmacro InstallFolder skins
363 !insertmacro InstallFolder http
365 WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
366 "${PRODUCT_WEB_SITE}"
367 FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
368 WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
369 "${PRODUCT_WEB_SITE}/doc/"
370 FileWrite $UninstallLog "Documentation.url$\r$\n"
372 !insertmacro CloseUninstallLog
374 ; Add VLC to "recomended programs" for the following extensions
375 WriteRegStr HKCR Applications\vlc.exe "" ""
376 WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
377 WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC"
378 WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \
379 '$INSTDIR\vlc.exe --started-from-file "%1"'
380 !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
382 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player"
383 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
384 "$INSTDIR\vlc.exe --started-from-file cdda:%1"
385 WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player"
386 WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
387 "$INSTDIR\vlc.exe --started-from-file dvd:%1"
389 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
390 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie"
391 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
392 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
393 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "play"
394 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
396 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
397 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio"
398 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --started-from-file",0'
399 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
400 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
401 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
402 WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
403 WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play"
404 WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \
405 '$INSTDIR\vlc.exe --started-from-file dvd:%1'
406 WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
407 WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
408 WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play"
409 WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \
410 '$INSTDIR\vlc.exe --started-from-file cdda:%1'
411 WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
413 SectionEnd
415 Section "Start Menu Shortcut" SEC02a
416 SectionIn 1 2 3
417 CreateDirectory "$SMPROGRAMS\VideoLAN"
418 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings"
419 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Audio"
420 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to DirectX (default).lnk" \
421 "$INSTDIR\vlc.exe" "--aout aout_directx --save-config vlc:quit"
422 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to Waveout.lnk" \
423 "$INSTDIR\vlc.exe" "--aout waveout --save-config vlc:quit"
424 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Interface"
425 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Skinnable.lnk" \
426 "$INSTDIR\vlc.exe" "-I skins --save-config vlc:quit"
427 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to wxWidgets (default).lnk" \
428 "$INSTDIR\vlc.exe" "-I wxwin --save-config vlc:quit"
429 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Video"
430 ; FIXME add detection for Vista. Direct3D will be default there, for all others it's DirectX
431 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D.lnk" \
432 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --directx-hw-yuv --save-config vlc:quit"
433 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D (no hardware acceleration).lnk" \
434 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --no-directx-hw-yuv --save-config vlc:quit"
435 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX.lnk" \
436 "$INSTDIR\vlc.exe" "--vout directx --overlay --directx-hw-yuv --save-config vlc:quit"
437 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no hardware acceleration).lnk" \
438 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --no-directx-hw-yuv --save-config vlc:quit"
439 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no video overlay).lnk" \
440 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --directx-hw-yuv --save-config vlc:quit"
441 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to OpenGL.lnk" \
442 "$INSTDIR\vlc.exe" "--vout opengl --overlay --save-config vlc:quit"
443 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Reset VLC media player preferences and cache files.lnk" \
444 "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache --save-config vlc:quit"
445 CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
446 "$INSTDIR\Documentation.url"
447 CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
448 "$INSTDIR\NEWS.txt" ""
449 CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
450 "$INSTDIR\${PRODUCT_GROUP} Website.url"
451 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
452 "$INSTDIR\vlc.exe" ""
453 SectionEnd
455 Section "Desktop Shortcut" SEC02b
456 SectionIn 1 2 3
457 CreateShortCut "$DESKTOP\VLC media player.lnk" \
458 "$INSTDIR\vlc.exe" ""
459 SectionEnd
461 Section /o "Mozilla plugin" SEC03
462 SectionIn 3
464 SetOutPath "$INSTDIR"
465 !insertmacro OpenUninstallLog
466 !insertmacro InstallFile mozilla\npvlc.dll
467 !insertmacro CloseUninstallLog
469 !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
470 WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
471 WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
472 WriteRegStr HKLM ${Moz} "Product" "VLC media player"
473 WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
474 WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
476 ; for very old version of mozilla, these lines may be needed
477 ;Push $R0
478 ;Push $R1
479 ;Push $R2
481 ;!define Index 'Line${__LINE__}'
482 ;StrCpy $R1 "0"
484 ;"${Index}-Loop:"
486 ; ; Check for Key
487 ; EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
488 ; StrCmp $R0 "" "${Index}-End"
489 ; IntOp $R1 $R1 + 1
490 ; ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
491 ; StrCmp $R2 "" "${Index}-Loop" ""
493 ; CopyFiles "$INSTDIR\npvlc.dll" "$R2"
494 ; !ifdef LIBVLC_DLL
495 ; CopyFiles ${LIBVLC_DLL} "$R2"
496 ; !endif
497 ; !ifdef LIBVLC_CONTROL_DLL
498 ; CopyFiles ${LIBVLC_CONTROL_DLL} "$R2"
499 ; !endif
500 ; Goto "${Index}-Loop"
502 ;"${Index}-End:"
503 ;!undef Index
505 SectionEnd
507 Section "ActiveX plugin" SEC04
508 SectionIn 1 3
509 SetOutPath "$INSTDIR"
510 !insertmacro OpenUninstallLog
511 !insertmacro InstallFile activex\axvlc.dll
512 !insertmacro CloseUninstallLog
513 RegDLL "$INSTDIR\axvlc.dll"
514 SectionEnd
516 SectionGroup "File type associations" SEC06
517 SectionGroup "Audio Files"
518 !insertmacro MacroAudioExtensions RegisterExtensionSection
519 SectionGroupEnd
520 SectionGroup "Video Files"
521 !insertmacro MacroVideoExtensions RegisterExtensionSection
522 SectionGroupEnd
523 SectionGroup "Other"
524 !insertmacro MacroOtherExtensions RegisterExtensionSection
525 SectionGroupEnd
526 SectionGroupEnd
528 Section /o "Context Menus" SEC05
529 SectionIn 3
530 !insertmacro MacroAllExtensions AddContextMenu
531 !insertmacro AddContextMenuExt "Directory"
532 SectionEnd
534 Section /o "Delete preferences and cache" SEC07
535 !insertmacro delprefs
536 SectionEnd
538 ; Installer section descriptions
539 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
540 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} \
541 "The media player itself"
542 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} \
543 "Adds icons to your start menu for easy access"
544 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} \
545 "Adds icon to your desktop for easy access"
546 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} \
547 "The VLC Mozilla and Mozilla Firefox plugin"
548 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} \
549 "The VLC ActiveX plugin"
550 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} \
551 "Add context menu items ('Play With VLC' and 'Add To VLC's Playlist')"
552 !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} \
553 "Sets VLC media player as the default application for the specified file type"
554 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} \
555 "Deletes VLC media player preferences and cache files leftover from previous installations"
556 !insertmacro MUI_FUNCTION_DESCRIPTION_END
558 Function .onInit
559 ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
560 "UninstallString"
561 StrCmp $R0 "" done
563 MessageBox MB_YESNO|MB_ICONEXCLAMATION \
564 "VLC media player has already been installed. $\nDo you want to remove \
565 the previous version before installing $(^Name) ?" \
566 IDNO done
568 ;Run the uninstaller
569 ;uninst:
570 ClearErrors
571 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
572 done:
573 !insertmacro MUI_LANGDLL_DISPLAY
574 FunctionEnd
576 Section -Post
577 WriteUninstaller "$INSTDIR\uninstall.exe"
578 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
579 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
580 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
582 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
583 "DisplayName" "$(^Name)"
584 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
585 "UninstallString" "$INSTDIR\uninstall.exe"
586 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
587 "DisplayIcon" "$INSTDIR\vlc.exe"
588 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
589 "DisplayVersion" "${PRODUCT_VERSION}"
590 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
591 "URLInfoAbout" "${PRODUCT_WEB_SITE}"
592 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
593 "Publisher" "${PRODUCT_PUBLISHER}"
594 SectionEnd
596 ;;;;;;;;;;;;;;;;;;;;;;;;
597 ; Uninstaller sections ;
598 ;;;;;;;;;;;;;;;;;;;;;;;;
600 ; TrimNewlines (copied from NSIS documentation)
601 ; input, top of stack (e.g. whatever$\r$\n)
602 ; output, top of stack (replaces, with e.g. whatever)
603 ; modifies no other variables.
605 Function un.TrimNewlines
606 Exch $R0
607 Push $R1
608 Push $R2
609 StrCpy $R1 0
611 loop:
612 IntOp $R1 $R1 - 1
613 StrCpy $R2 $R0 1 $R1
614 StrCmp $R2 "$\r" loop
615 StrCmp $R2 "$\n" loop
616 IntOp $R1 $R1 + 1
617 IntCmp $R1 0 no_trim_needed
618 StrCpy $R0 $R0 $R1
620 no_trim_needed:
621 Pop $R2
622 Pop $R1
623 Exch $R0
624 FunctionEnd
626 Function un.RemoveEmptyDirs
627 Pop $9
628 !define Index 'Line${__LINE__}'
629 FindFirst $0 $1 "$INSTDIR$9*"
630 StrCmp $0 "" "${Index}-End"
631 "${Index}-Loop:"
632 StrCmp $1 "" "${Index}-End"
633 StrCmp $1 "." "${Index}-Next"
634 StrCmp $1 ".." "${Index}-Next"
635 Push $0
636 Push $1
637 Push $9
638 Push "$9$1\"
639 Call un.RemoveEmptyDirs
640 Pop $9
641 Pop $1
642 Pop $0
643 "${Index}-Remove:"
644 RMDir "$INSTDIR$9$1"
645 "${Index}-Next:"
646 FindNext $0 $1
647 Goto "${Index}-Loop"
648 "${Index}-End:"
649 FindClose $0
650 !undef Index
651 FunctionEnd
653 Section "Uninstall" SEC91
654 SectionIn 1 2 3 RO
655 SetShellVarContext all
657 !insertmacro MacroAllExtensions DeleteContextMenu
658 !insertmacro MacroAllExtensions UnRegisterExtensionSection
659 !insertmacro DeleteContextMenuExt "Directory"
661 ;remove activex plugin
662 UnRegDLL "$INSTDIR\axvlc.dll"
663 Delete /REBOOTOK "$INSTDIR\axvlc.dll"
665 ;remove mozilla plugin
666 Push $R0
667 Push $R1
668 Push $R2
670 !define Index 'Line${__LINE__}'
671 StrCpy $R1 "0"
673 "${Index}-Loop:"
675 ; Check for Key
676 EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
677 StrCmp $R0 "" "${Index}-End"
678 IntOp $R1 $R1 + 1
679 ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
680 StrCmp $R2 "" "${Index}-Loop" ""
682 ; old files (0.8.5 and before) that may be lying around
683 Delete /REBOOTOK "$R2\npvlc.dll"
684 Delete /REBOOTOK "$R2\libvlc.dll"
685 Delete /REBOOTOK "$R2\vlcintf.xpt"
686 Goto "${Index}-Loop"
688 "${Index}-End:"
689 !undef Index
690 Delete /REBOOTOK "$INSTDIR\npvlc.dll"
692 RMDir "$SMPROGRAMS\VideoLAN"
693 RMDir /r $SMPROGRAMS\VideoLAN
695 FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
696 UninstallLoop:
697 ClearErrors
698 FileRead $UninstallLog $R0
699 IfErrors UninstallEnd
700 Push $R0
701 Call un.TrimNewLines
702 Pop $R0
703 Delete "$INSTDIR\$R0"
704 Goto UninstallLoop
705 UninstallEnd:
706 FileClose $UninstallLog
707 Delete "$INSTDIR\uninstall.log"
708 Delete "$INSTDIR\uninstall.exe"
709 Push "\"
710 Call un.RemoveEmptyDirs
711 RMDir "$INSTDIR"
713 DeleteRegKey HKLM Software\VideoLAN
715 DeleteRegKey HKCR Applications\vlc.exe
716 DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
717 DeleteRegKey HKCR DVD\shell\PlayWithVLC
718 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
719 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
720 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
721 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
722 DeleteRegKey HKCR "VLC.MediaFile"
724 DeleteRegKey HKLM \
725 "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
727 DeleteRegKey HKLM \
728 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
730 Delete "$DESKTOP\VLC media player.lnk"
732 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
733 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
734 SetAutoClose true
735 SectionEnd
737 Section /o "un.Delete preferences and cache" SEC92
738 !insertmacro delprefs
739 SectionEnd
741 ; Uninstaller section descriptions
742 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
743 !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} \
744 "Uninstall VLC media player and all its components"
745 !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} \
746 "Deletes VLC media player preferences and cache files"
747 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
749 ;Function un.onUninstSuccess
750 ; HideWindow
751 ; MessageBox MB_ICONINFORMATION|MB_OK \
752 ; "$(^Name) was successfully removed from your computer."
753 ;FunctionEnd
755 Function un.onInit
756 !insertmacro MUI_UNGETLANGUAGE
757 FunctionEnd