Lei Zhang : mshtml: Added ProxyEnable / ProxyServer handling.

Alexandre Julliard julliard at winehq.org
Thu May 22 06:27:25 CDT 2008


Module: wine
Branch: master
Commit: 09e8a3328943d83c05c977ba21ad8a66577e6fe8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=09e8a3328943d83c05c977ba21ad8a66577e6fe8

Author: Lei Zhang <thestig at google.com>
Date:   Wed May 21 17:43:29 2008 -0700

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..87132f4 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_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);
 




More information about the wine-cvs mailing list