]> git.sesse.net Git - vlc/blob - extras/package/win32/vlc.win32.nsi.in
Add Basque translation in Win32 installer
[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 @HAVE_WIN64_FALSE@ !define INSTALL_MOZILLA
25
26 @FILE_LIBVLCCORE_DLL@
27 @FILE_LIBVLC_DLL@
28
29 ;;;;;;;;;;;;;;;;;;;;;;;;;
30 ; General configuration ;
31 ;;;;;;;;;;;;;;;;;;;;;;;;;
32
33 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
34 OutFile ..\vlc-${VERSION}-win32.exe
35 InstallDir "$@PROGRAMFILES@\VideoLAN\VLC"
36 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
37 !ifdef NSIS_LZMA_COMPRESS_WHOLE
38 SetCompressor lzma
39 !else
40 SetCompressor /SOLID lzma
41 !endif
42
43 SetOverwrite ifnewer
44 CRCCheck on
45 BrandingText "${PRODUCT_GROUP} ${PRODUCT_NAME}"
46
47 InstType $Name_InstTypeRecommended
48 InstType $Name_InstTypeMinimum
49 InstType $Name_InstTypeFull
50
51 RequestExecutionLevel user
52 !addincludedir NSIS
53 !addplugindir NSIS
54 !include UAC.nsh
55
56 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57 ; NSIS Modern User Interface configuration ;
58 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
59
60 ; MUI 1.67 compatible ------
61   !include "MUI.nsh"
62
63 ; MUI Settings
64   !define MUI_ABORTWARNING
65   !define MUI_ICON "vlc.ico"
66   !define MUI_UNICON "vlc.ico"
67   !define MUI_COMPONENTSPAGE_SMALLDESC
68
69 ; Installer pages
70   ; Welcome page
71     !define MUI_WELCOMEPAGE_TITLE_3LINES
72     !insertmacro MUI_PAGE_WELCOME
73   ; License page
74     !define MUI_LICENSEPAGE_BUTTON $(^NextBtn)
75     !define MUI_LICENSEPAGE_TEXT_BOTTOM $License_NextText
76     !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
77   ; Components page
78     !insertmacro MUI_PAGE_COMPONENTS
79   ; Directory page
80     !insertmacro MUI_PAGE_DIRECTORY
81   ; Instfiles page
82     !insertmacro MUI_PAGE_INSTFILES
83   ; Finish page
84
85     Function ExecAppFile
86       Exec '$INSTDIR\vlc.exe'
87     FunctionEnd
88
89     Function AppRunAs
90       !insertmacro UAC.CallFunctionAsUser ExecAppFile
91     FunctionEnd
92
93     !define MUI_FINISHPAGE_RUN
94     !define MUI_FINISHPAGE_RUN_FUNCTION AppRunAs
95     !define MUI_FINISHPAGE_LINK $Link_VisitWebsite
96     !define MUI_FINISHPAGE_LINK_LOCATION "http://www.videolan.org/vlc/"
97     !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
98     !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
99     !define MUI_FINISHPAGE_NOREBOOTSUPPORT
100     !insertmacro MUI_PAGE_FINISH
101
102 ; Uninstaller pages
103     !insertmacro MUI_UNPAGE_CONFIRM
104     !insertmacro MUI_UNPAGE_COMPONENTS
105     !insertmacro MUI_UNPAGE_INSTFILES
106     !insertmacro MUI_UNPAGE_FINISH
107
108 ; Language files
109   !insertmacro MUI_LANGUAGE "English" # first language is the default language
110   !insertmacro MUI_LANGUAGE "French"
111   !insertmacro MUI_LANGUAGE "German"
112   !insertmacro MUI_LANGUAGE "Spanish"
113   !insertmacro MUI_LANGUAGE "SimpChinese"
114   !insertmacro MUI_LANGUAGE "TradChinese"
115   !insertmacro MUI_LANGUAGE "Japanese"
116   !insertmacro MUI_LANGUAGE "Korean"
117   !insertmacro MUI_LANGUAGE "Italian"
118   !insertmacro MUI_LANGUAGE "Dutch"
119   !insertmacro MUI_LANGUAGE "Danish"
120   !insertmacro MUI_LANGUAGE "Swedish"
121   !insertmacro MUI_LANGUAGE "Norwegian"
122   !insertmacro MUI_LANGUAGE "Finnish"
123   !insertmacro MUI_LANGUAGE "Greek"
124   !insertmacro MUI_LANGUAGE "Russian"
125   !insertmacro MUI_LANGUAGE "Portuguese"
126   !insertmacro MUI_LANGUAGE "PortugueseBR"
127   !insertmacro MUI_LANGUAGE "Arabic"
128   !insertmacro MUI_LANGUAGE "Polish"
129   !insertmacro MUI_LANGUAGE "Romanian"
130   !insertmacro MUI_LANGUAGE "Slovak"
131   !insertmacro MUI_LANGUAGE "Czech"
132   !insertmacro MUI_LANGUAGE "Hungarian"
133   !insertmacro MUI_LANGUAGE "Catalan"
134   !insertmacro MUI_LANGUAGE "Bulgarian"
135   !insertmacro MUI_LANGUAGE "Estonian"
136   !insertmacro MUI_LANGUAGE "Lithuanian"
137   !insertmacro MUI_LANGUAGE "Basque"
138
139 ; Reserve files for solid compression
140   !insertmacro MUI_RESERVEFILE_LANGDLL
141   !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
142
143 ; MUI end ------
144
145 ;;;;;;;;;;;;;;;;;;;;;;;
146 ; Macro and Functions ;
147 ;;;;;;;;;;;;;;;;;;;;;;;
148
149 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
150 ; 1. File type associations ;
151 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
152
153 ;; Function that registers one extension for VLC
154 Function RegisterExtension
155   ; back up old value for extension $R0 (eg. ".opt")
156   ReadRegStr $1 HKCR "$R0" ""
157   StrCmp $1 "" NoBackup
158     StrCmp $1 "VLC$R0" "NoBackup"
159     WriteRegStr HKCR "$R0" "VLC.backup" $1
160 NoBackup:
161   WriteRegStr HKCR "$R0" "" "VLC$R0"
162   ReadRegStr $0 HKCR "VLC$R0" ""
163   WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
164   WriteRegStr HKCR "VLC$R0\shell" "" "Open"
165   WriteRegStr HKCR "VLC$R0\shell\Open" "" $ShellAssociation_Play
166   WriteRegStr HKCR "VLC$R0\shell\Open\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
167   WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
168
169 ;;; Vista Only part
170   ; Vista and above detection
171   ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
172   StrCpy $R2 $R1 1
173   StrCmp $R2 '6' ForVista ToEnd
174 ForVista:
175   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
176
177 ToEnd:
178 FunctionEnd
179
180 ;; Function that registers one skin extension for VLC
181 Function RegisterSkinExtension
182   ; back up old value for extension $R0 (eg. ".opt")
183   ReadRegStr $1 HKCR "$R0" ""
184   StrCmp $1 "" NoBackup
185     StrCmp $1 "VLC$R0" "NoBackup"
186     WriteRegStr HKCR "$R0" "VLC.backup" $1
187 NoBackup:
188   WriteRegStr HKCR "$R0" "" "VLC$R0"
189   ReadRegStr $0 HKCR "VLC$R0" ""
190   WriteRegStr HKCR "VLC$R0" "" "VLC skin file ($R0)"
191   WriteRegStr HKCR "VLC$R0\shell" "" "Open"
192   WriteRegStr HKCR "VLC$R0\shell\Open" "" ""
193   WriteRegStr HKCR "VLC$R0\shell\Open\command" "" '"$INSTDIR\vlc.exe" -Iskins --skins2-last "%1"'
194   WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
195
196 ;;; Vista Only part
197   ; Vista and above detection
198   ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
199   StrCpy $R2 $R1 1
200   StrCmp $R2 '6' ForVista ToEnd
201 ForVista:
202   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
203
204 ToEnd:
205 FunctionEnd
206
207 ;; Function that removes one extension that VLC owns.
208 Function un.RegisterExtension
209   ;start of restore script
210   ReadRegStr $1 HKCR "$R0" ""
211   StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
212     ; Read the old value from Backup
213     ReadRegStr $1 HKCR "$R0" "VLC.backup"
214     StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
215       DeleteRegKey HKCR "$R0"
216     Goto NoOwn
217 Restore:
218       WriteRegStr HKCR "$R0" "" $1
219       DeleteRegValue HKCR "$R0" "VLC.backup"
220 NoOwn:
221     DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
222     DeleteRegKey HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations\VLC$R0" ; for vista
223 FunctionEnd
224
225 !macro RegisterExtensionSection EXT
226   Section ${EXT}
227     SectionIn 1 3
228     Push $R0
229     StrCpy $R0 ${EXT}
230     Call RegisterExtension
231     Pop $R0
232   SectionEnd
233 !macroend
234
235 !macro RegisterSkinExtensionSection EXT
236   Section /o ${EXT}
237     SectionIn 1 3
238     Push $R0
239     StrCpy $R0 ${EXT}
240     Call RegisterSkinExtension
241     Pop $R0
242   SectionEnd
243 !macroend
244
245 !macro UnRegisterExtensionSection EXT
246   Push $R0
247   StrCpy $R0 ${EXT}
248   Call un.RegisterExtension
249   Pop $R0
250 !macroend
251
252 !macro WriteRegStrSupportedTypes EXT
253   WriteRegStr HKCR Applications\vlc.exe\SupportedTypes ${EXT} ""
254 !macroend
255
256 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
257 ; Extension lists  Macros                    ;
258 ; Those macros calls the previous functions  ;
259 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
260
261 !macro MacroAudioExtensions _action
262   !insertmacro ${_action} ".a52"
263   !insertmacro ${_action} ".aac"
264   !insertmacro ${_action} ".ac3"
265   !insertmacro ${_action} ".adt"
266   !insertmacro ${_action} ".adts"
267   !insertmacro ${_action} ".aif"
268   !insertmacro ${_action} ".aifc"
269   !insertmacro ${_action} ".aiff"
270   !insertmacro ${_action} ".au"
271   !insertmacro ${_action} ".amr"
272   !insertmacro ${_action} ".aob"
273   !insertmacro ${_action} ".ape"
274   !insertmacro ${_action} ".caf"
275   !insertmacro ${_action} ".cda"
276   !insertmacro ${_action} ".dts"
277   !insertmacro ${_action} ".flac"
278   !insertmacro ${_action} ".it"
279   !insertmacro ${_action} ".m4a"
280   !insertmacro ${_action} ".m4p"
281   !insertmacro ${_action} ".mid"
282   !insertmacro ${_action} ".mka"
283   !insertmacro ${_action} ".mlp"
284   !insertmacro ${_action} ".mod"
285   !insertmacro ${_action} ".mp1"
286   !insertmacro ${_action} ".mp2"
287   !insertmacro ${_action} ".mp3"
288   !insertmacro ${_action} ".mpc"
289   !insertmacro ${_action} ".oma"
290   !insertmacro ${_action} ".oga"
291   !insertmacro ${_action} ".rmi"
292   !insertmacro ${_action} ".snd"
293   !insertmacro ${_action} ".s3m"
294   !insertmacro ${_action} ".spx"
295   !insertmacro ${_action} ".tta"
296   !insertmacro ${_action} ".voc"
297   !insertmacro ${_action} ".vqf"
298   !insertmacro ${_action} ".w64"
299   !insertmacro ${_action} ".wav"
300   !insertmacro ${_action} ".wma"
301   !insertmacro ${_action} ".wv"
302   !insertmacro ${_action} ".xa"
303   !insertmacro ${_action} ".xm"
304 !macroend
305
306 !macro MacroVideoExtensions _action
307   !insertmacro ${_action} ".3g2"
308   !insertmacro ${_action} ".3gp"
309   !insertmacro ${_action} ".3gp2"
310   !insertmacro ${_action} ".3gpp"
311   !insertmacro ${_action} ".amv"
312   !insertmacro ${_action} ".asf"
313   !insertmacro ${_action} ".avi"
314   !insertmacro ${_action} ".divx"
315   !insertmacro ${_action} ".dv"
316   !insertmacro ${_action} ".f4v"
317   !insertmacro ${_action} ".flv"
318   !insertmacro ${_action} ".gxf"
319   !insertmacro ${_action} ".m1v"
320   !insertmacro ${_action} ".m2t"
321   !insertmacro ${_action} ".m2v"
322   !insertmacro ${_action} ".m2ts"
323   !insertmacro ${_action} ".m4v"
324   !insertmacro ${_action} ".mkv"
325   !insertmacro ${_action} ".mov"
326   !insertmacro ${_action} ".mp2"
327   !insertmacro ${_action} ".mp2v"
328   !insertmacro ${_action} ".mp4"
329   !insertmacro ${_action} ".mp4v"
330   !insertmacro ${_action} ".mpa"
331   !insertmacro ${_action} ".mpe"
332   !insertmacro ${_action} ".mpeg"
333   !insertmacro ${_action} ".mpeg1"
334   !insertmacro ${_action} ".mpeg2"
335   !insertmacro ${_action} ".mpeg4"
336   !insertmacro ${_action} ".mpg"
337   !insertmacro ${_action} ".mpv2"
338   !insertmacro ${_action} ".mts"
339   !insertmacro ${_action} ".mtv"
340   !insertmacro ${_action} ".mxf"
341   !insertmacro ${_action} ".nsv"
342   !insertmacro ${_action} ".nuv"
343   !insertmacro ${_action} ".ogg"
344   !insertmacro ${_action} ".ogm"
345   !insertmacro ${_action} ".ogx"
346   !insertmacro ${_action} ".ogv"
347   !insertmacro ${_action} ".rec"
348   !insertmacro ${_action} ".rm"
349   !insertmacro ${_action} ".rmvb"
350   !insertmacro ${_action} ".tod"
351   !insertmacro ${_action} ".ts"
352   !insertmacro ${_action} ".tts"
353   !insertmacro ${_action} ".vob"
354   !insertmacro ${_action} ".vro"
355   !insertmacro ${_action} ".webm"
356   !insertmacro ${_action} ".wmv"
357 !macroend
358
359 !macro MacroOtherExtensions _action
360   !insertmacro ${_action} ".asx"
361   !insertmacro ${_action} ".b4s"
362   !insertmacro ${_action} ".bin"
363   !insertmacro ${_action} ".cue"
364   !insertmacro ${_action} ".ifo"
365   !insertmacro ${_action} ".m3u"
366   !insertmacro ${_action} ".m3u8"
367   !insertmacro ${_action} ".pls"
368   !insertmacro ${_action} ".ram"
369   !insertmacro ${_action} ".sdp"
370   !insertmacro ${_action} ".vlc"
371   !insertmacro ${_action} ".xspf"
372 !macroend
373
374 !macro MacroSkinExtensions _action
375   !insertmacro ${_action} ".vlt"
376   !insertmacro ${_action} ".wsz"
377 !macroend
378
379 ; One macro to rule them all
380 !macro MacroAllExtensions _action
381   !insertmacro MacroAudioExtensions ${_action}
382   !insertmacro MacroVideoExtensions ${_action}
383   !insertmacro MacroOtherExtensions ${_action}
384 !macroend
385
386 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
387 ; 2. Context menu entries ;
388 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
389
390 ; Generic function for adding the context menu for one ext.
391 !macro AddContextMenuExt EXT
392   WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" $ContextMenuEntry_PlayWith
393   WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '"$INSTDIR\vlc.exe" --started-from-file --no-playlist-enqueue "%1"'
394
395   WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" $ContextMenuEntry_AddToPlaylist
396   WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '"$INSTDIR\vlc.exe" --started-from-file --playlist-enqueue "%1"'
397 !macroend
398
399 !macro AddContextMenu EXT
400   Push $R0
401   ReadRegStr $R0 HKCR ${EXT} ""
402   !insertmacro AddContextMenuExt $R0
403   Pop $R0
404 !macroend
405
406 !macro DeleteContextMenuExt EXT
407   DeleteRegKey HKCR ${EXT}\shell\PlayWithVLC
408   DeleteRegKey HKCR ${EXT}\shell\AddToPlaylistVLC
409 !macroend
410
411 !macro DeleteContextMenu EXT
412   Push $R0
413   ReadRegStr $R0 HKCR ${EXT} ""
414   !insertmacro DeleteContextMenuExt $R0
415   Pop $R0
416 !macroend
417
418 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
419 ; 3. Delete prefs           ;
420 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
421
422 !macro delprefs
423   StrCpy $0 0
424   !define Index 'Line${__LINE__}'
425   "${Index}-Loop:"
426   ; FIXME
427   ; this will loop through all the logged users and "virtual" windows users
428   ; (it looks like users are only present in HKEY_USERS when they are logged in)
429     ClearErrors
430     EnumRegKey $1 HKU "" $0
431     StrCmp $1 "" "${Index}-End"
432     IntOp $0 $0 + 1
433     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
434     StrCmp $2 "" "${Index}-Loop"
435     RMDir /r "$2\vlc"
436     Goto "${Index}-Loop"
437   "${Index}-End:"
438   !undef Index
439 !macroend
440
441 ;;;;;;;;;;;;;;;
442 ; 4. Logging  ;
443 ;;;;;;;;;;;;;;;
444 Var UninstallLog
445 !macro OpenUninstallLog
446   FileOpen $UninstallLog "$INSTDIR\uninstall.log" a
447   FileSeek $UninstallLog 0 END
448 !macroend
449
450 !macro CloseUninstallLog
451   FileClose $UninstallLog
452   SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
453 !macroend
454
455 ;;;;;;;;;;;;;;;;;;;;
456 ; 5. Installations ;
457 ;;;;;;;;;;;;;;;;;;;;
458 !macro InstallFile FILEREGEX
459   File "${FILEREGEX}"
460   !define Index 'Line${__LINE__}'
461   FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
462   StrCmp $0 "" "${Index}-End"
463   "${Index}-Loop:"
464     StrCmp $1 "" "${Index}-End"
465     FileWrite $UninstallLog "$1$\r$\n"
466     FindNext $0 $1
467     Goto "${Index}-Loop"
468   "${Index}-End:"
469   !undef Index
470 !macroend
471
472 !macro InstallFolder FOLDER
473   File /r "${FOLDER}"
474   Push "${FOLDER}"
475   Call InstallFolderInternal
476 !macroend
477
478 Function InstallFolderInternal
479   Pop $9
480   !define Index 'Line${__LINE__}'
481   FindFirst $0 $1 "$INSTDIR\$9\*"
482   StrCmp $0 "" "${Index}-End"
483   "${Index}-Loop:"
484     StrCmp $1 "" "${Index}-End"
485     StrCmp $1 "." "${Index}-Next"
486     StrCmp $1 ".." "${Index}-Next"
487     IfFileExists "$9\$1\*" 0 "${Index}-Write"
488       Push $0
489       Push $9
490       Push "$9\$1"
491       Call InstallFolderInternal
492       Pop $9
493       Pop $0
494       Goto "${Index}-Next"
495     "${Index}-Write:"
496     FileWrite $UninstallLog "$9\$1$\r$\n"
497     "${Index}-Next:"
498     FindNext $0 $1
499     Goto "${Index}-Loop"
500   "${Index}-End:"
501   !undef Index
502 FunctionEnd
503 ;;; End of Macros
504
505
506 ;;;;;;;;;;;;;;;;;;;;;;
507 ; Installer sections ;
508 ; The CORE of the    ;
509 ; installer          ;
510 ;;;;;;;;;;;;;;;;;;;;;;
511
512 Section $Name_Section01 SEC01
513   SectionIn 1 2 3 RO
514   SetShellVarContext all
515   SetOutPath "$INSTDIR"
516
517   !insertmacro OpenUninstallLog
518
519   ; VLC.exe, libvlc.dll
520   !insertmacro InstallFile vlc.exe
521   !insertmacro InstallFile vlc.exe.manifest
522   !insertmacro InstallFile vlc-cache-gen.exe
523
524   ; All dlls
525   !insertmacro InstallFile *.dll
526
527   ; Text files
528   !insertmacro InstallFile *.txt
529
530   ; Subfolders
531   !insertmacro InstallFolder plugins
532   !insertmacro InstallFolder locale
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 /o $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 UAC_Elevate:
776     UAC::RunElevated
777     StrCmp 1223 $0 UAC_ElevationAborted
778     StrCmp 0 $0 0 UAC_Err
779     StrCmp 1 $1 0 UAC_Success
780     Quit
781
782 UAC_Err:
783     MessageBox mb_iconstop "Unable to elevate, error $0"
784     Abort
785
786 UAC_ElevationAborted:
787     MessageBox mb_iconstop "This installer requires admin access, aborting!"
788     Abort
789
790 UAC_Success:
791     StrCmp 1 $3 +4
792     StrCmp 3 $1 0 UAC_ElevationAborted
793     MessageBox mb_iconstop "This installer requires admin access, try again"
794     goto UAC_Elevate
795   !insertmacro MUI_LANGDLL_DISPLAY
796
797   !include "languages\english.nsh"
798   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
799   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
800   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
801   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
802   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
803   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
804   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
805   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
806   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
807   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
808   StrCmp $LANGUAGE ${LANG_DANISH} Danish 0
809   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
810   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
811   StrCmp $LANGUAGE ${LANG_JAPANESE} Japanese 0
812 ;  StrCmp $LANGUAGE ${LANG_BENGALI} Bengali 0
813 ;  StrCmp $LANGUAGE ${LANG_PUNJABI} Punjabi 0
814 ;  StrCmp $LANGUAGE ${LANG_SLOVENIAN} Slovenian 0
815   StrCmp $LANGUAGE ${LANG_SPANISH} Spanish 0
816   StrCmp $LANGUAGE ${LANG_ESTONIAN} Estonian 0
817   StrCmp $LANGUAGE ${LANG_LITHUANIAN} Lithuanian 0
818   StrCmp $LANGUAGE ${LANG_BASQUE} Basque 0
819   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
820   French:
821   !include "languages\french.nsh"
822   Goto EndLanguageCmp
823   German:
824   !include "languages\german.nsh"
825   Goto EndLanguageCmp
826   Italian:
827   !include "languages\italian.nsh"
828   Goto EndLanguageCmp
829   Hungarian:
830   !include "languages\hungarian.nsh"
831   Goto EndLanguageCmp
832   Romanian:
833   !include "languages\romanian.nsh"
834   Goto EndLanguageCmp
835   Catalan:
836   !include "languages\catalan.nsh"
837   Goto EndLanguageCmp
838   Bulgarian:
839   !include "languages\bulgarian.nsh"
840   Goto EndLanguageCmp
841   Slovak:
842   !include "languages\slovak.nsh"
843   Goto EndLanguageCmp
844   Polish:
845   !include "languages\polish.nsh"
846   Goto EndLanguageCmp
847   Dutch:
848   !include "languages\dutch.nsh"
849   Goto EndLanguageCmp
850   Danish:
851   !include "languages\danish.nsh"
852   Goto EndLanguageCmp
853   Schinese:
854   !include "languages\schinese.nsh"
855   Goto EndLanguageCmp
856   Finnish:
857   !include "languages\finnish.nsh"
858   Goto EndLanguageCmp
859   Japanese:
860   !include "languages\japanese.nsh"
861   Goto EndLanguageCmp
862   Bengali:
863   !include "languages\bengali.nsh"
864   Goto EndLanguageCmp
865   Punjabi:
866   !include "languages\punjabi.nsh"
867   Goto EndLanguageCmp
868   Slovenian:
869   !include "languages\slovenian.nsh"
870   Goto EndLanguageCmp
871   Spanish:
872   !include "languages\spanish.nsh"
873   Goto EndLanguageCmp
874   Estonian:
875   !include "languages\estonian.nsh"
876   Goto EndLanguageCmp
877   Lithuanian:
878   !include "languages\lithuanian.nsh"
879   Goto EndLanguageCmp
880   Basque:
881   !include "languages\basque.nsh"
882   Goto EndLanguageCmp
883   Brazilian:
884   !include "languages\brazilian_portuguese.nsh"
885   EndLanguageCmp:
886
887   ReadRegStr $R0  ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
888   "UninstallString"
889   StrCmp $R0 "" done
890
891   MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled /SD IDNO IDNO done
892
893   ;Run the uninstaller
894   ;uninst:
895     ClearErrors
896     ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
897   done:
898
899 FunctionEnd
900
901 Function .OnInstFailed
902     UAC::Unload
903 FunctionEnd
904
905 Function .OnInstSuccess
906     UAC::Unload
907 FunctionEnd
908
909 ;; End function
910 Section -Post
911   WriteUninstaller "$INSTDIR\uninstall.exe"
912   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
913   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
914   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
915
916   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
917     "DisplayName" "$(^Name)"
918   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
919     "UninstallString" "$INSTDIR\uninstall.exe"
920   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
921     "InstallLocation" "$INSTDIR"
922   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
923     "DisplayIcon" "$INSTDIR\vlc.exe"
924   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
925     "DisplayVersion" "${PRODUCT_VERSION}"
926   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
927     "URLInfoAbout" "${PRODUCT_WEB_SITE}"
928   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
929     "Publisher" "${PRODUCT_PUBLISHER}"
930   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
931     "VersionMajor"  "@VERSION_MAJOR@"
932   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
933     "VersionMinor" "@VERSION_MINOR@"
934 SectionEnd
935
936 ;;;;;;;;;;;;;;;;;;;;;;;;
937 ; Uninstaller sections ;
938 ;;;;;;;;;;;;;;;;;;;;;;;;
939
940 ; TrimNewlines (copied from NSIS documentation)
941 ; input, top of stack  (e.g. whatever$\r$\n)
942 ; output, top of stack (replaces, with e.g. whatever)
943 ; modifies no other variables.
944
945 Function un.TrimNewlines
946  Exch $R0
947  Push $R1
948  Push $R2
949  StrCpy $R1 0
950
951  loop:
952    IntOp $R1 $R1 - 1
953    StrCpy $R2 $R0 1 $R1
954    StrCmp $R2 "$\r" loop
955    StrCmp $R2 "$\n" loop
956    IntOp $R1 $R1 + 1
957    IntCmp $R1 0 no_trim_needed
958    StrCpy $R0 $R0 $R1
959
960  no_trim_needed:
961    Pop $R2
962    Pop $R1
963    Exch $R0
964 FunctionEnd
965
966 Function un.RemoveEmptyDirs
967   Pop $9
968   !define Index 'Line${__LINE__}'
969   FindFirst $0 $1 "$INSTDIR$9*"
970   StrCmp $0 "" "${Index}-End"
971   "${Index}-Loop:"
972     StrCmp $1 "" "${Index}-End"
973     StrCmp $1 "." "${Index}-Next"
974     StrCmp $1 ".." "${Index}-Next"
975       Push $0
976       Push $1
977       Push $9
978       Push "$9$1\"
979       Call un.RemoveEmptyDirs
980       Pop $9
981       Pop $1
982       Pop $0
983     "${Index}-Remove:"
984     RMDir "$INSTDIR$9$1"
985     "${Index}-Next:"
986     FindNext $0 $1
987     Goto "${Index}-Loop"
988   "${Index}-End:"
989   FindClose $0
990   !undef Index
991 FunctionEnd
992
993 Section "un.$Name_Section91" SEC91
994   SectionIn 1 2 3 RO
995   SetShellVarContext all
996
997   !insertmacro MacroAllExtensions DeleteContextMenu
998   !insertmacro MacroAllExtensions UnRegisterExtensionSection
999   !insertmacro MacroSkinExtensions UnRegisterExtensionSection
1000   !insertmacro DeleteContextMenuExt "Directory"
1001
1002   ;remove activex plugin
1003   UnRegDLL "$INSTDIR\axvlc.dll"
1004   Delete /REBOOTOK "$INSTDIR\axvlc.dll"
1005   Delete /REBOOTOK "$INSTDIR\axvlc.dll.manifest"
1006
1007   ;remove mozilla plugin
1008   Push $R0
1009   Push $R1
1010   Push $R2
1011
1012   !define Index 'Line${__LINE__}'
1013   StrCpy $R1 "0"
1014
1015   "${Index}-Loop:"
1016
1017     ; Check for Key
1018     EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
1019     StrCmp $R0 "" "${Index}-End"
1020     IntOp $R1 $R1 + 1
1021     ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
1022     StrCmp $R2 "" "${Index}-Loop" ""
1023
1024     ; old files (0.8.5 and before) that may be lying around
1025     Delete /REBOOTOK "$R2\npvlc.dll"
1026     Delete /REBOOTOK "$R2\libvlc.dll"
1027     Delete /REBOOTOK "$R2\vlcintf.xpt"
1028     Goto "${Index}-Loop"
1029
1030   "${Index}-End:"
1031   !undef Index
1032   Delete /REBOOTOK "$INSTDIR\npvlc.dll"
1033   Delete /REBOOTOK "$INSTDIR\npvlc.dll.manifest"
1034
1035   RMDir "$SMPROGRAMS\VideoLAN"
1036   RMDir /r $SMPROGRAMS\VideoLAN
1037
1038   FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
1039   UninstallLoop:
1040     ClearErrors
1041     FileRead $UninstallLog $R0
1042     IfErrors UninstallEnd
1043     Push $R0
1044     Call un.TrimNewLines
1045     Pop $R0
1046     Delete "$INSTDIR\$R0"
1047     Goto UninstallLoop
1048   UninstallEnd:
1049   FileClose $UninstallLog
1050   Delete "$INSTDIR\uninstall.log"
1051   Delete "$INSTDIR\uninstall.exe"
1052   Push "\"
1053   Call un.RemoveEmptyDirs
1054   RMDir "$INSTDIR"
1055
1056   DeleteRegKey HKLM Software\VideoLAN
1057
1058   DeleteRegKey HKCR Applications\vlc.exe
1059   DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
1060   DeleteRegKey HKCR DVD\shell\PlayWithVLC
1061   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
1062   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
1063   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
1064   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
1065   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoCDMovieOnArrival" "VLCPlayVCDMovieOnArrival"
1066   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival
1067   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlaySuperVideoCDMovieOnArrival" "VLCPlaySVCDMovieOnArrival"
1068   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival
1069   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDAudioOnArrival" "VLCPlayDVDAudioOnArrival"
1070   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival
1071   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoFilesOnArrival" "VLCPlayVideoFilesOnArrival"
1072   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival
1073   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayMusicFilesOnArrival" "VLCPlayMusicFilesOnArrival"
1074   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival
1075
1076   DeleteRegKey HKLM Software\Clients\Media\VLC
1077   DeleteRegValue HKLM "Software\RegisteredApplications" "VLC"
1078   DeleteRegKey HKCR "VLC.MediaFile"
1079   DeleteRegKey HKCR "VLC.DVDMovie"
1080   DeleteRegKey HKCR "VLC.CDAudio"
1081   DeleteRegKey HKCR "VLC.VCDMovie"
1082   DeleteRegKey HKCR "VLC.SVCDMovie"
1083   DeleteRegKey HKCR "VLC.OPENFolder"
1084
1085
1086   DeleteRegKey HKLM \
1087     "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
1088
1089   DeleteRegKey HKLM \
1090     "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
1091
1092   Delete "$DESKTOP\VLC media player.lnk"
1093
1094   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
1095   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
1096   SetAutoClose true
1097 SectionEnd
1098
1099 Section /o "un.$Name_Section92" SEC92
1100   !insertmacro delprefs
1101 SectionEnd
1102
1103 ; Uninstaller section descriptions
1104 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1105   !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} $Desc_Section91
1106   !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} $Desc_Section92
1107 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
1108
1109 Function un.OnUnInstFailed
1110     UAC::Unload
1111 FunctionEnd
1112
1113 Function un.OnUnInstSuccess
1114     UAC::Unload
1115     Delete "$INSTDIR\UAC.dll"
1116 FunctionEnd
1117
1118 Function un.onInit
1119
1120 UAC_Elevate:
1121     UAC::RunElevated
1122     StrCmp 1223 $0 UAC_ElevationAborted
1123     StrCmp 0 $0 0 UAC_Err
1124     StrCmp 1 $1 0 UAC_Success
1125     Quit
1126
1127 UAC_Err:
1128     MessageBox mb_iconstop "Unable to elevate, error $0"
1129     Abort
1130
1131 UAC_ElevationAborted:
1132     MessageBox mb_iconstop "This installer requires admin access, aborting!"
1133     Abort
1134
1135 UAC_Success:
1136     StrCmp 1 $3 +4
1137     StrCmp 3 $1 0 UAC_ElevationAborted
1138     MessageBox mb_iconstop "This installer requires admin access, try again"
1139     goto UAC_Elevate
1140
1141   !insertmacro MUI_UNGETLANGUAGE
1142
1143   !include "languages\english.nsh"
1144   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
1145   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
1146   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
1147   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
1148   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
1149   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
1150   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
1151   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
1152   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
1153   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
1154   StrCmp $LANGUAGE ${LANG_DANISH} Danish 0
1155   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
1156   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
1157   StrCmp $LANGUAGE ${LANG_JAPANESE} Japanese 0
1158 ;  StrCmp $LANGUAGE ${LANG_BENGALI} Bengali 0
1159 ;  StrCmp $LANGUAGE ${LANG_PUNJABI} Punjabi 0
1160 ;  StrCmp $LANGUAGE ${LANG_SLOVENIAN} Slovenian 0
1161   StrCmp $LANGUAGE ${LANG_SPANISH} Spanish 0
1162   StrCmp $LANGUAGE ${LANG_ESTONIAN} Estonian 0
1163   StrCmp $LANGUAGE ${LANG_LITHUANIAN} Lithuanian 0
1164   StrCmp $LANGUAGE ${LANG_BASQUE} Basque 0
1165   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
1166   French:
1167   !include "languages\french.nsh"
1168   Goto EndLanguageCmp
1169   German:
1170   !include "languages\german.nsh"
1171   Goto EndLanguageCmp
1172   Italian:
1173   !include "languages\italian.nsh"
1174   Goto EndLanguageCmp
1175   Hungarian:
1176   !include "languages\hungarian.nsh"
1177   Goto EndLanguageCmp
1178   Romanian:
1179   !include "languages\romanian.nsh"
1180   Goto EndLanguageCmp
1181   Catalan:
1182   !include "languages\catalan.nsh"
1183   Goto EndLanguageCmp
1184   Bulgarian:
1185   !include "languages\bulgarian.nsh"
1186   Goto EndLanguageCmp
1187   Slovak:
1188   !include "languages\slovak.nsh"
1189   Goto EndLanguageCmp
1190   Polish:
1191   !include "languages\polish.nsh"
1192   Goto EndLanguageCmp
1193   Dutch:
1194   !include "languages\dutch.nsh"
1195   Goto EndLanguageCmp
1196   Danish:
1197   !include "languages\danish.nsh"
1198   Goto EndLanguageCmp
1199   Schinese:
1200   !include "languages\schinese.nsh"
1201   Goto EndLanguageCmp
1202   Finnish:
1203   !include "languages\finnish.nsh"
1204   Goto EndLanguageCmp
1205   Japanese:
1206   !include "languages\japanese.nsh"
1207   Goto EndLanguageCmp
1208   Bengali:
1209   !include "languages\bengali.nsh"
1210   Goto EndLanguageCmp
1211   Punjabi:
1212   !include "languages\punjabi.nsh"
1213   Goto EndLanguageCmp
1214   Slovenian:
1215   !include "languages\slovenian.nsh"
1216   Goto EndLanguageCmp
1217   Spanish:
1218   !include "languages\spanish.nsh"
1219   Goto EndLanguageCmp
1220   Estonian:
1221   !include "languages\estonian.nsh"
1222   Goto EndLanguageCmp
1223   Lithuanian:
1224   !include "languages\lithuanian.nsh"
1225   Goto EndLanguageCmp
1226   Basque:
1227   !include "languages\basque.nsh"
1228   Goto EndLanguageCmp
1229   Brazilian:
1230   !include "languages\brazilian_portuguese.nsh"
1231   EndLanguageCmp:
1232
1233 FunctionEnd