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