Commit c79be420 authored by Thomas Mullaly's avatar Thomas Mullaly Committed by Alexandre Julliard

urlmon: CreateUri should return E_INVALIDARG for NULL args.

parent 3aa93e11
......@@ -20,7 +20,9 @@
/*
* IUri testing framework goals:
* - Test invalid flags
* - Test invalid args
* - invalid flags
* - invalid args (IUri, uri string)
* - Test parsing for components when no canonicalization occurs
* - Test parsing for components when canonicalization occurs.
* - More tests...
......@@ -75,6 +77,18 @@ static void test_CreateUri_InvalidFlags(void) {
}
}
static void test_CreateUri_InvalidArgs(void) {
HRESULT hr;
IUri *uri = (void*) 0xdeadbeef;
hr = pCreateUri(http_urlW, 0, 0, NULL);
ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
hr = pCreateUri(NULL, 0, 0, &uri);
ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
}
START_TEST(uri) {
HMODULE hurlmon;
......@@ -88,4 +102,7 @@ START_TEST(uri) {
trace("test CreateUri invalid flags...\n");
test_CreateUri_InvalidFlags();
trace("test CreateUri invalid args...\n");
test_CreateUri_InvalidArgs();
}
......@@ -296,6 +296,14 @@ HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IU
TRACE("(%s %x %x %p)\n", debugstr_w(pwzURI), dwFlags, (DWORD)dwReserved, ppURI);
if(!ppURI)
return E_INVALIDARG;
if(!pwzURI) {
*ppURI = NULL;
return E_INVALIDARG;
}
ret = heap_alloc(sizeof(Uri));
if(!ret)
return E_OUTOFMEMORY;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment