Ge van Geldorp : urlmon/tests: Skip a couple of tests when IE is running in Enhanced Security Configuration .

Alexandre Julliard julliard at winehq.org
Sat Jan 10 11:16:43 CST 2009


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

Author: Ge van Geldorp <ge at gse.nl>
Date:   Thu Jan  8 13:34:42 2009 +0100

urlmon/tests: Skip a couple of tests when IE is running in Enhanced Security Configuration.

---

 dlls/urlmon/tests/misc.c |   43 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/dlls/urlmon/tests/misc.c b/dlls/urlmon/tests/misc.c
index 1de010d..b40341e 100644
--- a/dlls/urlmon/tests/misc.c
+++ b/dlls/urlmon/tests/misc.c
@@ -823,6 +823,27 @@ static void test_SecurityManager(void)
     IInternetSecurityManager_Release(secmgr);
 }
 
+/* Check if Internet Explorer is configured to run in "Enhanced Security Configuration" (aka hardened mode) */
+/* Note: this code is duplicated in dlls/mshtml/tests/dom.c, dlls/mshtml/tests/script.c and dlls/urlmon/tests/misc.c */
+static BOOL is_ie_hardened()
+{
+    HKEY zone_map;
+    DWORD ie_harden, type, size;
+
+    ie_harden = 0;
+    if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap",
+                    0, KEY_QUERY_VALUE, &zone_map) == ERROR_SUCCESS) {
+        size = sizeof(DWORD);
+        if (RegQueryValueEx(zone_map, "IEHarden", NULL, &type, (LPBYTE) &ie_harden, &size) != ERROR_SUCCESS ||
+            type != REG_DWORD) {
+            ie_harden = 0;
+        }
+    RegCloseKey(zone_map);
+    }
+
+    return ie_harden != 0;
+}
+
 static void test_url_action(IInternetSecurityManager *secmgr, IInternetZoneManager *zonemgr, DWORD action)
 {
     DWORD res, size, policy, reg_policy;
@@ -863,15 +884,19 @@ static void test_url_action(IInternetSecurityManager *secmgr, IInternetZoneManag
     ok(policy == reg_policy, "(%x) policy=%x, expected %x\n", action, policy, reg_policy);
 
     if(policy != URLPOLICY_QUERY) {
-        policy = 0xdeadbeef;
-        hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
-                sizeof(WCHAR), NULL, 0, 0, 0);
-        if(reg_policy == URLPOLICY_DISALLOW)
-            ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
-        else
-            ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
-        ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
-    }
+        if(winetest_interactive || ! is_ie_hardened()) {
+            policy = 0xdeadbeef;
+            hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
+                    sizeof(WCHAR), NULL, 0, 0, 0);
+            if(reg_policy == URLPOLICY_DISALLOW)
+                ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+            else
+                ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
+            ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
+        }else {
+            skip("IE running in Enhanced Security Configuration\n");
+        }
+	}
 }
 
 static void test_special_url_action(IInternetSecurityManager *secmgr, IInternetZoneManager *zonemgr, DWORD action)




More information about the wine-cvs mailing list