wininet: Also set last error on NULL first parameter in InternetCreateUrl{A, W}.

This commit is contained in:
Hans Leidekker 2007-08-09 18:34:09 +02:00 committed by Alexandre Julliard
parent d10891eab9
commit c1c6f4ad6b
2 changed files with 5 additions and 11 deletions

View File

@ -3663,10 +3663,7 @@ BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags,
TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength); TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
if (!lpUrlComponents) if (!lpUrlComponents || lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
return FALSE;
if (lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
{ {
INTERNET_SetLastError(ERROR_INVALID_PARAMETER); INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
@ -3733,10 +3730,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength); TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
if (!lpUrlComponents) if (!lpUrlComponents || lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
return FALSE;
if (lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
{ {
INTERNET_SetLastError(ERROR_INVALID_PARAMETER); INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;

View File

@ -404,11 +404,11 @@ static void InternetCreateUrlA_test(void)
host[] = "host"; host[] = "host";
/* test NULL lpUrlComponents */ /* test NULL lpUrlComponents */
ret = InternetCreateUrlA(NULL, 0, NULL, &len);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = InternetCreateUrlA(NULL, 0, NULL, &len);
ok(!ret, "Expected failure\n"); ok(!ret, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected 0xdeadbeef, got %d\n", GetLastError()); "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
ok(len == -1, "Expected len -1, got %d\n", len); ok(len == -1, "Expected len -1, got %d\n", len);
/* test zero'ed lpUrlComponents */ /* test zero'ed lpUrlComponents */