Thomas Mullaly : urlmon: Added support for invalid flag combinations to CreateUri.

Alexandre Julliard julliard at winehq.org
Tue Aug 17 11:31:14 CDT 2010


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

Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date:   Sun Aug  1 16:29:27 2010 -0400

urlmon: Added support for invalid flag combinations to CreateUri.

---

 dlls/urlmon/tests/uri.c |    8 +++-----
 dlls/urlmon/uri.c       |   10 ++++++++++
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index bae4c33..2da6766 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -3683,11 +3683,9 @@ static void test_CreateUri_InvalidFlags(void) {
         IUri *uri = (void*) 0xdeadbeef;
 
         hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
-        todo_wine {
-            ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
-                    hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
-        }
-        todo_wine { ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri); }
+        ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
+                hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
+        ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
     }
 }
 
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index 1c831c7..ca7896a 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -3761,6 +3761,16 @@ HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IU
         return E_INVALIDARG;
     }
 
+    /* Check for invalid flags. */
+    if((dwFlags & Uri_CREATE_DECODE_EXTRA_INFO && dwFlags & Uri_CREATE_NO_DECODE_EXTRA_INFO) ||
+       (dwFlags & Uri_CREATE_CANONICALIZE && dwFlags & Uri_CREATE_NO_CANONICALIZE) ||
+       (dwFlags & Uri_CREATE_CRACK_UNKNOWN_SCHEMES && dwFlags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES) ||
+       (dwFlags & Uri_CREATE_PRE_PROCESS_HTML_URI && dwFlags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI) ||
+       (dwFlags & Uri_CREATE_IE_SETTINGS && dwFlags & Uri_CREATE_NO_IE_SETTINGS)) {
+        *ppURI = NULL;
+        return E_INVALIDARG;
+    }
+
     ret = heap_alloc(sizeof(Uri));
     if(!ret)
         return E_OUTOFMEMORY;




More information about the wine-cvs mailing list