vlc.win32.nsi.in 26.5 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NSIS installer script for vlc ;
; (http://nsis.sourceforge.net) ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

!define PRODUCT_NAME "VLC media player"
!define PRODUCT_VERSION '${VERSION}'
!define PRODUCT_GROUP "VideoLAN"
!define PRODUCT_PUBLISHER "VideoLAN Team"
!define PRODUCT_WEB_SITE "http://www.videolan.org"
!define PRODUCT_DIR_REGKEY "Software\VideoLAN\VLC"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
14
!define PRODUCT_ID "{ea92ef52-afe4-4212-bacb-dfe9fca94cd6}"
15

16
17
18
19
!define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_DIR_REGKEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Language"

damienf's avatar
damienf committed
20
@FILE_LIBVLC_DLL@
21
@FILE_LIBVLC_CONTROL_DLL@
22

23
24
25
26
27
28
29
;;;;;;;;;;;;;;;;;;;;;;;;;
; General configuration ;
;;;;;;;;;;;;;;;;;;;;;;;;;

Name "${PRODUCT_GROUP} ${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile ..\vlc-${VERSION}-win32.exe
InstallDir "$PROGRAMFILES\VideoLAN\VLC"
dionoea's avatar
dionoea committed
30
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
31
32
33
!ifdef NSIS_LZMA_COMPRESS_WHOLE
SetCompressor lzma
!else
34
SetCompressor /SOLID lzma
35
!endif
36
37
;ShowInstDetails show
;ShowUnInstDetails show
38
39
40
SetOverwrite ifnewer
CRCCheck on

41
InstType "Recommended"
dionoea's avatar
dionoea committed
42
InstType "Minimum"
43
44
InstType "Full"

45
46
47
48
49
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NSIS Modern User Interface configuration ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; MUI 1.67 compatible ------
50
  !include "MUI.nsh"
51
52

; MUI Settings
53
  !define MUI_ABORTWARNING
54
  !define MUI_ICON "vlc48x48.ico"
dionoea's avatar
dionoea committed
55
  !define MUI_UNICON "vlc48x48.ico"
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  !define MUI_COMPONENTSPAGE_SMALLDESC

; Installer pages
  ; Welcome page
    !define MUI_WELCOMEPAGE_TITLE_3LINES
    !insertmacro MUI_PAGE_WELCOME
  ; License page
    !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
  ; Components page
    !insertmacro MUI_PAGE_COMPONENTS
  ; Directory page
    !insertmacro MUI_PAGE_DIRECTORY
  ; Instfiles page
    !insertmacro MUI_PAGE_INSTFILES
  ; Finish page
    !define MUI_FINISHPAGE_RUN "$INSTDIR\vlc.exe"
dionoea's avatar
dionoea committed
72
    !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
73
74
75
76
77
    !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
    !define MUI_FINISHPAGE_LINK "Visit the VideoLAN VLC media player Website"
    !define MUI_FINISHPAGE_LINK_LOCATION "http://www.videolan.org/vlc/"
    !define MUI_FINISHPAGE_NOREBOOTSUPPORT
    !insertmacro MUI_PAGE_FINISH
78
79

; Uninstaller pages
80
81
82
83
    !insertmacro MUI_UNPAGE_CONFIRM
    !insertmacro MUI_UNPAGE_COMPONENTS
    !insertmacro MUI_UNPAGE_INSTFILES
    !insertmacro MUI_UNPAGE_FINISH
84
85

; Language files
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  !insertmacro MUI_LANGUAGE "English" # first language is the default language
  !insertmacro MUI_LANGUAGE "French"
  !insertmacro MUI_LANGUAGE "German"
  !insertmacro MUI_LANGUAGE "Spanish"
  !insertmacro MUI_LANGUAGE "SimpChinese"
  !insertmacro MUI_LANGUAGE "TradChinese"
  !insertmacro MUI_LANGUAGE "Japanese"
  !insertmacro MUI_LANGUAGE "Korean"
  !insertmacro MUI_LANGUAGE "Italian"
  !insertmacro MUI_LANGUAGE "Dutch"
  !insertmacro MUI_LANGUAGE "Danish"
  !insertmacro MUI_LANGUAGE "Swedish"
  !insertmacro MUI_LANGUAGE "Norwegian"
  !insertmacro MUI_LANGUAGE "Finnish"
  !insertmacro MUI_LANGUAGE "Greek"
  !insertmacro MUI_LANGUAGE "Russian"
  !insertmacro MUI_LANGUAGE "Portuguese"
  !insertmacro MUI_LANGUAGE "Arabic"
104
  !insertmacro MUI_LANGUAGE "Polish"
105
  !insertmacro MUI_LANGUAGE "Romanian"
106
107

!insertmacro MUI_RESERVEFILE_LANGDLL
108
109

; Reserve files
110
  !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
111
112
113

; MUI end ------

114
115
116
117
;;;;;;;;;;;;;;;;;;;
; Extension lists ;
;;;;;;;;;;;;;;;;;;;

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
!macro MacroAudioExtensions _action
  !insertmacro ${_action} ".a52"
  !insertmacro ${_action} ".aac"
  !insertmacro ${_action} ".ac3"
  !insertmacro ${_action} ".dts"
  !insertmacro ${_action} ".flac"
  !insertmacro ${_action} ".mka"
  !insertmacro ${_action} ".mp1"
  !insertmacro ${_action} ".mp2"
  !insertmacro ${_action} ".mp3"
  !insertmacro ${_action} ".ogg"
  !insertmacro ${_action} ".spx"
  !insertmacro ${_action} ".wav"
  !insertmacro ${_action} ".wma"
!macroend

!macro MacroVideoExtensions _action
  !insertmacro ${_action} ".asf"
  !insertmacro ${_action} ".avi"
  !insertmacro ${_action} ".divx"
  !insertmacro ${_action} ".dv"
  !insertmacro ${_action} ".m1v"
  !insertmacro ${_action} ".m2v"
  !insertmacro ${_action} ".mkv"
  !insertmacro ${_action} ".mov"
  !insertmacro ${_action} ".mp4"
  !insertmacro ${_action} ".mpeg"
  !insertmacro ${_action} ".mpeg1"
  !insertmacro ${_action} ".mpeg2"
  !insertmacro ${_action} ".mpeg4"
  !insertmacro ${_action} ".mpg"
149
  !insertmacro ${_action} ".mxf"
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
  !insertmacro ${_action} ".ps"
  !insertmacro ${_action} ".ts"
  !insertmacro ${_action} ".ogm"
  !insertmacro ${_action} ".vob"
  !insertmacro ${_action} ".wmv"
!macroend

!macro MacroOtherExtensions _action
  !insertmacro ${_action} ".asx"
  !insertmacro ${_action} ".bin"
  !insertmacro ${_action} ".cue"
  !insertmacro ${_action} ".m3u"
  !insertmacro ${_action} ".pls"
  !insertmacro ${_action} ".vlc"
!macroend

!macro MacroAllExtensions _action
  !insertmacro MacroAudioExtensions ${_action}
  !insertmacro MacroVideoExtensions ${_action}
  !insertmacro MacroOtherExtensions ${_action}
!macroend

172
173
174
175
176
177
178
179
180
181
182
183
184
;;;;;;;;;;;;;;;;;;;;;;;;;;
; File type associations ;
;;;;;;;;;;;;;;;;;;;;;;;;;;

Function RegisterExtension
  ; back up old value for extension $R0 (eg. ".opt")
  ReadRegStr $1 HKCR "$R0" ""
  StrCmp $1 "" NoBackup
    StrCmp $1 "VLC$R0" "NoBackup"
    WriteRegStr HKCR "$R0" "VLC.backup" $1
NoBackup:
  WriteRegStr HKCR "$R0" "" "VLC$R0"
  ReadRegStr $0 HKCR "VLC$R0" ""
Christophe Mutricy's avatar
Christophe Mutricy committed
185
  WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
186
  WriteRegStr HKCR "VLC$R0\shell" "" "Play"
187
  WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
188
  WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
189
190
191
192
193
194
195
196
197

  ; Vista detection
  ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  StrCpy $R2 $R1 3
  StrCmp $R2 '6.0' ForVista ToEnd
ForVista:
  WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
ToEnd:

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
FunctionEnd

Function un.RegisterExtension
  ;start of restore script
  ReadRegStr $1 HKCR "$R0" ""
  StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
    ReadRegStr $1 HKCR "$R0" "VLC.backup"
    StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
      DeleteRegKey HKCR "$R0"
    Goto NoOwn
Restore:
      WriteRegStr HKCR "$R0" "" $1
      DeleteRegValue HKCR "$R0" "VLC.backup"
NoOwn:
    DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
FunctionEnd

!macro RegisterExtensionSection EXT
216
  Section ${EXT}
217
    SectionIn 1 3
218
219
220
221
222
223
224
225
226
227
228
229
230
231
    Push $R0
    StrCpy $R0 ${EXT}
    Call RegisterExtension
    Pop $R0
  SectionEnd
!macroend

!macro UnRegisterExtensionSection EXT
  Push $R0
  StrCpy $R0 ${EXT}
  Call un.RegisterExtension
  Pop $R0
!macroend

232
233
234
235
236
237
238
239
!macro WriteRegStrSupportedTypes EXT
  WriteRegStr HKCR Applications\vlc.exe\SupportedTypes ${EXT} ""
!macroend

;;;;;;;;;;;;;;;;;;;;;;;;
; Context menu entries ;
;;;;;;;;;;;;;;;;;;;;;;;;

240
241
242
243
244
245
246
247
!macro AddContextMenuExt EXT
  WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" "Play with VLC media player"
  WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '$INSTDIR\vlc.exe --started-from-file --no-playlist-enqueue "%1"'

  WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" "Add to VLC media player's Playlist"
  WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --started-from-file --playlist-enqueue "%1"'
!macroend

248
!macro AddContextMenu EXT
249
250
  Push $R0
  ReadRegStr $R0 HKCR ${EXT} ""
251
  !insertmacro AddContextMenuExt $R0
252
  Pop $R0
253
254
!macroend

255
256
257
258
259
!macro DeleteContextMenuExt EXT
  DeleteRegKey HKCR ${EXT}\shell\PlayWithVLC
  DeleteRegKey HKCR ${EXT}\shell\AddToPlaylistVLC
!macroend

260
!macro DeleteContextMenu EXT
261
262
  Push $R0
  ReadRegStr $R0 HKCR ${EXT} ""
263
  !insertmacro DeleteContextMenuExt $R0
264
  Pop $R0
265
266
!macroend

267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
;;;;;;;;;;;;;;;;;;;;;;;;;;
; Delete prefs and cache ;
;;;;;;;;;;;;;;;;;;;;;;;;;;

!macro delprefs
  StrCpy $0 0
  !define Index 'Line${__LINE__}'
  "${Index}-Loop:"
  ; FIXME
  ; this will loop through all the logged users and "virtual" windows users
  ; (it looks like users are only present in HKEY_USERS when they are logged in)
    ClearErrors
    EnumRegKey $1 HKU "" $0
    StrCmp $1 "" "${Index}-End"
    IntOp $0 $0 + 1
    ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
    StrCmp $2 "" "${Index}-Loop"
    RMDir /r "$2\vlc"
    Goto "${Index}-Loop"
  "${Index}-End:"
  !undef Index
!macroend

290
291
Var UninstallLog

292
!macro OpenUninstallLog
dionoea's avatar
dionoea committed
293
  FileOpen $UninstallLog "$INSTDIR\uninstall.log" a
294
295
296
297
298
299
300
301
  FileSeek $UninstallLog 0 END
!macroend

!macro CloseUninstallLog
  FileClose $UninstallLog
  SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
!macroend

302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
!macro InstallFile FILEREGEX
  File "${FILEREGEX}"
  !define Index 'Line${__LINE__}'
  FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
  StrCmp $0 "" "${Index}-End"
  "${Index}-Loop:"
    StrCmp $1 "" "${Index}-End"
    FileWrite $UninstallLog "$1$\r$\n"
    FindNext $0 $1
    Goto "${Index}-Loop"
  "${Index}-End:"
  !undef Index
!macroend

!macro InstallFolder FOLDER
  File /r "${FOLDER}"
  Push "${FOLDER}"
  Call InstallFolderInternal
!macroend

Function InstallFolderInternal
  Pop $9
  !define Index 'Line${__LINE__}'
  FindFirst $0 $1 "$INSTDIR\$9\*"
  StrCmp $0 "" "${Index}-End"
  "${Index}-Loop:"
    StrCmp $1 "" "${Index}-End"
    StrCmp $1 "." "${Index}-Next"
    StrCmp $1 ".." "${Index}-Next"
    IfFileExists "$9\$1\*" 0 "${Index}-Write"
      Push $0
      Push $9
      Push "$9\$1"
      Call InstallFolderInternal
      Pop $9
      Pop $0
      Goto "${Index}-Next"
    "${Index}-Write:"
    FileWrite $UninstallLog "$9\$1$\r$\n"
    "${Index}-Next:"
    FindNext $0 $1
    Goto "${Index}-Loop"
  "${Index}-End:"
  !undef Index
FunctionEnd


349
350
351
;;;;;;;;;;;;;;;;;;;;;;
; Installer sections ;
;;;;;;;;;;;;;;;;;;;;;;
352
353
354
355
356
357

Section "Media player (required)" SEC01
  SectionIn 1 2 3 RO
  SetShellVarContext all
  SetOutPath "$INSTDIR"

358
  !insertmacro OpenUninstallLog
359
360
361

  !insertmacro InstallFile vlc.exe
  !insertmacro InstallFile vlc.exe.manifest
damienf's avatar
damienf committed
362
363
  !ifdef LIBVLC_DLL
  !insertmacro InstallFile ${LIBVLC_DLL}
364
  !endif
365
366
367
  !ifdef LIBVLC_CONTROL_DLL
  !insertmacro InstallFile ${LIBVLC_CONTROL_DLL}
  !endif
368
  !insertmacro InstallFile *.txt
369

370
371
372
373
374
  !insertmacro InstallFolder plugins
  !insertmacro InstallFolder locale
  !insertmacro InstallFolder osdmenu
  !insertmacro InstallFolder skins
  !insertmacro InstallFolder http
375
  !insertmacro InstallFolder share
376

377
  WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
378
    "${PRODUCT_WEB_SITE}"
379
  FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
380
381
382
383
  WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
    "${PRODUCT_WEB_SITE}/doc/"
  FileWrite $UninstallLog "Documentation.url$\r$\n"

384
  !insertmacro CloseUninstallLog
385

386
  ; Add VLC to "recomended programs" for the following extensions
387
  WriteRegStr HKCR Applications\vlc.exe "" ""
388
389
  WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
  WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC"
390
  WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \
391
    '$INSTDIR\vlc.exe --started-from-file "%1"'
392
  !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
393

394
395
  WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player"
  WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
396
    "$INSTDIR\vlc.exe --started-from-file cdda:%1"
397
398
  WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player"
  WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
399
    "$INSTDIR\vlc.exe --started-from-file dvd:%1"
gbazin's avatar
gbazin committed
400
401
402

  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie"
403
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
404
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
gbazin's avatar
gbazin committed
405
406
407
408
409
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "play"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"

  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio"
410
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --started-from-file",0'
411
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
gbazin's avatar
gbazin committed
412
413
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
414
415
416
  WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
  WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play"
  WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \
417
    '$INSTDIR\vlc.exe --started-from-file dvd:%1'
418
419
420
421
  WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
  WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
  WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play"
  WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \
422
    '$INSTDIR\vlc.exe --started-from-file cdda:%1'
423
  WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
424

425
426
427
428
429
430
431
432
433
434
435
436
  ; Vista detection
  ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  StrCpy $R1 $R0 3
  StrCmp $R1 '6.0' lbl_vista lbl_done

  lbl_vista:
  WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
  WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
  WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"

  lbl_done:

437
438
SectionEnd

439
Section "Start Menu Shortcut" SEC02a
440
441
  SectionIn 1 2 3
  CreateDirectory "$SMPROGRAMS\VideoLAN"
442
443
444
  CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings"
  CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Audio"
  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to DirectX (default).lnk" \
trax's avatar
trax committed
445
    "$INSTDIR\vlc.exe" "--aout aout_directx --save-config vlc:quit"
446
  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to Waveout.lnk" \
trax's avatar
trax committed
447
    "$INSTDIR\vlc.exe" "--aout waveout --save-config vlc:quit"
448
449
  CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Interface"
  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Skinnable.lnk" \
trax's avatar
trax committed
450
    "$INSTDIR\vlc.exe" "-I skins --save-config vlc:quit"
451
  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to wxWidgets (default).lnk" \
trax's avatar
trax committed
452
    "$INSTDIR\vlc.exe" "-I wxwin --save-config vlc:quit"
453
  CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Video"
454
  ; FIXME add detection for Vista. Direct3D will be default there, for all others it's DirectX
455
  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D.lnk" \
456
457
458
    "$INSTDIR\vlc.exe" "--vout direct3d --overlay --directx-hw-yuv --save-config vlc:quit"
  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D (no hardware acceleration).lnk" \
    "$INSTDIR\vlc.exe" "--vout direct3d --overlay --no-directx-hw-yuv --save-config vlc:quit"
459
  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX.lnk" \
460
    "$INSTDIR\vlc.exe" "--vout directx --overlay --directx-hw-yuv --save-config vlc:quit"
461
462
  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no hardware acceleration).lnk" \
    "$INSTDIR\vlc.exe" "--vout directx --no-overlay --no-directx-hw-yuv --save-config vlc:quit"
463
464
  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no video overlay).lnk" \
    "$INSTDIR\vlc.exe" "--vout directx --no-overlay --directx-hw-yuv --save-config vlc:quit"
465
  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to OpenGL.lnk" \
trax's avatar
trax committed
466
    "$INSTDIR\vlc.exe" "--vout opengl --overlay --save-config vlc:quit"
467
468
  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Reset VLC media player preferences and cache files.lnk" \
    "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache --save-config vlc:quit"
469
470
  CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
    "$INSTDIR\Documentation.url"
471
  CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
trax's avatar
trax committed
472
    "$INSTDIR\NEWS.txt" ""
473
474
475
  CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
    "$INSTDIR\${PRODUCT_GROUP} Website.url"
  CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
trax's avatar
trax committed
476
    "$INSTDIR\vlc.exe" ""
477
478
SectionEnd

479
480
481
Section "Desktop Shortcut" SEC02b
  SectionIn 1 2 3
  CreateShortCut "$DESKTOP\VLC media player.lnk" \
482
    "$INSTDIR\vlc.exe" ""
483
484
SectionEnd

485
486
Section /o "Mozilla plugin" SEC03
  SectionIn 3
487

488
  SetOutPath "$INSTDIR"
dionoea's avatar
Woops    
dionoea committed
489
  !insertmacro OpenUninstallLog
490
  !insertmacro InstallFile mozilla\npvlc.dll
491
  !insertmacro CloseUninstallLog
492

493
494
495
496
497
498
  !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
  WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
  WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
  WriteRegStr HKLM ${Moz} "Product" "VLC media player"
  WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
  WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
499

500
501
502
503
 ; for very old version of mozilla, these lines may be needed 
 ;Push $R0
 ;Push $R1
 ;Push $R2
504

505
506
 ;!define Index 'Line${__LINE__}'
 ;StrCpy $R1 "0"
507

508
 ;"${Index}-Loop:"
509

510
511
512
513
514
515
 ;  ; Check for Key
 ;  EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
 ;  StrCmp $R0 "" "${Index}-End"
 ;  IntOp $R1 $R1 + 1
 ;  ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
 ;  StrCmp $R2 "" "${Index}-Loop" ""
516

517
518
519
520
 ;  CopyFiles "$INSTDIR\npvlc.dll" "$R2"
 ;  !ifdef LIBVLC_DLL
 ;  CopyFiles ${LIBVLC_DLL} "$R2"
 ;  !endif
521
522
523
 ;  !ifdef LIBVLC_CONTROL_DLL
 ;  CopyFiles ${LIBVLC_CONTROL_DLL} "$R2"
 ;  !endif
524
 ;  Goto "${Index}-Loop"
525

526
527
 ;"${Index}-End:"
 ;!undef Index
528

529
530
SectionEnd

531
Section "ActiveX plugin" SEC04
532
  SectionIn 1 3
533
  SetOutPath "$INSTDIR"
dionoea's avatar
Woops    
dionoea committed
534
  !insertmacro OpenUninstallLog
535
536
  !insertmacro InstallFile activex\axvlc.dll
  !insertmacro CloseUninstallLog
537
  RegDLL "$INSTDIR\axvlc.dll"
538
539
SectionEnd

540
541
542
543
544
545
546
547
548
549
550
SectionGroup "File type associations" SEC06
  SectionGroup "Audio Files"
    !insertmacro MacroAudioExtensions RegisterExtensionSection
  SectionGroupEnd
  SectionGroup "Video Files"
    !insertmacro MacroVideoExtensions RegisterExtensionSection
  SectionGroupEnd
  SectionGroup "Other"
    !insertmacro MacroOtherExtensions RegisterExtensionSection
  SectionGroupEnd
SectionGroupEnd
551

552
553
554
Section /o "Context Menus" SEC05
  SectionIn 3
  !insertmacro MacroAllExtensions AddContextMenu
555
  !insertmacro AddContextMenuExt "Directory"
556
557
SectionEnd

558
559
Section /o "Delete preferences and cache" SEC07
  !insertmacro delprefs
560
561
SectionEnd

562
; Installer section descriptions
563
564
565
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} \
    "The media player itself"
566
567
568
569
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} \
    "Adds icons to your start menu for easy access"
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} \
    "Adds icon to your desktop for easy access"
570
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} \
571
    "The VLC Mozilla and Mozilla Firefox plugin"
572
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} \
573
574
    "The VLC ActiveX plugin"
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} \
575
    "Add context menu items ('Play With VLC' and 'Add To VLC's Playlist')"
576
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} \
577
    "Sets VLC media player as the default application for the specified file type"
578
579
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} \
    "Deletes VLC media player preferences and cache files leftover from previous installations"
580
581
!insertmacro MUI_FUNCTION_DESCRIPTION_END

582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
Function .onInit
  ReadRegStr $R0  ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
  "UninstallString"
  StrCmp $R0 "" done
 
  MessageBox MB_YESNO|MB_ICONEXCLAMATION \
  "VLC media player has already been installed. $\nDo you want to remove \
  the previous version before installing $(^Name) ?" \
  IDNO done
  
  ;Run the uninstaller
  ;uninst:
    ClearErrors
    ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
  done:
  !insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
599

600
601
602
603
604
Section -Post
  WriteUninstaller "$INSTDIR\uninstall.exe"
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
605

606
607
608
609
610
611
612
613
614
615
616
617
618
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
    "DisplayName" "$(^Name)"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
    "UninstallString" "$INSTDIR\uninstall.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
    "DisplayIcon" "$INSTDIR\vlc.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
    "DisplayVersion" "${PRODUCT_VERSION}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
    "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
    "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
619

620
621
622
623
;;;;;;;;;;;;;;;;;;;;;;;;
; Uninstaller sections ;
;;;;;;;;;;;;;;;;;;;;;;;;

624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
; TrimNewlines (copied from NSIS documentation)
; input, top of stack  (e.g. whatever$\r$\n)
; output, top of stack (replaces, with e.g. whatever)
; modifies no other variables.

Function un.TrimNewlines
 Exch $R0
 Push $R1
 Push $R2
 StrCpy $R1 0
 
 loop:
   IntOp $R1 $R1 - 1
   StrCpy $R2 $R0 1 $R1
   StrCmp $R2 "$\r" loop
   StrCmp $R2 "$\n" loop
   IntOp $R1 $R1 + 1
   IntCmp $R1 0 no_trim_needed
   StrCpy $R0 $R0 $R1
 
 no_trim_needed:
   Pop $R2
   Pop $R1
   Exch $R0
FunctionEnd

Function un.RemoveEmptyDirs
  Pop $9
  !define Index 'Line${__LINE__}'
  FindFirst $0 $1 "$INSTDIR$9*"
  StrCmp $0 "" "${Index}-End"
  "${Index}-Loop:"
    StrCmp $1 "" "${Index}-End"
    StrCmp $1 "." "${Index}-Next"
    StrCmp $1 ".." "${Index}-Next"
      Push $0
      Push $1
      Push $9
      Push "$9$1\"
      Call un.RemoveEmptyDirs
      Pop $9
      Pop $1
      Pop $0
    "${Index}-Remove:"
    RMDir "$INSTDIR$9$1"
    "${Index}-Next:"
    FindNext $0 $1
    Goto "${Index}-Loop"
  "${Index}-End:"
  FindClose $0
  !undef Index
FunctionEnd

677
678
Section "Uninstall" SEC91
  SectionIn 1 2 3 RO
679
680
  SetShellVarContext all

681
682
  !insertmacro MacroAllExtensions DeleteContextMenu
  !insertmacro MacroAllExtensions UnRegisterExtensionSection
683
  !insertmacro DeleteContextMenuExt "Directory"
684

685
  ;remove activex plugin
686
687
  UnRegDLL "$INSTDIR\axvlc.dll"
  Delete /REBOOTOK "$INSTDIR\axvlc.dll"
688

689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
  ;remove mozilla plugin
  Push $R0
  Push $R1
  Push $R2

  !define Index 'Line${__LINE__}'
  StrCpy $R1 "0"

  "${Index}-Loop:"

    ; Check for Key
    EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
    StrCmp $R0 "" "${Index}-End"
    IntOp $R1 $R1 + 1
    ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
    StrCmp $R2 "" "${Index}-Loop" ""

706
707
708
709
    ; old files (0.8.5 and before) that may be lying around
    Delete /REBOOTOK "$R2\npvlc.dll"
    Delete /REBOOTOK "$R2\libvlc.dll"
    Delete /REBOOTOK "$R2\vlcintf.xpt"
710
711
712
713
    Goto "${Index}-Loop"

  "${Index}-End:"
  !undef Index
714
  Delete /REBOOTOK "$INSTDIR\npvlc.dll"
715

716
717
  RMDir "$SMPROGRAMS\VideoLAN"
  RMDir /r $SMPROGRAMS\VideoLAN
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736

  FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
  UninstallLoop:
    ClearErrors
    FileRead $UninstallLog $R0
    IfErrors UninstallEnd
    Push $R0
    Call un.TrimNewLines
    Pop $R0
    Delete "$INSTDIR\$R0"
    Goto UninstallLoop
  UninstallEnd:
  FileClose $UninstallLog
  Delete "$INSTDIR\uninstall.log"
  Delete "$INSTDIR\uninstall.exe"
  Push "\"
  Call un.RemoveEmptyDirs
  RMDir "$INSTDIR"

737
738
739
  DeleteRegKey HKLM Software\VideoLAN

  DeleteRegKey HKCR Applications\vlc.exe
740
741
  DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
  DeleteRegKey HKCR DVD\shell\PlayWithVLC
gbazin's avatar
gbazin committed
742
743
744
745
  DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
  DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
  DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
  DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
746
  DeleteRegKey HKLM Software\Clients\Media\VLC
gbazin's avatar
gbazin committed
747
  DeleteRegKey HKCR "VLC.MediaFile"
748
749

  DeleteRegKey HKLM \
Jean-Paul Saman's avatar
Jean-Paul Saman committed
750
    "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
751
752

  DeleteRegKey HKLM \
Jean-Paul Saman's avatar
Jean-Paul Saman committed
753
    "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
754
755
756
757
758
759
760

  Delete "$DESKTOP\VLC media player.lnk"

  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
  SetAutoClose true
SectionEnd
761

762
Section /o "un.Delete preferences and cache" SEC92
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
  !insertmacro delprefs
SectionEnd

; Uninstaller section descriptions
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} \
    "Uninstall VLC media player and all its components"
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} \
    "Deletes VLC media player preferences and cache files"
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END

;Function un.onUninstSuccess
;  HideWindow
;  MessageBox MB_ICONINFORMATION|MB_OK \
;    "$(^Name) was successfully removed from your computer."
;FunctionEnd

Function un.onInit
781
  !insertmacro MUI_UNGETLANGUAGE
782
FunctionEnd