1 /*****************************************************************************
2 * win32_specific.c: Win32 specific features
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
5 * $Id: win32_specific.c,v 1.6 2002/04/02 23:43:57 gbazin Exp $
7 * Authors: Samuel Hocevar <sam@zoy.org>
8 * Gildas Bazin <gbazin@netcourrier.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
24 #include <errno.h> /* ENOMEM */
25 #include <string.h> /* strdup() */
26 #include <stdlib.h> /* free() */
31 #include <videolan/vlc.h>
33 /*****************************************************************************
34 * system_Init: initialize winsock and misc other things.
35 *****************************************************************************/
36 void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
42 /* Allocate structure */
43 p_main_sys = malloc( sizeof( main_sys_t ) );
44 if( p_main_sys == NULL )
46 intf_ErrMsg( "init error: can't create p_main_sys (%s)",
51 /* dynamically get the address of SignalObjectAndWait */
52 hInstLib = LoadLibrary( "kernel32" );
53 p_main_sys->SignalObjectAndWait =
54 (SIGNALOBJECTANDWAIT)GetProcAddress( hInstLib, "SignalObjectAndWait" );
56 /* WinSock Library Init. */
57 i_err = WSAStartup( MAKEWORD( 1, 1 ), &Data );
61 fprintf( stderr, "error: can't initiate WinSocks, error %i", i_err );
64 _fmode = _O_BINARY; /* sets the default file-translation mode */
67 /*****************************************************************************
68 * system_Configure: check for system specific configuration options.
69 *****************************************************************************/
70 void system_Configure( void )
72 p_main_sys->b_fast_pthread = config_GetIntVariable( "fast_pthread" );
75 /*****************************************************************************
76 * system_End: terminate winsock.
77 *****************************************************************************/
78 void system_End( void )