urlmon: Added support for invalid flag combinations to CreateUri.

This commit is contained in:
Thomas Mullaly 2010-08-01 16:29:27 -04:00 committed by Alexandre Julliard
parent b3ad7469d0
commit 0daa39fa97
2 changed files with 13 additions and 5 deletions

View File

@ -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(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
}
}

View File

@ -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;