wininet from Wine vendor drop
Added: vendor/wine/dlls/wininet/
Added: vendor/wine/dlls/wininet/current/
Added: vendor/wine/dlls/wininet/current/Makefile.in
Added: vendor/wine/dlls/wininet/current/cookie.c
Added: vendor/wine/dlls/wininet/current/dialogs.c
Added: vendor/wine/dlls/wininet/current/ftp.c
Added: vendor/wine/dlls/wininet/current/gopher.c
Added: vendor/wine/dlls/wininet/current/http.c
Added: vendor/wine/dlls/wininet/current/internet.c
Added: vendor/wine/dlls/wininet/current/internet.h
Added: vendor/wine/dlls/wininet/current/netconnection.c
Added: vendor/wine/dlls/wininet/current/resource.h
Added: vendor/wine/dlls/wininet/current/rsrc.rc
Added: vendor/wine/dlls/wininet/current/urlcache.c
Added: vendor/wine/dlls/wininet/current/utility.c
Added: vendor/wine/dlls/wininet/current/version.rc
Added: vendor/wine/dlls/wininet/current/wininet.spec
Added: vendor/wine/dlls/wininet/current/wininet_Bg.rc
Added: vendor/wine/dlls/wininet/current/wininet_Cs.rc
Added: vendor/wine/dlls/wininet/current/wininet_De.rc
Added: vendor/wine/dlls/wininet/current/wininet_En.rc
Added: vendor/wine/dlls/wininet/current/wininet_Es.rc
Added: vendor/wine/dlls/wininet/current/wininet_Fi.rc
Added: vendor/wine/dlls/wininet/current/wininet_Fr.rc
Added: vendor/wine/dlls/wininet/current/wininet_It.rc
Added: vendor/wine/dlls/wininet/current/wininet_Ja.rc
Added: vendor/wine/dlls/wininet/current/wininet_Ko.rc
Added: vendor/wine/dlls/wininet/current/wininet_Nl.rc
Added: vendor/wine/dlls/wininet/current/wininet_No.rc
Added: vendor/wine/dlls/wininet/current/wininet_Pt.rc
Added: vendor/wine/dlls/wininet/current/wininet_Ru.rc
Added: vendor/wine/dlls/wininet/current/wininet_Si.rc
Added: vendor/wine/dlls/wininet/current/wininet_main.c
_____
Added: vendor/wine/dlls/wininet/current/Makefile.in
--- vendor/wine/dlls/wininet/current/Makefile.in 2006-01-15
21:59:39 UTC (rev 20906)
+++ vendor/wine/dlls/wininet/current/Makefile.in 2006-01-15
22:20:27 UTC (rev 20907)
@@ -0,0 +1,31 @@
+EXTRADEFS = -D_WINX32_
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR = @srcdir@
+VPATH = @srcdir@
+MODULE = wininet.dll
+IMPORTLIB = libwininet.$(IMPLIBEXT)
+IMPORTS = mpr shlwapi shell32 user32 advapi32 kernel32 ntdll
+EXTRALIBS = $(LIBUNICODE) @SOCKETLIBS@
+
+C_SRCS = \
+ cookie.c \
+ dialogs.c \
+ ftp.c \
+ gopher.c \
+ http.c \
+ internet.c \
+ netconnection.c \
+ urlcache.c \
+ utility.c \
+ wininet_main.c
+
+RC_SRCS = \
+ rsrc.rc \
+ version.rc
+
+SUBDIRS = tests
+
+@MAKE_DLL_RULES@
+
+### Dependencies:
Property changes on: vendor/wine/dlls/wininet/current/Makefile.in
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
_____
Added: vendor/wine/dlls/wininet/current/cookie.c
--- vendor/wine/dlls/wininet/current/cookie.c 2006-01-15 21:59:39 UTC
(rev 20906)
+++ vendor/wine/dlls/wininet/current/cookie.c 2006-01-15 22:20:27 UTC
(rev 20907)
@@ -0,0 +1,501 @@
+/*
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "windef.h"
+#include "winbase.h"
+#include "wininet.h"
+#include "winerror.h"
+
+#include "wine/debug.h"
+#include "internet.h"
+
+#include "wine/list.h"
+
+#define RESPONSE_TIMEOUT 30 /* FROM internet.c */
+
+
+WINE_DEFAULT_DEBUG_CHANNEL(wininet);
+
+/* FIXME
+ * Cookies are currently memory only.
+ * Cookies are NOT THREAD SAFE
+ * Cookies could use A LOT OF MEMORY. We need some kind of memory
management here!
+ * Cookies should care about the expiry time
+ */
+
+typedef struct _cookie_domain cookie_domain;
+typedef struct _cookie cookie;
+
+struct _cookie
+{
+ struct list entry;
+
+ struct _cookie_domain *parent;
+
+ LPWSTR lpCookieName;
+ LPWSTR lpCookieData;
+ time_t expiry; /* FIXME: not used */
+};
+
+struct _cookie_domain
+{
+ struct list entry;
+
+ LPWSTR lpCookieDomain;
+ LPWSTR lpCookiePath;
+ struct list cookie_list;
+};
+
+static struct list domain_list = LIST_INIT(domain_list);
+
+static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name,
LPCWSTR data);
+static cookie *COOKIE_findCookie(cookie_domain *domain, LPCWSTR
lpszCookieName);
+static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain);
+static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path);
+static void COOKIE_deleteDomain(cookie_domain *deadDomain);
+
+
+/* adds a cookie to the domain */
+static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name,
LPCWSTR data)
+{
+ cookie *newCookie = HeapAlloc(GetProcessHeap(), 0, sizeof(cookie));
+
+ list_init(&newCookie->entry);
+ newCookie->lpCookieName = NULL;
+ newCookie->lpCookieData = NULL;
+
+ if (name)
+ {
+ newCookie->lpCookieName = HeapAlloc(GetProcessHeap(), 0,
(strlenW(name) + 1)*sizeof(WCHAR));
+ lstrcpyW(newCookie->lpCookieName, name);
+ }
+ if (data)
+ {
+ newCookie->lpCookieData = HeapAlloc(GetProcessHeap(), 0,
(strlenW(data) + 1)*sizeof(WCHAR));
+ lstrcpyW(newCookie->lpCookieData, data);
+ }
+
+ TRACE("added cookie %p (data is %s)\n", newCookie, debugstr_w(data)
);
+
+ list_add_tail(&domain->cookie_list, &newCookie->entry);
+ newCookie->parent = domain;
+ return newCookie;
+}
+
+
+/* finds a cookie in the domain matching the cookie name */
+static cookie *COOKIE_findCookie(cookie_domain *domain, LPCWSTR
lpszCookieName)
+{
+ struct list * cursor;
+ TRACE("(%p, %s)\n", domain, debugstr_w(lpszCookieName));
+
+ LIST_FOR_EACH(cursor, &domain->cookie_list)
+ {
+ cookie *searchCookie = LIST_ENTRY(cursor, cookie, entry);
+ BOOL candidate = TRUE;
+ if (candidate && lpszCookieName)
+ {
+ if (candidate && !searchCookie->lpCookieName)
+ candidate = FALSE;
+ if (candidate && strcmpW(lpszCookieName,
searchCookie->lpCookieName) != 0)
+ 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)
+{
+ HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieName);
+ HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieData);
+ list_remove(&deadCookie->entry);
+
+ /* special case: last cookie, lets remove the domain to save memory
*/
+ if (list_empty(&deadCookie->parent->cookie_list) && deleteDomain)
+ COOKIE_deleteDomain(deadCookie->parent);
+ HeapFree(GetProcessHeap(), 0, deadCookie);
+}
+
+/* allocates a domain and adds it to the end */
+static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path)
+{
+ cookie_domain *newDomain = HeapAlloc(GetProcessHeap(), 0,
sizeof(cookie_domain));
+
+ list_init(&newDomain->entry);
+ list_init(&newDomain->cookie_list);
+ newDomain->lpCookieDomain = NULL;
+ newDomain->lpCookiePath = NULL;
+
+ if (domain)
+ {
+ newDomain->lpCookieDomain = HeapAlloc(GetProcessHeap(), 0,
(strlenW(domain) + 1)*sizeof(WCHAR));
+ strcpyW(newDomain->lpCookieDomain, domain);
+ }
+ if (path)
+ {
+ newDomain->lpCookiePath = HeapAlloc(GetProcessHeap(), 0,
(strlenW(path) + 1)*sizeof(WCHAR));
+ lstrcpyW(newDomain->lpCookiePath, path);
+ }
+
+ list_add_tail(&domain_list, &newDomain->entry);
+
+ TRACE("Adding domain: %p\n", newDomain);
+ return newDomain;
+}
+
+static void COOKIE_crackUrlSimple(LPCWSTR lpszUrl, LPWSTR hostName, int
hostNameLen, LPWSTR path, int pathLen)
+{
+ URL_COMPONENTSW UrlComponents;
+
+ UrlComponents.lpszExtraInfo = NULL;
+ UrlComponents.lpszPassword = NULL;
+ UrlComponents.lpszScheme = NULL;
+ UrlComponents.lpszUrlPath = path;
+ UrlComponents.lpszUserName = NULL;
+ UrlComponents.lpszHostName = hostName;
+ UrlComponents.dwHostNameLength = hostNameLen;
+ UrlComponents.dwUrlPathLength = pathLen;
+
+ InternetCrackUrlW(lpszUrl, 0, 0, &UrlComponents);
+}
+
+/* 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)
+{
+ TRACE("searching on domain %p\n", searchDomain);
+ if (lpszCookieDomain)
+ {
+ if (!searchDomain->lpCookieDomain)
+ return FALSE;
+
+ TRACE("comparing domain %s with %s\n",
+ 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;
+ }
+ if (lpszCookiePath)
+ {
+ TRACE("comparing paths: %s with %s\n",
debugstr_w(lpszCookiePath), debugstr_w(searchDomain->lpCookiePath));
+ if (!searchDomain->lpCookiePath)
+ return FALSE;
+ if (strcmpW(lpszCookiePath, searchDomain->lpCookiePath))
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/* remove a domain from the list and delete it */
+static void COOKIE_deleteDomain(cookie_domain *deadDomain)
+{
+ struct list * cursor;
+ while ((cursor = list_tail(&deadDomain->cookie_list)))
+ {
+ COOKIE_deleteCookie(LIST_ENTRY(cursor, cookie, entry), FALSE);
+ list_remove(cursor);
+ }
+
+ HeapFree(GetProcessHeap(), 0, deadDomain->lpCookieDomain);
+ HeapFree(GetProcessHeap(), 0, deadDomain->lpCookiePath);
+
+ list_remove(&deadDomain->entry);
+
+ HeapFree(GetProcessHeap(), 0, deadDomain);
+}
+
+/**********************************************************************
*
+ * 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)
+{
+ struct list * cursor;
+ int cnt = 0, domain_count = 0;
+ int cookie_count = 0;
+ WCHAR hostName[2048], path[2048];
+
+ TRACE("(%s, %s, %p, %p)\n",
debugstr_w(lpszUrl),debugstr_w(lpszCookieName),
+ lpCookieData, lpdwSize);
+
+ COOKIE_crackUrlSimple(lpszUrl, hostName,
sizeof(hostName)/sizeof(hostName[0]), path,
sizeof(path)/sizeof(path[0]));
+
+ LIST_FOR_EACH(cursor, &domain_list)
+ {
+ cookie_domain *cookiesDomain = LIST_ENTRY(cursor,
cookie_domain, entry);
+ if (COOKIE_matchDomain(hostName, NULL /* FIXME: path */,
cookiesDomain, TRUE))
+ {
+ struct list * cursor;
+ domain_count++;
+ TRACE("found domain %p\n", cookiesDomain);
+
+ LIST_FOR_EACH(cursor, &cookiesDomain->cookie_list)
+ {
+ cookie *thisCookie = LIST_ENTRY(cursor, cookie, entry);
+ if (lpCookieData == NULL) /* return the size of the
buffer required to lpdwSize */
+ {
+ if (cookie_count != 0)
+ cnt += 2; /* '; ' */
+ cnt += strlenW(thisCookie->lpCookieName);
+ cnt += 1; /* = */
+ cnt += strlenW(thisCookie->lpCookieData);
+ }
+ else
+ {
+ static const WCHAR szsc[] = { ';',' ',0 };
+ static const WCHAR szpseq[] = {
'%','s','=','%','s',0 };
+ if (cookie_count != 0)
+ cnt += snprintfW(lpCookieData + cnt, *lpdwSize
- cnt, szsc);
+ cnt += snprintfW(lpCookieData + cnt, *lpdwSize -
cnt, szpseq,
+ thisCookie->lpCookieName,
+ thisCookie->lpCookieData);
+ TRACE("Cookie: %s=%s\n",
debugstr_w(thisCookie->lpCookieName),
debugstr_w(thisCookie->lpCookieData));
+ }
+ cookie_count++;
+ }
+ }
+ }
+ if (lpCookieData == NULL)
+ {
+ cnt += 1; /* NULL */
+ *lpdwSize = cnt*sizeof(WCHAR);
+ TRACE("returning\n");
+ return TRUE;
+ }
+
+ if (!domain_count)
+ return FALSE;
+
+ *lpdwSize = (cnt + 1)*sizeof(WCHAR);
+
+ TRACE("Returning %i (from %i domains): %s\n", cnt, domain_count,
+ debugstr_w(lpCookieData));
+
+ return (cnt ? TRUE : FALSE);
+}
+
+
+/**********************************************************************
*
+ * InternetGetCookieA (WININET.@)
+ *
+ * Retrieve cookie from the specified url
+ *
+ * RETURNS
+ * TRUE on success
+ * FALSE on failure
+ *
+ */
+BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
+ LPSTR lpCookieData, LPDWORD lpdwSize)
+{
+ DWORD len;
+ LPWSTR szCookieData = NULL, szUrl = NULL, szCookieName = NULL;
+ BOOL r;
+
+ TRACE("(%s,%s,%p)\n", debugstr_a(lpszUrl),
debugstr_a(lpszCookieName),
+ lpCookieData);
+
+ if( lpszUrl )
+ {
+ len = MultiByteToWideChar( CP_ACP, 0, lpszUrl, -1, NULL, 0 );
+ szUrl = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, lpszUrl, -1, szUrl, len );
+ }
+
+ if( lpszCookieName )
+ {
+ len = MultiByteToWideChar( CP_ACP, 0, lpszCookieName, -1, NULL,
0 );
+ szCookieName = HeapAlloc( GetProcessHeap(), 0, len *
sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, lpszCookieName, -1,
szCookieName, len );
+ }
+
+ r = InternetGetCookieW( szUrl, szCookieName, NULL, &len );
+ if( r )
+ {
+ szCookieData = HeapAlloc( GetProcessHeap(), 0, len *
sizeof(WCHAR) );
+ if( !szCookieData )
+ return FALSE;
+
+ r = InternetGetCookieW( szUrl, szCookieName, szCookieData, &len
);
+
+ *lpdwSize = WideCharToMultiByte( CP_ACP, 0, szCookieData, len,
+ lpCookieData, *lpdwSize, NULL, NULL );
+ }
+
+ HeapFree( GetProcessHeap(), 0, szCookieData );
+ HeapFree( GetProcessHeap(), 0, szCookieName );
+ HeapFree( GetProcessHeap(), 0, szUrl );
+
+ return r;
+}
+
+
+/**********************************************************************
*
+ * InternetSetCookieW (WININET.@)
+ *
+ * Sets cookie for the specified url
+ *
+ * RETURNS
+ * TRUE on success
+ * FALSE on failure
+ *
+ */
+BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
+ LPCWSTR lpCookieData)
+{
+ cookie_domain *thisCookieDomain = NULL;
+ cookie *thisCookie;
+ WCHAR hostName[2048], path[2048];
+ struct list * cursor;
+
+ TRACE("(%s,%s,%s)\n", debugstr_w(lpszUrl),
+ debugstr_w(lpszCookieName), debugstr_w(lpCookieData));
+
+ if (!lpCookieData || !strlenW(lpCookieData))
+ {
+ TRACE("no cookie data, not adding\n");
+ return FALSE;
+ }
+ if (!lpszCookieName)
+ {
+ /* 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. */
+ /* FIXME, probably a bug here, for now I don't care */
+ WCHAR *ourCookieName, *ourCookieData;
+ int ourCookieNameSize;
+ BOOL ret;
+
+ if (!(ourCookieData = strchrW(lpCookieData, '=')))
+ {
+ TRACE("something terribly wrong with cookie data %s\n",
+ debugstr_w(ourCookieData));
+ return FALSE;
+ }
+ ourCookieNameSize = ourCookieData - lpCookieData;
+ ourCookieData += 1;
+ ourCookieName = HeapAlloc(GetProcessHeap(), 0,
+ (ourCookieNameSize + 1)*sizeof(WCHAR));
+ memcpy(ourCookieName, ourCookieData, ourCookieNameSize *
sizeof(WCHAR));
+ ourCookieName[ourCookieNameSize] = '\0';
+ TRACE("setting (hacked) cookie of %s, %s\n",
+ debugstr_w(ourCookieName), debugstr_w(ourCookieData));
+ ret = InternetSetCookieW(lpszUrl, ourCookieName,
ourCookieData);
+ HeapFree(GetProcessHeap(), 0, ourCookieName);
+ return ret;
+ }
+
+ COOKIE_crackUrlSimple(lpszUrl, hostName,
sizeof(hostName)/sizeof(hostName[0]), path,
sizeof(path)/sizeof(path[0]));
+
+ LIST_FOR_EACH(cursor, &domain_list)
+ {
+ thisCookieDomain = LIST_ENTRY(cursor, cookie_domain, entry);
+ if (COOKIE_matchDomain(hostName, NULL /* FIXME: path */,
thisCookieDomain, FALSE))
+ break;
+ thisCookieDomain = NULL;
+ }
+ if (!thisCookieDomain)
+ thisCookieDomain = COOKIE_addDomain(hostName, path);
+
+ if ((thisCookie = COOKIE_findCookie(thisCookieDomain,
lpszCookieName)))
+ COOKIE_deleteCookie(thisCookie, FALSE);
+
+ thisCookie = COOKIE_addCookie(thisCookieDomain, lpszCookieName,
lpCookieData);
+ return TRUE;
+}
+
+
+/**********************************************************************
*
+ * InternetSetCookieA (WININET.@)
+ *
+ * Sets cookie for the specified url
+ *
+ * RETURNS
+ * TRUE on success
+ * FALSE on failure
+ *
+ */
+BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
+ LPCSTR lpCookieData)
+{
+ DWORD len;
+ LPWSTR szCookieData = NULL, szUrl = NULL, szCookieName = NULL;
+ BOOL r;
+
+ TRACE("(%s,%s,%s)\n", debugstr_a(lpszUrl),
+ debugstr_a(lpszCookieName), debugstr_a(lpCookieData));
+
+ if( lpszUrl )
+ {
+ len = MultiByteToWideChar( CP_ACP, 0, lpszUrl, -1, NULL, 0 );
+ szUrl = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, lpszUrl, -1, szUrl, len );
+ }
+
+ if( lpszCookieName )
+ {
+ len = MultiByteToWideChar( CP_ACP, 0, lpszCookieName, -1, NULL,
0 );
+ szCookieName = HeapAlloc( GetProcessHeap(), 0, len *
sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, lpszCookieName, -1,
szCookieName, len );
+ }
+
+ if( lpCookieData )
+ {
+ len = MultiByteToWideChar( CP_ACP, 0, lpCookieData, -1, NULL, 0
);
+ szCookieData = HeapAlloc( GetProcessHeap(), 0, len *
sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, lpCookieData, -1, szCookieData,
len );
+ }
+
+ r = InternetSetCookieW( szUrl, szCookieName, szCookieData );
+
+ HeapFree( GetProcessHeap(), 0, szCookieData );
+ HeapFree( GetProcessHeap(), 0, szCookieName );
+ HeapFree( GetProcessHeap(), 0, szUrl );
+
+ return r;
+}
Property changes on: vendor/wine/dlls/wininet/current/cookie.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
_____
Added: vendor/wine/dlls/wininet/current/dialogs.c
--- vendor/wine/dlls/wininet/current/dialogs.c 2006-01-15 21:59:39 UTC
(rev 20906)
+++ vendor/wine/dlls/wininet/current/dialogs.c 2006-01-15 22:20:27 UTC
(rev 20907)
@@ -0,0 +1,384 @@
+/*
+ * Wininet
+ *
+ * Copyright 2003 Mike McCormack for CodeWeavers Inc.
+ *
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "wininet.h"
+#include "winnetwk.h"
+#include "winnls.h"
+#include "wine/debug.h"
+#include "winerror.h"
+#define NO_SHLWAPI_STREAM
+#include "shlwapi.h"
+
+#include "internet.h"
+
+#include "wine/unicode.h"
+
+#include "resource.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wininet);
+
+struct WININET_ErrorDlgParams
+{
+ HWND hWnd;
+ HINTERNET hRequest;
+ DWORD dwError;
+ DWORD dwFlags;
+ LPVOID* lppvData;
+};
+
+/**********************************************************************
*
+ * WININET_GetProxyServer
+ *
+ * Determine the name of the proxy server the request is using
+ */
+static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf,
DWORD sz )
+{
+ LPWININETHTTPREQW lpwhr;
+ LPWININETHTTPSESSIONW lpwhs = NULL;
+ LPWININETAPPINFOW hIC = NULL;
+ LPWSTR p;
+
+ lpwhr = (LPWININETHTTPREQW) WININET_GetObject( hRequest );
+ if (NULL == lpwhr)
+ return FALSE;
+
+ lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent;
+ if (NULL == lpwhs)
+ return FALSE;
+
+ hIC = (LPWININETAPPINFOW) lpwhs->hdr.lpwhparent;
+ if (NULL == hIC)
+ return FALSE;
+
+ lstrcpynW(szBuf, hIC->lpszProxy, sz);
+
+ /* FIXME: perhaps it would be better to use InternetCrackUrl here
*/
+ p = strchrW(szBuf, ':');
+ if(*p)
+ *p = 0;
+
+ return TRUE;
+}
+
+/**********************************************************************
*
+ * WININET_GetAuthRealm
+ *
+ * Determine the name of the (basic) Authentication realm
+ */
+static BOOL WININET_GetAuthRealm( HINTERNET hRequest, LPWSTR szBuf,
DWORD sz )
+{
+ LPWSTR p, q;
+ DWORD index;
+ static const WCHAR szRealm[] = {
'r','e','a','l','m','=',0 };
+
+ /* extract the Realm from the proxy response and show it */
+ index = 0;
+ if( !HttpQueryInfoW( hRequest, HTTP_QUERY_PROXY_AUTHENTICATE,
+ szBuf, &sz, &index) )
+ return FALSE;
+
+ /*
+ * FIXME: maybe we should check that we're
+ * dealing with 'Basic' Authentication
+ */
+ p = strchrW( szBuf, ' ' );
+ if( p && !strncmpW( p+1, szRealm, strlenW(szRealm) ) )
+ {
+ /* remove quotes */
+ p += 7;
+ if( *p == '"' )
+ {
+ p++;
+ q = strrchrW( p, '"' );
+ if( q )
+ *q = 0;
+ }
+ }
+
+ strcpyW( szBuf, p );
+
+ return TRUE;
+}
+
+/**********************************************************************
*
+ * WININET_GetSetPassword
+ */
+static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer,
+ LPCWSTR szRealm, BOOL bSet )
+{
+ WCHAR szResource[0x80], szUserPass[0x40];
+ LPWSTR p;
+ HWND hUserItem, hPassItem;
+ DWORD r, dwMagic = 19;
+ UINT r_len, u_len;
+ WORD sz;
+ static const WCHAR szColon[] = { ':',0 };
+ static const WCHAR szbs[] = { '/', 0 };
+
+ hUserItem = GetDlgItem( hdlg, IDC_USERNAME );
+ hPassItem = GetDlgItem( hdlg, IDC_PASSWORD );
+
+ /* now try fetch the username and password */
+ lstrcpyW( szResource, szServer);
+ lstrcatW( szResource, szbs);
+ lstrcatW( szResource, szRealm);
+
+ /*
+ * WNetCachePassword is only concerned with the length
+ * of the data stored (which we tell it) and it does
+ * not use strlen() internally so we can add WCHAR data
+ * instead of ASCII data and get it back the same way.
+ */
+ if( bSet )
+ {
+ szUserPass[0] = 0;
+ GetWindowTextW( hUserItem, szUserPass,
+ (sizeof szUserPass-1)/sizeof(WCHAR) );
+ lstrcatW(szUserPass, szColon);
+ u_len = strlenW( szUserPass );
+ GetWindowTextW( hPassItem, szUserPass+u_len,
+ (sizeof szUserPass)/sizeof(WCHAR)-u_len );
+
+ r_len = (strlenW( szResource ) + 1)*sizeof(WCHAR);
+ u_len = (strlenW( szUserPass ) + 1)*sizeof(WCHAR);
+ r = WNetCachePassword( (CHAR*)szResource, r_len,
+ (CHAR*)szUserPass, u_len, dwMagic, 0 );
+
+ return ( r == WN_SUCCESS );
+ }
+
+ sz = sizeof szUserPass;
+ r_len = (strlenW( szResource ) + 1)*sizeof(WCHAR);
+ r = WNetGetCachedPassword( (CHAR*)szResource, r_len,
+ (CHAR*)szUserPass, &sz, dwMagic );
+ if( r != WN_SUCCESS )
+ return FALSE;
+
+ p = strchrW( szUserPass, ':' );
+ if( p )
+ {
+ *p = 0;
+ SetWindowTextW( hUserItem, szUserPass );
+ SetWindowTextW( hPassItem, p+1 );
+ }
+
+ return TRUE;
+}
+
+/**********************************************************************
*
+ * WININET_SetProxyAuthorization
+ */
+static BOOL WININET_SetProxyAuthorization( HINTERNET hRequest,
+ LPWSTR username, LPWSTR
password )
+{
+ LPWININETHTTPREQW lpwhr;
+ LPWININETHTTPSESSIONW lpwhs;
+ LPWININETAPPINFOW hIC;
+ LPWSTR p;
+
+ lpwhr = (LPWININETHTTPREQW) WININET_GetObject( hRequest );
+ if( !lpwhr )
+ return FALSE;
+
+ lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent;
+ if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION)
+ {
+ INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
+ return FALSE;
+ }
+
+ hIC = (LPWININETAPPINFOW) lpwhs->hdr.lpwhparent;
+
+ p = HeapAlloc( GetProcessHeap(), 0, (strlenW( username ) +
1)*sizeof(WCHAR) );
+ if( !p )
+ return FALSE;
+
+ lstrcpyW( p, username );
+ hIC->lpszProxyUsername = p;
+
+ p = HeapAlloc( GetProcessHeap(), 0, (strlenW( password ) +
1)*sizeof(WCHAR) );
+ if( !p )
+ return FALSE;
+
+ lstrcpyW( p, password );
+ hIC->lpszProxyPassword = p;
+
+ return TRUE;
+}
+
+/**********************************************************************
*
+ * WININET_ProxyPasswordDialog
+ */
+static INT_PTR WINAPI WININET_ProxyPasswordDialog(
+ HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+{
+ HWND hitem;
+ struct WININET_ErrorDlgParams *params;
+ WCHAR szRealm[0x80], szServer[0x80];
+
+ if( uMsg == WM_INITDIALOG )
+ {
+ TRACE("WM_INITDIALOG (%08lx)\n", lParam);
+
+ /* save the parameter list */
+ params = (struct WININET_ErrorDlgParams*) lParam;
+ SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam );
+
+ /* extract the Realm from the proxy response and show it */
+ if( WININET_GetAuthRealm( params->hRequest,
+ szRealm, sizeof
szRealm/sizeof(WCHAR)) )
+ {
+ hitem = GetDlgItem( hdlg, IDC_REALM );
+ SetWindowTextW( hitem, szRealm );
+ }
+
+ /* extract the name of the proxy server */
+ if( WININET_GetProxyServer( params->hRequest,
+ szServer, sizeof
szServer/sizeof(WCHAR)) )
+ {
+ hitem = GetDlgItem( hdlg, IDC_PROXY );
+ SetWindowTextW( hitem, szServer );
+ }
+
+ WININET_GetSetPassword( hdlg, szServer, szRealm, FALSE );
+
+ return TRUE;
+ }
+
+ params = (struct WININET_ErrorDlgParams*)
+ GetWindowLongPtrW( hdlg, GWLP_USERDATA );
+
+ switch( uMsg )
+ {
+ case WM_COMMAND:
+ if( wParam == IDOK )
+ {
+ WCHAR username[0x20], password[0x20];
+
+ username[0] = 0;
+ hitem = GetDlgItem( hdlg, IDC_USERNAME );
+ if( hitem )
+ GetWindowTextW( hitem, username, sizeof
username/sizeof(WCHAR) );
+
+ password[0] = 0;
+ hitem = GetDlgItem( hdlg, IDC_PASSWORD );
+ if( hitem )
+ GetWindowTextW( hitem, password, sizeof
password/sizeof(WCHAR) );
+
+ hitem = GetDlgItem( hdlg, IDC_SAVEPASSWORD );
+ if( hitem &&
+ SendMessageW( hitem, BM_GETSTATE, 0, 0 ) &&
+ WININET_GetAuthRealm( params->hRequest,
+ szRealm, sizeof
szRealm/sizeof(WCHAR)) &&
+ WININET_GetProxyServer( params->hRequest,
+ szServer, sizeof
szServer/sizeof(WCHAR)) )
+ {
+ WININET_GetSetPassword( hdlg, szServer, szRealm, TRUE
);
+ }
+ WININET_SetProxyAuthorization( params->hRequest, username,
password );
+
+ EndDialog( hdlg, ERROR_INTERNET_FORCE_RETRY );
+ return TRUE;
+ }
+ if( wParam == IDCANCEL )
+ {
+ EndDialog( hdlg, 0 );
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+/**********************************************************************
*
+ * WININET_GetConnectionStatus
+ */
+static INT WININET_GetConnectionStatus( HINTERNET hRequest )
+{
+ WCHAR szStatus[0x20];
+ DWORD sz, index, dwStatus;
+
+ TRACE("%p\n", hRequest );
+
+ sz = sizeof szStatus;
+ index = 0;
+ if( !HttpQueryInfoW( hRequest, HTTP_QUERY_STATUS_CODE,
+ szStatus, &sz, &index))
+ return -1;
+ dwStatus = atoiW( szStatus );
+
+ TRACE("request %p status = %ld\n", hRequest, dwStatus );
+
+ return dwStatus;
+}
+
+
+/**********************************************************************
*
+ * InternetErrorDlg
+ */
+DWORD WINAPI InternetErrorDlg(HWND hWnd, HINTERNET hRequest,
+ DWORD dwError, DWORD dwFlags, LPVOID* lppvData)
+{
+ struct WININET_ErrorDlgParams params;
+ HMODULE hwininet = GetModuleHandleA( "wininet.dll" );
+ INT dwStatus;
+
+ TRACE("%p %p %ld %08lx %p\n", hWnd, hRequest, dwError, dwFlags,
lppvData);
+
+ params.hWnd = hWnd;
+ params.hRequest = hRequest;
+ params.dwError = dwError;
+ params.dwFlags = dwFlags;
+ params.lppvData = lppvData;
+
+ switch( dwError )
+ {
+ case ERROR_SUCCESS:
+ if( !(dwFlags & FLAGS_ERROR_UI_FILTER_FOR_ERRORS ) )
+ return 0;
+ dwStatus = WININET_GetConnectionStatus( hRequest );
+ if( HTTP_STATUS_PROXY_AUTH_REQ != dwStatus )
+ return ERROR_SUCCESS;
+ return DialogBoxParamW( hwininet, MAKEINTRESOURCEW(
IDD_PROXYDLG ),
+ hWnd, WININET_ProxyPasswordDialog, (LPARAM) ¶ms
);
+
+ case ERROR_INTERNET_INCORRECT_PASSWORD:
+ return DialogBoxParamW( hwininet, MAKEINTRESOURCEW(
IDD_PROXYDLG ),
+ hWnd, WININET_ProxyPasswordDialog, (LPARAM) ¶ms
);
+
+ case ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR:
+ case ERROR_INTERNET_INVALID_CA:
+ case ERROR_INTERNET_POST_IS_NON_SECURE:
+ case ERROR_INTERNET_SEC_CERT_CN_INVALID:
+ case ERROR_INTERNET_SEC_CERT_DATE_INVALID:
+ FIXME("Need to display dialog for error %ld\n", dwError);
+ return ERROR_SUCCESS;
+ }
+ return ERROR_INVALID_PARAMETER;
+}
Property changes on: vendor/wine/dlls/wininet/current/dialogs.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
_____
Added: vendor/wine/dlls/wininet/current/ftp.c
--- vendor/wine/dlls/wininet/current/ftp.c 2006-01-15 21:59:39 UTC
(rev 20906)
+++ vendor/wine/dlls/wininet/current/ftp.c 2006-01-15 22:20:27 UTC
(rev 20907)
@@ -0,0 +1,3147 @@
+/*
+ * WININET - Ftp implementation
+ *
+ * Copyright 1999 Corel Corporation
+ * Copyright 2004 Mike McCormack for CodeWeavers
+ * Copyright 2004 Kevin Koltzau
+ *
+ * Ulrich Czekalla
+ * Noureddine Jemmali
+ *
+ * Copyright 2000 Andreas Mohr
+ * Copyright 2002 Jaco Greeff
+ *
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#include <time.h>
+#include <assert.h>
+
[truncated at 1000 lines; 16091 more skipped]