demux: libmp4: add and parse 3DDS uuid
[vlc.git] / src / win32 / netconf.c
blobaccdddf2ce2ab35d6b89268f9b5d171959711f23
1 /*****************************************************************************
2 * netconf.c : Network configuration
3 *****************************************************************************
4 * Copyright (C) 2001-2008 VLC authors and VideoLAN
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifdef HAVE_CONFIG_H
22 # include "config.h"
23 #endif
25 #include <string.h>
26 #include <windows.h>
28 #include <vlc_common.h>
29 #include <vlc_network.h>
31 char *vlc_getProxyUrl(const char *url)
33 char *proxy_url = NULL;
34 #if 0
35 /* Try to get the proxy server address from Windows internet settings. */
36 HKEY h_key;
38 /* Open the key */
39 if( RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Microsoft"
40 "\\Windows\\CurrentVersion\\Internet Settings",
41 0, KEY_READ, &h_key ) == ERROR_SUCCESS )
42 return NULL;
44 DWORD len = sizeof( DWORD );
45 BYTE proxyEnable;
47 /* Get the proxy enable value */
48 if( RegQueryValueEx( h_key, "ProxyEnable", NULL, NULL,
49 &proxyEnable, &len ) != ERROR_SUCCESS
50 || !proxyEnable )
51 goto out;
53 /* Proxy is enabled */
54 /* Get the proxy URL :
55 Proxy server value in the registry can be something like "address:port"
56 or "ftp=address1:port1;http=address2:port2 ..."
57 depending of the configuration. */
58 unsigned char key[256];
60 len = sizeof( key );
61 if( RegQueryValueEx( h_key, "ProxyServer", NULL, NULL,
62 key, &len ) == ERROR_SUCCESS )
64 /* FIXME: This is lame. The string should be tokenized. */
65 #warning FIXME.
66 char *psz_proxy = strstr( (char *)key, "http=" );
67 if( psz_proxy != NULL )
69 psz_proxy += 5;
70 char *end = strchr( psz_proxy, ';' );
71 if( end != NULL )
72 *end = '\0';
74 else
75 psz_proxy = (char *)key;
76 proxy_url = strdup( psz_proxy );
79 out:
80 RegCloseKey( h_key );
81 #endif
82 return proxy_url;