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