wininet: Fix up and test InternetSetCookie parameter checking.
This commit is contained in:
parent
7b3cf21dc1
commit
68d18612a0
|
@ -402,9 +402,9 @@ BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
||||||
TRACE("(%s,%s,%s)\n", debugstr_w(lpszUrl),
|
TRACE("(%s,%s,%s)\n", debugstr_w(lpszUrl),
|
||||||
debugstr_w(lpszCookieName), debugstr_w(lpCookieData));
|
debugstr_w(lpszCookieName), debugstr_w(lpCookieData));
|
||||||
|
|
||||||
if (!lpCookieData || !strlenW(lpCookieData))
|
if (!lpCookieData)
|
||||||
{
|
{
|
||||||
TRACE("no cookie data, not adding\n");
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!lpszCookieName)
|
if (!lpszCookieName)
|
||||||
|
|
|
@ -123,6 +123,9 @@ static void test_null(void)
|
||||||
{
|
{
|
||||||
HINTERNET hi, hc;
|
HINTERNET hi, hc;
|
||||||
static const WCHAR szServer[] = { 's','e','r','v','e','r',0 };
|
static const WCHAR szServer[] = { 's','e','r','v','e','r',0 };
|
||||||
|
static const WCHAR szEmpty[] = { 0 };
|
||||||
|
static const WCHAR szUrl[] = { 'h','t','t','p',':','/','/','a','.','b','.','c',0 };
|
||||||
|
BOOL r;
|
||||||
|
|
||||||
hi = InternetOpenW(NULL, 0, NULL, NULL, 0);
|
hi = InternetOpenW(NULL, 0, NULL, NULL, 0);
|
||||||
ok(hi != NULL, "open failed\n");
|
ok(hi != NULL, "open failed\n");
|
||||||
|
@ -152,6 +155,35 @@ static void test_null(void)
|
||||||
ok(hc == NULL, "connect failed\n");
|
ok(hc == NULL, "connect failed\n");
|
||||||
|
|
||||||
InternetCloseHandle(hi);
|
InternetCloseHandle(hi);
|
||||||
|
|
||||||
|
r = InternetSetCookieW(NULL, NULL, NULL);
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
|
||||||
|
ok(r == FALSE, "return wrong\n");
|
||||||
|
|
||||||
|
r = InternetSetCookieW(szServer, NULL, NULL);
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
|
||||||
|
ok(r == FALSE, "return wrong\n");
|
||||||
|
|
||||||
|
r = InternetSetCookieW(szUrl, szServer, NULL);
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
|
||||||
|
ok(r == FALSE, "return wrong\n");
|
||||||
|
|
||||||
|
r = InternetSetCookieW(szUrl, szServer, szServer);
|
||||||
|
ok(r == TRUE, "return wrong\n");
|
||||||
|
|
||||||
|
todo_wine {
|
||||||
|
r = InternetSetCookieW(szUrl, NULL, szServer);
|
||||||
|
ok(r == TRUE, "return wrong\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
r = InternetSetCookieW(szUrl, szServer, szEmpty);
|
||||||
|
ok(r == TRUE, "return wrong\n");
|
||||||
|
|
||||||
|
r = InternetSetCookieW(szServer, NULL, szServer);
|
||||||
|
todo_wine {
|
||||||
|
ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME, "wrong error\n");
|
||||||
|
}
|
||||||
|
ok(r == FALSE, "return wrong\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(internet)
|
START_TEST(internet)
|
||||||
|
|
Loading…
Reference in New Issue