wininet: Set ProxyEnable registry value if it isn't already set.

This commit is contained in:
Hans Leidekker 2008-03-30 19:17:54 +01:00 committed by Alexandre Julliard
parent e4c59c263d
commit ed1cb1f099
1 changed files with 31 additions and 33 deletions

View File

@ -357,16 +357,15 @@ static BOOL INTERNET_ConfigureProxy( LPWININETAPPINFOW lpwai )
if (RegOpenKeyW( HKEY_CURRENT_USER, szInternetSettings, &key )) return FALSE; if (RegOpenKeyW( HKEY_CURRENT_USER, szInternetSettings, &key )) return FALSE;
len = sizeof enabled; len = sizeof enabled;
if (!RegQueryValueExW( key, szProxyEnable, NULL, &type, (BYTE *)&enabled, &len ) && if (RegQueryValueExW( key, szProxyEnable, NULL, &type, (BYTE *)&enabled, &len ) || type != REG_DWORD)
(type == REG_DWORD)) RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE *)&enabled, sizeof(REG_DWORD) );
{
if (enabled) if (enabled)
{ {
TRACE("Proxy is enabled.\n"); TRACE("Proxy is enabled.\n");
/* figure out how much memory the proxy setting takes */ /* figure out how much memory the proxy setting takes */
if (!RegQueryValueExW( key, szProxyServer, NULL, &type, NULL, &len ) && if (!RegQueryValueExW( key, szProxyServer, NULL, &type, NULL, &len ) && len && (type == REG_SZ))
len && (type == REG_SZ))
{ {
LPWSTR szProxy, p; LPWSTR szProxy, p;
static const WCHAR szHttp[] = {'h','t','t','p','=',0}; static const WCHAR szHttp[] = {'h','t','t','p','=',0};
@ -396,7 +395,6 @@ static BOOL INTERNET_ConfigureProxy( LPWININETAPPINFOW lpwai )
else else
ERR("Couldn't read proxy server settings from registry.\n"); ERR("Couldn't read proxy server settings from registry.\n");
} }
}
else if ((envproxy = getenv( "http_proxy" ))) else if ((envproxy = getenv( "http_proxy" )))
{ {
WCHAR *envproxyW; WCHAR *envproxyW;