Hans Leidekker : wininet: Implement IsDomainLegalCookieDomainW.
Alexandre Julliard
julliard at winehq.org
Fri Jan 30 07:58:11 CST 2009
Module: wine
Branch: master
Commit: 2d42f291c81ee400f0e34b054ca70402563da404
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2d42f291c81ee400f0e34b054ca70402563da404
Author: Hans Leidekker <hans at codeweavers.com>
Date: Thu Jan 29 16:59:33 2009 +0100
wininet: Implement IsDomainLegalCookieDomainW.
---
dlls/wininet/cookie.c | 25 ++++++++
dlls/wininet/tests/internet.c | 131 +++++++++++++++++++++++++++++++++++++++++
dlls/wininet/wininet.spec | 2 +-
3 files changed, 157 insertions(+), 1 deletions(-)
diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c
index 1ee8809..c6352c8 100644
--- a/dlls/wininet/cookie.c
+++ b/dlls/wininet/cookie.c
@@ -696,3 +696,28 @@ BOOL WINAPI InternetSetPerSiteCookieDecisionW( LPCWSTR pchHostName, DWORD dwDeci
FIXME("(%s, 0x%08x) stub\n", debugstr_w(pchHostName), dwDecision);
return FALSE;
}
+
+/***********************************************************************
+ * IsDomainLegalCookieDomainW (WININET.@)
+ */
+BOOL WINAPI IsDomainLegalCookieDomainW( LPCWSTR s1, LPCWSTR s2 )
+{
+ const WCHAR *p;
+
+ FIXME("(%s, %s)\n", debugstr_w(s1), debugstr_w(s2));
+
+ if (!s1 || !s2)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+ if (s1[0] == '.' || !s1[0] || s2[0] == '.' || !s2[0])
+ {
+ SetLastError(ERROR_INVALID_NAME);
+ return FALSE;
+ }
+ if (!(p = strchrW(s2, '.'))) return FALSE;
+ if (strchrW(p + 1, '.') && !strcmpW(p + 1, s1)) return TRUE;
+ else if (!strcmpW(s1, s2)) return TRUE;
+ return FALSE;
+}
diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c
index 5fbfd76..13a5f5c 100644
--- a/dlls/wininet/tests/internet.c
+++ b/dlls/wininet/tests/internet.c
@@ -31,6 +31,7 @@ static BOOL (WINAPI *pInternetTimeFromSystemTimeA)(CONST SYSTEMTIME *,DWORD ,LPS
static BOOL (WINAPI *pInternetTimeFromSystemTimeW)(CONST SYSTEMTIME *,DWORD ,LPWSTR ,DWORD);
static BOOL (WINAPI *pInternetTimeToSystemTimeA)(LPCSTR ,SYSTEMTIME *,DWORD);
static BOOL (WINAPI *pInternetTimeToSystemTimeW)(LPCWSTR ,SYSTEMTIME *,DWORD);
+static BOOL (WINAPI *pIsDomainLegalCookieDomainW)(LPCWSTR, LPCWSTR);
/* ############################### */
@@ -526,6 +527,131 @@ static void InternetTimeToSystemTimeW_test(void)
ok( ret, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
}
+static void test_IsDomainLegalCookieDomainW(void)
+{
+ BOOL ret;
+ DWORD error;
+ static const WCHAR empty[] = {0};
+ static const WCHAR dot[] = {'.',0};
+ static const WCHAR uk[] = {'u','k',0};
+ static const WCHAR com[] = {'c','o','m',0};
+ static const WCHAR dot_com[] = {'.','c','o','m',0};
+ static const WCHAR gmail_com[] = {'g','m','a','i','l','.','c','o','m',0};
+ static const WCHAR dot_gmail_com[] = {'.','g','m','a','i','l','.','c','o','m',0};
+ static const WCHAR mail_gmail_com[] = {'m','a','i','l','.','g','m','a','i','l','.','c','o','m',0};
+ static const WCHAR gmail_co_uk[] = {'g','m','a','i','l','.','c','o','.','u','k',0};
+ static const WCHAR co_uk[] = {'c','o','.','u','k',0};
+ static const WCHAR dot_co_uk[] = {'.','c','o','.','u','k',0};
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(NULL, NULL);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+ ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(com, NULL);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+ ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(NULL, gmail_com);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+ ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(empty, gmail_com);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+ ok(error == ERROR_INVALID_NAME, "got %u expected ERROR_INVALID_NAME\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(com, empty);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+ ok(error == ERROR_INVALID_NAME, "got %u expected ERROR_INVALID_NAME\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(gmail_com, dot);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+ ok(error == ERROR_INVALID_NAME, "got %u expected ERROR_INVALID_NAME\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(dot, gmail_com);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+ ok(error == ERROR_INVALID_NAME, "got %u expected ERROR_INVALID_NAME\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(com, com);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+ ok(error == 0xdeadbeef, "got %u expected 0xdeadbeef\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(com, dot_com);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+ ok(error == ERROR_INVALID_NAME, "got %u expected ERROR_INVALID_NAME\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(dot_com, com);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+ ok(error == ERROR_INVALID_NAME, "got %u expected ERROR_INVALID_NAME\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(com, gmail_com);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+ ok(error == 0xdeadbeef, "got %u expected 0xdeadbeef\n", error);
+
+ ret = pIsDomainLegalCookieDomainW(gmail_com, gmail_com);
+ ok(ret, "IsDomainLegalCookieDomainW failed\n");
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(gmail_co_uk, co_uk);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW failed\n");
+ ok(error == 0xdeadbeef, "got %u expected 0xdeadbeef\n", error);
+
+ ret = pIsDomainLegalCookieDomainW(uk, co_uk);
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+
+ ret = pIsDomainLegalCookieDomainW(gmail_co_uk, dot_co_uk);
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+
+ ret = pIsDomainLegalCookieDomainW(gmail_co_uk, gmail_co_uk);
+ ok(ret, "IsDomainLegalCookieDomainW failed\n");
+
+ ret = pIsDomainLegalCookieDomainW(gmail_com, com);
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+
+ SetLastError(0xdeadbeef);
+ ret = pIsDomainLegalCookieDomainW(dot_gmail_com, mail_gmail_com);
+ error = GetLastError();
+ ok(!ret, "IsDomainLegalCookieDomainW failed\n");
+ ok(error == ERROR_INVALID_NAME, "got %u expected ERROR_INVALID_NAME\n", error);
+
+ ret = pIsDomainLegalCookieDomainW(gmail_com, mail_gmail_com);
+ ok(ret, "IsDomainLegalCookieDomainW failed\n");
+
+ ret = pIsDomainLegalCookieDomainW(mail_gmail_com, gmail_com);
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+
+ ret = pIsDomainLegalCookieDomainW(mail_gmail_com, com);
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+
+ ret = pIsDomainLegalCookieDomainW(dot_gmail_com, mail_gmail_com);
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+
+ ret = pIsDomainLegalCookieDomainW(mail_gmail_com, dot_gmail_com);
+ ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
+}
+
/* ############################### */
START_TEST(internet)
@@ -536,6 +662,7 @@ START_TEST(internet)
pInternetTimeFromSystemTimeW = (void*)GetProcAddress(hdll, "InternetTimeFromSystemTimeW");
pInternetTimeToSystemTimeA = (void*)GetProcAddress(hdll, "InternetTimeToSystemTimeA");
pInternetTimeToSystemTimeW = (void*)GetProcAddress(hdll, "InternetTimeToSystemTimeW");
+ pIsDomainLegalCookieDomainW = (void*)GetProcAddress(hdll, (LPCSTR)117);
test_InternetCanonicalizeUrlA();
test_InternetQueryOptionA();
@@ -552,4 +679,8 @@ START_TEST(internet)
InternetTimeToSystemTimeA_test();
InternetTimeToSystemTimeW_test();
}
+ if (!pIsDomainLegalCookieDomainW)
+ skip("skipping IsDomainLegalCookieDomainW tests\n");
+ else
+ test_IsDomainLegalCookieDomainW();
}
diff --git a/dlls/wininet/wininet.spec b/dlls/wininet/wininet.spec
index f5b616e..8db462c 100644
--- a/dlls/wininet/wininet.spec
+++ b/dlls/wininet/wininet.spec
@@ -9,7 +9,7 @@
111 stub -noname ExportCookieFileW
112 stub -noname IsProfilesEnabled
116 stub -noname IsDomainlegalCookieDomainA
-117 stub -noname IsDomainLegalCookieDomainW
+117 stdcall -noname IsDomainLegalCookieDomainW(wstr wstr)
118 stub -noname FindP3PPolicySymbol
120 stub -noname MapResourceToPolicy
121 stub -noname GetP3PPolicy
More information about the wine-cvs
mailing list