]> git.sesse.net Git - vlc/blob - extras/package/win32/vlc.win32.nsi.in
Support opening over 15 files at same time via Windows Explorer
[vlc] / extras / package / win32 / vlc.win32.nsi.in
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ; NSIS installer script for vlc ;
3 ; (http://nsis.sourceforge.net) ;
4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5
6 !include "languages\declaration.nsh"
7
8 !define PRODUCT_NAME "VLC media player"
9 !define VERSION @VERSION@
10 !define PRODUCT_VERSION @VERSION@
11 !define PRODUCT_GROUP "VideoLAN"
12 !define PRODUCT_PUBLISHER "VideoLAN"
13 !define PRODUCT_WEB_SITE "http://www.videolan.org/"
14 !define PRODUCT_DIR_REGKEY "Software\VideoLAN\VLC"
15 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
16 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
17 !define PRODUCT_ID "{ea92ef52-afe4-4212-bacb-dfe9fca94cd6}"
18
19 !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
20 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_DIR_REGKEY}"
21 !define MUI_LANGDLL_REGISTRY_VALUENAME "Language"
22
23 @HAVE_WIN64_FALSE@ !define INSTALL_ACTIVEX
24 !define INSTALL_MOZILLA
25
26 ;;;;;;;;;;;;;;;;;;;;;;;;;
27 ; General configuration ;
28 ;;;;;;;;;;;;;;;;;;;;;;;;;
29
30 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
31 @HAVE_WIN64_FALSE@ OutFile ..\vlc-${VERSION}-win32.exe
32 @HAVE_WIN64_TRUE@  OutFile ..\vlc-${VERSION}-win64.exe
33 InstallDir "$@PROGRAMFILES@\VideoLAN\VLC"
34 !ifdef NSIS_LZMA_COMPRESS_WHOLE
35 SetCompressor lzma
36 !else
37 SetCompressor /SOLID lzma
38 !endif
39
40 SetOverwrite ifnewer
41 CRCCheck on
42 BrandingText "${PRODUCT_GROUP} ${PRODUCT_NAME}"
43
44 InstType $Name_InstTypeRecommended
45 InstType $Name_InstTypeMinimum
46 InstType $Name_InstTypeFull
47
48 RequestExecutionLevel user
49 !addincludedir NSIS
50 !addplugindir NSIS
51 !include UAC.nsh
52
53 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
54 ; NSIS Modern User Interface configuration ;
55 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56
57 ; MUI 1.67 compatible ------
58   !include "MUI.nsh"
59
60 ; MUI Settings
61   !define MUI_ABORTWARNING
62   !define MUI_ICON "vlc.ico"
63   !define MUI_UNICON "vlc.ico"
64   !define MUI_COMPONENTSPAGE_SMALLDESC
65
66 ; Installer pages
67   ; Welcome page
68     !define MUI_WELCOMEPAGE_TITLE_3LINES
69     !insertmacro MUI_PAGE_WELCOME
70   ; License page
71     !define MUI_LICENSEPAGE_BUTTON $(^NextBtn)
72     !define MUI_LICENSEPAGE_TEXT_BOTTOM $License_NextText
73     !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
74   ; Components page
75     !insertmacro MUI_PAGE_COMPONENTS
76   ; Directory page
77     !insertmacro MUI_PAGE_DIRECTORY
78   ; Instfiles page
79     !insertmacro MUI_PAGE_INSTFILES
80   ; Finish page
81
82     Function ExecAppFile
83       Exec '$INSTDIR\vlc.exe'
84     FunctionEnd
85
86     Function AppRunAs
87       !insertmacro UAC.CallFunctionAsUser ExecAppFile
88     FunctionEnd
89
90     !define MUI_FINISHPAGE_RUN
91     !define MUI_FINISHPAGE_RUN_FUNCTION AppRunAs
92     !define MUI_FINISHPAGE_LINK $Link_VisitWebsite
93     !define MUI_FINISHPAGE_LINK_LOCATION "http://www.videolan.org/vlc/"
94     !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
95     !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
96     !define MUI_FINISHPAGE_NOREBOOTSUPPORT
97     !insertmacro MUI_PAGE_FINISH
98
99 ; Uninstaller pages
100     !insertmacro MUI_UNPAGE_CONFIRM
101     !insertmacro MUI_UNPAGE_COMPONENTS
102     !insertmacro MUI_UNPAGE_INSTFILES
103     !insertmacro MUI_UNPAGE_FINISH
104
105 ; Language files
106   !insertmacro MUI_LANGUAGE "English" # first language is the default language
107   !insertmacro MUI_LANGUAGE "French"
108   !insertmacro MUI_LANGUAGE "German"
109   !insertmacro MUI_LANGUAGE "Spanish"
110   !insertmacro MUI_LANGUAGE "SimpChinese"
111   !insertmacro MUI_LANGUAGE "TradChinese"
112   !insertmacro MUI_LANGUAGE "Japanese"
113   !insertmacro MUI_LANGUAGE "Korean"
114   !insertmacro MUI_LANGUAGE "Italian"
115   !insertmacro MUI_LANGUAGE "Dutch"
116   !insertmacro MUI_LANGUAGE "Danish"
117   !insertmacro MUI_LANGUAGE "Swedish"
118   !insertmacro MUI_LANGUAGE "Norwegian"
119   !insertmacro MUI_LANGUAGE "Finnish"
120   !insertmacro MUI_LANGUAGE "Greek"
121   !insertmacro MUI_LANGUAGE "Russian"
122   !insertmacro MUI_LANGUAGE "Portuguese"
123   !insertmacro MUI_LANGUAGE "PortugueseBR"
124   !insertmacro MUI_LANGUAGE "Arabic"
125   !insertmacro MUI_LANGUAGE "Polish"
126   !insertmacro MUI_LANGUAGE "Romanian"
127   !insertmacro MUI_LANGUAGE "Slovak"
128   !insertmacro MUI_LANGUAGE "Serbian"
129   !insertmacro MUI_LANGUAGE "Czech"
130   !insertmacro MUI_LANGUAGE "Hungarian"
131   !insertmacro MUI_LANGUAGE "Catalan"
132   !insertmacro MUI_LANGUAGE "Bulgarian"
133   !insertmacro MUI_LANGUAGE "Estonian"
134   !insertmacro MUI_LANGUAGE "Lithuanian"
135   !insertmacro MUI_LANGUAGE "Basque"
136
137 ; Reserve files for solid compression
138   !insertmacro MUI_RESERVEFILE_LANGDLL
139   !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
140
141 ; MUI end ------
142
143 ;;;;;;;;;;;;;;;;;;;;;;;
144 ; Macro and Functions ;
145 ;;;;;;;;;;;;;;;;;;;;;;;
146
147 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
148 ; 1. File type associations ;
149 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
150
151 ;; Function that registers one extension for VLC
152 Function RegisterExtension
153   ; back up old value for extension $R0 (eg. ".opt")
154   ReadRegStr $1 HKCR "$R0" ""
155   StrCmp $1 "" NoBackup
156     StrCmp $1 "VLC$R0" "NoBackup"
157     WriteRegStr HKCR "$R0" "VLC.backup" $1
158 NoBackup:
159   WriteRegStr HKCR "$R0" "" "VLC$R0"
160   ReadRegStr $0 HKCR "VLC$R0" ""
161   WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
162   WriteRegStr HKCR "VLC$R0\shell" "" "Open"
163   WriteRegStr HKCR "VLC$R0\shell\Open" "" $ShellAssociation_Play
164   WriteRegStr HKCR "VLC$R0\shell\Open" "MultiSelectModel" "Player"
165   WriteRegStr HKCR "VLC$R0\shell\Open\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
166   WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
167
168 ;;; Vista Only part
169   ; Vista and above detection
170   ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
171   StrCpy $R2 $R1 1
172   StrCmp $R2 '6' ForVista ToEnd
173 ForVista:
174   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
175
176 ToEnd:
177 FunctionEnd
178
179 ;; Function that registers one skin extension for VLC
180 Function RegisterSkinExtension
181   ; back up old value for extension $R0 (eg. ".opt")
182   ReadRegStr $1 HKCR "$R0" ""
183   StrCmp $1 "" NoBackup
184     StrCmp $1 "VLC$R0" "NoBackup"
185     WriteRegStr HKCR "$R0" "VLC.backup" $1
186 NoBackup:
187   WriteRegStr HKCR "$R0" "" "VLC$R0"
188   ReadRegStr $0 HKCR "VLC$R0" ""
189   WriteRegStr HKCR "VLC$R0" "" "VLC skin file ($R0)"
190   WriteRegStr HKCR "VLC$R0\shell" "" "Open"
191   WriteRegStr HKCR "VLC$R0\shell\Open" "" ""
192   WriteRegStr HKCR "VLC$R0\shell\Open\command" "" '"$INSTDIR\vlc.exe" -Iskins --skins2-last "%1"'
193   WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
194
195 ;;; Vista Only part
196   ; Vista and above detection
197   ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
198   StrCpy $R2 $R1 1
199   StrCmp $R2 '6' ForVista ToEnd
200 ForVista:
201   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
202
203 ToEnd:
204 FunctionEnd
205
206 ;; Function that removes one extension that VLC owns.
207 Function un.RegisterExtension
208   ;start of restore script
209   ReadRegStr $1 HKCR "$R0" ""
210   StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
211     ; Read the old value from Backup
212     ReadRegStr $1 HKCR "$R0" "VLC.backup"
213     StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
214       DeleteRegKey HKCR "$R0"
215     Goto NoOwn
216 Restore:
217       WriteRegStr HKCR "$R0" "" $1
218       DeleteRegValue HKCR "$R0" "VLC.backup"
219 NoOwn:
220     DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
221     DeleteRegKey HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations\VLC$R0" ; for vista
222 FunctionEnd
223
224 !macro RegisterExtensionSection EXT
225   Section ${EXT}
226     SectionIn 1 3
227     Push $R0
228     StrCpy $R0 ${EXT}
229     Call RegisterExtension
230     Pop $R0
231   SectionEnd
232 !macroend
233
234 !macro RegisterSkinExtensionSection EXT
235   Section /o ${EXT}
236     SectionIn 1 3
237     Push $R0
238     StrCpy $R0 ${EXT}
239     Call RegisterSkinExtension
240     Pop $R0
241   SectionEnd
242 !macroend
243
244 !macro UnRegisterExtensionSection EXT
245   Push $R0
246   StrCpy $R0 ${EXT}
247   Call un.RegisterExtension
248   Pop $R0
249 !macroend
250
251 !macro WriteRegStrSupportedTypes EXT
252   WriteRegStr HKCR Applications\vlc.exe\SupportedTypes ${EXT} ""
253 !macroend
254
255 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
256 ; Extension lists  Macros                    ;
257 ; Those macros calls the previous functions  ;
258 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
259
260 !macro MacroAudioExtensions _action
261   !insertmacro ${_action} ".a52"
262   !insertmacro ${_action} ".aac"
263   !insertmacro ${_action} ".ac3"
264   !insertmacro ${_action} ".adt"
265   !insertmacro ${_action} ".adts"
266   !insertmacro ${_action} ".aif"
267   !insertmacro ${_action} ".aifc"
268   !insertmacro ${_action} ".aiff"
269   !insertmacro ${_action} ".au"
270   !insertmacro ${_action} ".amr"
271   !insertmacro ${_action} ".aob"
272   !insertmacro ${_action} ".ape"
273   !insertmacro ${_action} ".caf"
274   !insertmacro ${_action} ".cda"
275   !insertmacro ${_action} ".dts"
276   !insertmacro ${_action} ".flac"
277   !insertmacro ${_action} ".it"
278   !insertmacro ${_action} ".m4a"
279   !insertmacro ${_action} ".m4p"
280   !insertmacro ${_action} ".mid"
281   !insertmacro ${_action} ".mka"
282   !insertmacro ${_action} ".mlp"
283   !insertmacro ${_action} ".mod"
284   !insertmacro ${_action} ".mp1"
285   !insertmacro ${_action} ".mp2"
286   !insertmacro ${_action} ".mp3"
287   !insertmacro ${_action} ".mpc"
288   !insertmacro ${_action} ".oma"
289   !insertmacro ${_action} ".oga"
290   !insertmacro ${_action} ".rmi"
291   !insertmacro ${_action} ".snd"
292   !insertmacro ${_action} ".s3m"
293   !insertmacro ${_action} ".spx"
294   !insertmacro ${_action} ".tta"
295   !insertmacro ${_action} ".voc"
296   !insertmacro ${_action} ".vqf"
297   !insertmacro ${_action} ".w64"
298   !insertmacro ${_action} ".wav"
299   !insertmacro ${_action} ".wma"
300   !insertmacro ${_action} ".wv"
301   !insertmacro ${_action} ".xa"
302   !insertmacro ${_action} ".xm"
303 !macroend
304
305 !macro MacroVideoExtensions _action
306   !insertmacro ${_action} ".3g2"
307   !insertmacro ${_action} ".3gp"
308   !insertmacro ${_action} ".3gp2"
309   !insertmacro ${_action} ".3gpp"
310   !insertmacro ${_action} ".amv"
311   !insertmacro ${_action} ".asf"
312   !insertmacro ${_action} ".avi"
313   !insertmacro ${_action} ".divx"
314   !insertmacro ${_action} ".dv"
315   !insertmacro ${_action} ".f4v"
316   !insertmacro ${_action} ".flv"
317   !insertmacro ${_action} ".gxf"
318   !insertmacro ${_action} ".m1v"
319   !insertmacro ${_action} ".m2t"
320   !insertmacro ${_action} ".m2v"
321   !insertmacro ${_action} ".m2ts"
322   !insertmacro ${_action} ".m4v"
323   !insertmacro ${_action} ".mkv"
324   !insertmacro ${_action} ".mov"
325   !insertmacro ${_action} ".mp2"
326   !insertmacro ${_action} ".mp2v"
327   !insertmacro ${_action} ".mp4"
328   !insertmacro ${_action} ".mp4v"
329   !insertmacro ${_action} ".mpa"
330   !insertmacro ${_action} ".mpe"
331   !insertmacro ${_action} ".mpeg"
332   !insertmacro ${_action} ".mpeg1"
333   !insertmacro ${_action} ".mpeg2"
334   !insertmacro ${_action} ".mpeg4"
335   !insertmacro ${_action} ".mpg"
336   !insertmacro ${_action} ".mpv2"
337   !insertmacro ${_action} ".mts"
338   !insertmacro ${_action} ".mtv"
339   !insertmacro ${_action} ".mxf"
340   !insertmacro ${_action} ".nsv"
341   !insertmacro ${_action} ".nuv"
342   !insertmacro ${_action} ".ogg"
343   !insertmacro ${_action} ".ogm"
344   !insertmacro ${_action} ".ogx"
345   !insertmacro ${_action} ".ogv"
346   !insertmacro ${_action} ".rec"
347   !insertmacro ${_action} ".rm"
348   !insertmacro ${_action} ".rmvb"
349   !insertmacro ${_action} ".tod"
350   !insertmacro ${_action} ".ts"
351   !insertmacro ${_action} ".tts"
352   !insertmacro ${_action} ".vob"
353   !insertmacro ${_action} ".vro"
354   !insertmacro ${_action} ".webm"
355   !insertmacro ${_action} ".wmv"
356 !macroend
357
358 !macro MacroOtherExtensions _action
359   !insertmacro ${_action} ".asx"
360   !insertmacro ${_action} ".b4s"
361   !insertmacro ${_action} ".bin"
362   !insertmacro ${_action} ".cue"
363   !insertmacro ${_action} ".ifo"
364   !insertmacro ${_action} ".m3u"
365   !insertmacro ${_action} ".m3u8"
366   !insertmacro ${_action} ".pls"
367   !insertmacro ${_action} ".ram"
368   !insertmacro ${_action} ".sdp"
369   !insertmacro ${_action} ".vlc"
370   !insertmacro ${_action} ".xspf"
371 !macroend
372
373 !macro MacroSkinExtensions _action
374   !insertmacro ${_action} ".vlt"
375   !insertmacro ${_action} ".wsz"
376 !macroend
377
378 ; One macro to rule them all
379 !macro MacroAllExtensions _action
380   !insertmacro MacroAudioExtensions ${_action}
381   !insertmacro MacroVideoExtensions ${_action}
382   !insertmacro MacroOtherExtensions ${_action}
383 !macroend
384
385 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
386 ; 2. Context menu entries ;
387 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
388
389 ; Generic function for adding the context menu for one ext.
390 !macro AddContextMenuExt EXT
391   WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" $ContextMenuEntry_PlayWith
392   WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '"$INSTDIR\vlc.exe" --started-from-file --no-playlist-enqueue "%1"'
393
394   WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" $ContextMenuEntry_AddToPlaylist
395   WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '"$INSTDIR\vlc.exe" --started-from-file --playlist-enqueue "%1"'
396 !macroend
397
398 !macro AddContextMenu EXT
399   Push $R0
400   ReadRegStr $R0 HKCR ${EXT} ""
401   !insertmacro AddContextMenuExt $R0
402   Pop $R0
403 !macroend
404
405 !macro DeleteContextMenuExt EXT
406   DeleteRegKey HKCR ${EXT}\shell\PlayWithVLC
407   DeleteRegKey HKCR ${EXT}\shell\AddToPlaylistVLC
408 !macroend
409
410 !macro DeleteContextMenu EXT
411   Push $R0
412   ReadRegStr $R0 HKCR ${EXT} ""
413   !insertmacro DeleteContextMenuExt $R0
414   Pop $R0
415 !macroend
416
417 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
418 ; 3. Delete prefs           ;
419 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
420
421 !macro delprefs
422   StrCpy $0 0
423   !define Index 'Line${__LINE__}'
424   "${Index}-Loop:"
425   ; FIXME
426   ; this will loop through all the logged users and "virtual" windows users
427   ; (it looks like users are only present in HKEY_USERS when they are logged in)
428     ClearErrors
429     EnumRegKey $1 HKU "" $0
430     StrCmp $1 "" "${Index}-End"
431     IntOp $0 $0 + 1
432     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
433     StrCmp $2 "" "${Index}-Loop"
434     RMDir /r "$2\vlc"
435     Goto "${Index}-Loop"
436   "${Index}-End:"
437   !undef Index
438 !macroend
439
440 ;;;;;;;;;;;;;;;
441 ; 4. Logging  ;
442 ;;;;;;;;;;;;;;;
443 Var UninstallLog
444 !macro OpenUninstallLog
445   FileOpen $UninstallLog "$INSTDIR\uninstall.log" a
446   FileSeek $UninstallLog 0 END
447 !macroend
448
449 !macro CloseUninstallLog
450   FileClose $UninstallLog
451   SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
452 !macroend
453
454 ;;;;;;;;;;;;;;;;;;;;
455 ; 5. Installations ;
456 ;;;;;;;;;;;;;;;;;;;;
457 !macro InstallFile FILEREGEX
458   File "${FILEREGEX}"
459   !define Index 'Line${__LINE__}'
460   FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
461   StrCmp $0 "" "${Index}-End"
462   "${Index}-Loop:"
463     StrCmp $1 "" "${Index}-End"
464     FileWrite $UninstallLog "$1$\r$\n"
465     FindNext $0 $1
466     Goto "${Index}-Loop"
467   "${Index}-End:"
468   !undef Index
469 !macroend
470
471 !macro InstallFolder FOLDER
472   File /r "${FOLDER}"
473   Push "${FOLDER}"
474   Call InstallFolderInternal
475 !macroend
476
477 Function InstallFolderInternal
478   Pop $9
479   !define Index 'Line${__LINE__}'
480   FindFirst $0 $1 "$INSTDIR\$9\*"
481   StrCmp $0 "" "${Index}-End"
482   "${Index}-Loop:"
483     StrCmp $1 "" "${Index}-End"
484     StrCmp $1 "." "${Index}-Next"
485     StrCmp $1 ".." "${Index}-Next"
486     IfFileExists "$9\$1\*" 0 "${Index}-Write"
487       Push $0
488       Push $9
489       Push "$9\$1"
490       Call InstallFolderInternal
491       Pop $9
492       Pop $0
493       Goto "${Index}-Next"
494     "${Index}-Write:"
495     FileWrite $UninstallLog "$9\$1$\r$\n"
496     "${Index}-Next:"
497     FindNext $0 $1
498     Goto "${Index}-Loop"
499   "${Index}-End:"
500   !undef Index
501 FunctionEnd
502 ;;; End of Macros
503
504
505 ;;;;;;;;;;;;;;;;;;;;;;
506 ; Installer sections ;
507 ; The CORE of the    ;
508 ; installer          ;
509 ;;;;;;;;;;;;;;;;;;;;;;
510
511 Section $Name_Section01 SEC01
512   SectionIn 1 2 3 RO
513   SetShellVarContext all
514   SetOutPath "$INSTDIR"
515
516   !insertmacro OpenUninstallLog
517
518   ; VLC.exe, libvlc.dll
519   !insertmacro InstallFile vlc.exe
520   !insertmacro InstallFile vlc.exe.manifest
521   !insertmacro InstallFile vlc-cache-gen.exe
522
523   ; All dlls
524   !insertmacro InstallFile *.dll
525
526   ; Text files
527   !insertmacro InstallFile *.txt
528
529   ; Subfolders
530   !insertmacro InstallFolder plugins
531   !insertmacro InstallFolder locale
532   !insertmacro InstallFolder sdk
533 @BUILD_OSDMENU_TRUE@ !insertmacro InstallFolder osdmenu
534 @BUILD_SKINS_TRUE@   !insertmacro InstallFolder skins
535 @BUILD_LUA_TRUE@     !insertmacro InstallFolder lua
536
537   ; Generate the cache and add it to uninstall.log
538   ExecWait "$INSTDIR\vlc-cache-gen.exe $INSTDIR\plugins"
539   FindFirst $0 $1 "$INSTDIR\plugins\*.dat"
540   FileWrite $UninstallLog "plugins\$1$\r$\n"
541   FindClose $0
542
543
544
545   ; URLs
546   WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
547     "${PRODUCT_WEB_SITE}"
548   FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
549   WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
550     "${PRODUCT_WEB_SITE}/doc/"
551   FileWrite $UninstallLog "Documentation.url$\r$\n"
552   WriteIniStr "$INSTDIR\New_Skins.url" "InternetShortcut" "URL" \
553     "${PRODUCT_WEB_SITE}/vlc/skins.php"
554   FileWrite $UninstallLog "New_Skins.url$\r$\n"
555
556   !insertmacro CloseUninstallLog
557
558   ; Add VLC to "recommended programs" for the following extensions
559   WriteRegStr HKCR Applications\vlc.exe "" ""
560   WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
561   WriteRegStr HKCR Applications\vlc.exe\shell\Open "" $ContextMenuEntry_PlayWith
562   WriteRegStr HKCR Applications\vlc.exe\shell\Open\command "" \
563     '"$INSTDIR\vlc.exe" --started-from-file "%1"'
564   !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
565
566 ; Windows default programs Registration
567   ; Vista and above detection
568   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
569   StrCpy $R1 $R0 1
570   StrCmp $R1 '6' lbl_vista lbl_done
571
572   lbl_vista:
573   WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
574   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
575   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
576   WriteRegStr HKLM "Software\Clients\Media\VLC" "" "VLC media player"
577   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "HideIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /HideIcons /S"
578   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ShowIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /ShowIcons /S"
579   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ReinstallCommand" "$\"$INSTDIR\spad-setup.exe$\" /Reinstall /S"
580   WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 0x001
581
582   lbl_done:
583 SectionEnd
584
585 Section $Name_Section02a SEC02a
586   SectionIn 1 2 3
587   CreateDirectory "$SMPROGRAMS\VideoLAN"
588   CreateShortCut "$SMPROGRAMS\VideoLAN\Reset VLC media player preferences and cache files.lnk" \
589     "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache vlc://quit"
590   CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
591     "$INSTDIR\vlc.exe" ""
592   CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player skinned.lnk" \
593     "$INSTDIR\vlc.exe" "-Iskins"
594   CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
595     "$INSTDIR\Documentation.url"
596   CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
597     "$INSTDIR\NEWS.txt" ""
598   CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
599     "$INSTDIR\${PRODUCT_GROUP} Website.url"
600 SectionEnd
601
602 Section $Name_Section02b SEC02b
603   SectionIn 1 2 3
604   CreateShortCut "$DESKTOP\VLC media player.lnk" \
605     "$INSTDIR\vlc.exe" ""
606 SectionEnd
607
608 !ifdef INSTALL_MOZILLA
609 Section $Name_Section03 SEC03
610   SectionIn 3
611
612   SetOutPath "$INSTDIR"
613   !insertmacro OpenUninstallLog
614   !insertmacro InstallFile npvlc.dll
615   !insertmacro InstallFile npvlc.dll.manifest
616   !insertmacro CloseUninstallLog
617
618   !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
619   WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
620   WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
621   WriteRegStr HKLM ${Moz} "Product" "VLC media player"
622   WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
623   WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
624 SectionEnd
625 !endif
626
627 !ifdef INSTALL_ACTIVEX
628 Section $Name_Section04 SEC04
629   SectionIn 3
630
631   SetOutPath "$INSTDIR"
632   !insertmacro OpenUninstallLog
633   !insertmacro InstallFile axvlc.dll
634   !insertmacro InstallFile axvlc.dll.manifest
635   !insertmacro CloseUninstallLog
636   RegDLL "$INSTDIR\axvlc.dll"
637 SectionEnd
638 !endif
639
640
641 Section $Name_Section05 SEC05
642   SectionIn 1 2 3
643   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
644   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
645     '"$INSTDIR\vlc.exe" --started-from-file cdda:///%1'
646   WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
647   WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
648     '"$INSTDIR\vlc.exe" --started-from-file dvd:///%1'
649
650   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
651   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" $Action_OnArrivalDVD
652   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
653   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
654   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "Open"
655   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
656
657   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
658   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" $Action_OnArrivalAudioCD
659   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
660   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
661   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "Open"
662   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
663
664   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoCDMovieOnArrival" "VLCPlayVCDMovieOnArrival" ""
665   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "Action" $Action_OnArrivalVCDMovie
666   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
667   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "InvokeProgID" "VLC.VCDMovie"
668   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "InvokeVerb" "Open"
669   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "Provider" "VideoLAN VLC media player"
670
671   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlaySuperVideoCDMovieOnArrival" "VLCPlaySVCDMovieOnArrival" ""
672   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "Action" $Action_OnArrivalSVCDMovie
673   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
674   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "InvokeProgID" "VLC.SVCDMovie"
675   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "InvokeVerb" "Open"
676   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "Provider" "VideoLAN VLC media player"
677
678   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDAudioOnArrival" "VLCPlayDVDAudioOnArrival" ""
679   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "Action" $Action_OnArrivalDVDAudio
680   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
681   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "InvokeProgID" "VLC.OPENFolder"
682   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "InvokeVerb" "Open"
683   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "Provider" "VideoLAN VLC media player"
684
685   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoFilesOnArrival" "VLCPlayVideoFilesOnArrival" ""
686   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "Action" $Action_OnArrivalVideoFiles
687   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
688   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "InvokeProgID" "VLC.OPENFolder"
689   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "InvokeVerb" "Open"
690   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "Provider" "VideoLAN VLC media player"
691
692   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayMusicFilesOnArrival" "VLCPlayMusicFilesOnArrival" ""
693   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "Action" $Action_OnArrivalMusicFiles
694   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
695   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "InvokeProgID" "VLC.OPENFolder"
696   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "InvokeVerb" "Open"
697   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "Provider" "VideoLAN VLC media player"
698
699   WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
700   WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Open"
701   WriteRegStr HKCR "VLC.DVDMovie\shell\Open\command" "" \
702     '"$INSTDIR\vlc.exe" --started-from-file dvd:///%1'
703   WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
704
705   WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
706   WriteRegStr HKCR "VLC.CDAudio\shell" "" "Open"
707   WriteRegStr HKCR "VLC.CDAudio\shell\Open\command" "" \
708     '"$INSTDIR\vlc.exe" --started-from-file cdda:///%1'
709   WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
710
711   WriteRegStr HKCR "VLC.VCDMovie" "" "VLC VCD Movie"
712   WriteRegStr HKCR "VLC.VCDMovie\shell" "" "Open"
713   WriteRegStr HKCR "VLC.VCDMovie\shell\Open\command" "" \
714      '"$INSTDIR\vlc.exe" --started-from-file vcd:///%1'
715   WriteRegStr HKCR "VLC.VCDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
716
717   WriteRegStr HKCR "VLC.SVCDMovie" "" "VLC SVCD Movie"
718   WriteRegStr HKCR "VLC.SVCDMovie\shell" "" "Open"
719   WriteRegStr HKCR "VLC.SVCDMovie\shell\Open\command" "" \
720      '"$INSTDIR\vlc.exe" --started-from-file vcd:///%1'
721   WriteRegStr HKCR "VLC.SVCDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
722
723   WriteRegStr HKCR "VLC.OPENFolder" "" "VLC Play content"
724   WriteRegStr HKCR "VLC.OPENFolder\shell" "" "Open"
725   WriteRegStr HKCR "VLC.OPENFolder\shell\Open\command" "" \
726      '"$INSTDIR\vlc.exe" %1'
727   WriteRegStr HKCR "VLC.OPENFolder\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
728
729 SectionEnd
730
731
732 SectionGroup /e !$Name_Section06 SEC06
733   SectionGroup $Name_SectionGroupAudio
734     !insertmacro MacroAudioExtensions RegisterExtensionSection
735   SectionGroupEnd
736   SectionGroup $Name_SectionGroupVideo
737     !insertmacro MacroVideoExtensions RegisterExtensionSection
738   SectionGroupEnd
739   SectionGroup $Name_SectionGroupOther
740     !insertmacro MacroOtherExtensions RegisterExtensionSection
741     !insertmacro MacroSkinExtensions RegisterSkinExtensionSection
742   SectionGroupEnd
743 SectionGroupEnd
744
745 Section $Name_Section07 SEC07
746   SectionIn 1 3
747   !insertmacro MacroAllExtensions AddContextMenu
748   !insertmacro AddContextMenuExt "Directory"
749 SectionEnd
750
751 Section /o $Name_Section08 SEC08
752   !insertmacro delprefs
753 SectionEnd
754
755 ; Installer section descriptions
756 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
757   !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $Desc_Section01
758   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} $Desc_Section02a
759   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} $Desc_Section02b
760 !ifdef INSTALL_MOZILLA
761   !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $Desc_Section03
762 !endif
763 !ifdef INSTALL_ACTIVEX
764   !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $Desc_Section04
765 !endif
766   !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $Desc_Section05
767   !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $Desc_Section06
768   !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $Desc_Section07
769   !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} $Desc_Section08
770 !insertmacro MUI_FUNCTION_DESCRIPTION_END
771
772 ;;; Start function
773 Function .onInit
774
775 @HAVE_WIN64_TRUE@ SetRegView 64
776 ReadRegStr $INSTDIR HKLM "${PRODUCT_DIR_REGKEY}" ""
777 StrCmp $INSTDIR "" 0 +1
778 StrCpy $INSTDIR "$@PROGRAMFILES@\VideoLAN\VLC"
779
780 UAC_Elevate:
781     UAC::RunElevated
782     StrCmp 1223 $0 UAC_ElevationAborted
783     StrCmp 0 $0 0 UAC_Err
784     StrCmp 1 $1 0 UAC_Success
785     Quit
786
787 UAC_Err:
788     MessageBox mb_iconstop "Unable to elevate, error $0"
789     Abort
790
791 UAC_ElevationAborted:
792     MessageBox mb_iconstop "This installer requires admin access, aborting!"
793     Abort
794
795 UAC_Success:
796     StrCmp 1 $3 +4
797     StrCmp 3 $1 0 UAC_ElevationAborted
798     MessageBox mb_iconstop "This installer requires admin access, try again"
799     goto UAC_Elevate
800   !insertmacro MUI_LANGDLL_DISPLAY
801
802   !include "languages\english.nsh"
803   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
804   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
805   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
806   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
807   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
808   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
809   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
810   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
811   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
812   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
813   StrCmp $LANGUAGE ${LANG_DANISH} Danish 0
814   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
815   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
816   StrCmp $LANGUAGE ${LANG_JAPANESE} Japanese 0
817 ;  StrCmp $LANGUAGE ${LANG_BENGALI} Bengali 0
818 ;  StrCmp $LANGUAGE ${LANG_PUNJABI} Punjabi 0
819 ;  StrCmp $LANGUAGE ${LANG_SLOVENIAN} Slovenian 0
820   StrCmp $LANGUAGE ${LANG_SPANISH} Spanish 0
821   StrCmp $LANGUAGE ${LANG_ESTONIAN} Estonian 0
822   StrCmp $LANGUAGE ${LANG_LITHUANIAN} Lithuanian 0
823   StrCmp $LANGUAGE ${LANG_BASQUE} Basque 0
824   StrCmp $LANGUAGE ${LANG_SERBIAN} Serbian 0
825   StrCmp $LANGUAGE ${LANG_RUSSIAN} Russian 0
826   StrCmp $LANGUAGE ${LANG_HEBREW} Hebrew 0
827   StrCmp $LANGUAGE ${LANG_GALICIAN} Galician 0
828   StrCmp $LANGUAGE ${LANG_SWEDISH} Swedish 0
829   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
830   French:
831   !include "languages\french.nsh"
832   Goto EndLanguageCmp
833   German:
834   !include "languages\german.nsh"
835   Goto EndLanguageCmp
836   Italian:
837   !include "languages\italian.nsh"
838   Goto EndLanguageCmp
839   Hungarian:
840   !include "languages\hungarian.nsh"
841   Goto EndLanguageCmp
842   Romanian:
843   !include "languages\romanian.nsh"
844   Goto EndLanguageCmp
845   Catalan:
846   !include "languages\catalan.nsh"
847   Goto EndLanguageCmp
848   Bulgarian:
849   !include "languages\bulgarian.nsh"
850   Goto EndLanguageCmp
851   Slovak:
852   !include "languages\slovak.nsh"
853   Goto EndLanguageCmp
854   Polish:
855   !include "languages\polish.nsh"
856   Goto EndLanguageCmp
857   Dutch:
858   !include "languages\dutch.nsh"
859   Goto EndLanguageCmp
860   Danish:
861   !include "languages\danish.nsh"
862   Goto EndLanguageCmp
863   Schinese:
864   !include "languages\schinese.nsh"
865   Goto EndLanguageCmp
866   Finnish:
867   !include "languages\finnish.nsh"
868   Goto EndLanguageCmp
869   Japanese:
870   !include "languages\japanese.nsh"
871   Goto EndLanguageCmp
872   Bengali:
873   !include "languages\bengali.nsh"
874   Goto EndLanguageCmp
875   Punjabi:
876   !include "languages\punjabi.nsh"
877   Goto EndLanguageCmp
878   Slovenian:
879   !include "languages\slovenian.nsh"
880   Goto EndLanguageCmp
881   Spanish:
882   !include "languages\spanish.nsh"
883   Goto EndLanguageCmp
884   Estonian:
885   !include "languages\estonian.nsh"
886   Goto EndLanguageCmp
887   Lithuanian:
888   !include "languages\lithuanian.nsh"
889   Goto EndLanguageCmp
890   Basque:
891   !include "languages\basque.nsh"
892   Goto EndLanguageCmp
893   Serbian:
894   !include "languages\serbian.nsh"
895   Goto EndLanguageCmp
896   Russian:
897   !include "languages\Russian.nsh"
898   Goto EndLanguageCmp
899   Hebrew:
900   !include "languages\hebrew.nsh"
901   Goto EndLanguageCmp
902   Galician:
903   !include "languages\galician.nsh"
904   Goto EndLanguageCmp
905   Swedish:
906   !include "languages\swedish.nsh"
907   Goto EndLanguageCmp
908   Brazilian:
909   !include "languages\brazilian_portuguese.nsh"
910   EndLanguageCmp:
911
912   ReadRegStr $R0  ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
913   "UninstallString"
914   StrCmp $R0 "" done
915
916   MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled /SD IDNO IDNO done
917
918   ;Run the uninstaller
919   ;uninst:
920     ClearErrors
921     ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
922   done:
923
924 FunctionEnd
925
926 Function .OnInstFailed
927     UAC::Unload
928 FunctionEnd
929
930 Function .OnInstSuccess
931     UAC::Unload
932 FunctionEnd
933
934 ;; End function
935 Section -Post
936   WriteUninstaller "$INSTDIR\uninstall.exe"
937   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
938   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
939   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
940
941   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
942     "DisplayName" "$(^Name)"
943   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
944     "UninstallString" "$INSTDIR\uninstall.exe"
945   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
946     "InstallLocation" "$INSTDIR"
947   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
948     "DisplayIcon" "$INSTDIR\vlc.exe"
949   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
950     "DisplayVersion" "${PRODUCT_VERSION}"
951   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
952     "URLInfoAbout" "${PRODUCT_WEB_SITE}"
953   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
954     "Publisher" "${PRODUCT_PUBLISHER}"
955   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
956     "VersionMajor"  "@VERSION_MAJOR@"
957   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
958     "VersionMinor" "@VERSION_MINOR@"
959 SectionEnd
960
961 ;;;;;;;;;;;;;;;;;;;;;;;;
962 ; Uninstaller sections ;
963 ;;;;;;;;;;;;;;;;;;;;;;;;
964
965 ; TrimNewlines (copied from NSIS documentation)
966 ; input, top of stack  (e.g. whatever$\r$\n)
967 ; output, top of stack (replaces, with e.g. whatever)
968 ; modifies no other variables.
969
970 Function un.TrimNewlines
971  Exch $R0
972  Push $R1
973  Push $R2
974  StrCpy $R1 0
975
976  loop:
977    IntOp $R1 $R1 - 1
978    StrCpy $R2 $R0 1 $R1
979    StrCmp $R2 "$\r" loop
980    StrCmp $R2 "$\n" loop
981    IntOp $R1 $R1 + 1
982    IntCmp $R1 0 no_trim_needed
983    StrCpy $R0 $R0 $R1
984
985  no_trim_needed:
986    Pop $R2
987    Pop $R1
988    Exch $R0
989 FunctionEnd
990
991 Function un.RemoveEmptyDirs
992   Pop $9
993   !define Index 'Line${__LINE__}'
994   FindFirst $0 $1 "$INSTDIR$9*"
995   StrCmp $0 "" "${Index}-End"
996   "${Index}-Loop:"
997     StrCmp $1 "" "${Index}-End"
998     StrCmp $1 "." "${Index}-Next"
999     StrCmp $1 ".." "${Index}-Next"
1000       Push $0
1001       Push $1
1002       Push $9
1003       Push "$9$1\"
1004       Call un.RemoveEmptyDirs
1005       Pop $9
1006       Pop $1
1007       Pop $0
1008     "${Index}-Remove:"
1009     RMDir "$INSTDIR$9$1"
1010     "${Index}-Next:"
1011     FindNext $0 $1
1012     Goto "${Index}-Loop"
1013   "${Index}-End:"
1014   FindClose $0
1015   !undef Index
1016 FunctionEnd
1017
1018 Section "un.$Name_Section91" SEC91
1019   SectionIn 1 2 3 RO
1020   SetShellVarContext all
1021
1022   !insertmacro MacroAllExtensions DeleteContextMenu
1023   !insertmacro MacroAllExtensions UnRegisterExtensionSection
1024   !insertmacro MacroSkinExtensions UnRegisterExtensionSection
1025   !insertmacro DeleteContextMenuExt "Directory"
1026
1027   ;remove activex plugin
1028   UnRegDLL "$INSTDIR\axvlc.dll"
1029   Delete /REBOOTOK "$INSTDIR\axvlc.dll"
1030   Delete /REBOOTOK "$INSTDIR\axvlc.dll.manifest"
1031
1032   ;remove mozilla plugin
1033   Push $R0
1034   Push $R1
1035   Push $R2
1036
1037   !define Index 'Line${__LINE__}'
1038   StrCpy $R1 "0"
1039
1040   "${Index}-Loop:"
1041
1042     ; Check for Key
1043     EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
1044     StrCmp $R0 "" "${Index}-End"
1045     IntOp $R1 $R1 + 1
1046     ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
1047     StrCmp $R2 "" "${Index}-Loop" ""
1048
1049     ; old files (0.8.5 and before) that may be lying around
1050     Delete /REBOOTOK "$R2\npvlc.dll"
1051     Delete /REBOOTOK "$R2\libvlc.dll"
1052     Delete /REBOOTOK "$R2\vlcintf.xpt"
1053     Goto "${Index}-Loop"
1054
1055   "${Index}-End:"
1056   !undef Index
1057   Delete /REBOOTOK "$INSTDIR\npvlc.dll"
1058   Delete /REBOOTOK "$INSTDIR\npvlc.dll.manifest"
1059
1060   RMDir "$SMPROGRAMS\VideoLAN"
1061   RMDir /r $SMPROGRAMS\VideoLAN
1062
1063   FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
1064   UninstallLoop:
1065     ClearErrors
1066     FileRead $UninstallLog $R0
1067     IfErrors UninstallEnd
1068     Push $R0
1069     Call un.TrimNewLines
1070     Pop $R0
1071     Delete "$INSTDIR\$R0"
1072     Goto UninstallLoop
1073   UninstallEnd:
1074   FileClose $UninstallLog
1075   Delete "$INSTDIR\uninstall.log"
1076   Delete "$INSTDIR\uninstall.exe"
1077   Push "\"
1078   Call un.RemoveEmptyDirs
1079   RMDir "$INSTDIR"
1080
1081   DeleteRegKey HKLM Software\VideoLAN
1082
1083   DeleteRegKey HKCR Applications\vlc.exe
1084   DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
1085   DeleteRegKey HKCR DVD\shell\PlayWithVLC
1086   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
1087   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
1088   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
1089   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
1090   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoCDMovieOnArrival" "VLCPlayVCDMovieOnArrival"
1091   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival
1092   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlaySuperVideoCDMovieOnArrival" "VLCPlaySVCDMovieOnArrival"
1093   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival
1094   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDAudioOnArrival" "VLCPlayDVDAudioOnArrival"
1095   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival
1096   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoFilesOnArrival" "VLCPlayVideoFilesOnArrival"
1097   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival
1098   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayMusicFilesOnArrival" "VLCPlayMusicFilesOnArrival"
1099   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival
1100
1101   DeleteRegKey HKLM Software\Clients\Media\VLC
1102   DeleteRegValue HKLM "Software\RegisteredApplications" "VLC"
1103   DeleteRegKey HKCR "VLC.MediaFile"
1104   DeleteRegKey HKCR "VLC.DVDMovie"
1105   DeleteRegKey HKCR "VLC.CDAudio"
1106   DeleteRegKey HKCR "VLC.VCDMovie"
1107   DeleteRegKey HKCR "VLC.SVCDMovie"
1108   DeleteRegKey HKCR "VLC.OPENFolder"
1109
1110
1111   DeleteRegKey HKLM \
1112     "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
1113
1114   DeleteRegKey HKLM \
1115     "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
1116
1117   Delete "$DESKTOP\VLC media player.lnk"
1118
1119   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
1120   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
1121   SetAutoClose true
1122 SectionEnd
1123
1124 Section /o "un.$Name_Section92" SEC92
1125   !insertmacro delprefs
1126 SectionEnd
1127
1128 ; Uninstaller section descriptions
1129 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1130   !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} $Desc_Section91
1131   !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} $Desc_Section92
1132 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
1133
1134 Function un.OnUnInstFailed
1135     UAC::Unload
1136 FunctionEnd
1137
1138 Function un.OnUnInstSuccess
1139     UAC::Unload
1140     Delete "$INSTDIR\UAC.dll"
1141 FunctionEnd
1142
1143 Function un.onInit
1144
1145 UAC_Elevate:
1146     UAC::RunElevated
1147     StrCmp 1223 $0 UAC_ElevationAborted
1148     StrCmp 0 $0 0 UAC_Err
1149     StrCmp 1 $1 0 UAC_Success
1150     Quit
1151
1152 UAC_Err:
1153     MessageBox mb_iconstop "Unable to elevate, error $0"
1154     Abort
1155
1156 UAC_ElevationAborted:
1157     MessageBox mb_iconstop "This installer requires admin access, aborting!"
1158     Abort
1159
1160 UAC_Success:
1161     StrCmp 1 $3 +4
1162     StrCmp 3 $1 0 UAC_ElevationAborted
1163     MessageBox mb_iconstop "This installer requires admin access, try again"
1164     goto UAC_Elevate
1165
1166   !insertmacro MUI_UNGETLANGUAGE
1167
1168   !include "languages\english.nsh"
1169   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
1170   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
1171   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
1172   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
1173   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
1174   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
1175   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
1176   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
1177   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
1178   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
1179   StrCmp $LANGUAGE ${LANG_DANISH} Danish 0
1180   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
1181   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
1182   StrCmp $LANGUAGE ${LANG_JAPANESE} Japanese 0
1183 ;  StrCmp $LANGUAGE ${LANG_BENGALI} Bengali 0
1184 ;  StrCmp $LANGUAGE ${LANG_PUNJABI} Punjabi 0
1185 ;  StrCmp $LANGUAGE ${LANG_SLOVENIAN} Slovenian 0
1186   StrCmp $LANGUAGE ${LANG_SPANISH} Spanish 0
1187   StrCmp $LANGUAGE ${LANG_ESTONIAN} Estonian 0
1188   StrCmp $LANGUAGE ${LANG_LITHUANIAN} Lithuanian 0
1189   StrCmp $LANGUAGE ${LANG_BASQUE} Basque 0
1190   StrCmp $LANGUAGE ${LANG_SERBIAN} Serbian 0
1191   StrCmp $LANGUAGE ${LANG_RUSSIAN} Russian 0
1192   StrCmp $LANGUAGE ${LANG_HEBREW} Hebrew 0
1193   StrCmp $LANGUAGE ${LANG_GALICIAN} Galician 0
1194   StrCmp $LANGUAGE ${LANG_SWEDISH} Swedish 0
1195   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
1196   French:
1197   !include "languages\french.nsh"
1198   Goto EndLanguageCmp
1199   German:
1200   !include "languages\german.nsh"
1201   Goto EndLanguageCmp
1202   Italian:
1203   !include "languages\italian.nsh"
1204   Goto EndLanguageCmp
1205   Hungarian:
1206   !include "languages\hungarian.nsh"
1207   Goto EndLanguageCmp
1208   Romanian:
1209   !include "languages\romanian.nsh"
1210   Goto EndLanguageCmp
1211   Catalan:
1212   !include "languages\catalan.nsh"
1213   Goto EndLanguageCmp
1214   Bulgarian:
1215   !include "languages\bulgarian.nsh"
1216   Goto EndLanguageCmp
1217   Slovak:
1218   !include "languages\slovak.nsh"
1219   Goto EndLanguageCmp
1220   Polish:
1221   !include "languages\polish.nsh"
1222   Goto EndLanguageCmp
1223   Dutch:
1224   !include "languages\dutch.nsh"
1225   Goto EndLanguageCmp
1226   Danish:
1227   !include "languages\danish.nsh"
1228   Goto EndLanguageCmp
1229   Schinese:
1230   !include "languages\schinese.nsh"
1231   Goto EndLanguageCmp
1232   Finnish:
1233   !include "languages\finnish.nsh"
1234   Goto EndLanguageCmp
1235   Japanese:
1236   !include "languages\japanese.nsh"
1237   Goto EndLanguageCmp
1238   Bengali:
1239   !include "languages\bengali.nsh"
1240   Goto EndLanguageCmp
1241   Punjabi:
1242   !include "languages\punjabi.nsh"
1243   Goto EndLanguageCmp
1244   Slovenian:
1245   !include "languages\slovenian.nsh"
1246   Goto EndLanguageCmp
1247   Spanish:
1248   !include "languages\spanish.nsh"
1249   Goto EndLanguageCmp
1250   Estonian:
1251   !include "languages\estonian.nsh"
1252   Goto EndLanguageCmp
1253   Lithuanian:
1254   !include "languages\lithuanian.nsh"
1255   Goto EndLanguageCmp
1256   Basque:
1257   !include "languages\basque.nsh"
1258   Goto EndLanguageCmp
1259   Serbian:
1260   !include "languages\serbian.nsh"
1261   Goto EndLanguageCmp
1262   Russian:
1263   !include "languages\russian.nsh"
1264   Goto EndLanguageCmp
1265   Hebrew:
1266   !include "languages\hebrew.nsh"
1267   Goto EndLanguageCmp
1268   Galician:
1269   !include "languages\galician.nsh"
1270   Goto EndLanguageCmp
1271   Swedish:
1272   !include "languages\swedish.nsh"
1273   Goto EndLanguageCmp
1274   Brazilian:
1275   !include "languages\brazilian_portuguese.nsh"
1276   EndLanguageCmp:
1277
1278 FunctionEnd