>From 8469607c810a14d594f77f2a6478a98e568fbeb2 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 30 Aug 2011 22:27:02 +1000
Subject: [PATCH] Correct MSXML Object Safety tests
To: wine-patches <wine-patches@winehq.org>

---
 dlls/msxml3/domdoc.c       |    5 +++--
 dlls/msxml3/httprequest.c  |    3 ++-
 dlls/msxml3/tests/domdoc.c |   21 +++++++++++----------
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index 2b2416d..5aadd2e 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -3428,9 +3428,10 @@ static HRESULT WINAPI domdoc_Safety_SetInterfaceSafetyOptions(IObjectSafety *ifa
     TRACE("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), mask, enabled);
 
     if ((mask & ~SAFETY_SUPPORTED_OPTIONS) != 0)
-        return E_FAIL;
+        return E_FAIL;    
+
+    This->safeopt = (This->safeopt & ~mask) | (mask & enabled);
 
-    This->safeopt = enabled & mask & SAFETY_SUPPORTED_OPTIONS;
     return S_OK;
 }
 
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index ea1fc43..69945e4 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -1129,7 +1129,8 @@ static HRESULT WINAPI httprequest_Safety_SetInterfaceSafetyOptions(IObjectSafety
     if ((mask & ~SAFETY_SUPPORTED_OPTIONS) != 0)
         return E_FAIL;
 
-    This->safeopt = enabled & mask & SAFETY_SUPPORTED_OPTIONS;
+    This->safeopt = (This->safeopt & ~mask) | (mask & enabled);
+
     return S_OK;
 }
 
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 2c3de42..42b3b05 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -4457,11 +4457,11 @@ static void _test_IObjectSafety_common(unsigned line, IObjectSafety *safety)
     ok_(__FILE__,line)(hr == S_OK, "ret %08x\n", hr );
     hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
     ok_(__FILE__,line)(hr == S_OK, "ret %08x\n", hr );
-    todo_wine
-    ok_(__FILE__,line)(broken(enabled == INTERFACESAFE_FOR_UNTRUSTED_CALLER) ||
-       enabled == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACE_USES_SECURITY_MANAGER) /* msxml3 SP8+ */,
-         "Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACE_USES_SECURITY_MANAGER), "
-         "got %08x\n", enabled);
+    ok_(__FILE__,line)(enabled == INTERFACESAFE_FOR_UNTRUSTED_CALLER, "Expected INTERFACESAFE_FOR_UNTRUSTED_CALLER got %08x\n", enabled);
+    ok_(__FILE__,line)(broken(supported == INTERFACESAFE_FOR_UNTRUSTED_CALLER) ||
+       supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER) /* msxml3 SP8+ */,
+         "Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER), "
+         "got %08x\n", supported);
 
     hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
                                                          INTERFACESAFE_FOR_UNTRUSTED_DATA,
@@ -4469,11 +4469,12 @@ static void _test_IObjectSafety_common(unsigned line, IObjectSafety *safety)
     ok_(__FILE__,line)(hr == S_OK, "ret %08x\n", hr );
     hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
     ok_(__FILE__,line)(hr == S_OK, "ret %08x\n", hr );
-    todo_wine
-    ok_(__FILE__,line)(broken(enabled == INTERFACESAFE_FOR_UNTRUSTED_DATA) ||
-       enabled == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA) /* msxml3 SP8+ */,
-        "Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA), "
-        "got %08x\n", enabled);
+    ok_(__FILE__,line)(enabled == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA),
+                       "expected INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA got %08x\n", enabled);
+    ok_(__FILE__,line)(broken(supported == INTERFACESAFE_FOR_UNTRUSTED_DATA) ||
+       supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER) /* msxml3 SP8+ */,
+        "Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER), "
+        "got %08x\n", supported);
 }
 
 static void test_XMLHTTP(void)
-- 
1.7.4.1

