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 = heap_alloc(sizeof(cookie));
94 list_init(&newCookie->entry);
95 newCookie->lpCookieName = NULL;
96 newCookie->lpCookieData = NULL;
97 newCookie->expiry = expiry;
98 newCookie->lpCookieName = heap_strdupW(name);
99 newCookie->lpCookieData = heap_strdupW(data);
101 TRACE("added cookie %p (data is %s)\n", newCookie, debugstr_w(data) );
103 list_add_tail(&domain->cookie_list, &newCookie->entry);
104 newCookie->parent = domain;
109 /* finds a cookie in the domain matching the cookie name */
110 static cookie *COOKIE_findCookie(cookie_domain *domain, LPCWSTR lpszCookieName)
112 struct list * cursor;
113 TRACE("(%p, %s)\n", domain, debugstr_w(lpszCookieName));
115 LIST_FOR_EACH(cursor, &domain->cookie_list)
117 cookie *searchCookie = LIST_ENTRY(cursor, cookie, entry);
118 BOOL candidate = TRUE;
119 if (candidate && lpszCookieName)
121 if (candidate && !searchCookie->lpCookieName)
123 if (candidate && strcmpW(lpszCookieName, searchCookie->lpCookieName) != 0)
132 /* removes a cookie from the list, if its the last cookie we also remove the domain */
133 static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain)
135 HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieName);
136 HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieData);
137 list_remove(&deadCookie->entry);
139 /* special case: last cookie, lets remove the domain to save memory */
140 if (list_empty(&deadCookie->parent->cookie_list) && deleteDomain)
141 COOKIE_deleteDomain(deadCookie->parent);
142 HeapFree(GetProcessHeap(), 0, deadCookie);
145 /* allocates a domain and adds it to the end */
146 static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path)
148 cookie_domain *newDomain = heap_alloc(sizeof(cookie_domain));
150 list_init(&newDomain->entry);
151 list_init(&newDomain->cookie_list);
152 newDomain->lpCookieDomain = NULL;
153 newDomain->lpCookiePath = NULL;
154 newDomain->lpCookieDomain = heap_strdupW(domain);
155 newDomain->lpCookiePath = heap_strdupW(path);
157 list_add_tail(&domain_list, &newDomain->entry);
159 TRACE("Adding domain: %p\n", newDomain);
163 static BOOL COOKIE_crackUrlSimple(LPCWSTR lpszUrl, LPWSTR hostName, int hostNameLen, LPWSTR path, int pathLen)
165 URL_COMPONENTSW UrlComponents;
167 UrlComponents.lpszExtraInfo = NULL;
168 UrlComponents.lpszPassword = NULL;
169 UrlComponents.lpszScheme = NULL;
170 UrlComponents.lpszUrlPath = path;
171 UrlComponents.lpszUserName = NULL;
172 UrlComponents.lpszHostName = hostName;
173 UrlComponents.dwExtraInfoLength = 0;
174 UrlComponents.dwPasswordLength = 0;
175 UrlComponents.dwSchemeLength = 0;
176 UrlComponents.dwUserNameLength = 0;
177 UrlComponents.dwHostNameLength = hostNameLen;
178 UrlComponents.dwUrlPathLength = pathLen;
180 if (!InternetCrackUrlW(lpszUrl, 0, 0, &UrlComponents)) return FALSE;
182 /* discard the webpage off the end of the path */
183 if (UrlComponents.dwUrlPathLength)
185 if (path[UrlComponents.dwUrlPathLength - 1] != '/')
188 if ((ptr = strrchrW(path, '/'))) *(++ptr) = 0;
196 else if (pathLen >= 2)
204 /* match a domain. domain must match if the domain is not NULL. path must match if the path is not NULL */
205 static BOOL COOKIE_matchDomain(LPCWSTR lpszCookieDomain, LPCWSTR lpszCookiePath,
206 cookie_domain *searchDomain, BOOL allow_partial)
208 TRACE("searching on domain %p\n", searchDomain);
209 if (lpszCookieDomain)
211 if (!searchDomain->lpCookieDomain)
214 TRACE("comparing domain %s with %s\n",
215 debugstr_w(lpszCookieDomain),
216 debugstr_w(searchDomain->lpCookieDomain));
218 if (allow_partial && !strstrW(lpszCookieDomain, searchDomain->lpCookieDomain))
220 else if (!allow_partial && lstrcmpW(lpszCookieDomain, searchDomain->lpCookieDomain) != 0)
226 TRACE("comparing paths: %s with %s\n", debugstr_w(lpszCookiePath), debugstr_w(searchDomain->lpCookiePath));
227 /* paths match at the beginning. so a path of /foo would match
228 * /foobar and /foo/bar
230 if (!searchDomain->lpCookiePath)
234 len = lstrlenW(searchDomain->lpCookiePath);
235 if (strncmpiW(searchDomain->lpCookiePath, lpszCookiePath, len)!=0)
238 else if (strcmpW(lpszCookiePath, searchDomain->lpCookiePath))
245 /* remove a domain from the list and delete it */
246 static void COOKIE_deleteDomain(cookie_domain *deadDomain)
248 struct list * cursor;
249 while ((cursor = list_tail(&deadDomain->cookie_list)))
251 COOKIE_deleteCookie(LIST_ENTRY(cursor, cookie, entry), FALSE);
255 HeapFree(GetProcessHeap(), 0, deadDomain->lpCookieDomain);
256 HeapFree(GetProcessHeap(), 0, deadDomain->lpCookiePath);
258 list_remove(&deadDomain->entry);
260 HeapFree(GetProcessHeap(), 0, deadDomain);
263 BOOL get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD *size)
265 unsigned cnt = 0, len, domain_count = 0, cookie_count = 0;
266 cookie_domain *domain;
269 GetSystemTimeAsFileTime(&tm);
271 LIST_FOR_EACH_ENTRY(domain, &domain_list, cookie_domain, entry) {
272 struct list *cursor, *cursor2;
274 if(!COOKIE_matchDomain(host, path, domain, TRUE))
278 TRACE("found domain %p\n", domain);
280 LIST_FOR_EACH_SAFE(cursor, cursor2, &domain->cookie_list) {
281 cookie *cookie_iter = LIST_ENTRY(cursor, cookie, entry);
283 /* check for expiry */
284 if((cookie_iter->expiry.dwLowDateTime != 0 || cookie_iter->expiry.dwHighDateTime != 0)
285 && CompareFileTime(&tm, &cookie_iter->expiry) > 0)
287 TRACE("Found expired cookie. deleting\n");
288 COOKIE_deleteCookie(cookie_iter, FALSE);
292 if(!cookie_data) { /* return the size of the buffer required to lpdwSize */
295 cnt += strlenW(cookie_iter->lpCookieName);
296 if ((len = strlenW(cookie_iter->lpCookieData))) {
301 static const WCHAR szsc[] = { ';',' ',0 };
302 static const WCHAR szname[] = { '%','s',0 };
303 static const WCHAR szdata[] = { '=','%','s',0 };
305 if (cookie_count) cnt += snprintfW(cookie_data + cnt, *size - cnt, szsc);
306 cnt += snprintfW(cookie_data + cnt, *size - cnt, szname, cookie_iter->lpCookieName);
308 if (cookie_iter->lpCookieData[0])
309 cnt += snprintfW(cookie_data + cnt, *size - cnt, szdata, cookie_iter->lpCookieData);
311 TRACE("Cookie: %s\n", debugstr_w(cookie_data));
318 TRACE("no cookies found for %s\n", debugstr_w(host));
319 SetLastError(ERROR_NO_MORE_ITEMS);
324 *size = (cnt + 1) * sizeof(WCHAR);
325 TRACE("returning %u\n", *size);
331 TRACE("Returning %u (from %u domains): %s\n", cnt, domain_count, debugstr_w(cookie_data));
335 /***********************************************************************
336 * InternetGetCookieW (WININET.@)
338 * Retrieve cookie from the specified url
340 * It should be noted that on windows the lpszCookieName parameter is "not implemented".
341 * So it won't be implemented here.
348 BOOL WINAPI InternetGetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
349 LPWSTR lpCookieData, LPDWORD lpdwSize)
351 WCHAR host[INTERNET_MAX_HOST_NAME_LENGTH], path[INTERNET_MAX_PATH_LENGTH];
354 TRACE("(%s, %s, %p, %p)\n", debugstr_w(lpszUrl),debugstr_w(lpszCookieName), lpCookieData, lpdwSize);
358 SetLastError(ERROR_INVALID_PARAMETER);
363 ret = COOKIE_crackUrlSimple(lpszUrl, host, sizeof(host)/sizeof(host[0]), path, sizeof(path)/sizeof(path[0]));
364 if (!ret || !host[0]) return FALSE;
366 return get_cookie(host, path, lpCookieData, lpdwSize);
370 /***********************************************************************
371 * InternetGetCookieA (WININET.@)
373 * Retrieve cookie from the specified url
380 BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
381 LPSTR lpCookieData, LPDWORD lpdwSize)
384 LPWSTR szCookieData = NULL, url, name;
387 TRACE("(%s,%s,%p)\n", debugstr_a(lpszUrl), debugstr_a(lpszCookieName),
390 url = heap_strdupAtoW(lpszUrl);
391 name = heap_strdupAtoW(lpszCookieName);
393 r = InternetGetCookieW( url, name, NULL, &len );
396 szCookieData = heap_alloc(len * sizeof(WCHAR));
403 r = InternetGetCookieW( url, name, szCookieData, &len );
405 *lpdwSize = WideCharToMultiByte( CP_ACP, 0, szCookieData, len,
406 lpCookieData, *lpdwSize, NULL, NULL );
410 HeapFree( GetProcessHeap(), 0, szCookieData );
411 HeapFree( GetProcessHeap(), 0, name );
412 HeapFree( GetProcessHeap(), 0, url );
417 BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cookie_data)
419 cookie_domain *thisCookieDomain = NULL;
425 BOOL expired = FALSE;
427 value = data = heap_strdupW(cookie_data);
430 ERR("could not allocate the cookie data buffer\n");
434 memset(&expiry,0,sizeof(expiry));
436 /* lots of information can be parsed out of the cookie value */
441 static const WCHAR szDomain[] = {'d','o','m','a','i','n','=',0};
442 static const WCHAR szPath[] = {'p','a','t','h','=',0};
443 static const WCHAR szExpires[] = {'e','x','p','i','r','e','s','=',0};
444 static const WCHAR szSecure[] = {'s','e','c','u','r','e',0};
445 static const WCHAR szHttpOnly[] = {'h','t','t','p','o','n','l','y',0};
447 if (!(ptr = strchrW(ptr,';'))) break;
451 HeapFree(GetProcessHeap(), 0, value);
452 value = heap_alloc((ptr - data) * sizeof(WCHAR));
455 HeapFree(GetProcessHeap(), 0, data);
456 ERR("could not allocate the cookie value buffer\n");
459 strcpyW(value, data);
461 while (*ptr == ' ') ptr++; /* whitespace */
463 if (strncmpiW(ptr, szDomain, 7) == 0)
465 ptr+=strlenW(szDomain);
467 TRACE("Parsing new domain %s\n",debugstr_w(domain));
469 else if (strncmpiW(ptr, szPath, 5) == 0)
471 ptr+=strlenW(szPath);
473 TRACE("Parsing new path %s\n",debugstr_w(path));
475 else if (strncmpiW(ptr, szExpires, 8) == 0)
479 FIXME("persistent cookies not handled (%s)\n",debugstr_w(ptr));
480 ptr+=strlenW(szExpires);
481 if (InternetTimeToSystemTimeW(ptr, &st, 0))
483 SystemTimeToFileTime(&st, &expiry);
484 GetSystemTimeAsFileTime(&ft);
486 if (CompareFileTime(&ft,&expiry) > 0)
488 TRACE("Cookie already expired.\n");
493 else if (strncmpiW(ptr, szSecure, 6) == 0)
495 FIXME("secure not handled (%s)\n",debugstr_w(ptr));
496 ptr += strlenW(szSecure);
498 else if (strncmpiW(ptr, szHttpOnly, 8) == 0)
500 FIXME("httponly not handled (%s)\n",debugstr_w(ptr));
501 ptr += strlenW(szHttpOnly);
505 FIXME("Unknown additional option %s\n",debugstr_w(ptr));
510 LIST_FOR_EACH(cursor, &domain_list)
512 thisCookieDomain = LIST_ENTRY(cursor, cookie_domain, entry);
513 if (COOKIE_matchDomain(domain, path, thisCookieDomain, FALSE))
515 thisCookieDomain = NULL;
518 if (!thisCookieDomain)
521 thisCookieDomain = COOKIE_addDomain(domain, path);
524 HeapFree(GetProcessHeap(),0,data);
525 if (value != data) HeapFree(GetProcessHeap(), 0, value);
530 if ((thisCookie = COOKIE_findCookie(thisCookieDomain, cookie_name)))
531 COOKIE_deleteCookie(thisCookie, FALSE);
533 TRACE("setting cookie %s=%s for domain %s path %s\n", debugstr_w(cookie_name),
534 debugstr_w(value), debugstr_w(thisCookieDomain->lpCookieDomain),debugstr_w(thisCookieDomain->lpCookiePath));
536 if (!expired && !COOKIE_addCookie(thisCookieDomain, cookie_name, value, expiry))
538 HeapFree(GetProcessHeap(),0,data);
539 if (value != data) HeapFree(GetProcessHeap(), 0, value);
543 HeapFree(GetProcessHeap(),0,data);
544 if (value != data) HeapFree(GetProcessHeap(), 0, value);
548 /***********************************************************************
549 * InternetSetCookieW (WININET.@)
551 * Sets cookie for the specified url
558 BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
559 LPCWSTR lpCookieData)
562 WCHAR hostName[2048], path[2048];
564 TRACE("(%s,%s,%s)\n", debugstr_w(lpszUrl),
565 debugstr_w(lpszCookieName), debugstr_w(lpCookieData));
567 if (!lpszUrl || !lpCookieData)
569 SetLastError(ERROR_INVALID_PARAMETER);
574 ret = COOKIE_crackUrlSimple(lpszUrl, hostName, sizeof(hostName)/sizeof(hostName[0]), path, sizeof(path)/sizeof(path[0]));
575 if (!ret || !hostName[0]) return FALSE;
579 WCHAR *cookie, *data;
581 cookie = heap_strdupW(lpCookieData);
584 SetLastError(ERROR_OUTOFMEMORY);
588 /* some apps (or is it us??) try to add a cookie with no cookie name, but
589 * the cookie data in the form of name[=data].
591 if (!(data = strchrW(cookie, '='))) data = cookie + strlenW(cookie);
594 ret = set_cookie(hostName, path, cookie, data);
596 HeapFree(GetProcessHeap(), 0, cookie);
599 return set_cookie(hostName, path, lpszCookieName, lpCookieData);
603 /***********************************************************************
604 * InternetSetCookieA (WININET.@)
606 * Sets cookie for the specified url
613 BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
616 LPWSTR data, url, name;
619 TRACE("(%s,%s,%s)\n", debugstr_a(lpszUrl),
620 debugstr_a(lpszCookieName), debugstr_a(lpCookieData));
622 url = heap_strdupAtoW(lpszUrl);
623 name = heap_strdupAtoW(lpszCookieName);
624 data = heap_strdupAtoW(lpCookieData);
626 r = InternetSetCookieW( url, name, data );
628 HeapFree( GetProcessHeap(), 0, data );
629 HeapFree( GetProcessHeap(), 0, name );
630 HeapFree( GetProcessHeap(), 0, url );
635 /***********************************************************************
636 * InternetSetCookieExA (WININET.@)
638 * See InternetSetCookieExW.
640 DWORD WINAPI InternetSetCookieExA( LPCSTR lpszURL, LPCSTR lpszCookieName, LPCSTR lpszCookieData,
641 DWORD dwFlags, DWORD_PTR dwReserved)
643 TRACE("(%s, %s, %s, 0x%08x, 0x%08lx)\n",
644 debugstr_a(lpszURL), debugstr_a(lpszCookieName), debugstr_a(lpszCookieData),
645 dwFlags, dwReserved);
647 if (dwFlags) FIXME("flags 0x%08x not supported\n", dwFlags);
648 return InternetSetCookieA(lpszURL, lpszCookieName, lpszCookieData);
651 /***********************************************************************
652 * InternetSetCookieExW (WININET.@)
654 * Sets a cookie for the specified URL.
661 DWORD WINAPI InternetSetCookieExW( LPCWSTR lpszURL, LPCWSTR lpszCookieName, LPCWSTR lpszCookieData,
662 DWORD dwFlags, DWORD_PTR dwReserved)
664 TRACE("(%s, %s, %s, 0x%08x, 0x%08lx)\n",
665 debugstr_w(lpszURL), debugstr_w(lpszCookieName), debugstr_w(lpszCookieData),
666 dwFlags, dwReserved);
668 if (dwFlags) FIXME("flags 0x%08x not supported\n", dwFlags);
669 return InternetSetCookieW(lpszURL, lpszCookieName, lpszCookieData);
672 /***********************************************************************
673 * InternetGetCookieExA (WININET.@)
675 * See InternetGetCookieExW.
677 BOOL WINAPI InternetGetCookieExA( LPCSTR pchURL, LPCSTR pchCookieName, LPSTR pchCookieData,
678 LPDWORD pcchCookieData, DWORD dwFlags, LPVOID lpReserved)
680 TRACE("(%s, %s, %s, %p, 0x%08x, %p)\n",
681 debugstr_a(pchURL), debugstr_a(pchCookieName), debugstr_a(pchCookieData),
682 pcchCookieData, dwFlags, lpReserved);
684 if (dwFlags) FIXME("flags 0x%08x not supported\n", dwFlags);
685 return InternetGetCookieA(pchURL, pchCookieName, pchCookieData, pcchCookieData);
688 /***********************************************************************
689 * InternetGetCookieExW (WININET.@)
691 * Retrieve cookie for the specified URL.
698 BOOL WINAPI InternetGetCookieExW( LPCWSTR pchURL, LPCWSTR pchCookieName, LPWSTR pchCookieData,
699 LPDWORD pcchCookieData, DWORD dwFlags, LPVOID lpReserved)
701 TRACE("(%s, %s, %s, %p, 0x%08x, %p)\n",
702 debugstr_w(pchURL), debugstr_w(pchCookieName), debugstr_w(pchCookieData),
703 pcchCookieData, dwFlags, lpReserved);
705 if (dwFlags) FIXME("flags 0x%08x not supported\n", dwFlags);
706 return InternetGetCookieW(pchURL, pchCookieName, pchCookieData, pcchCookieData);
709 /***********************************************************************
710 * InternetClearAllPerSiteCookieDecisions (WININET.@)
712 * Clears all per-site decisions about cookies.
719 BOOL WINAPI InternetClearAllPerSiteCookieDecisions( VOID )
725 /***********************************************************************
726 * InternetEnumPerSiteCookieDecisionA (WININET.@)
728 * See InternetEnumPerSiteCookieDecisionW.
730 BOOL WINAPI InternetEnumPerSiteCookieDecisionA( LPSTR pszSiteName, ULONG *pcSiteNameSize,
731 ULONG *pdwDecision, ULONG dwIndex )
733 FIXME("(%s, %p, %p, 0x%08x) stub\n",
734 debugstr_a(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
738 /***********************************************************************
739 * InternetEnumPerSiteCookieDecisionW (WININET.@)
741 * Enumerates all per-site decisions about cookies.
748 BOOL WINAPI InternetEnumPerSiteCookieDecisionW( LPWSTR pszSiteName, ULONG *pcSiteNameSize,
749 ULONG *pdwDecision, ULONG dwIndex )
751 FIXME("(%s, %p, %p, 0x%08x) stub\n",
752 debugstr_w(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
756 /***********************************************************************
757 * InternetGetPerSiteCookieDecisionA (WININET.@)
759 BOOL WINAPI InternetGetPerSiteCookieDecisionA( LPCSTR pwchHostName, ULONG *pResult )
761 FIXME("(%s, %p) stub\n", debugstr_a(pwchHostName), pResult);
765 /***********************************************************************
766 * InternetGetPerSiteCookieDecisionW (WININET.@)
768 BOOL WINAPI InternetGetPerSiteCookieDecisionW( LPCWSTR pwchHostName, ULONG *pResult )
770 FIXME("(%s, %p) stub\n", debugstr_w(pwchHostName), pResult);
774 /***********************************************************************
775 * InternetSetPerSiteCookieDecisionA (WININET.@)
777 BOOL WINAPI InternetSetPerSiteCookieDecisionA( LPCSTR pchHostName, DWORD dwDecision )
779 FIXME("(%s, 0x%08x) stub\n", debugstr_a(pchHostName), dwDecision);
783 /***********************************************************************
784 * InternetSetPerSiteCookieDecisionW (WININET.@)
786 BOOL WINAPI InternetSetPerSiteCookieDecisionW( LPCWSTR pchHostName, DWORD dwDecision )
788 FIXME("(%s, 0x%08x) stub\n", debugstr_w(pchHostName), dwDecision);
792 /***********************************************************************
793 * IsDomainLegalCookieDomainW (WININET.@)
795 BOOL WINAPI IsDomainLegalCookieDomainW( LPCWSTR s1, LPCWSTR s2 )
799 FIXME("(%s, %s)\n", debugstr_w(s1), debugstr_w(s2));
803 SetLastError(ERROR_INVALID_PARAMETER);
806 if (s1[0] == '.' || !s1[0] || s2[0] == '.' || !s2[0])
808 SetLastError(ERROR_INVALID_NAME);
811 if (!(p = strchrW(s2, '.'))) return FALSE;
812 if (strchrW(p + 1, '.') && !strcmpW(p + 1, s1)) return TRUE;
813 else if (!strcmpW(s1, s2)) return TRUE;