From 0daa39fa97a0b078ac09f3af56964d6bb4dcd4f1 Mon Sep 17 00:00:00 2001 From: Thomas Mullaly Date: Sun, 1 Aug 2010 16:29:27 -0400 Subject: [PATCH] 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 bae4c3327ba..2da67667d0b 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 1c831c7af44..ca7896ab298 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;