Detlef Riekenberg : urlmon: Implement ZoneManager_GetZoneAttributes.

Alexandre Julliard julliard at winehq.org
Mon Jun 22 09:04:15 CDT 2009


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

Author: Detlef Riekenberg <wine.dev at web.de>
Date:   Mon Jun 22 00:39:11 2009 +0200

urlmon: Implement ZoneManager_GetZoneAttributes.

---

 dlls/urlmon/sec_mgr.c |   91 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 89 insertions(+), 2 deletions(-)

diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c
index 943b6dd..19286b1 100644
--- a/dlls/urlmon/sec_mgr.c
+++ b/dlls/urlmon/sec_mgr.c
@@ -29,7 +29,67 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
 
+static const WCHAR currentlevelW[] = {'C','u','r','r','e','n','t','L','e','v','e','l',0};
+static const WCHAR descriptionW[] = {'D','e','s','c','r','i','p','t','i','o','n',0};
+static const WCHAR displaynameW[] = {'D','i','s','p','l','a','y','N','a','m','e',0};
 static const WCHAR fileW[] = {'f','i','l','e',0};
+static const WCHAR flagsW[] = {'F','l','a','g','s',0};
+static const WCHAR iconW[] = {'I','c','o','n',0};
+static const WCHAR minlevelW[] = {'M','i','n','L','e','v','e','l',0};
+static const WCHAR recommendedlevelW[] = {'R','e','c','o','m','m','e','n','d','e','d',
+                                          'L','e','v','e','l',0};
+
+/********************************************************************
+ * get_string_from_reg [internal]
+ *
+ * helper to get a string from the reg.
+ *
+ */
+static void get_string_from_reg(HKEY hcu, HKEY hklm, LPCWSTR name, LPWSTR out, DWORD maxlen)
+{
+    DWORD type = REG_SZ;
+    DWORD len = maxlen * sizeof(WCHAR);
+    DWORD res;
+
+    res = RegQueryValueExW(hcu, name, NULL, &type, (LPBYTE) out, &len);
+
+    if (res && hklm) {
+        len = maxlen * sizeof(WCHAR);
+        type = REG_SZ;
+        res = RegQueryValueExW(hklm, name, NULL, &type, (LPBYTE) out, &len);
+    }
+
+    if (res) {
+        TRACE("%s failed: %d\n", debugstr_w(name), res);
+        *out = '\0';
+    }
+}
+
+/********************************************************************
+ * get_dword_from_reg [internal]
+ *
+ * helper to get a dword from the reg.
+ *
+ */
+static void get_dword_from_reg(HKEY hcu, HKEY hklm, LPCWSTR name, LPDWORD out)
+{
+    DWORD type = REG_DWORD;
+    DWORD len = sizeof(DWORD);
+    DWORD res;
+
+    res = RegQueryValueExW(hcu, name, NULL, &type, (LPBYTE) out, &len);
+
+    if (res && hklm) {
+        len = sizeof(DWORD);
+        type = REG_DWORD;
+        res = RegQueryValueExW(hklm, name, NULL, &type, (LPBYTE) out, &len);
+    }
+
+    if (res) {
+        TRACE("%s failed: %d\n", debugstr_w(name), res);
+        *out = 0;
+    }
+}
 
 static HRESULT get_zone_from_reg(LPCWSTR schema, DWORD *zone)
 {
@@ -677,8 +737,35 @@ static HRESULT WINAPI ZoneMgrImpl_GetZoneAttributes(IInternetZoneManager* iface,
                                                     DWORD dwZone,
                                                     ZONEATTRIBUTES* pZoneAttributes)
 {
-    FIXME("(%p)->(%d %p) stub\n", iface, dwZone, pZoneAttributes);
-    return E_NOTIMPL;
+    ZoneMgrImpl* This = (ZoneMgrImpl*)iface;
+    HRESULT hr;
+    HKEY hcu;
+    HKEY hklm = NULL;
+
+    TRACE("(%p)->(%d %p)\n", This, dwZone, pZoneAttributes);
+
+    if (!pZoneAttributes)
+        return E_INVALIDARG;
+
+    hr = open_zone_key(HKEY_CURRENT_USER, dwZone, &hcu);
+    if (FAILED(hr))
+        return S_OK;  /* IE6 and older returned E_FAIL here */
+
+    hr = open_zone_key(HKEY_LOCAL_MACHINE, dwZone, &hklm);
+    if (FAILED(hr))
+        TRACE("Zone %d not in HKLM\n", dwZone);
+
+    get_string_from_reg(hcu, hklm, displaynameW, pZoneAttributes->szDisplayName, MAX_ZONE_PATH);
+    get_string_from_reg(hcu, hklm, descriptionW, pZoneAttributes->szDescription, MAX_ZONE_DESCRIPTION);
+    get_string_from_reg(hcu, hklm, iconW, pZoneAttributes->szIconPath, MAX_ZONE_PATH);
+    get_dword_from_reg(hcu, hklm, minlevelW, &pZoneAttributes->dwTemplateMinLevel);
+    get_dword_from_reg(hcu, hklm, currentlevelW, &pZoneAttributes->dwTemplateCurrentLevel);
+    get_dword_from_reg(hcu, hklm, recommendedlevelW, &pZoneAttributes->dwTemplateRecommended);
+    get_dword_from_reg(hcu, hklm, flagsW, &pZoneAttributes->dwFlags);
+
+    RegCloseKey(hklm);
+    RegCloseKey(hcu);
+    return S_OK;
 }
 
 /********************************************************************




More information about the wine-cvs mailing list