2 * Wininet - cookie handling stuff
4 * Copyright 2002 TransGaming Technologies Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/port.h"
26 #if defined(__MINGW32__) || defined (_MSC_VER)
43 #include "wine/debug.h"
46 #define RESPONSE_TIMEOUT 30 /* FROM internet.c */
49 WINE_DEFAULT_DEBUG_CHANNEL(wininet
);
52 * Cookies are currently memory only.
53 * Cookies are NOT THREAD SAFE
54 * Cookies could use A LOT OF MEMORY. We need some kind of memory management here!
57 typedef struct _cookie_domain cookie_domain
;
58 typedef struct _cookie cookie
;
64 struct _cookie_domain
*parent
;
75 LPWSTR lpCookieDomain
;
77 struct list cookie_list
;
80 static struct list domain_list
= LIST_INIT(domain_list
);
82 static cookie
*COOKIE_addCookie(cookie_domain
*domain
, LPCWSTR name
, LPCWSTR data
, FILETIME expiry
);
83 static cookie
*COOKIE_findCookie(cookie_domain
*domain
, LPCWSTR lpszCookieName
);
84 static void COOKIE_deleteCookie(cookie
*deadCookie
, BOOL deleteDomain
);
85 static cookie_domain
*COOKIE_addDomain(LPCWSTR domain
, LPCWSTR path
);
86 static void COOKIE_deleteDomain(cookie_domain
*deadDomain
);
89 /* adds a cookie to the domain */
90 static cookie
*COOKIE_addCookie(cookie_domain
*domain
, LPCWSTR name
, LPCWSTR data
, FILETIME expiry
)
92 cookie
*newCookie
= HeapAlloc(GetProcessHeap(), 0, sizeof(cookie
));
94 list_init(&newCookie
->entry
);
95 newCookie
->lpCookieName
= NULL
;
96 newCookie
->lpCookieData
= NULL
;
97 newCookie
->expiry
= expiry
;
101 newCookie
->lpCookieName
= HeapAlloc(GetProcessHeap(), 0, (strlenW(name
) + 1)*sizeof(WCHAR
));
102 lstrcpyW(newCookie
->lpCookieName
, name
);
106 newCookie
->lpCookieData
= HeapAlloc(GetProcessHeap(), 0, (strlenW(data
) + 1)*sizeof(WCHAR
));
107 lstrcpyW(newCookie
->lpCookieData
, data
);
110 TRACE("added cookie %p (data is %s)\n", newCookie
, debugstr_w(data
) );
112 list_add_tail(&domain
->cookie_list
, &newCookie
->entry
);
113 newCookie
->parent
= domain
;
118 /* finds a cookie in the domain matching the cookie name */
119 static cookie
*COOKIE_findCookie(cookie_domain
*domain
, LPCWSTR lpszCookieName
)
121 struct list
* cursor
;
122 TRACE("(%p, %s)\n", domain
, debugstr_w(lpszCookieName
));
124 LIST_FOR_EACH(cursor
, &domain
->cookie_list
)
126 cookie
*searchCookie
= LIST_ENTRY(cursor
, cookie
, entry
);
127 BOOL candidate
= TRUE
;
128 if (candidate
&& lpszCookieName
)
130 if (candidate
&& !searchCookie
->lpCookieName
)
132 if (candidate
&& strcmpW(lpszCookieName
, searchCookie
->lpCookieName
) != 0)
141 /* removes a cookie from the list, if its the last cookie we also remove the domain */
142 static void COOKIE_deleteCookie(cookie
*deadCookie
, BOOL deleteDomain
)
144 HeapFree(GetProcessHeap(), 0, deadCookie
->lpCookieName
);
145 HeapFree(GetProcessHeap(), 0, deadCookie
->lpCookieData
);
146 list_remove(&deadCookie
->entry
);
148 /* special case: last cookie, lets remove the domain to save memory */
149 if (list_empty(&deadCookie
->parent
->cookie_list
) && deleteDomain
)
150 COOKIE_deleteDomain(deadCookie
->parent
);
151 HeapFree(GetProcessHeap(), 0, deadCookie
);
154 /* allocates a domain and adds it to the end */
155 static cookie_domain
*COOKIE_addDomain(LPCWSTR domain
, LPCWSTR path
)
157 cookie_domain
*newDomain
= HeapAlloc(GetProcessHeap(), 0, sizeof(cookie_domain
));
159 list_init(&newDomain
->entry
);
160 list_init(&newDomain
->cookie_list
);
161 newDomain
->lpCookieDomain
= NULL
;
162 newDomain
->lpCookiePath
= NULL
;
166 newDomain
->lpCookieDomain
= HeapAlloc(GetProcessHeap(), 0, (strlenW(domain
) + 1)*sizeof(WCHAR
));
167 strcpyW(newDomain
->lpCookieDomain
, domain
);
171 newDomain
->lpCookiePath
= HeapAlloc(GetProcessHeap(), 0, (strlenW(path
) + 1)*sizeof(WCHAR
));
172 lstrcpyW(newDomain
->lpCookiePath
, path
);
175 list_add_tail(&domain_list
, &newDomain
->entry
);
177 TRACE("Adding domain: %p\n", newDomain
);
181 static BOOL
COOKIE_crackUrlSimple(LPCWSTR lpszUrl
, LPWSTR hostName
, int hostNameLen
, LPWSTR path
, int pathLen
)
183 URL_COMPONENTSW UrlComponents
;
186 UrlComponents
.lpszExtraInfo
= NULL
;
187 UrlComponents
.lpszPassword
= NULL
;
188 UrlComponents
.lpszScheme
= NULL
;
189 UrlComponents
.lpszUrlPath
= path
;
190 UrlComponents
.lpszUserName
= NULL
;
191 UrlComponents
.lpszHostName
= hostName
;
192 UrlComponents
.dwExtraInfoLength
= 0;
193 UrlComponents
.dwPasswordLength
= 0;
194 UrlComponents
.dwSchemeLength
= 0;
195 UrlComponents
.dwUserNameLength
= 0;
196 UrlComponents
.dwHostNameLength
= hostNameLen
;
197 UrlComponents
.dwUrlPathLength
= pathLen
;
199 rc
= InternetCrackUrlW(lpszUrl
, 0, 0, &UrlComponents
);
201 /* discard the webpage off the end of the path */
202 if (pathLen
> 0 && path
[pathLen
-1] != '/')
205 ptr
= strrchrW(path
,'/');
217 /* match a domain. domain must match if the domain is not NULL. path must match if the path is not NULL */
218 static BOOL
COOKIE_matchDomain(LPCWSTR lpszCookieDomain
, LPCWSTR lpszCookiePath
,
219 cookie_domain
*searchDomain
, BOOL allow_partial
)
221 TRACE("searching on domain %p\n", searchDomain
);
222 if (lpszCookieDomain
)
224 if (!searchDomain
->lpCookieDomain
)
227 TRACE("comparing domain %s with %s\n",
228 debugstr_w(lpszCookieDomain
),
229 debugstr_w(searchDomain
->lpCookieDomain
));
231 if (allow_partial
&& !strstrW(lpszCookieDomain
, searchDomain
->lpCookieDomain
))
233 else if (!allow_partial
&& lstrcmpW(lpszCookieDomain
, searchDomain
->lpCookieDomain
) != 0)
239 TRACE("comparing paths: %s with %s\n", debugstr_w(lpszCookiePath
), debugstr_w(searchDomain
->lpCookiePath
));
240 /* paths match at the beginning. so a path of /foo would match
241 * /foobar and /foo/bar
243 if (!searchDomain
->lpCookiePath
)
247 len
= lstrlenW(searchDomain
->lpCookiePath
);
248 if (strncmpiW(searchDomain
->lpCookiePath
, lpszCookiePath
, len
)!=0)
251 else if (strcmpW(lpszCookiePath
, searchDomain
->lpCookiePath
))
258 /* remove a domain from the list and delete it */
259 static void COOKIE_deleteDomain(cookie_domain
*deadDomain
)
261 struct list
* cursor
;
262 while ((cursor
= list_tail(&deadDomain
->cookie_list
)))
264 COOKIE_deleteCookie(LIST_ENTRY(cursor
, cookie
, entry
), FALSE
);
268 HeapFree(GetProcessHeap(), 0, deadDomain
->lpCookieDomain
);
269 HeapFree(GetProcessHeap(), 0, deadDomain
->lpCookiePath
);
271 list_remove(&deadDomain
->entry
);
273 HeapFree(GetProcessHeap(), 0, deadDomain
);
276 /***********************************************************************
277 * InternetGetCookieW (WININET.@)
279 * Retrieve cookie from the specified url
281 * It should be noted that on windows the lpszCookieName parameter is "not implemented".
282 * So it won't be implemented here.
289 BOOL WINAPI
InternetGetCookieW(LPCWSTR lpszUrl
, LPCWSTR lpszCookieName
,
290 LPWSTR lpCookieData
, LPDWORD lpdwSize
)
293 struct list
* cursor
;
294 unsigned int cnt
= 0, domain_count
= 0, cookie_count
= 0;
295 WCHAR hostName
[2048], path
[2048];
298 TRACE("(%s, %s, %p, %p)\n", debugstr_w(lpszUrl
),debugstr_w(lpszCookieName
),
299 lpCookieData
, lpdwSize
);
303 SetLastError(ERROR_INVALID_PARAMETER
);
308 ret
= COOKIE_crackUrlSimple(lpszUrl
, hostName
, sizeof(hostName
)/sizeof(hostName
[0]), path
, sizeof(path
)/sizeof(path
[0]));
309 if (!ret
|| !hostName
[0]) return FALSE
;
311 GetSystemTimeAsFileTime(&tm
);
313 LIST_FOR_EACH(cursor
, &domain_list
)
315 cookie_domain
*cookiesDomain
= LIST_ENTRY(cursor
, cookie_domain
, entry
);
316 if (COOKIE_matchDomain(hostName
, path
, cookiesDomain
, TRUE
))
318 struct list
* cursor
;
320 TRACE("found domain %p\n", cookiesDomain
);
322 LIST_FOR_EACH(cursor
, &cookiesDomain
->cookie_list
)
324 cookie
*thisCookie
= LIST_ENTRY(cursor
, cookie
, entry
);
325 /* check for expiry */
326 if ((thisCookie
->expiry
.dwLowDateTime
!= 0 || thisCookie
->expiry
.dwHighDateTime
!= 0) && CompareFileTime(&tm
,&thisCookie
->expiry
) > 0)
328 TRACE("Found expired cookie. deleting\n");
329 COOKIE_deleteCookie(thisCookie
, FALSE
);
333 if (lpCookieData
== NULL
) /* return the size of the buffer required to lpdwSize */
337 if (cookie_count
) cnt
+= 2; /* '; ' */
338 cnt
+= strlenW(thisCookie
->lpCookieName
);
339 if ((len
= strlenW(thisCookie
->lpCookieData
)))
347 static const WCHAR szsc
[] = { ';',' ',0 };
348 static const WCHAR szname
[] = { '%','s',0 };
349 static const WCHAR szdata
[] = { '=','%','s',0 };
351 if (cookie_count
) cnt
+= snprintfW(lpCookieData
+ cnt
, *lpdwSize
- cnt
, szsc
);
352 cnt
+= snprintfW(lpCookieData
+ cnt
, *lpdwSize
- cnt
, szname
, thisCookie
->lpCookieName
);
354 if (thisCookie
->lpCookieData
[0])
355 cnt
+= snprintfW(lpCookieData
+ cnt
, *lpdwSize
- cnt
, szdata
, thisCookie
->lpCookieData
);
357 TRACE("Cookie: %s\n", debugstr_w(lpCookieData
));
366 TRACE("no cookies found for %s\n", debugstr_w(hostName
));
367 SetLastError(ERROR_NO_MORE_ITEMS
);
371 if (lpCookieData
== NULL
)
373 *lpdwSize
= (cnt
+ 1) * sizeof(WCHAR
);
374 TRACE("returning %u\n", *lpdwSize
);
380 TRACE("Returning %u (from %u domains): %s\n", cnt
, domain_count
,
381 debugstr_w(lpCookieData
));
383 return (cnt
? TRUE
: FALSE
);
387 /***********************************************************************
388 * InternetGetCookieA (WININET.@)
390 * Retrieve cookie from the specified url
397 BOOL WINAPI
InternetGetCookieA(LPCSTR lpszUrl
, LPCSTR lpszCookieName
,
398 LPSTR lpCookieData
, LPDWORD lpdwSize
)
401 LPWSTR szCookieData
= NULL
, szUrl
= NULL
, szCookieName
= NULL
;
404 TRACE("(%s,%s,%p)\n", debugstr_a(lpszUrl
), debugstr_a(lpszCookieName
),
409 len
= MultiByteToWideChar( CP_ACP
, 0, lpszUrl
, -1, NULL
, 0 );
410 szUrl
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) );
411 MultiByteToWideChar( CP_ACP
, 0, lpszUrl
, -1, szUrl
, len
);
416 len
= MultiByteToWideChar( CP_ACP
, 0, lpszCookieName
, -1, NULL
, 0 );
417 szCookieName
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) );
418 MultiByteToWideChar( CP_ACP
, 0, lpszCookieName
, -1, szCookieName
, len
);
421 r
= InternetGetCookieW( szUrl
, szCookieName
, NULL
, &len
);
424 szCookieData
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) );
431 r
= InternetGetCookieW( szUrl
, szCookieName
, szCookieData
, &len
);
433 *lpdwSize
= WideCharToMultiByte( CP_ACP
, 0, szCookieData
, len
,
434 lpCookieData
, *lpdwSize
, NULL
, NULL
);
438 HeapFree( GetProcessHeap(), 0, szCookieData
);
439 HeapFree( GetProcessHeap(), 0, szCookieName
);
440 HeapFree( GetProcessHeap(), 0, szUrl
);
445 static BOOL
set_cookie(LPCWSTR domain
, LPCWSTR path
, LPCWSTR cookie_name
, LPCWSTR cookie_data
)
447 cookie_domain
*thisCookieDomain
= NULL
;
453 BOOL expired
= FALSE
;
455 data
= HeapAlloc(GetProcessHeap(),0,(lstrlenW(cookie_data
)+1) * sizeof(WCHAR
));
456 strcpyW(data
,cookie_data
);
457 memset(&expiry
,0,sizeof(expiry
));
459 /* lots of informations can be parsed out of the cookie value */
464 static const WCHAR szDomain
[] = {'d','o','m','a','i','n','=',0};
465 static const WCHAR szPath
[] = {'p','a','t','h','=',0};
466 static const WCHAR szExpires
[] = {'e','x','p','i','r','e','s','=',0};
467 static const WCHAR szSecure
[] = {'s','e','c','u','r','e',0};
468 static const WCHAR szHttpOnly
[] = {'h','t','t','p','o','n','l','y',0};
470 if (!(ptr
= strchrW(ptr
,';'))) break;
472 while (*ptr
== ' ') ptr
++; /* whitespace */
474 if (strncmpiW(ptr
, szDomain
, 7) == 0)
476 ptr
+=strlenW(szDomain
);
478 TRACE("Parsing new domain %s\n",debugstr_w(domain
));
480 else if (strncmpiW(ptr
, szPath
, 5) == 0)
482 ptr
+=strlenW(szPath
);
484 TRACE("Parsing new path %s\n",debugstr_w(path
));
486 else if (strncmpiW(ptr
, szExpires
, 8) == 0)
490 FIXME("persistent cookies not handled (%s)\n",debugstr_w(ptr
));
491 ptr
+=strlenW(szExpires
);
492 if (InternetTimeToSystemTimeW(ptr
, &st
, 0))
494 SystemTimeToFileTime(&st
, &expiry
);
495 GetSystemTimeAsFileTime(&ft
);
497 if (CompareFileTime(&ft
,&expiry
) > 0)
499 TRACE("Cookie already expired.\n");
504 else if (strncmpiW(ptr
, szSecure
, 6) == 0)
505 FIXME("secure not handled (%s)\n",debugstr_w(ptr
));
506 else if (strncmpiW(ptr
, szHttpOnly
, 8) == 0)
507 FIXME("httponly not handled (%s)\n",debugstr_w(ptr
));
509 FIXME("Unknown additional option %s\n",debugstr_w(ptr
));
512 LIST_FOR_EACH(cursor
, &domain_list
)
514 thisCookieDomain
= LIST_ENTRY(cursor
, cookie_domain
, entry
);
515 if (COOKIE_matchDomain(domain
, path
, thisCookieDomain
, FALSE
))
517 thisCookieDomain
= NULL
;
520 if (!thisCookieDomain
)
523 thisCookieDomain
= COOKIE_addDomain(domain
, path
);
526 HeapFree(GetProcessHeap(),0,data
);
531 if ((thisCookie
= COOKIE_findCookie(thisCookieDomain
, cookie_name
)))
532 COOKIE_deleteCookie(thisCookie
, FALSE
);
534 TRACE("setting cookie %s=%s for domain %s path %s\n", debugstr_w(cookie_name
),
535 debugstr_w(data
), debugstr_w(thisCookieDomain
->lpCookieDomain
),debugstr_w(thisCookieDomain
->lpCookiePath
));
537 if (!expired
&& !COOKIE_addCookie(thisCookieDomain
, cookie_name
,data
, expiry
))
539 HeapFree(GetProcessHeap(),0,data
);
543 HeapFree(GetProcessHeap(),0,data
);
547 /***********************************************************************
548 * InternetSetCookieW (WININET.@)
550 * Sets cookie for the specified url
557 BOOL WINAPI
InternetSetCookieW(LPCWSTR lpszUrl
, LPCWSTR lpszCookieName
,
558 LPCWSTR lpCookieData
)
561 WCHAR hostName
[2048], path
[2048];
563 TRACE("(%s,%s,%s)\n", debugstr_w(lpszUrl
),
564 debugstr_w(lpszCookieName
), debugstr_w(lpCookieData
));
566 if (!lpszUrl
|| !lpCookieData
)
568 SetLastError(ERROR_INVALID_PARAMETER
);
572 hostName
[0] = path
[0] = 0;
573 ret
= COOKIE_crackUrlSimple(lpszUrl
, hostName
, sizeof(hostName
)/sizeof(hostName
[0]), path
, sizeof(path
)/sizeof(path
[0]));
574 if (!ret
|| !hostName
[0]) return FALSE
;
579 WCHAR
*cookie
, *data
;
581 len
= strlenW(lpCookieData
);
582 if (!(cookie
= HeapAlloc(GetProcessHeap(), 0, (len
+ 1) * sizeof(WCHAR
))))
584 SetLastError(ERROR_OUTOFMEMORY
);
587 strcpyW(cookie
, lpCookieData
);
589 /* some apps (or is it us??) try to add a cookie with no cookie name, but
590 * the cookie data in the form of name[=data].
592 if (!(data
= strchrW(cookie
, '='))) data
= cookie
+ len
;
595 ret
= set_cookie(hostName
, path
, cookie
, data
);
597 HeapFree(GetProcessHeap(), 0, cookie
);
600 return set_cookie(hostName
, path
, lpszCookieName
, lpCookieData
);
604 /***********************************************************************
605 * InternetSetCookieA (WININET.@)
607 * Sets cookie for the specified url
614 BOOL WINAPI
InternetSetCookieA(LPCSTR lpszUrl
, LPCSTR lpszCookieName
,
618 LPWSTR szCookieData
= NULL
, szUrl
= NULL
, szCookieName
= NULL
;
621 TRACE("(%s,%s,%s)\n", debugstr_a(lpszUrl
),
622 debugstr_a(lpszCookieName
), debugstr_a(lpCookieData
));
626 len
= MultiByteToWideChar( CP_ACP
, 0, lpszUrl
, -1, NULL
, 0 );
627 szUrl
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) );
628 MultiByteToWideChar( CP_ACP
, 0, lpszUrl
, -1, szUrl
, len
);
633 len
= MultiByteToWideChar( CP_ACP
, 0, lpszCookieName
, -1, NULL
, 0 );
634 szCookieName
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) );
635 MultiByteToWideChar( CP_ACP
, 0, lpszCookieName
, -1, szCookieName
, len
);
640 len
= MultiByteToWideChar( CP_ACP
, 0, lpCookieData
, -1, NULL
, 0 );
641 szCookieData
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) );
642 MultiByteToWideChar( CP_ACP
, 0, lpCookieData
, -1, szCookieData
, len
);
645 r
= InternetSetCookieW( szUrl
, szCookieName
, szCookieData
);
647 HeapFree( GetProcessHeap(), 0, szCookieData
);
648 HeapFree( GetProcessHeap(), 0, szCookieName
);
649 HeapFree( GetProcessHeap(), 0, szUrl
);
654 /***********************************************************************
655 * InternetSetCookieExA (WININET.@)
657 * See InternetSetCookieExW.
659 DWORD WINAPI
InternetSetCookieExA( LPCSTR lpszURL
, LPCSTR lpszCookieName
, LPCSTR lpszCookieData
,
660 DWORD dwFlags
, DWORD_PTR dwReserved
)
662 TRACE("(%s, %s, %s, 0x%08x, 0x%08lx)\n",
663 debugstr_a(lpszURL
), debugstr_a(lpszCookieName
), debugstr_a(lpszCookieData
),
664 dwFlags
, dwReserved
);
666 if (dwFlags
) FIXME("flags 0x%08x not supported\n", dwFlags
);
667 return InternetSetCookieA(lpszURL
, lpszCookieName
, lpszCookieData
);
670 /***********************************************************************
671 * InternetSetCookieExW (WININET.@)
673 * Sets a cookie for the specified URL.
680 DWORD WINAPI
InternetSetCookieExW( LPCWSTR lpszURL
, LPCWSTR lpszCookieName
, LPCWSTR lpszCookieData
,
681 DWORD dwFlags
, DWORD_PTR dwReserved
)
683 TRACE("(%s, %s, %s, 0x%08x, 0x%08lx)\n",
684 debugstr_w(lpszURL
), debugstr_w(lpszCookieName
), debugstr_w(lpszCookieData
),
685 dwFlags
, dwReserved
);
687 if (dwFlags
) FIXME("flags 0x%08x not supported\n", dwFlags
);
688 return InternetSetCookieW(lpszURL
, lpszCookieName
, lpszCookieData
);
691 /***********************************************************************
692 * InternetGetCookieExA (WININET.@)
694 * See InternetGetCookieExW.
696 BOOL WINAPI
InternetGetCookieExA( LPCSTR pchURL
, LPCSTR pchCookieName
, LPSTR pchCookieData
,
697 LPDWORD pcchCookieData
, DWORD dwFlags
, LPVOID lpReserved
)
699 TRACE("(%s, %s, %s, %p, 0x%08x, %p)\n",
700 debugstr_a(pchURL
), debugstr_a(pchCookieName
), debugstr_a(pchCookieData
),
701 pcchCookieData
, dwFlags
, lpReserved
);
703 if (dwFlags
) FIXME("flags 0x%08x not supported\n", dwFlags
);
704 return InternetGetCookieA(pchURL
, pchCookieName
, pchCookieData
, pcchCookieData
);
707 /***********************************************************************
708 * InternetGetCookieExW (WININET.@)
710 * Retrieve cookie for the specified URL.
717 BOOL WINAPI
InternetGetCookieExW( LPCWSTR pchURL
, LPCWSTR pchCookieName
, LPWSTR pchCookieData
,
718 LPDWORD pcchCookieData
, DWORD dwFlags
, LPVOID lpReserved
)
720 TRACE("(%s, %s, %s, %p, 0x%08x, %p)\n",
721 debugstr_w(pchURL
), debugstr_w(pchCookieName
), debugstr_w(pchCookieData
),
722 pcchCookieData
, dwFlags
, lpReserved
);
724 if (dwFlags
) FIXME("flags 0x%08x not supported\n", dwFlags
);
725 return InternetGetCookieW(pchURL
, pchCookieName
, pchCookieData
, pcchCookieData
);
728 /***********************************************************************
729 * InternetClearAllPerSiteCookieDecisions (WININET.@)
731 * Clears all per-site decisions about cookies.
738 BOOL WINAPI
InternetClearAllPerSiteCookieDecisions( VOID
)
744 /***********************************************************************
745 * InternetEnumPerSiteCookieDecisionA (WININET.@)
747 * See InternetEnumPerSiteCookieDecisionW.
749 BOOL WINAPI
InternetEnumPerSiteCookieDecisionA( LPSTR pszSiteName
, ULONG
*pcSiteNameSize
,
750 ULONG
*pdwDecision
, ULONG dwIndex
)
752 FIXME("(%s, %p, %p, 0x%08x) stub\n",
753 debugstr_a(pszSiteName
), pcSiteNameSize
, pdwDecision
, dwIndex
);
757 /***********************************************************************
758 * InternetEnumPerSiteCookieDecisionW (WININET.@)
760 * Enumerates all per-site decisions about cookies.
767 BOOL WINAPI
InternetEnumPerSiteCookieDecisionW( LPWSTR pszSiteName
, ULONG
*pcSiteNameSize
,
768 ULONG
*pdwDecision
, ULONG dwIndex
)
770 FIXME("(%s, %p, %p, 0x%08x) stub\n",
771 debugstr_w(pszSiteName
), pcSiteNameSize
, pdwDecision
, dwIndex
);
775 /***********************************************************************
776 * InternetGetPerSiteCookieDecisionA (WININET.@)
778 BOOL WINAPI
InternetGetPerSiteCookieDecisionA( LPCSTR pwchHostName
, ULONG
*pResult
)
780 FIXME("(%s, %p) stub\n", debugstr_a(pwchHostName
), pResult
);
784 /***********************************************************************
785 * InternetGetPerSiteCookieDecisionW (WININET.@)
787 BOOL WINAPI
InternetGetPerSiteCookieDecisionW( LPCWSTR pwchHostName
, ULONG
*pResult
)
789 FIXME("(%s, %p) stub\n", debugstr_w(pwchHostName
), pResult
);
793 /***********************************************************************
794 * InternetSetPerSiteCookieDecisionA (WININET.@)
796 BOOL WINAPI
InternetSetPerSiteCookieDecisionA( LPCSTR pchHostName
, DWORD dwDecision
)
798 FIXME("(%s, 0x%08x) stub\n", debugstr_a(pchHostName
), dwDecision
);
802 /***********************************************************************
803 * InternetSetPerSiteCookieDecisionW (WININET.@)
805 BOOL WINAPI
InternetSetPerSiteCookieDecisionW( LPCWSTR pchHostName
, DWORD dwDecision
)
807 FIXME("(%s, 0x%08x) stub\n", debugstr_w(pchHostName
), dwDecision
);
811 /***********************************************************************
812 * IsDomainLegalCookieDomainW (WININET.@)
814 BOOL WINAPI
IsDomainLegalCookieDomainW( LPCWSTR s1
, LPCWSTR s2
)
818 FIXME("(%s, %s)\n", debugstr_w(s1
), debugstr_w(s2
));
822 SetLastError(ERROR_INVALID_PARAMETER
);
825 if (s1
[0] == '.' || !s1
[0] || s2
[0] == '.' || !s2
[0])
827 SetLastError(ERROR_INVALID_NAME
);
830 if (!(p
= strchrW(s2
, '.'))) return FALSE
;
831 if (strchrW(p
+ 1, '.') && !strcmpW(p
+ 1, s1
)) return TRUE
;
832 else if (!strcmpW(s1
, s2
)) return TRUE
;