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