Commit cc53b715 authored by Marian Durkovic's avatar Marian Durkovic

Fix one instance mode for Win32 in trunk

parent f8a10111
...@@ -39,6 +39,9 @@ ...@@ -39,6 +39,9 @@
#include <winsock.h> #include <winsock.h>
extern void __wgetmainargs(int *argc, wchar_t ***wargv, wchar_t ***wenviron,
int expand_wildcards, int *startupinfo);
/***************************************************************************** /*****************************************************************************
* system_Init: initialize winsock and misc other things. * system_Init: initialize winsock and misc other things.
*****************************************************************************/ *****************************************************************************/
...@@ -203,8 +206,37 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] ) ...@@ -203,8 +206,37 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
COPYDATASTRUCT wm_data; COPYDATASTRUCT wm_data;
int i_opt, i_data; int i_opt, i_data;
char *p_data; char *p_data;
wchar_t **wargv, **wenvp;
int si = { 0 };
i_data = sizeof(int); i_data = sizeof(int);
if( GetVersion() < 0x80000000 )
{
/* use unicode argv[] for Windows NT and above */
__wgetmainargs(&i_opt, &wargv, &wenvp, 0, &si);
for( i_opt = optind; i_opt < *pi_argc; i_opt++ )
{
i_data += sizeof(int);
i_data += WideCharToMultiByte( CP_UTF8, 0,
wargv[ i_opt ], -1, NULL, 0, NULL, NULL ) + 1;
}
p_data = (char *)malloc( i_data );
*((int *)&p_data[0]) = *pi_argc - optind;
i_data = sizeof(int);
for( i_opt = optind; i_opt < *pi_argc; i_opt++ )
{
int i_len = WideCharToMultiByte( CP_UTF8, 0,
wargv[ i_opt ], -1, NULL, 0, NULL, NULL ) + 1;
*((int *)&p_data[i_data]) = i_len;
i_data += sizeof(int);
WideCharToMultiByte( CP_UTF8, 0, wargv[ i_opt ], -1,
&p_data[i_data], i_len, NULL, NULL );
i_data += i_len;
}
}
else
{
for( i_opt = optind; i_opt < *pi_argc; i_opt++ ) for( i_opt = optind; i_opt < *pi_argc; i_opt++ )
{ {
i_data += sizeof(int); i_data += sizeof(int);
...@@ -222,6 +254,7 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] ) ...@@ -222,6 +254,7 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
memcpy( &p_data[i_data], ppsz_argv[ i_opt ], i_len ); memcpy( &p_data[i_data], ppsz_argv[ i_opt ], i_len );
i_data += i_len; i_data += i_len;
} }
}
/* Send our playlist items to the 1st instance */ /* Send our playlist items to the 1st instance */
wm_data.dwData = 0; wm_data.dwData = 0;
......
...@@ -176,7 +176,7 @@ NoBackup: ...@@ -176,7 +176,7 @@ NoBackup:
ReadRegStr $0 HKCR "VLC$R0" "" ReadRegStr $0 HKCR "VLC$R0" ""
WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)" WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
WriteRegStr HKCR "VLC$R0\shell" "" "Play" WriteRegStr HKCR "VLC$R0\shell" "" "Play"
WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --one-instance-when-started-from-file "%1"' WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0' WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
FunctionEnd FunctionEnd
...@@ -222,10 +222,10 @@ FunctionEnd ...@@ -222,10 +222,10 @@ FunctionEnd
!macro AddContextMenu EXT !macro AddContextMenu EXT
WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" "Play with VLC media player" WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" "Play with VLC media player"
WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '$INSTDIR\vlc.exe --one-instance-when-started-from-file --no-playlist-enqueue "%1"' 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 "" "Add to VLC media player's Playlist"
WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --one-instance-when-started-from-file --playlist-enqueue "%1"' WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --started-from-file --playlist-enqueue "%1"'
!macroend !macroend
!macro DeleteContextMenu EXT !macro DeleteContextMenu EXT
...@@ -354,15 +354,15 @@ Section "Media player (required)" SEC01 ...@@ -354,15 +354,15 @@ Section "Media player (required)" SEC01
WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player" WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC" WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC"
WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \ WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \
'$INSTDIR\vlc.exe --one-instance-when-started-from-file "%1"' '$INSTDIR\vlc.exe --started-from-file "%1"'
!insertmacro MacroAllExtensions WriteRegStrSupportedTypes !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player" WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player"
WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \ WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
"$INSTDIR\vlc.exe --one-instance-when-started-from-file cdda:%1" "$INSTDIR\vlc.exe --started-from-file cdda:%1"
WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player" WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player"
WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \ WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
"$INSTDIR\vlc.exe --one-instance-when-started-from-file dvd:%1" "$INSTDIR\vlc.exe --started-from-file dvd:%1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" "" 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" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie"
...@@ -373,19 +373,19 @@ Section "Media player (required)" SEC01 ...@@ -373,19 +373,19 @@ Section "Media player (required)" SEC01
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" "" 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" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --one-instance-when-started-from-file",0' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --started-from-file",0'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play" 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" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie" WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play" WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play"
WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \ WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \
'$INSTDIR\vlc.exe --one-instance-when-started-from-file dvd:%1' '$INSTDIR\vlc.exe --started-from-file dvd:%1'
WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0' WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio" WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play" WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play"
WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \ WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \
'$INSTDIR\vlc.exe --one-instance-when-started-from-file cdda:%1' '$INSTDIR\vlc.exe --started-from-file cdda:%1'
WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0' WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
SectionEnd SectionEnd
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment