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