Commit 09e8a332 authored by Lei Zhang's avatar Lei Zhang Committed by Alexandre Julliard

mshtml: Added ProxyEnable / ProxyServer handling.

parent 089221fc
......@@ -301,6 +301,65 @@ static void set_lang(nsIPrefBranch *pref)
ERR("SetCharPref failed: %08x\n", nsres);
}
static void set_proxy(nsIPrefBranch *pref)
{
char proxy[512];
char * proxy_port;
int proxy_port_num;
DWORD enabled = 0, res, size, type;
HKEY hkey;
nsresult nsres;
static const WCHAR proxy_keyW[] =
{'S','o','f','t','w','a','r','e',
'\\','M','i','c','r','o','s','o','f','t',
'\\','W','i','n','d','o','w','s',
'\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',
'\\','I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',0};
res = RegOpenKeyW(HKEY_CURRENT_USER, proxy_keyW, &hkey);
if(res != ERROR_SUCCESS)
return;
size = sizeof(enabled);
res = RegQueryValueExA(hkey, "ProxyEnable", 0, &type, (LPBYTE)&enabled, &size);
if(res != ERROR_SUCCESS || type != REG_DWORD || enabled == 0)
{
RegCloseKey(hkey);
return;
}
size = sizeof(proxy);
res = RegQueryValueExA(hkey, "ProxyServer", 0, &type, (LPBYTE)proxy, &size);
RegCloseKey(hkey);
if(res != ERROR_SUCCESS || type != REG_SZ)
return;
proxy_port = strchr(proxy, ':');
if (!proxy_port)
return;
*proxy_port = 0;
proxy_port_num = atoi(proxy_port + 1);
TRACE("Setting proxy to %s, port %d\n", debugstr_a(proxy), proxy_port_num);
nsres = nsIPrefBranch_SetIntPref(pref, "network.proxy.type", 1);
if(NS_FAILED(nsres))
ERR("SetIntPref network.proxy.type failed: %08x\n", nsres);
nsres = nsIPrefBranch_SetCharPref(pref, "network.proxy.http", proxy);
if(NS_FAILED(nsres))
ERR("SetCharPref network.proxy.http failed: %08x\n", nsres);
nsres = nsIPrefBranch_SetIntPref(pref, "network.proxy.http_port", proxy_port_num);
if(NS_FAILED(nsres))
ERR("SetIntPref network.proxy.http_port failed: %08x\n", nsres);
nsres = nsIPrefBranch_SetCharPref(pref, "network.proxy.ssl", proxy);
if(NS_FAILED(nsres))
ERR("SetCharPref network.proxy.ssl failed: %08x\n", nsres);
nsres = nsIPrefBranch_SetIntPref(pref, "network.proxy.ssl_port", proxy_port_num);
if(NS_FAILED(nsres))
ERR("SetIntPref network.proxy.ssl_port failed: %08x\n", nsres);
}
static void set_bool_pref(nsIPrefBranch *pref, const char *pref_name, BOOL val)
{
nsresult nsres;
......@@ -347,6 +406,7 @@ static void set_profile(void)
}
set_lang(pref);
set_proxy(pref);
set_bool_pref(pref, "security.warn_entering_secure", FALSE);
set_bool_pref(pref, "security.warn_submit_insecure", FALSE);
......
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