Ge van Geldorp : mshtml/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: b67f0de1c64fcfc2fa6d6f5ce453b7b0f0323666
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b67f0de1c64fcfc2fa6d6f5ce453b7b0f0323666

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

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

---

 dlls/mshtml/tests/dom.c    |   27 ++++++++++++++++++++++++++-
 dlls/mshtml/tests/script.c |   33 +++++++++++++++++++++++++++++----
 2 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 46136c1..03068d1 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -4001,6 +4001,27 @@ static void gecko_installer_workaround(BOOL disable)
     RegCloseKey(hkey);
 }
 
+/* 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;
+}
+
 START_TEST(dom)
 {
     gecko_installer_workaround(TRUE);
@@ -4009,7 +4030,11 @@ START_TEST(dom)
     run_domtest(doc_str1, test_doc_elem);
     run_domtest(range_test_str, test_txtrange);
     run_domtest(range_test2_str, test_txtrange2);
-    run_domtest(elem_test_str, test_elems);
+    if (winetest_interactive || ! is_ie_hardened()) {
+        run_domtest(elem_test_str, test_elems);
+    }else {
+        skip("IE running in Enhanced Security Configuration\n");
+    }
     run_domtest(doc_blank, test_create_elems);
     run_domtest(doc_blank, test_defaults);
     run_domtest(indent_test_str, test_indent);
diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c
index 32f0974..30be52c 100644
--- a/dlls/mshtml/tests/script.c
+++ b/dlls/mshtml/tests/script.c
@@ -1137,16 +1137,41 @@ static void gecko_installer_workaround(BOOL disable)
     RegCloseKey(hkey);
 }
 
+/* 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;
+}
+
 START_TEST(script)
 {
     gecko_installer_workaround(TRUE);
     CoInitialize(NULL);
 
-    if(register_script_engine()) {
-        test_simple_script();
-        init_registry(FALSE);
+    if(winetest_interactive || ! is_ie_hardened()) {
+        if(register_script_engine()) {
+            test_simple_script();
+            init_registry(FALSE);
+        }else {
+            skip("Could not register TestScript engine\n");
+        }
     }else {
-        skip("Could not register TestScript engine\n");
+        skip("IE running in Enhanced Security Configuration\n");
     }
 
     CoUninitialize();




More information about the wine-cvs mailing list