[PATCH] urlmon: [Patch 5] Implement GetZoneAttributes

Detlef Riekenberg wine.dev at web.de
Wed Jun 17 22:35:00 CDT 2009


---
 dlls/urlmon/sec_mgr.c       |   86 +++++++++++++++++++++++++++++++++++++++++-
 dlls/urlmon/tests/sec_mgr.c |    1 -
 2 files changed, 83 insertions(+), 4 deletions(-)

diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c
index 6a13eae..1bc21ac 100644
--- a/dlls/urlmon/sec_mgr.c
+++ b/dlls/urlmon/sec_mgr.c
@@ -29,7 +29,15 @@
 
 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};
 
 static HRESULT get_zone_from_reg(LPCWSTR schema, DWORD *zone)
 {
@@ -678,8 +686,80 @@ 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;
+    DWORD type;
+    DWORD len;
+    HKEY hkey;
+
+    TRACE("(%p)->(%d %p)\n", This, dwZone, pZoneAttributes);
+
+    if (pZoneAttributes && (dwZone < This->zone_count)) {
+        if (pZoneAttributes->cbSize != sizeof(ZONEATTRIBUTES))
+            FIXME("cbSize: %d requested\n", pZoneAttributes->cbSize);
+
+        memset(pZoneAttributes, 0, sizeof(ZONEATTRIBUTES));
+        pZoneAttributes->cbSize = sizeof(ZONEATTRIBUTES);
+
+        hr = open_zone_key(HKEY_CURRENT_USER, dwZone, &hkey);
+        if (FAILED(hr))
+            return hr;
+
+        type = REG_SZ;
+        len = MAX_PATH * sizeof(WCHAR);
+        hr = RegQueryValueExW(hkey, displaynameW, NULL, &type,
+                                (LPBYTE) pZoneAttributes->szDisplayName, &len);
+        if (hr)
+            TRACE("Displayname: got %0d\n", hr);
+
+        type = REG_SZ;
+        len = MAX_ZONE_DESCRIPTION * sizeof(WCHAR);
+        hr = RegQueryValueExW(hkey, descriptionW, NULL, &type,
+                                (LPBYTE) pZoneAttributes->szDescription, &len);
+        if (hr)
+            TRACE("Description: got %0d\n", hr);
+
+        type = REG_SZ;
+        len = MAX_PATH * sizeof(WCHAR);
+        hr = RegQueryValueExW(hkey, iconW, NULL, &type,
+                                (LPBYTE) pZoneAttributes->szIconPath, &len);
+        if (hr)
+            TRACE("Icon: got %0d\n", hr);
+
+        type = REG_DWORD;
+        len = sizeof(DWORD);
+        hr = RegQueryValueExW(hkey, minlevelW, NULL, &type,
+                                (LPBYTE) &pZoneAttributes->dwTemplateMinLevel, &len);
+        if (hr)
+            TRACE("MinLevel: got %0d\n", hr);
+
+
+        type = REG_DWORD;
+        len = sizeof(DWORD);
+        hr = RegQueryValueExW(hkey, currentlevelW, NULL, &type,
+                                (LPBYTE) &pZoneAttributes->dwTemplateCurrentLevel, &len);
+
+        if (hr)
+            TRACE("CurrentLevel: got %0d\n", hr);
+
+        type = REG_DWORD;
+        len = sizeof(DWORD);
+        hr = RegQueryValueExW(hkey, recommendedlevelW, NULL, &type,
+                                (LPBYTE) &pZoneAttributes->dwTemplateRecommended, &len);
+        if (hr)
+            TRACE("RecommendedLevel: got %0d\n", hr);
+
+        type = REG_DWORD;
+        len = sizeof(DWORD);
+        hr = RegQueryValueExW(hkey, flagsW, NULL, &type,
+                                (LPBYTE) &pZoneAttributes->dwFlags, &len);
+        if (hr)
+            TRACE("Flags: got %0d\n", hr);
+
+        RegCloseKey(hkey);
+        return S_OK;
+    }
+    return E_INVALIDARG;
 }
 
 /********************************************************************
@@ -801,7 +881,7 @@ static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManager* ifa
     *pdwCount = This->zone_count = 5;
     *pdwEnum = 0x7700cafe;
 
-    return E_NOTIMPL;
+    return S_OK;
 }
 
 /********************************************************************
diff --git a/dlls/urlmon/tests/sec_mgr.c b/dlls/urlmon/tests/sec_mgr.c
index 705fc02..bf6f834 100644
--- a/dlls/urlmon/tests/sec_mgr.c
+++ b/dlls/urlmon/tests/sec_mgr.c
@@ -324,7 +324,6 @@ static void test_CreateZoneEnumerator(void)
     dwCount=0xdeadbeef;
     /* Normal use */
     hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 0);
-    todo_wine
     ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
 
     if (SUCCEEDED(hr)) {
-- 
1.5.4.3


--=-igctYDOLz7m4Z+hi9mZn--




More information about the wine-patches mailing list