/*****************************************************************************
* win32_specific.c: Win32 specific features
*****************************************************************************
- * Copyright (C) 2001-2004 VideoLAN
+ * Copyright (C) 2001-2004 the VideoLAN team
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <string.h> /* strdup() */
#include <stdlib.h> /* free() */
# include <fcntl.h>
#endif
-#include <winsock2.h>
+#include <winsock.h>
/*****************************************************************************
* system_Init: initialize winsock and misc other things.
else psz_path[0] = '\0';
#else
- if( !GetModuleFileName( NULL, psz_path, MAX_PATH ) )
+ if( ppsz_argv[0] )
+ {
+ GetFullPathName( ppsz_argv[0], MAX_PATH, psz_path, &psz_vlc );
+ }
+ else if( !GetModuleFileName( NULL, psz_path, MAX_PATH ) )
{
psz_path[0] = '\0';
}
/* Set the default file-translation mode */
#if !defined( UNDER_CE )
_fmode = _O_BINARY;
-#endif
_setmode( _fileno( stdin ), _O_BINARY ); /* Needed for pipes */
+#endif
/* Call mdate() once to make sure it is initialized properly */
mdate();
msg_Info( p_this, "one instance mode ENABLED");
/* Use a named mutex to check if another instance is already running */
- if( ( hmutex = CreateMutex( NULL, TRUE, "VLC ipc "VERSION ) ) == NULL )
+ if( !( hmutex = CreateMutex( 0, TRUE, _T("VLC ipc ") _T(VERSION) ) ) )
{
/* Failed for some reason. Just ignore the option and go on as
* normal. */
/* Locate the window created by the IPC helper thread of the
* 1st instance */
- if( ( ipcwindow = FindWindow( NULL, "VLC ipc "VERSION ) )
- == NULL )
+ if( !( ipcwindow = FindWindow( 0, _T("VLC ipc ") _T(VERSION) ) ) )
{
msg_Err( p_this, "one instance mode DISABLED "
"(couldn't find 1st instance of program)" );
MSG message;
ipcwindow =
- CreateWindow( "STATIC", /* name of window class */
- "VLC ipc "VERSION, /* window title bar text */
+ CreateWindow( _T("STATIC"), /* name of window class */
+ _T("VLC ipc ") _T(VERSION), /* window title bar text */
0, /* window style */
0, /* default X coordinate */
0, /* default Y coordinate */
{
i_options++;
}
-
- playlist_AddExt( p_playlist, ppsz_argv[i_opt],ppsz_argv[i_opt],
- PLAYLIST_APPEND | (i_opt? 0 : PLAYLIST_GO),
+ if( i_opt || config_GetInt( p_this, "playlist-enqueue" ) )
+ {
+ playlist_AddExt( p_playlist, ppsz_argv[i_opt],
+ ppsz_argv[i_opt], PLAYLIST_APPEND ,
PLAYLIST_END, -1,
(char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
i_options );
+ } else {
+ playlist_AddExt( p_playlist, ppsz_argv[i_opt],
+ ppsz_argv[i_opt], PLAYLIST_APPEND | PLAYLIST_GO,
+ PLAYLIST_END, -1,
+ (char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
+ i_options );
+ }
i_opt += i_options;
}
*****************************************************************************/
void system_End( vlc_t *p_this )
{
+ if( p_this && p_this->p_libvlc && p_this->p_libvlc->psz_vlcpath )
+ {
+ free( p_this->p_libvlc->psz_vlcpath );
+ p_this->p_libvlc->psz_vlcpath = NULL;
+ }
+
WSACleanup();
}