2003-06-21 01:26:56 +02:00
|
|
|
/*
|
|
|
|
* Wininet - cookie handling stuff
|
|
|
|
*
|
|
|
|
* Copyright 2002 TransGaming Technologies Inc.
|
|
|
|
*
|
|
|
|
* David Hammerton
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-06-21 01:26:56 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2004-09-03 20:30:28 +02:00
|
|
|
#include "wine/port.h"
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2008-12-09 11:33:25 +01:00
|
|
|
#if defined(__MINGW32__) || defined (_MSC_VER)
|
|
|
|
#include <ws2tcpip.h>
|
|
|
|
#endif
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2003-06-21 01:26:56 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2003-08-08 23:07:23 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2003-06-21 01:26:56 +02:00
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wininet.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "internet.h"
|
|
|
|
|
|
|
|
#define RESPONSE_TIMEOUT 30 /* FROM internet.c */
|
|
|
|
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
|
|
|
|
|
|
|
/* FIXME
|
|
|
|
* Cookies are currently memory only.
|
|
|
|
* Cookies are NOT THREAD SAFE
|
2005-01-26 22:09:04 +01:00
|
|
|
* Cookies could use A LOT OF MEMORY. We need some kind of memory management here!
|
2003-06-21 01:26:56 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _cookie_domain cookie_domain;
|
|
|
|
typedef struct _cookie cookie;
|
|
|
|
|
|
|
|
struct _cookie
|
|
|
|
{
|
2004-07-21 21:36:53 +02:00
|
|
|
struct list entry;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
|
|
|
struct _cookie_domain *parent;
|
|
|
|
|
2004-03-30 22:38:08 +02:00
|
|
|
LPWSTR lpCookieName;
|
|
|
|
LPWSTR lpCookieData;
|
2009-02-18 15:32:26 +01:00
|
|
|
FILETIME expiry;
|
2003-06-21 01:26:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _cookie_domain
|
|
|
|
{
|
2004-07-21 21:36:53 +02:00
|
|
|
struct list entry;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2004-03-30 22:38:08 +02:00
|
|
|
LPWSTR lpCookieDomain;
|
|
|
|
LPWSTR lpCookiePath;
|
2004-07-21 21:36:53 +02:00
|
|
|
struct list cookie_list;
|
2003-06-21 01:26:56 +02:00
|
|
|
};
|
|
|
|
|
2004-07-21 21:36:53 +02:00
|
|
|
static struct list domain_list = LIST_INIT(domain_list);
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2009-02-18 15:32:26 +01:00
|
|
|
static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR data, FILETIME expiry);
|
2004-03-30 22:38:08 +02:00
|
|
|
static cookie *COOKIE_findCookie(cookie_domain *domain, LPCWSTR lpszCookieName);
|
2003-06-21 01:26:56 +02:00
|
|
|
static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain);
|
2004-03-30 22:38:08 +02:00
|
|
|
static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path);
|
2003-06-21 01:26:56 +02:00
|
|
|
static void COOKIE_deleteDomain(cookie_domain *deadDomain);
|
|
|
|
|
|
|
|
|
|
|
|
/* adds a cookie to the domain */
|
2009-02-18 15:32:26 +01:00
|
|
|
static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR data, FILETIME expiry)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2011-04-21 13:39:03 +02:00
|
|
|
cookie *newCookie = heap_alloc(sizeof(cookie));
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2004-07-21 21:36:53 +02:00
|
|
|
list_init(&newCookie->entry);
|
2003-06-21 01:26:56 +02:00
|
|
|
newCookie->lpCookieName = NULL;
|
|
|
|
newCookie->lpCookieData = NULL;
|
2009-02-18 15:32:26 +01:00
|
|
|
newCookie->expiry = expiry;
|
2009-07-19 18:09:10 +02:00
|
|
|
newCookie->lpCookieName = heap_strdupW(name);
|
|
|
|
newCookie->lpCookieData = heap_strdupW(data);
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2004-03-30 22:38:08 +02:00
|
|
|
TRACE("added cookie %p (data is %s)\n", newCookie, debugstr_w(data) );
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2004-07-21 21:36:53 +02:00
|
|
|
list_add_tail(&domain->cookie_list, &newCookie->entry);
|
2003-06-21 01:26:56 +02:00
|
|
|
newCookie->parent = domain;
|
|
|
|
return newCookie;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* finds a cookie in the domain matching the cookie name */
|
2004-03-30 22:38:08 +02:00
|
|
|
static cookie *COOKIE_findCookie(cookie_domain *domain, LPCWSTR lpszCookieName)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2004-07-21 21:36:53 +02:00
|
|
|
struct list * cursor;
|
2004-03-30 22:38:08 +02:00
|
|
|
TRACE("(%p, %s)\n", domain, debugstr_w(lpszCookieName));
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2004-07-21 21:36:53 +02:00
|
|
|
LIST_FOR_EACH(cursor, &domain->cookie_list)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2004-07-21 21:36:53 +02:00
|
|
|
cookie *searchCookie = LIST_ENTRY(cursor, cookie, entry);
|
2003-06-21 01:26:56 +02:00
|
|
|
BOOL candidate = TRUE;
|
|
|
|
if (candidate && lpszCookieName)
|
|
|
|
{
|
|
|
|
if (candidate && !searchCookie->lpCookieName)
|
|
|
|
candidate = FALSE;
|
2004-03-30 22:38:08 +02:00
|
|
|
if (candidate && strcmpW(lpszCookieName, searchCookie->lpCookieName) != 0)
|
2003-06-21 01:26:56 +02:00
|
|
|
candidate = FALSE;
|
|
|
|
}
|
|
|
|
if (candidate)
|
|
|
|
return searchCookie;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* removes a cookie from the list, if its the last cookie we also remove the domain */
|
|
|
|
static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain)
|
|
|
|
{
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(deadCookie->lpCookieName);
|
|
|
|
heap_free(deadCookie->lpCookieData);
|
2004-07-21 21:36:53 +02:00
|
|
|
list_remove(&deadCookie->entry);
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2004-07-21 21:36:53 +02:00
|
|
|
/* special case: last cookie, lets remove the domain to save memory */
|
|
|
|
if (list_empty(&deadCookie->parent->cookie_list) && deleteDomain)
|
|
|
|
COOKIE_deleteDomain(deadCookie->parent);
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(deadCookie);
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* allocates a domain and adds it to the end */
|
2004-03-30 22:38:08 +02:00
|
|
|
static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2011-04-21 13:39:03 +02:00
|
|
|
cookie_domain *newDomain = heap_alloc(sizeof(cookie_domain));
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2004-07-21 21:36:53 +02:00
|
|
|
list_init(&newDomain->entry);
|
|
|
|
list_init(&newDomain->cookie_list);
|
2003-06-21 01:26:56 +02:00
|
|
|
newDomain->lpCookieDomain = NULL;
|
|
|
|
newDomain->lpCookiePath = NULL;
|
2009-07-19 18:09:10 +02:00
|
|
|
newDomain->lpCookieDomain = heap_strdupW(domain);
|
|
|
|
newDomain->lpCookiePath = heap_strdupW(path);
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2004-07-21 21:36:53 +02:00
|
|
|
list_add_tail(&domain_list, &newDomain->entry);
|
|
|
|
|
2003-06-21 01:26:56 +02:00
|
|
|
TRACE("Adding domain: %p\n", newDomain);
|
|
|
|
return newDomain;
|
|
|
|
}
|
|
|
|
|
2007-11-14 13:15:16 +01:00
|
|
|
static BOOL COOKIE_crackUrlSimple(LPCWSTR lpszUrl, LPWSTR hostName, int hostNameLen, LPWSTR path, int pathLen)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2004-03-30 22:38:08 +02:00
|
|
|
URL_COMPONENTSW UrlComponents;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
|
|
|
UrlComponents.lpszExtraInfo = NULL;
|
|
|
|
UrlComponents.lpszPassword = NULL;
|
|
|
|
UrlComponents.lpszScheme = NULL;
|
|
|
|
UrlComponents.lpszUrlPath = path;
|
|
|
|
UrlComponents.lpszUserName = NULL;
|
|
|
|
UrlComponents.lpszHostName = hostName;
|
2007-11-08 18:09:36 +01:00
|
|
|
UrlComponents.dwExtraInfoLength = 0;
|
|
|
|
UrlComponents.dwPasswordLength = 0;
|
|
|
|
UrlComponents.dwSchemeLength = 0;
|
|
|
|
UrlComponents.dwUserNameLength = 0;
|
2004-07-21 21:36:53 +02:00
|
|
|
UrlComponents.dwHostNameLength = hostNameLen;
|
|
|
|
UrlComponents.dwUrlPathLength = pathLen;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2009-10-26 09:56:04 +01:00
|
|
|
if (!InternetCrackUrlW(lpszUrl, 0, 0, &UrlComponents)) return FALSE;
|
2009-02-17 17:28:54 +01:00
|
|
|
|
|
|
|
/* discard the webpage off the end of the path */
|
2009-10-26 09:56:04 +01:00
|
|
|
if (UrlComponents.dwUrlPathLength)
|
2009-02-17 17:28:54 +01:00
|
|
|
{
|
2009-10-26 09:56:04 +01:00
|
|
|
if (path[UrlComponents.dwUrlPathLength - 1] != '/')
|
2009-02-17 17:28:54 +01:00
|
|
|
{
|
2009-10-26 09:56:04 +01:00
|
|
|
WCHAR *ptr;
|
|
|
|
if ((ptr = strrchrW(path, '/'))) *(++ptr) = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
path[0] = '/';
|
|
|
|
path[1] = 0;
|
|
|
|
}
|
2009-02-17 17:28:54 +01:00
|
|
|
}
|
|
|
|
}
|
2009-10-26 09:56:04 +01:00
|
|
|
else if (pathLen >= 2)
|
|
|
|
{
|
|
|
|
path[0] = '/';
|
|
|
|
path[1] = 0;
|
|
|
|
}
|
|
|
|
return TRUE;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
2004-07-21 21:36:53 +02:00
|
|
|
/* match a domain. domain must match if the domain is not NULL. path must match if the path is not NULL */
|
|
|
|
static BOOL COOKIE_matchDomain(LPCWSTR lpszCookieDomain, LPCWSTR lpszCookiePath,
|
|
|
|
cookie_domain *searchDomain, BOOL allow_partial)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2004-07-21 21:36:53 +02:00
|
|
|
TRACE("searching on domain %p\n", searchDomain);
|
|
|
|
if (lpszCookieDomain)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2004-07-21 21:36:53 +02:00
|
|
|
if (!searchDomain->lpCookieDomain)
|
|
|
|
return FALSE;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2004-03-30 22:38:08 +02:00
|
|
|
TRACE("comparing domain %s with %s\n",
|
2004-07-21 21:36:53 +02:00
|
|
|
debugstr_w(lpszCookieDomain),
|
|
|
|
debugstr_w(searchDomain->lpCookieDomain));
|
|
|
|
|
|
|
|
if (allow_partial && !strstrW(lpszCookieDomain, searchDomain->lpCookieDomain))
|
|
|
|
return FALSE;
|
|
|
|
else if (!allow_partial && lstrcmpW(lpszCookieDomain, searchDomain->lpCookieDomain) != 0)
|
|
|
|
return FALSE;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
2004-07-21 21:36:53 +02:00
|
|
|
if (lpszCookiePath)
|
|
|
|
{
|
2009-02-17 17:29:03 +01:00
|
|
|
INT len;
|
2004-07-21 21:36:53 +02:00
|
|
|
TRACE("comparing paths: %s with %s\n", debugstr_w(lpszCookiePath), debugstr_w(searchDomain->lpCookiePath));
|
2009-02-17 17:29:03 +01:00
|
|
|
/* paths match at the beginning. so a path of /foo would match
|
|
|
|
* /foobar and /foo/bar
|
|
|
|
*/
|
2004-07-21 21:36:53 +02:00
|
|
|
if (!searchDomain->lpCookiePath)
|
|
|
|
return FALSE;
|
2009-02-17 17:29:03 +01:00
|
|
|
if (allow_partial)
|
|
|
|
{
|
|
|
|
len = lstrlenW(searchDomain->lpCookiePath);
|
|
|
|
if (strncmpiW(searchDomain->lpCookiePath, lpszCookiePath, len)!=0)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (strcmpW(lpszCookiePath, searchDomain->lpCookiePath))
|
2004-07-21 21:36:53 +02:00
|
|
|
return FALSE;
|
2009-02-17 17:29:03 +01:00
|
|
|
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
2004-07-21 21:36:53 +02:00
|
|
|
return TRUE;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* remove a domain from the list and delete it */
|
|
|
|
static void COOKIE_deleteDomain(cookie_domain *deadDomain)
|
|
|
|
{
|
2004-07-21 21:36:53 +02:00
|
|
|
struct list * cursor;
|
|
|
|
while ((cursor = list_tail(&deadDomain->cookie_list)))
|
|
|
|
{
|
|
|
|
COOKIE_deleteCookie(LIST_ENTRY(cursor, cookie, entry), FALSE);
|
|
|
|
list_remove(cursor);
|
|
|
|
}
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(deadDomain->lpCookieDomain);
|
|
|
|
heap_free(deadDomain->lpCookiePath);
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2004-07-21 21:36:53 +02:00
|
|
|
list_remove(&deadDomain->entry);
|
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(deadDomain);
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
2011-05-19 16:11:30 +02:00
|
|
|
BOOL get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD *size)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2011-05-19 16:11:10 +02:00
|
|
|
unsigned cnt = 0, len, domain_count = 0, cookie_count = 0;
|
|
|
|
cookie_domain *domain;
|
2009-02-18 15:32:26 +01:00
|
|
|
FILETIME tm;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
GetSystemTimeAsFileTime(&tm);
|
2006-06-02 12:49:27 +02:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(domain, &domain_list, cookie_domain, entry) {
|
|
|
|
struct list *cursor, *cursor2;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
if(!COOKIE_matchDomain(host, path, domain, TRUE))
|
|
|
|
continue;
|
2009-02-18 15:32:26 +01:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
domain_count++;
|
|
|
|
TRACE("found domain %p\n", domain);
|
2004-07-21 21:36:53 +02:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
LIST_FOR_EACH_SAFE(cursor, cursor2, &domain->cookie_list) {
|
|
|
|
cookie *cookie_iter = LIST_ENTRY(cursor, cookie, entry);
|
|
|
|
|
|
|
|
/* check for expiry */
|
|
|
|
if((cookie_iter->expiry.dwLowDateTime != 0 || cookie_iter->expiry.dwHighDateTime != 0)
|
|
|
|
&& CompareFileTime(&tm, &cookie_iter->expiry) > 0)
|
2004-07-21 21:36:53 +02:00
|
|
|
{
|
2011-05-19 16:11:10 +02:00
|
|
|
TRACE("Found expired cookie. deleting\n");
|
|
|
|
COOKIE_deleteCookie(cookie_iter, FALSE);
|
|
|
|
continue;
|
|
|
|
}
|
2009-02-18 15:32:26 +01:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
if(!cookie_data) { /* return the size of the buffer required to lpdwSize */
|
|
|
|
if (cookie_count)
|
|
|
|
cnt += 2; /* '; ' */
|
|
|
|
cnt += strlenW(cookie_iter->lpCookieName);
|
|
|
|
if ((len = strlenW(cookie_iter->lpCookieData))) {
|
|
|
|
cnt += 1; /* = */
|
|
|
|
cnt += len;
|
2004-07-21 21:36:53 +02:00
|
|
|
}
|
2011-05-19 16:11:10 +02:00
|
|
|
}else {
|
|
|
|
static const WCHAR szsc[] = { ';',' ',0 };
|
|
|
|
static const WCHAR szname[] = { '%','s',0 };
|
|
|
|
static const WCHAR szdata[] = { '=','%','s',0 };
|
2007-11-14 13:15:29 +01:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
if (cookie_count) cnt += snprintfW(cookie_data + cnt, *size - cnt, szsc);
|
|
|
|
cnt += snprintfW(cookie_data + cnt, *size - cnt, szname, cookie_iter->lpCookieName);
|
2007-11-14 13:15:29 +01:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
if (cookie_iter->lpCookieData[0])
|
|
|
|
cnt += snprintfW(cookie_data + cnt, *size - cnt, szdata, cookie_iter->lpCookieData);
|
2007-11-14 13:15:29 +01:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
TRACE("Cookie: %s\n", debugstr_w(cookie_data));
|
2004-07-21 21:36:53 +02:00
|
|
|
}
|
2011-05-19 16:11:10 +02:00
|
|
|
cookie_count++;
|
2004-07-21 21:36:53 +02:00
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
2006-03-09 16:20:24 +01:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
if (!domain_count) {
|
|
|
|
TRACE("no cookies found for %s\n", debugstr_w(host));
|
2006-03-09 16:20:24 +01:00
|
|
|
SetLastError(ERROR_NO_MORE_ITEMS);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
if(!cookie_data) {
|
|
|
|
*size = (cnt + 1) * sizeof(WCHAR);
|
|
|
|
TRACE("returning %u\n", *size);
|
2007-11-14 13:15:29 +01:00
|
|
|
return TRUE;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
*size = cnt + 1;
|
|
|
|
|
|
|
|
TRACE("Returning %u (from %u domains): %s\n", cnt, domain_count, debugstr_w(cookie_data));
|
|
|
|
return cnt != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetCookieW (WININET.@)
|
|
|
|
*
|
|
|
|
* Retrieve cookie from the specified url
|
|
|
|
*
|
|
|
|
* It should be noted that on windows the lpszCookieName parameter is "not implemented".
|
|
|
|
* So it won't be implemented here.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetGetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
|
|
|
LPWSTR lpCookieData, LPDWORD lpdwSize)
|
|
|
|
{
|
|
|
|
WCHAR host[INTERNET_MAX_HOST_NAME_LENGTH], path[INTERNET_MAX_PATH_LENGTH];
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
TRACE("(%s, %s, %p, %p)\n", debugstr_w(lpszUrl),debugstr_w(lpszCookieName), lpCookieData, lpdwSize);
|
|
|
|
|
|
|
|
if (!lpszUrl)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
host[0] = 0;
|
|
|
|
ret = COOKIE_crackUrlSimple(lpszUrl, host, sizeof(host)/sizeof(host[0]), path, sizeof(path)/sizeof(path[0]));
|
2012-09-04 17:08:06 +02:00
|
|
|
if (!ret || !host[0]) {
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
return get_cookie(host, path, lpCookieData, lpdwSize);
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2004-03-30 22:38:08 +02:00
|
|
|
* InternetGetCookieA (WININET.@)
|
2003-06-21 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Retrieve cookie from the specified url
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2004-03-30 22:38:08 +02:00
|
|
|
BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
|
|
|
|
LPSTR lpCookieData, LPDWORD lpdwSize)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2004-03-30 22:38:08 +02:00
|
|
|
DWORD len;
|
2009-07-19 18:09:10 +02:00
|
|
|
LPWSTR szCookieData = NULL, url, name;
|
2004-03-30 22:38:08 +02:00
|
|
|
BOOL r;
|
|
|
|
|
|
|
|
TRACE("(%s,%s,%p)\n", debugstr_a(lpszUrl), debugstr_a(lpszCookieName),
|
2003-06-21 01:26:56 +02:00
|
|
|
lpCookieData);
|
2004-03-30 22:38:08 +02:00
|
|
|
|
2009-07-19 18:09:10 +02:00
|
|
|
url = heap_strdupAtoW(lpszUrl);
|
|
|
|
name = heap_strdupAtoW(lpszCookieName);
|
2004-03-30 22:38:08 +02:00
|
|
|
|
2009-07-19 18:09:10 +02:00
|
|
|
r = InternetGetCookieW( url, name, NULL, &len );
|
2004-03-30 22:38:08 +02:00
|
|
|
if( r )
|
|
|
|
{
|
2011-04-21 13:39:03 +02:00
|
|
|
szCookieData = heap_alloc(len * sizeof(WCHAR));
|
2004-03-30 22:38:08 +02:00
|
|
|
if( !szCookieData )
|
2007-10-11 23:00:17 +02:00
|
|
|
{
|
|
|
|
r = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-19 18:09:10 +02:00
|
|
|
r = InternetGetCookieW( url, name, szCookieData, &len );
|
2004-03-30 22:38:08 +02:00
|
|
|
|
2007-10-11 23:00:17 +02:00
|
|
|
*lpdwSize = WideCharToMultiByte( CP_ACP, 0, szCookieData, len,
|
|
|
|
lpCookieData, *lpdwSize, NULL, NULL );
|
|
|
|
}
|
2004-03-30 22:38:08 +02:00
|
|
|
}
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free( szCookieData );
|
|
|
|
heap_free( name );
|
|
|
|
heap_free( url );
|
2004-03-30 22:38:08 +02:00
|
|
|
return r;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
2011-05-19 16:11:45 +02:00
|
|
|
BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cookie_data)
|
2007-11-14 13:15:16 +01:00
|
|
|
{
|
|
|
|
cookie_domain *thisCookieDomain = NULL;
|
|
|
|
cookie *thisCookie;
|
|
|
|
struct list *cursor;
|
2009-04-24 14:59:08 +02:00
|
|
|
LPWSTR data, value;
|
2009-02-17 17:28:46 +01:00
|
|
|
WCHAR *ptr;
|
2009-02-18 15:32:26 +01:00
|
|
|
FILETIME expiry;
|
|
|
|
BOOL expired = FALSE;
|
2009-02-17 17:28:46 +01:00
|
|
|
|
2009-07-19 18:09:10 +02:00
|
|
|
value = data = heap_strdupW(cookie_data);
|
|
|
|
if (!data)
|
2009-06-24 19:31:34 +02:00
|
|
|
{
|
2010-07-01 20:02:01 +02:00
|
|
|
ERR("could not allocate the cookie data buffer\n");
|
2009-06-24 19:31:34 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-18 15:32:26 +01:00
|
|
|
memset(&expiry,0,sizeof(expiry));
|
2009-02-17 17:28:46 +01:00
|
|
|
|
2009-04-20 14:47:23 +02:00
|
|
|
/* lots of information can be parsed out of the cookie value */
|
2009-02-17 17:28:46 +01:00
|
|
|
|
|
|
|
ptr = data;
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
static const WCHAR szDomain[] = {'d','o','m','a','i','n','=',0};
|
|
|
|
static const WCHAR szPath[] = {'p','a','t','h','=',0};
|
|
|
|
static const WCHAR szExpires[] = {'e','x','p','i','r','e','s','=',0};
|
|
|
|
static const WCHAR szSecure[] = {'s','e','c','u','r','e',0};
|
|
|
|
static const WCHAR szHttpOnly[] = {'h','t','t','p','o','n','l','y',0};
|
|
|
|
|
|
|
|
if (!(ptr = strchrW(ptr,';'))) break;
|
|
|
|
*ptr++ = 0;
|
2009-04-24 14:59:08 +02:00
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
if (value != data) heap_free(value);
|
2011-04-21 13:39:03 +02:00
|
|
|
value = heap_alloc((ptr - data) * sizeof(WCHAR));
|
2009-06-24 19:31:34 +02:00
|
|
|
if (value == NULL)
|
|
|
|
{
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(data);
|
2010-07-01 20:02:01 +02:00
|
|
|
ERR("could not allocate the cookie value buffer\n");
|
2009-06-24 19:31:34 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
2009-04-24 14:59:08 +02:00
|
|
|
strcpyW(value, data);
|
|
|
|
|
2009-02-17 17:28:46 +01:00
|
|
|
while (*ptr == ' ') ptr++; /* whitespace */
|
|
|
|
|
|
|
|
if (strncmpiW(ptr, szDomain, 7) == 0)
|
|
|
|
{
|
|
|
|
ptr+=strlenW(szDomain);
|
|
|
|
domain = ptr;
|
|
|
|
TRACE("Parsing new domain %s\n",debugstr_w(domain));
|
|
|
|
}
|
|
|
|
else if (strncmpiW(ptr, szPath, 5) == 0)
|
|
|
|
{
|
|
|
|
ptr+=strlenW(szPath);
|
|
|
|
path = ptr;
|
|
|
|
TRACE("Parsing new path %s\n",debugstr_w(path));
|
|
|
|
}
|
|
|
|
else if (strncmpiW(ptr, szExpires, 8) == 0)
|
2009-02-18 15:32:26 +01:00
|
|
|
{
|
|
|
|
FILETIME ft;
|
|
|
|
SYSTEMTIME st;
|
|
|
|
FIXME("persistent cookies not handled (%s)\n",debugstr_w(ptr));
|
|
|
|
ptr+=strlenW(szExpires);
|
|
|
|
if (InternetTimeToSystemTimeW(ptr, &st, 0))
|
|
|
|
{
|
|
|
|
SystemTimeToFileTime(&st, &expiry);
|
|
|
|
GetSystemTimeAsFileTime(&ft);
|
|
|
|
|
|
|
|
if (CompareFileTime(&ft,&expiry) > 0)
|
|
|
|
{
|
|
|
|
TRACE("Cookie already expired.\n");
|
|
|
|
expired = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-17 17:28:46 +01:00
|
|
|
else if (strncmpiW(ptr, szSecure, 6) == 0)
|
2009-04-24 14:59:08 +02:00
|
|
|
{
|
2009-02-17 17:28:46 +01:00
|
|
|
FIXME("secure not handled (%s)\n",debugstr_w(ptr));
|
2009-04-24 14:59:08 +02:00
|
|
|
ptr += strlenW(szSecure);
|
|
|
|
}
|
2009-02-17 17:28:46 +01:00
|
|
|
else if (strncmpiW(ptr, szHttpOnly, 8) == 0)
|
2009-04-24 14:59:08 +02:00
|
|
|
{
|
2009-02-17 17:28:46 +01:00
|
|
|
FIXME("httponly not handled (%s)\n",debugstr_w(ptr));
|
2009-04-24 14:59:08 +02:00
|
|
|
ptr += strlenW(szHttpOnly);
|
|
|
|
}
|
|
|
|
else if (*ptr)
|
|
|
|
{
|
2009-02-17 17:28:46 +01:00
|
|
|
FIXME("Unknown additional option %s\n",debugstr_w(ptr));
|
2009-04-24 14:59:08 +02:00
|
|
|
break;
|
|
|
|
}
|
2009-02-17 17:28:46 +01:00
|
|
|
}
|
2007-11-14 13:15:16 +01:00
|
|
|
|
|
|
|
LIST_FOR_EACH(cursor, &domain_list)
|
|
|
|
{
|
|
|
|
thisCookieDomain = LIST_ENTRY(cursor, cookie_domain, entry);
|
2009-02-17 17:29:03 +01:00
|
|
|
if (COOKIE_matchDomain(domain, path, thisCookieDomain, FALSE))
|
2007-11-14 13:15:16 +01:00
|
|
|
break;
|
|
|
|
thisCookieDomain = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!thisCookieDomain)
|
2009-02-18 15:32:26 +01:00
|
|
|
{
|
|
|
|
if (!expired)
|
|
|
|
thisCookieDomain = COOKIE_addDomain(domain, path);
|
|
|
|
else
|
|
|
|
{
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(data);
|
|
|
|
if (value != data) heap_free(value);
|
2009-02-18 15:32:26 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
2007-11-14 13:15:16 +01:00
|
|
|
|
|
|
|
if ((thisCookie = COOKIE_findCookie(thisCookieDomain, cookie_name)))
|
|
|
|
COOKIE_deleteCookie(thisCookie, FALSE);
|
|
|
|
|
2009-02-17 17:29:03 +01:00
|
|
|
TRACE("setting cookie %s=%s for domain %s path %s\n", debugstr_w(cookie_name),
|
2009-04-24 14:59:08 +02:00
|
|
|
debugstr_w(value), debugstr_w(thisCookieDomain->lpCookieDomain),debugstr_w(thisCookieDomain->lpCookiePath));
|
2007-11-14 13:15:16 +01:00
|
|
|
|
2009-04-24 14:59:08 +02:00
|
|
|
if (!expired && !COOKIE_addCookie(thisCookieDomain, cookie_name, value, expiry))
|
2009-02-17 17:28:46 +01:00
|
|
|
{
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(data);
|
|
|
|
if (value != data) heap_free(value);
|
2007-11-14 13:15:16 +01:00
|
|
|
return FALSE;
|
2009-02-17 17:28:46 +01:00
|
|
|
}
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(data);
|
|
|
|
if (value != data) heap_free(value);
|
2007-11-14 13:15:16 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2004-03-30 22:38:08 +02:00
|
|
|
* InternetSetCookieW (WININET.@)
|
2003-06-21 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Sets cookie for the specified url
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2004-03-30 22:38:08 +02:00
|
|
|
BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
|
|
|
LPCWSTR lpCookieData)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2007-11-14 13:15:16 +01:00
|
|
|
BOOL ret;
|
2011-08-22 21:30:55 +02:00
|
|
|
WCHAR hostName[INTERNET_MAX_HOST_NAME_LENGTH], path[INTERNET_MAX_PATH_LENGTH];
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2004-03-30 22:38:08 +02:00
|
|
|
TRACE("(%s,%s,%s)\n", debugstr_w(lpszUrl),
|
|
|
|
debugstr_w(lpszCookieName), debugstr_w(lpCookieData));
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2007-11-14 13:15:16 +01:00
|
|
|
if (!lpszUrl || !lpCookieData)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2006-06-02 12:49:09 +02:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2007-11-14 13:15:16 +01:00
|
|
|
return FALSE;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
2007-11-14 13:15:16 +01:00
|
|
|
|
2009-10-26 09:56:04 +01:00
|
|
|
hostName[0] = 0;
|
2007-11-14 13:15:16 +01:00
|
|
|
ret = COOKIE_crackUrlSimple(lpszUrl, hostName, sizeof(hostName)/sizeof(hostName[0]), path, sizeof(path)/sizeof(path[0]));
|
|
|
|
if (!ret || !hostName[0]) return FALSE;
|
|
|
|
|
2003-06-21 01:26:56 +02:00
|
|
|
if (!lpszCookieName)
|
|
|
|
{
|
2007-11-14 13:15:16 +01:00
|
|
|
WCHAR *cookie, *data;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2009-07-19 18:09:10 +02:00
|
|
|
cookie = heap_strdupW(lpCookieData);
|
|
|
|
if (!cookie)
|
2007-11-14 13:15:16 +01:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_OUTOFMEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-07-21 21:36:53 +02:00
|
|
|
|
2007-11-14 13:15:16 +01:00
|
|
|
/* some apps (or is it us??) try to add a cookie with no cookie name, but
|
|
|
|
* the cookie data in the form of name[=data].
|
|
|
|
*/
|
2009-07-19 18:09:10 +02:00
|
|
|
if (!(data = strchrW(cookie, '='))) data = cookie + strlenW(cookie);
|
2009-02-17 17:28:46 +01:00
|
|
|
else *data++ = 0;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2007-11-14 13:15:16 +01:00
|
|
|
ret = set_cookie(hostName, path, cookie, data);
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(cookie);
|
2007-11-14 13:15:16 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return set_cookie(hostName, path, lpszCookieName, lpCookieData);
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2004-03-30 22:38:08 +02:00
|
|
|
* InternetSetCookieA (WININET.@)
|
2003-06-21 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Sets cookie for the specified url
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2004-03-30 22:38:08 +02:00
|
|
|
BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
|
|
|
|
LPCSTR lpCookieData)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2009-07-19 18:09:10 +02:00
|
|
|
LPWSTR data, url, name;
|
2004-03-30 22:38:08 +02:00
|
|
|
BOOL r;
|
|
|
|
|
|
|
|
TRACE("(%s,%s,%s)\n", debugstr_a(lpszUrl),
|
|
|
|
debugstr_a(lpszCookieName), debugstr_a(lpCookieData));
|
|
|
|
|
2009-07-19 18:09:10 +02:00
|
|
|
url = heap_strdupAtoW(lpszUrl);
|
|
|
|
name = heap_strdupAtoW(lpszCookieName);
|
|
|
|
data = heap_strdupAtoW(lpCookieData);
|
2004-03-30 22:38:08 +02:00
|
|
|
|
2009-07-19 18:09:10 +02:00
|
|
|
r = InternetSetCookieW( url, name, data );
|
2004-03-30 22:38:08 +02:00
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free( data );
|
|
|
|
heap_free( name );
|
|
|
|
heap_free( url );
|
2004-03-30 22:38:08 +02:00
|
|
|
return r;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
2006-03-14 15:35:52 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetCookieExA (WININET.@)
|
|
|
|
*
|
|
|
|
* See InternetSetCookieExW.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI InternetSetCookieExA( LPCSTR lpszURL, LPCSTR lpszCookieName, LPCSTR lpszCookieData,
|
|
|
|
DWORD dwFlags, DWORD_PTR dwReserved)
|
|
|
|
{
|
2008-05-09 15:16:05 +02:00
|
|
|
TRACE("(%s, %s, %s, 0x%08x, 0x%08lx)\n",
|
2006-03-14 15:35:52 +01:00
|
|
|
debugstr_a(lpszURL), debugstr_a(lpszCookieName), debugstr_a(lpszCookieData),
|
|
|
|
dwFlags, dwReserved);
|
2008-05-09 15:16:05 +02:00
|
|
|
|
|
|
|
if (dwFlags) FIXME("flags 0x%08x not supported\n", dwFlags);
|
|
|
|
return InternetSetCookieA(lpszURL, lpszCookieName, lpszCookieData);
|
2006-03-14 15:35:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetCookieExW (WININET.@)
|
|
|
|
*
|
|
|
|
* Sets a cookie for the specified URL.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
DWORD WINAPI InternetSetCookieExW( LPCWSTR lpszURL, LPCWSTR lpszCookieName, LPCWSTR lpszCookieData,
|
|
|
|
DWORD dwFlags, DWORD_PTR dwReserved)
|
|
|
|
{
|
2008-05-09 15:16:05 +02:00
|
|
|
TRACE("(%s, %s, %s, 0x%08x, 0x%08lx)\n",
|
2006-03-14 15:35:52 +01:00
|
|
|
debugstr_w(lpszURL), debugstr_w(lpszCookieName), debugstr_w(lpszCookieData),
|
|
|
|
dwFlags, dwReserved);
|
2008-05-09 15:16:05 +02:00
|
|
|
|
|
|
|
if (dwFlags) FIXME("flags 0x%08x not supported\n", dwFlags);
|
|
|
|
return InternetSetCookieW(lpszURL, lpszCookieName, lpszCookieData);
|
2006-03-14 15:35:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetCookieExA (WININET.@)
|
|
|
|
*
|
|
|
|
* See InternetGetCookieExW.
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetGetCookieExA( LPCSTR pchURL, LPCSTR pchCookieName, LPSTR pchCookieData,
|
|
|
|
LPDWORD pcchCookieData, DWORD dwFlags, LPVOID lpReserved)
|
|
|
|
{
|
2008-05-09 15:16:05 +02:00
|
|
|
TRACE("(%s, %s, %s, %p, 0x%08x, %p)\n",
|
2006-03-14 15:35:52 +01:00
|
|
|
debugstr_a(pchURL), debugstr_a(pchCookieName), debugstr_a(pchCookieData),
|
|
|
|
pcchCookieData, dwFlags, lpReserved);
|
2008-05-09 15:16:05 +02:00
|
|
|
|
|
|
|
if (dwFlags) FIXME("flags 0x%08x not supported\n", dwFlags);
|
|
|
|
return InternetGetCookieA(pchURL, pchCookieName, pchCookieData, pcchCookieData);
|
2006-03-14 15:35:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetCookieExW (WININET.@)
|
|
|
|
*
|
|
|
|
* Retrieve cookie for the specified URL.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetGetCookieExW( LPCWSTR pchURL, LPCWSTR pchCookieName, LPWSTR pchCookieData,
|
|
|
|
LPDWORD pcchCookieData, DWORD dwFlags, LPVOID lpReserved)
|
|
|
|
{
|
2008-05-09 15:16:05 +02:00
|
|
|
TRACE("(%s, %s, %s, %p, 0x%08x, %p)\n",
|
2006-03-14 15:35:52 +01:00
|
|
|
debugstr_w(pchURL), debugstr_w(pchCookieName), debugstr_w(pchCookieData),
|
|
|
|
pcchCookieData, dwFlags, lpReserved);
|
2008-05-09 15:16:05 +02:00
|
|
|
|
|
|
|
if (dwFlags) FIXME("flags 0x%08x not supported\n", dwFlags);
|
|
|
|
return InternetGetCookieW(pchURL, pchCookieName, pchCookieData, pcchCookieData);
|
2006-03-14 15:35:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetClearAllPerSiteCookieDecisions (WININET.@)
|
|
|
|
*
|
|
|
|
* Clears all per-site decisions about cookies.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetClearAllPerSiteCookieDecisions( VOID )
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetEnumPerSiteCookieDecisionA (WININET.@)
|
|
|
|
*
|
|
|
|
* See InternetEnumPerSiteCookieDecisionW.
|
|
|
|
*/
|
2008-06-29 16:02:07 +02:00
|
|
|
BOOL WINAPI InternetEnumPerSiteCookieDecisionA( LPSTR pszSiteName, ULONG *pcSiteNameSize,
|
|
|
|
ULONG *pdwDecision, ULONG dwIndex )
|
2006-03-14 15:35:52 +01:00
|
|
|
{
|
2008-06-29 16:02:07 +02:00
|
|
|
FIXME("(%s, %p, %p, 0x%08x) stub\n",
|
2006-03-14 15:35:52 +01:00
|
|
|
debugstr_a(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetEnumPerSiteCookieDecisionW (WININET.@)
|
|
|
|
*
|
|
|
|
* Enumerates all per-site decisions about cookies.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2008-06-29 16:02:07 +02:00
|
|
|
BOOL WINAPI InternetEnumPerSiteCookieDecisionW( LPWSTR pszSiteName, ULONG *pcSiteNameSize,
|
|
|
|
ULONG *pdwDecision, ULONG dwIndex )
|
2006-03-14 15:35:52 +01:00
|
|
|
{
|
2008-06-29 16:02:07 +02:00
|
|
|
FIXME("(%s, %p, %p, 0x%08x) stub\n",
|
2006-03-14 15:35:52 +01:00
|
|
|
debugstr_w(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetPerSiteCookieDecisionA (WININET.@)
|
|
|
|
*/
|
2008-06-29 16:02:07 +02:00
|
|
|
BOOL WINAPI InternetGetPerSiteCookieDecisionA( LPCSTR pwchHostName, ULONG *pResult )
|
2006-03-14 15:35:52 +01:00
|
|
|
{
|
|
|
|
FIXME("(%s, %p) stub\n", debugstr_a(pwchHostName), pResult);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetPerSiteCookieDecisionW (WININET.@)
|
|
|
|
*/
|
2008-06-29 16:02:07 +02:00
|
|
|
BOOL WINAPI InternetGetPerSiteCookieDecisionW( LPCWSTR pwchHostName, ULONG *pResult )
|
2006-03-14 15:35:52 +01:00
|
|
|
{
|
|
|
|
FIXME("(%s, %p) stub\n", debugstr_w(pwchHostName), pResult);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetPerSiteCookieDecisionA (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetSetPerSiteCookieDecisionA( LPCSTR pchHostName, DWORD dwDecision )
|
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("(%s, 0x%08x) stub\n", debugstr_a(pchHostName), dwDecision);
|
2006-03-14 15:35:52 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetPerSiteCookieDecisionW (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetSetPerSiteCookieDecisionW( LPCWSTR pchHostName, DWORD dwDecision )
|
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("(%s, 0x%08x) stub\n", debugstr_w(pchHostName), dwDecision);
|
2006-03-14 15:35:52 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
2009-01-29 16:59:33 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* 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;
|
|
|
|
}
|