Commit 7c991833 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

shlwapi: Fix parameter check for UrlUnescapeA.

NULL pszUnescaped is okay if URL_UNESCAPE_INPLACE is set. Add a corresponding test for UrlUnescape{A,W}.
parent 8e7f30ef
......@@ -585,6 +585,9 @@ static void test_UrlUnescape(void)
WCHAR *urlW, *expected_urlW;
DWORD dwEscaped;
size_t i;
static char inplace[] = "file:///C:/Program%20Files";
static WCHAR inplaceW[] = {'f','i','l','e',':','/','/','/','C',':','/',
'P','r','o','g','r','a','m','%','2','0','F','i','l','e','s',0};
for(i=0; i<sizeof(TEST_URL_UNESCAPE)/sizeof(TEST_URL_UNESCAPE[0]); i++) {
dwEscaped=INTERNET_MAX_URL_LENGTH;
......@@ -601,6 +604,11 @@ static void test_UrlUnescape(void)
FreeWideString(expected_urlW);
}
dwEscaped = sizeof(inplace);
ok(UrlUnescapeA(inplace, NULL, &dwEscaped, URL_UNESCAPE_INPLACE) == S_OK, "UrlUnescapeA failed unexpectedly\n");
dwEscaped = sizeof(inplaceW);
ok(UrlUnescapeW(inplaceW, NULL, &dwEscaped, URL_UNESCAPE_INPLACE) == S_OK, "UrlUnescapeW failed unexpectedly\n");
}
static void test_PathSearchAndQualify(void)
......
......@@ -1117,7 +1117,7 @@ HRESULT WINAPI UrlUnescapeA(
TRACE("(%s, %p, %p, 0x%08lx)\n", debugstr_a(pszUrl), pszUnescaped,
pcchUnescaped, dwFlags);
if(!pszUrl || !pszUnescaped || !pcchUnescaped)
if(!pszUrl || (!pszUnescaped && !(dwFlags & URL_UNESCAPE_INPLACE)) || !pcchUnescaped)
return E_INVALIDARG;
if(dwFlags & URL_UNESCAPE_INPLACE)
......
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