urlmon: Return E_INVALIDARG for empty pwzURI in CreateUri.

This commit is contained in:
Jacek Caban 2010-09-02 00:26:13 +02:00 committed by Alexandre Julliard
parent 77a046e863
commit d8bfb7f8db
2 changed files with 7 additions and 1 deletions

View File

@ -4492,6 +4492,7 @@ static void test_CreateUri_InvalidArgs(void) {
IUri *uri = (void*) 0xdeadbeef;
const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
static const WCHAR emptyW[] = {0};
hr = pCreateUri(http_urlW, 0, 0, NULL);
ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
@ -4504,6 +4505,11 @@ static void test_CreateUri_InvalidArgs(void) {
hr = pCreateUri(invalidW, 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);
uri = (void*) 0xdeadbeef;
hr = pCreateUri(emptyW, 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);
}
static void test_CreateUri_InvalidUri(void) {

View File

@ -4058,7 +4058,7 @@ HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IU
if(!ppURI)
return E_INVALIDARG;
if(!pwzURI) {
if(!pwzURI || !*pwzURI) {
*ppURI = NULL;
return E_INVALIDARG;
}