Page 1 of 1

Registering VLC for use with "Default Programs" in Windows

Posted: 13 Dec 2009 20:46
by cs42
Hi,

After reinstalling my computer (Win 7 x64) I got a little bit tiered to remove each single default file association of windows media player manually. So I started looking for a way to set VLC as default player in the default programs options dialog and finally the appropriate documentationfor the required registry settings at http://msdn.microsoft.com/en-us/library ... S.85).aspx .
Actually only few a registry keys to be added:

Code: Select all

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications] "VLC media player"="SOFTWARE\\VideoLAN\\VLC\\Capabilities" [HKEY_LOCAL_MACHINE\SOFTWARE\VideoLAN\VLC\Capabilities] "ApplicationDescription"="[DESCRIPTION WHICH IS SHOWN IN THE DEFAULT PROGRAMS DIALOG]" [HKEY_LOCAL_MACHINE\SOFTWARE\VideoLAN\VLC\Capabilities\FileAssociations] ".asf"="VLC.asf" ".asx"="VLC.asx" ".avi"="VLC.avi" ".bin"="VLC.bin" ".cue"="VLC.cue" ".divx"="VLC.divx" ".dv"="VLC.dv" ".flv"="VLC.flv" ".gxf"="VLC.gxf" ".ifo"="VLC.ifo" ".m1v"="VLC.m1v" ".m2ts"="VLC.m2ts" ".m2v"="VLC.m2v" ".m3u"="VLC.m3u" ".m4v"="VLC.m4v" ".mkv"="VLC.mkv" ".mov"="VLC.mov" ".mp4"="VLC.mp4" ".mpeg"="VLC.mpeg" ".mpeg1"="VLC.mpeg1" ".mpeg2"="VLC.mpeg2" ".mpeg4"="VLC.mpeg4" ".mpg"="VLC.mpg" ".mts"="VLC.mts" ".mxf"="VLC.mxf" ".nuv"="VLC.nuv" ".ogg"="VLC.ogg" ".ogm"="VLC.ogm" ".ogv"="VLC.ogv" ".ogx"="VLC.ogx" ".pls"="VLC.pls" ".rmvb"="VLC.rmvb" ".ts"="VLC.ts" ".vlc"="VLC.vlc" ".vob"="VLC.vob" ".wmv"="VLC.wmv" ".xspf"="VLC.xspf"
Some file types like .mp3 are missing because VLC did not create the required settings in HKEY_LOCAL_MACHINE\SOFTWARE\Classes and I did not want to add them manually. Furthermore the key HKEY_LOCAL_MACHINE\SOFTWARE\VideoLAN\VLC\shell\open\command as mentioned in the documentation was not needed (or windows did not seem to care that it was missing :roll: ) because in the file type (e.g. VLC.asf) settings the execution and parameters were already specified.

Using a 64bit Windows to import the settings manually ”HKEY_LOCAL_MACHINE\SOFTWARE\” has to be replaced with “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\” . During installation this should not be a problem because windows should automatically remap the 32bit application to the appropriate path.

Re: Registering VLC for use with "Default Programs" in Windows

Posted: 14 Dec 2009 00:16
by Jean-Baptiste Kempf
Can't you provide a patch against our installer?

Re: Registering VLC for use with "Default Programs" in Windows

Posted: 14 Dec 2009 05:09
by cs42
I've started looking in the vlc.win32.nsi file. It turn's out VLC can already the appropriate registry keys. However it checks for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion for version 6.0 (= VISTA) and Windows 7 is version 6.1 the the registry keys are not added.

However i've never worked with NSI so if somebody else could add the additional check for Windows 7 i'd be pretty happy :roll: :roll: :roll:

Code: Select all

Function RegisterExtension [...] ;;; Vista Only part ; 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" [...]

Code: Select all

;;;;;;;;;;;;;;;;;;;;;; ; Installer sections ; ; The CORE of the ; ; installer ; ;;;;;;;;;;;;;;;;;;;;;; Section $Name_Section01 SEC01 [...] ; Vista Registration ; 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: SectionEnd [...]
Update:
After a litle morw searching it turn's out that viewtopic.php?f=14&t=67530 is actually related to this. sorry for the double post :cry: