From 6fe495ce84bb78abd0093f7a7d853da74145630b Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 21 May 2008 15:01:04 -0700 Subject: [PATCH] mshtml: Added ProxyEnable / ProxyServer handling. --- dlls/mshtml/nsembed.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 60 insertions(+), 0 deletions(-) diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index c172e0d..2bae995 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -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_BINARY || 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); -- 1.5.3.6