2000-04-11 22:07:00 +02:00
|
|
|
/*
|
|
|
|
* Wininet
|
|
|
|
*
|
|
|
|
* Copyright 1999 Corel Corporation
|
2002-06-22 01:59:49 +02:00
|
|
|
* Copyright 2002 CodeWeavers Inc.
|
2003-06-21 01:26:56 +02:00
|
|
|
* Copyright 2002 Jaco Greeff
|
|
|
|
* Copyright 2002 TransGaming Technologies Inc.
|
2004-02-09 23:07:42 +01:00
|
|
|
* Copyright 2004 Mike McCormack for CodeWeavers
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* Ulrich Czekalla
|
2002-06-22 01:59:49 +02:00
|
|
|
* Aric Stewart
|
2003-06-21 01:26:56 +02:00
|
|
|
* David Hammerton
|
2002-10-28 19:48:24 +01:00
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* 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
|
2000-04-11 22:07:00 +02:00
|
|
|
*/
|
|
|
|
|
2016-05-17 19:15:49 +02:00
|
|
|
#include "config.h"
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2014-05-06 11:33:18 +02:00
|
|
|
#ifdef HAVE_CORESERVICES_CORESERVICES_H
|
|
|
|
#define GetCurrentThread MacGetCurrentThread
|
|
|
|
#define LoadResource MacLoadResource
|
|
|
|
#include <CoreServices/CoreServices.h>
|
|
|
|
#undef GetCurrentThread
|
|
|
|
#undef LoadResource
|
|
|
|
#endif
|
|
|
|
|
2016-05-17 19:15:49 +02:00
|
|
|
#include "winsock2.h"
|
|
|
|
#include "ws2ipdef.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
2000-11-30 02:31:28 +01:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2001-11-06 23:31:19 +01:00
|
|
|
#include "winreg.h"
|
2004-11-21 16:42:57 +01:00
|
|
|
#include "winuser.h"
|
2000-04-11 22:07:00 +02:00
|
|
|
#include "wininet.h"
|
2002-10-28 19:48:24 +01:00
|
|
|
#include "winnls.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2000-04-11 22:07:00 +02:00
|
|
|
#include "winerror.h"
|
2001-12-11 01:30:17 +01:00
|
|
|
#define NO_SHLWAPI_STREAM
|
2001-01-06 01:36:43 +01:00
|
|
|
#include "shlwapi.h"
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2002-07-19 05:12:18 +02:00
|
|
|
#include "wine/exception.h"
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
#include "internet.h"
|
2004-11-21 16:42:57 +01:00
|
|
|
#include "resource.h"
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
#include "wine/unicode.h"
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD dwError;
|
|
|
|
CHAR response[MAX_REPLY_LEN];
|
|
|
|
} WITHREADERROR, *LPWITHREADERROR;
|
|
|
|
|
2004-11-29 19:00:10 +01:00
|
|
|
static DWORD g_dwTlsErrIndex = TLS_OUT_OF_INDEXES;
|
2010-12-19 21:34:27 +01:00
|
|
|
HMODULE WININET_hModule;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-02-07 02:03:41 +01:00
|
|
|
static CRITICAL_SECTION WININET_cs;
|
|
|
|
static CRITICAL_SECTION_DEBUG WININET_cs_debug =
|
|
|
|
{
|
|
|
|
0, 0, &WININET_cs,
|
|
|
|
{ &WININET_cs_debug.ProcessLocksList, &WININET_cs_debug.ProcessLocksList },
|
2005-09-09 12:19:44 +02:00
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": WININET_cs") }
|
2004-02-07 02:03:41 +01:00
|
|
|
};
|
|
|
|
static CRITICAL_SECTION WININET_cs = { &WININET_cs_debug, -1, 0, 0, 0, 0 };
|
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
static object_header_t **handle_table;
|
|
|
|
static UINT_PTR next_handle;
|
|
|
|
static UINT_PTR handle_table_size;
|
2004-02-07 02:03:41 +01:00
|
|
|
|
2010-01-20 21:48:55 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-07-21 21:54:27 +02:00
|
|
|
DWORD proxyEnabled;
|
|
|
|
LPWSTR proxy;
|
|
|
|
LPWSTR proxyBypass;
|
2014-05-06 11:32:26 +02:00
|
|
|
LPWSTR proxyUsername;
|
|
|
|
LPWSTR proxyPassword;
|
2010-01-20 21:48:55 +01:00
|
|
|
} proxyinfo_t;
|
|
|
|
|
2012-03-08 12:20:53 +01:00
|
|
|
static ULONG max_conns = 2, max_1_0_conns = 4;
|
2012-05-14 13:49:29 +02:00
|
|
|
static ULONG connect_timeout = 60000;
|
2012-03-08 12:20:53 +01:00
|
|
|
|
2010-01-20 21:48:55 +01:00
|
|
|
static const WCHAR szInternetSettings[] =
|
|
|
|
{ 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
|
|
|
'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',0 };
|
|
|
|
static const WCHAR szProxyServer[] = { 'P','r','o','x','y','S','e','r','v','e','r', 0 };
|
|
|
|
static const WCHAR szProxyEnable[] = { 'P','r','o','x','y','E','n','a','b','l','e', 0 };
|
2013-05-04 02:11:48 +02:00
|
|
|
static const WCHAR szProxyOverride[] = { 'P','r','o','x','y','O','v','e','r','r','i','d','e', 0 };
|
2010-01-20 21:48:55 +01:00
|
|
|
|
2011-02-02 22:51:13 +01:00
|
|
|
void *alloc_object(object_header_t *parent, const object_vtbl_t *vtbl, size_t size)
|
2004-02-07 02:03:41 +01:00
|
|
|
{
|
2010-04-09 13:43:23 +02:00
|
|
|
UINT_PTR handle = 0, num;
|
2011-02-02 22:51:13 +01:00
|
|
|
object_header_t *ret;
|
|
|
|
object_header_t **p;
|
|
|
|
BOOL res = TRUE;
|
2004-02-07 02:03:41 +01:00
|
|
|
|
2011-02-02 22:51:13 +01:00
|
|
|
ret = heap_alloc_zero(size);
|
|
|
|
if(!ret)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
list_init(&ret->children);
|
2007-09-21 03:59:40 +02:00
|
|
|
|
2004-02-07 02:03:41 +01:00
|
|
|
EnterCriticalSection( &WININET_cs );
|
2011-02-02 22:50:31 +01:00
|
|
|
|
|
|
|
if(!handle_table_size) {
|
|
|
|
num = 16;
|
|
|
|
p = heap_alloc_zero(sizeof(handle_table[0]) * num);
|
|
|
|
if(p) {
|
|
|
|
handle_table = p;
|
|
|
|
handle_table_size = num;
|
|
|
|
next_handle = 1;
|
|
|
|
}else {
|
2011-02-02 22:51:13 +01:00
|
|
|
res = FALSE;
|
2011-02-02 22:50:31 +01:00
|
|
|
}
|
|
|
|
}else if(next_handle == handle_table_size) {
|
|
|
|
num = handle_table_size * 2;
|
|
|
|
p = heap_realloc_zero(handle_table, sizeof(handle_table[0]) * num);
|
|
|
|
if(p) {
|
|
|
|
handle_table = p;
|
|
|
|
handle_table_size = num;
|
|
|
|
}else {
|
2011-02-02 22:51:13 +01:00
|
|
|
res = FALSE;
|
2011-02-02 22:50:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-02 22:51:13 +01:00
|
|
|
if(res) {
|
2011-02-02 22:50:31 +01:00
|
|
|
handle = next_handle;
|
|
|
|
if(handle_table[handle])
|
|
|
|
ERR("handle isn't free but should be\n");
|
2011-02-02 22:51:13 +01:00
|
|
|
handle_table[handle] = ret;
|
|
|
|
ret->valid_handle = TRUE;
|
2011-02-02 22:50:31 +01:00
|
|
|
|
2016-06-02 14:36:53 +02:00
|
|
|
while(next_handle < handle_table_size && handle_table[next_handle])
|
2011-02-02 22:50:31 +01:00
|
|
|
next_handle++;
|
|
|
|
}
|
2011-02-02 22:51:13 +01:00
|
|
|
|
2004-02-07 02:03:41 +01:00
|
|
|
LeaveCriticalSection( &WININET_cs );
|
|
|
|
|
2011-02-02 22:51:13 +01:00
|
|
|
if(!res) {
|
|
|
|
heap_free(ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret->vtbl = vtbl;
|
|
|
|
ret->refs = 1;
|
|
|
|
ret->hInternet = (HINTERNET)handle;
|
|
|
|
|
|
|
|
if(parent) {
|
|
|
|
ret->lpfnStatusCB = parent->lpfnStatusCB;
|
|
|
|
ret->dwInternalFlags = parent->dwInternalFlags & INET_CALLBACKW;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2004-02-07 02:03:41 +01:00
|
|
|
}
|
|
|
|
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *WININET_AddRef( object_header_t *info )
|
2004-07-19 23:49:39 +02:00
|
|
|
{
|
2008-03-10 17:39:15 +01:00
|
|
|
ULONG refs = InterlockedIncrement(&info->refs);
|
|
|
|
TRACE("%p -> refcount = %d\n", info, refs );
|
2004-07-19 23:49:39 +02:00
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
object_header_t *get_handle_object( HINTERNET hinternet )
|
2004-02-07 02:03:41 +01:00
|
|
|
{
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *info = NULL;
|
2010-04-09 13:43:23 +02:00
|
|
|
UINT_PTR handle = (UINT_PTR) hinternet;
|
2004-02-07 02:03:41 +01:00
|
|
|
|
|
|
|
EnterCriticalSection( &WININET_cs );
|
|
|
|
|
2011-02-02 22:50:46 +01:00
|
|
|
if(handle > 0 && handle < handle_table_size && handle_table[handle] && handle_table[handle]->valid_handle)
|
2011-02-02 22:50:31 +01:00
|
|
|
info = WININET_AddRef(handle_table[handle]);
|
2004-02-07 02:03:41 +01:00
|
|
|
|
|
|
|
LeaveCriticalSection( &WININET_cs );
|
|
|
|
|
2010-04-09 13:43:23 +02:00
|
|
|
TRACE("handle %ld -> %p\n", handle, info);
|
2004-02-07 02:03:41 +01:00
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2011-02-02 22:50:46 +01:00
|
|
|
static void invalidate_handle(object_header_t *info)
|
|
|
|
{
|
|
|
|
object_header_t *child, *next;
|
|
|
|
|
|
|
|
if(!info->valid_handle)
|
|
|
|
return;
|
|
|
|
info->valid_handle = FALSE;
|
|
|
|
|
|
|
|
/* Free all children as native does */
|
|
|
|
LIST_FOR_EACH_ENTRY_SAFE( child, next, &info->children, object_header_t, entry )
|
|
|
|
{
|
|
|
|
TRACE("invalidating child handle %p for parent %p\n", child->hInternet, info);
|
|
|
|
invalidate_handle( child );
|
|
|
|
}
|
|
|
|
|
|
|
|
WININET_Release(info);
|
|
|
|
}
|
|
|
|
|
2009-07-07 21:46:09 +02:00
|
|
|
BOOL WININET_Release( object_header_t *info )
|
2004-07-19 23:49:39 +02:00
|
|
|
{
|
2008-03-10 17:39:15 +01:00
|
|
|
ULONG refs = InterlockedDecrement(&info->refs);
|
|
|
|
TRACE( "object %p refcount = %d\n", info, refs );
|
|
|
|
if( !refs )
|
2004-07-19 23:49:39 +02:00
|
|
|
{
|
2011-02-02 22:50:46 +01:00
|
|
|
invalidate_handle(info);
|
2008-02-26 20:21:00 +01:00
|
|
|
if ( info->vtbl->CloseConnection )
|
2007-08-23 07:06:00 +02:00
|
|
|
{
|
|
|
|
TRACE( "closing connection %p\n", info);
|
2008-02-26 20:21:00 +01:00
|
|
|
info->vtbl->CloseConnection( info );
|
2007-08-23 07:06:00 +02:00
|
|
|
}
|
2008-05-31 21:46:34 +02:00
|
|
|
/* Don't send a callback if this is a session handle created with InternetOpenUrl */
|
2009-03-02 19:57:17 +01:00
|
|
|
if ((info->htype != WH_HHTTPSESSION && info->htype != WH_HFTPSESSION)
|
|
|
|
|| !(info->dwInternalFlags & INET_OPENURL))
|
2008-05-31 21:46:34 +02:00
|
|
|
{
|
|
|
|
INTERNET_SendCallback(info, info->dwContext,
|
|
|
|
INTERNET_STATUS_HANDLE_CLOSING, &info->hInternet,
|
|
|
|
sizeof(HINTERNET));
|
|
|
|
}
|
2004-07-19 23:49:39 +02:00
|
|
|
TRACE( "destroying object %p\n", info);
|
2007-09-21 03:59:40 +02:00
|
|
|
if ( info->htype != WH_HINIT )
|
|
|
|
list_remove( &info->entry );
|
2008-02-26 20:20:41 +01:00
|
|
|
info->vtbl->Destroy( info );
|
2004-07-19 23:49:39 +02:00
|
|
|
|
2011-02-02 22:50:46 +01:00
|
|
|
if(info->hInternet) {
|
|
|
|
UINT_PTR handle = (UINT_PTR)info->hInternet;
|
2004-02-07 02:03:41 +01:00
|
|
|
|
2011-02-02 22:50:46 +01:00
|
|
|
EnterCriticalSection( &WININET_cs );
|
2004-02-07 02:03:41 +01:00
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
handle_table[handle] = NULL;
|
2011-02-02 22:50:46 +01:00
|
|
|
if(next_handle > handle)
|
|
|
|
next_handle = handle;
|
2004-02-07 02:03:41 +01:00
|
|
|
|
2011-02-02 22:50:46 +01:00
|
|
|
LeaveCriticalSection( &WININET_cs );
|
2007-09-21 03:59:40 +02:00
|
|
|
}
|
2011-02-03 20:45:12 +01:00
|
|
|
|
|
|
|
heap_free(info);
|
2007-09-21 03:59:40 +02:00
|
|
|
}
|
2011-02-02 22:50:46 +01:00
|
|
|
return TRUE;
|
2004-02-07 02:03:41 +01:00
|
|
|
}
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
/***********************************************************************
|
2002-11-05 00:53:41 +01:00
|
|
|
* DllMain [Internal] Initializes the internal 'WININET.DLL'.
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* PARAMS
|
2000-07-16 17:44:22 +02:00
|
|
|
* hinstDLL [I] handle to the DLL's instance
|
2000-04-11 22:07:00 +02:00
|
|
|
* fdwReason [I]
|
2000-07-16 17:44:22 +02:00
|
|
|
* lpvReserved [I] reserved, must be NULL
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE
|
|
|
|
* Failure: FALSE
|
|
|
|
*/
|
|
|
|
|
2002-11-05 00:53:41 +01:00
|
|
|
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
switch (fdwReason) {
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
|
|
|
|
g_dwTlsErrIndex = TlsAlloc();
|
|
|
|
|
2011-10-18 21:56:32 +02:00
|
|
|
if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES)
|
|
|
|
return FALSE;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2012-09-21 14:53:33 +02:00
|
|
|
if(!init_urlcache())
|
|
|
|
{
|
|
|
|
TlsFree(g_dwTlsErrIndex);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-12-12 07:01:20 +01:00
|
|
|
|
2008-02-04 23:07:57 +01:00
|
|
|
WININET_hModule = hinstDLL;
|
2011-10-18 21:56:32 +02:00
|
|
|
break;
|
2004-11-21 16:42:57 +01:00
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
case DLL_THREAD_ATTACH:
|
2011-10-18 21:56:32 +02:00
|
|
|
break;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
case DLL_THREAD_DETACH:
|
2011-06-01 11:50:53 +02:00
|
|
|
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
|
|
|
|
{
|
|
|
|
heap_free(TlsGetValue(g_dwTlsErrIndex));
|
|
|
|
}
|
|
|
|
break;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
case DLL_PROCESS_DETACH:
|
2013-05-15 10:32:40 +02:00
|
|
|
if (lpvReserved) break;
|
2012-05-25 16:35:48 +02:00
|
|
|
collect_connections(COLLECT_CLEANUP);
|
2009-10-02 16:43:45 +02:00
|
|
|
NETCON_unload();
|
2012-09-21 14:53:33 +02:00
|
|
|
free_urlcache();
|
2012-10-01 14:23:10 +02:00
|
|
|
free_cookie();
|
2009-10-02 16:43:45 +02:00
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
|
|
|
|
{
|
|
|
|
heap_free(TlsGetValue(g_dwTlsErrIndex));
|
|
|
|
TlsFree(g_dwTlsErrIndex);
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-07-24 12:20:00 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* DllInstall (WININET.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
|
|
|
|
{
|
|
|
|
FIXME("(%x %s): stub\n", bInstall, debugstr_w(cmdline));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-01-20 21:49:05 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_SaveProxySettings
|
|
|
|
*
|
|
|
|
* Stores the proxy settings given by lpwai into the registry
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* ERROR_SUCCESS if no error, or error code on fail
|
|
|
|
*/
|
|
|
|
static LONG INTERNET_SaveProxySettings( proxyinfo_t *lpwpi )
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG ret;
|
|
|
|
|
|
|
|
if ((ret = RegOpenKeyW( HKEY_CURRENT_USER, szInternetSettings, &key )))
|
|
|
|
return ret;
|
|
|
|
|
2011-07-21 21:54:27 +02:00
|
|
|
if ((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE*)&lpwpi->proxyEnabled, sizeof(DWORD))))
|
2010-01-20 21:49:05 +01:00
|
|
|
{
|
|
|
|
RegCloseKey( key );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-07-21 21:54:27 +02:00
|
|
|
if (lpwpi->proxy)
|
2010-01-20 21:49:05 +01:00
|
|
|
{
|
2011-07-21 21:54:27 +02:00
|
|
|
if ((ret = RegSetValueExW( key, szProxyServer, 0, REG_SZ, (BYTE*)lpwpi->proxy, sizeof(WCHAR) * (lstrlenW(lpwpi->proxy) + 1))))
|
2010-01-20 21:49:05 +01:00
|
|
|
{
|
|
|
|
RegCloseKey( key );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-10-09 01:29:53 +02:00
|
|
|
if ((ret = RegDeleteValueW( key, szProxyServer )) && ret != ERROR_FILE_NOT_FOUND)
|
2010-01-20 21:49:05 +01:00
|
|
|
{
|
|
|
|
RegCloseKey( key );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(key);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2010-03-13 18:36:46 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_FindProxyForProtocol
|
|
|
|
*
|
|
|
|
* Searches the proxy string for a proxy of the given protocol.
|
|
|
|
* Returns the found proxy, or the default proxy if none of the given
|
|
|
|
* protocol is found.
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
|
|
|
* szProxy [In] proxy string to search
|
|
|
|
* proto [In] protocol to search for, e.g. "http"
|
|
|
|
* foundProxy [Out] found proxy
|
|
|
|
* foundProxyLen [In/Out] length of foundProxy buffer, in WCHARs
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE if a proxy is found, FALSE if not. If foundProxy is too short,
|
|
|
|
* *foundProxyLen is set to the required size in WCHARs, including the
|
|
|
|
* NULL terminator, and the last error is set to ERROR_INSUFFICIENT_BUFFER.
|
|
|
|
*/
|
2016-05-17 19:19:59 +02:00
|
|
|
WCHAR *INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto)
|
2010-03-13 18:36:46 +01:00
|
|
|
{
|
2016-05-17 19:19:59 +02:00
|
|
|
WCHAR *ret = NULL;
|
|
|
|
const WCHAR *ptr;
|
2010-03-13 18:36:46 +01:00
|
|
|
|
|
|
|
TRACE("(%s, %s)\n", debugstr_w(szProxy), debugstr_w(proto));
|
|
|
|
|
|
|
|
/* First, look for the specified protocol (proto=scheme://host:port) */
|
2016-05-17 19:19:59 +02:00
|
|
|
for (ptr = szProxy; ptr && *ptr; )
|
2010-03-13 18:36:46 +01:00
|
|
|
{
|
|
|
|
LPCWSTR end, equal;
|
|
|
|
|
|
|
|
if (!(end = strchrW(ptr, ' ')))
|
|
|
|
end = ptr + strlenW(ptr);
|
|
|
|
if ((equal = strchrW(ptr, '=')) && equal < end &&
|
|
|
|
equal - ptr == strlenW(proto) &&
|
|
|
|
!strncmpiW(proto, ptr, strlenW(proto)))
|
|
|
|
{
|
2016-05-17 19:19:59 +02:00
|
|
|
ret = heap_strndupW(equal + 1, end - equal - 1);
|
|
|
|
TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
|
|
|
|
return ret;
|
2010-03-13 18:36:46 +01:00
|
|
|
}
|
|
|
|
if (*end == ' ')
|
|
|
|
ptr = end + 1;
|
|
|
|
else
|
|
|
|
ptr = end;
|
|
|
|
}
|
2016-05-17 19:19:59 +02:00
|
|
|
|
|
|
|
/* It wasn't found: look for no protocol */
|
|
|
|
for (ptr = szProxy; ptr && *ptr; )
|
2010-03-13 18:36:46 +01:00
|
|
|
{
|
2016-05-17 19:19:59 +02:00
|
|
|
LPCWSTR end;
|
2010-03-13 18:36:46 +01:00
|
|
|
|
2016-05-17 19:19:59 +02:00
|
|
|
if (!(end = strchrW(ptr, ' ')))
|
|
|
|
end = ptr + strlenW(ptr);
|
|
|
|
if (!strchrW(ptr, '='))
|
|
|
|
{
|
|
|
|
ret = heap_strndupW(ptr, end - ptr);
|
|
|
|
TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
|
|
|
|
return ret;
|
2010-03-13 18:36:46 +01:00
|
|
|
}
|
2016-05-17 19:19:59 +02:00
|
|
|
if (*end == ' ')
|
|
|
|
ptr = end + 1;
|
|
|
|
else
|
|
|
|
ptr = end;
|
2010-03-13 18:36:46 +01:00
|
|
|
}
|
2016-05-17 19:19:59 +02:00
|
|
|
|
|
|
|
return NULL;
|
2010-03-13 18:36:46 +01:00
|
|
|
}
|
|
|
|
|
2002-10-28 19:48:24 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetInitializeAutoProxyDll (WININET.@)
|
|
|
|
*
|
|
|
|
* Setup the internal proxy
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
|
|
|
* dwReserved
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2002-10-29 22:31:26 +01:00
|
|
|
BOOL WINAPI InternetInitializeAutoProxyDll(DWORD dwReserved)
|
2002-10-28 19:48:24 +01:00
|
|
|
{
|
|
|
|
FIXME("STUB\n");
|
2009-12-03 14:47:43 +01:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
2002-10-28 19:48:24 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-04-22 01:24:46 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* DetectAutoProxyUrl (WININET.@)
|
|
|
|
*
|
|
|
|
* Auto detect the proxy url
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DetectAutoProxyUrl(LPSTR lpszAutoProxyUrl,
|
|
|
|
DWORD dwAutoProxyUrlLength, DWORD dwDetectFlags)
|
|
|
|
{
|
|
|
|
FIXME("STUB\n");
|
2009-12-03 14:47:43 +01:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
2003-04-22 01:24:46 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-01-20 21:48:55 +01:00
|
|
|
static void FreeProxyInfo( proxyinfo_t *lpwpi )
|
|
|
|
{
|
2011-07-21 21:54:27 +02:00
|
|
|
heap_free(lpwpi->proxy);
|
|
|
|
heap_free(lpwpi->proxyBypass);
|
2014-05-06 11:32:26 +02:00
|
|
|
heap_free(lpwpi->proxyUsername);
|
|
|
|
heap_free(lpwpi->proxyPassword);
|
2010-01-20 21:48:55 +01:00
|
|
|
}
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2011-07-21 22:17:21 +02:00
|
|
|
static proxyinfo_t *global_proxy;
|
|
|
|
|
|
|
|
static void free_global_proxy( void )
|
|
|
|
{
|
|
|
|
EnterCriticalSection( &WININET_cs );
|
|
|
|
if (global_proxy)
|
|
|
|
{
|
|
|
|
FreeProxyInfo( global_proxy );
|
|
|
|
heap_free( global_proxy );
|
|
|
|
}
|
|
|
|
LeaveCriticalSection( &WININET_cs );
|
|
|
|
}
|
|
|
|
|
2014-05-06 11:32:26 +02:00
|
|
|
static BOOL parse_proxy_url( proxyinfo_t *info, const WCHAR *url )
|
|
|
|
{
|
2016-04-27 19:20:18 +02:00
|
|
|
static const WCHAR fmt[] = {'%','.','*','s',':','%','u',0};
|
|
|
|
URL_COMPONENTSW uc = {sizeof(uc)};
|
|
|
|
|
|
|
|
uc.dwHostNameLength = 1;
|
|
|
|
uc.dwUserNameLength = 1;
|
|
|
|
uc.dwPasswordLength = 1;
|
2014-05-06 11:32:26 +02:00
|
|
|
|
|
|
|
if (!InternetCrackUrlW( url, 0, 0, &uc )) return FALSE;
|
2016-04-27 19:20:18 +02:00
|
|
|
if (!uc.dwHostNameLength)
|
2014-05-06 11:32:26 +02:00
|
|
|
{
|
|
|
|
if (!(info->proxy = heap_strdupW( url ))) return FALSE;
|
|
|
|
info->proxyUsername = NULL;
|
|
|
|
info->proxyPassword = NULL;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2016-04-27 19:20:18 +02:00
|
|
|
if (!(info->proxy = heap_alloc( (uc.dwHostNameLength + 12) * sizeof(WCHAR) ))) return FALSE;
|
|
|
|
sprintfW( info->proxy, fmt, uc.dwHostNameLength, uc.lpszHostName, uc.nPort );
|
2014-05-06 11:32:26 +02:00
|
|
|
|
2016-04-27 19:20:18 +02:00
|
|
|
if (!uc.dwUserNameLength) info->proxyUsername = NULL;
|
|
|
|
else if (!(info->proxyUsername = heap_strndupW( uc.lpszUserName, uc.dwUserNameLength )))
|
2014-05-06 11:32:26 +02:00
|
|
|
{
|
|
|
|
heap_free( info->proxy );
|
|
|
|
return FALSE;
|
|
|
|
}
|
2016-04-27 19:20:18 +02:00
|
|
|
if (!uc.dwPasswordLength) info->proxyPassword = NULL;
|
|
|
|
else if (!(info->proxyPassword = heap_strndupW( uc.lpszPassword, uc.dwPasswordLength )))
|
2014-05-06 11:32:26 +02:00
|
|
|
{
|
|
|
|
heap_free( info->proxyUsername );
|
|
|
|
heap_free( info->proxy );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-07-22 05:17:52 +02:00
|
|
|
/***********************************************************************
|
2010-01-20 21:48:55 +01:00
|
|
|
* INTERNET_LoadProxySettings
|
|
|
|
*
|
2011-07-21 22:17:21 +02:00
|
|
|
* Loads proxy information from process-wide global settings, the registry,
|
|
|
|
* or the environment into lpwpi.
|
2010-01-20 21:48:55 +01:00
|
|
|
*
|
|
|
|
* The caller should call FreeProxyInfo when done with lpwpi.
|
2003-07-22 05:17:52 +02:00
|
|
|
*
|
|
|
|
* FIXME:
|
|
|
|
* The proxy may be specified in the form 'http=proxy.my.org'
|
|
|
|
* Presumably that means there can be ftp=ftpproxy.my.org too.
|
|
|
|
*/
|
2010-01-20 21:48:55 +01:00
|
|
|
static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi )
|
2003-07-22 05:17:52 +02:00
|
|
|
{
|
|
|
|
HKEY key;
|
2010-01-20 21:48:55 +01:00
|
|
|
DWORD type, len;
|
2008-03-30 20:16:11 +02:00
|
|
|
LPCSTR envproxy;
|
2010-01-20 21:48:55 +01:00
|
|
|
LONG ret;
|
2003-07-22 05:17:52 +02:00
|
|
|
|
2014-05-06 11:31:53 +02:00
|
|
|
memset( lpwpi, 0, sizeof(*lpwpi) );
|
|
|
|
|
2011-07-21 22:17:21 +02:00
|
|
|
EnterCriticalSection( &WININET_cs );
|
|
|
|
if (global_proxy)
|
|
|
|
{
|
|
|
|
lpwpi->proxyEnabled = global_proxy->proxyEnabled;
|
|
|
|
lpwpi->proxy = heap_strdupW( global_proxy->proxy );
|
|
|
|
lpwpi->proxyBypass = heap_strdupW( global_proxy->proxyBypass );
|
|
|
|
}
|
|
|
|
LeaveCriticalSection( &WININET_cs );
|
|
|
|
|
2010-01-20 21:48:55 +01:00
|
|
|
if ((ret = RegOpenKeyW( HKEY_CURRENT_USER, szInternetSettings, &key )))
|
2014-05-06 11:31:53 +02:00
|
|
|
{
|
|
|
|
FreeProxyInfo( lpwpi );
|
2010-01-20 21:48:55 +01:00
|
|
|
return ret;
|
2014-05-06 11:31:53 +02:00
|
|
|
}
|
2003-07-22 05:17:52 +02:00
|
|
|
|
2010-01-20 21:48:55 +01:00
|
|
|
len = sizeof(DWORD);
|
2011-07-21 21:54:27 +02:00
|
|
|
if (RegQueryValueExW( key, szProxyEnable, NULL, &type, (BYTE *)&lpwpi->proxyEnabled, &len ) || type != REG_DWORD)
|
2010-01-20 21:48:55 +01:00
|
|
|
{
|
2011-07-21 21:54:27 +02:00
|
|
|
lpwpi->proxyEnabled = 0;
|
|
|
|
if((ret = RegSetValueExW( key, szProxyEnable, 0, REG_DWORD, (BYTE *)&lpwpi->proxyEnabled, sizeof(DWORD) )))
|
2010-01-20 21:48:55 +01:00
|
|
|
{
|
2014-05-06 11:31:53 +02:00
|
|
|
FreeProxyInfo( lpwpi );
|
2010-01-20 21:48:55 +01:00
|
|
|
RegCloseKey( key );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2008-03-30 20:17:54 +02:00
|
|
|
|
2011-07-21 21:54:27 +02:00
|
|
|
if (!(envproxy = getenv( "http_proxy" )) || lpwpi->proxyEnabled)
|
2003-07-22 05:17:52 +02:00
|
|
|
{
|
2008-03-30 20:17:54 +02:00
|
|
|
/* figure out how much memory the proxy setting takes */
|
|
|
|
if (!RegQueryValueExW( key, szProxyServer, NULL, &type, NULL, &len ) && len && (type == REG_SZ))
|
2003-07-22 05:17:52 +02:00
|
|
|
{
|
2008-03-30 20:17:54 +02:00
|
|
|
LPWSTR szProxy, p;
|
|
|
|
static const WCHAR szHttp[] = {'h','t','t','p','=',0};
|
2003-07-22 05:17:52 +02:00
|
|
|
|
2011-04-21 13:39:03 +02:00
|
|
|
if (!(szProxy = heap_alloc(len)))
|
2003-07-22 05:17:52 +02:00
|
|
|
{
|
2008-03-30 20:17:54 +02:00
|
|
|
RegCloseKey( key );
|
2014-05-06 11:31:53 +02:00
|
|
|
FreeProxyInfo( lpwpi );
|
2010-01-20 21:48:55 +01:00
|
|
|
return ERROR_OUTOFMEMORY;
|
2008-03-30 20:16:11 +02:00
|
|
|
}
|
2008-03-30 20:17:54 +02:00
|
|
|
RegQueryValueExW( key, szProxyServer, NULL, &type, (BYTE*)szProxy, &len );
|
|
|
|
|
|
|
|
/* find the http proxy, and strip away everything else */
|
|
|
|
p = strstrW( szProxy, szHttp );
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
p += lstrlenW( szHttp );
|
|
|
|
lstrcpyW( szProxy, p );
|
|
|
|
}
|
2014-05-06 11:31:35 +02:00
|
|
|
p = strchrW( szProxy, ';' );
|
2008-03-30 20:17:54 +02:00
|
|
|
if (p) *p = 0;
|
|
|
|
|
2014-05-06 11:31:53 +02:00
|
|
|
FreeProxyInfo( lpwpi );
|
2011-07-21 21:54:27 +02:00
|
|
|
lpwpi->proxy = szProxy;
|
2014-05-06 11:31:53 +02:00
|
|
|
lpwpi->proxyBypass = NULL;
|
2008-03-30 20:17:54 +02:00
|
|
|
|
2014-05-06 11:31:53 +02:00
|
|
|
TRACE("http proxy (from registry) = %s\n", debugstr_w(lpwpi->proxy));
|
2003-07-22 05:17:52 +02:00
|
|
|
}
|
2008-03-30 20:17:54 +02:00
|
|
|
else
|
2010-01-20 21:48:55 +01:00
|
|
|
{
|
|
|
|
TRACE("No proxy server settings in registry.\n");
|
2014-05-06 11:31:53 +02:00
|
|
|
FreeProxyInfo( lpwpi );
|
2011-07-21 21:54:27 +02:00
|
|
|
lpwpi->proxy = NULL;
|
2014-05-06 11:31:53 +02:00
|
|
|
lpwpi->proxyBypass = NULL;
|
2010-01-20 21:48:55 +01:00
|
|
|
}
|
2003-07-22 05:17:52 +02:00
|
|
|
}
|
2010-01-20 21:48:55 +01:00
|
|
|
else if (envproxy)
|
2008-03-30 20:16:11 +02:00
|
|
|
{
|
|
|
|
WCHAR *envproxyW;
|
|
|
|
|
|
|
|
len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 );
|
2011-04-21 13:39:03 +02:00
|
|
|
if (!(envproxyW = heap_alloc(len * sizeof(WCHAR))))
|
2014-05-06 11:31:53 +02:00
|
|
|
{
|
|
|
|
RegCloseKey( key );
|
2010-01-20 21:48:55 +01:00
|
|
|
return ERROR_OUTOFMEMORY;
|
2014-05-06 11:31:53 +02:00
|
|
|
}
|
2008-03-30 20:16:11 +02:00
|
|
|
MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len );
|
|
|
|
|
2014-05-06 11:31:53 +02:00
|
|
|
FreeProxyInfo( lpwpi );
|
2014-05-06 11:32:26 +02:00
|
|
|
if (parse_proxy_url( lpwpi, envproxyW ))
|
|
|
|
{
|
|
|
|
TRACE("http proxy (from environment) = %s\n", debugstr_w(lpwpi->proxy));
|
|
|
|
lpwpi->proxyEnabled = 1;
|
|
|
|
lpwpi->proxyBypass = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WARN("failed to parse http_proxy value %s\n", debugstr_w(envproxyW));
|
|
|
|
lpwpi->proxyEnabled = 0;
|
|
|
|
lpwpi->proxy = NULL;
|
|
|
|
lpwpi->proxyBypass = NULL;
|
|
|
|
}
|
|
|
|
heap_free( envproxyW );
|
2008-03-30 20:16:11 +02:00
|
|
|
}
|
2010-01-20 21:48:55 +01:00
|
|
|
|
2013-05-04 02:11:48 +02:00
|
|
|
if (lpwpi->proxyEnabled)
|
|
|
|
{
|
2014-05-06 11:31:53 +02:00
|
|
|
TRACE("Proxy is enabled.\n");
|
|
|
|
|
2013-05-04 02:11:48 +02:00
|
|
|
if (!(envproxy = getenv( "no_proxy" )))
|
|
|
|
{
|
|
|
|
/* figure out how much memory the proxy setting takes */
|
|
|
|
if (!RegQueryValueExW( key, szProxyOverride, NULL, &type, NULL, &len ) && len && (type == REG_SZ))
|
|
|
|
{
|
|
|
|
LPWSTR szProxy;
|
|
|
|
|
|
|
|
if (!(szProxy = heap_alloc(len)))
|
|
|
|
{
|
|
|
|
RegCloseKey( key );
|
|
|
|
return ERROR_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
RegQueryValueExW( key, szProxyOverride, NULL, &type, (BYTE*)szProxy, &len );
|
|
|
|
|
2014-05-06 11:31:53 +02:00
|
|
|
heap_free( lpwpi->proxyBypass );
|
2013-05-04 02:11:48 +02:00
|
|
|
lpwpi->proxyBypass = szProxy;
|
|
|
|
|
2014-05-06 11:31:53 +02:00
|
|
|
TRACE("http proxy bypass (from registry) = %s\n", debugstr_w(lpwpi->proxyBypass));
|
2013-05-04 02:11:48 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-05-06 11:31:53 +02:00
|
|
|
heap_free( lpwpi->proxyBypass );
|
|
|
|
lpwpi->proxyBypass = NULL;
|
|
|
|
|
2013-05-04 02:11:48 +02:00
|
|
|
TRACE("No proxy bypass server settings in registry.\n");
|
|
|
|
}
|
|
|
|
}
|
2014-05-06 11:31:53 +02:00
|
|
|
else
|
2013-05-04 02:11:48 +02:00
|
|
|
{
|
|
|
|
WCHAR *envproxyW;
|
|
|
|
|
|
|
|
len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 );
|
|
|
|
if (!(envproxyW = heap_alloc(len * sizeof(WCHAR))))
|
2014-05-06 11:31:53 +02:00
|
|
|
{
|
|
|
|
RegCloseKey( key );
|
2013-05-04 02:11:48 +02:00
|
|
|
return ERROR_OUTOFMEMORY;
|
2014-05-06 11:31:53 +02:00
|
|
|
}
|
2013-05-04 02:11:48 +02:00
|
|
|
MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len );
|
|
|
|
|
2014-05-06 11:31:53 +02:00
|
|
|
heap_free( lpwpi->proxyBypass );
|
2013-05-04 02:11:48 +02:00
|
|
|
lpwpi->proxyBypass = envproxyW;
|
|
|
|
|
|
|
|
TRACE("http proxy bypass (from environment) = %s\n", debugstr_w(lpwpi->proxyBypass));
|
|
|
|
}
|
|
|
|
}
|
2014-05-06 11:32:26 +02:00
|
|
|
else TRACE("Proxy is disabled.\n");
|
2013-05-04 02:11:48 +02:00
|
|
|
|
|
|
|
RegCloseKey( key );
|
2010-01-20 21:48:55 +01:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_ConfigureProxy
|
|
|
|
*/
|
|
|
|
static BOOL INTERNET_ConfigureProxy( appinfo_t *lpwai )
|
|
|
|
{
|
2014-05-06 11:32:26 +02:00
|
|
|
proxyinfo_t wpi;
|
2010-01-20 21:48:55 +01:00
|
|
|
|
|
|
|
if (INTERNET_LoadProxySettings( &wpi ))
|
|
|
|
return FALSE;
|
|
|
|
|
2011-07-21 21:54:27 +02:00
|
|
|
if (wpi.proxyEnabled)
|
2008-08-02 23:21:54 +02:00
|
|
|
{
|
2015-04-07 02:38:16 +02:00
|
|
|
TRACE("http proxy = %s bypass = %s\n", debugstr_w(wpi.proxy), debugstr_w(wpi.proxyBypass));
|
2014-05-06 11:32:26 +02:00
|
|
|
|
|
|
|
lpwai->accessType = INTERNET_OPEN_TYPE_PROXY;
|
|
|
|
lpwai->proxy = wpi.proxy;
|
|
|
|
lpwai->proxyBypass = wpi.proxyBypass;
|
|
|
|
lpwai->proxyUsername = wpi.proxyUsername;
|
|
|
|
lpwai->proxyPassword = wpi.proxyPassword;
|
|
|
|
return TRUE;
|
2008-08-02 23:21:54 +02:00
|
|
|
}
|
2010-01-20 21:48:55 +01:00
|
|
|
|
2011-03-01 20:00:49 +01:00
|
|
|
lpwai->accessType = INTERNET_OPEN_TYPE_DIRECT;
|
2013-05-06 23:53:34 +02:00
|
|
|
FreeProxyInfo(&wpi);
|
2010-01-20 21:48:55 +01:00
|
|
|
return FALSE;
|
2003-07-22 05:17:52 +02:00
|
|
|
}
|
|
|
|
|
2005-12-03 18:03:08 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* dump_INTERNET_FLAGS
|
|
|
|
*
|
|
|
|
* Helper function to TRACE the internet flags.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static void dump_INTERNET_FLAGS(DWORD dwFlags)
|
|
|
|
{
|
|
|
|
#define FE(x) { x, #x }
|
|
|
|
static const wininet_flag_info flag[] = {
|
|
|
|
FE(INTERNET_FLAG_RELOAD),
|
|
|
|
FE(INTERNET_FLAG_RAW_DATA),
|
|
|
|
FE(INTERNET_FLAG_EXISTING_CONNECT),
|
|
|
|
FE(INTERNET_FLAG_ASYNC),
|
|
|
|
FE(INTERNET_FLAG_PASSIVE),
|
|
|
|
FE(INTERNET_FLAG_NO_CACHE_WRITE),
|
|
|
|
FE(INTERNET_FLAG_MAKE_PERSISTENT),
|
|
|
|
FE(INTERNET_FLAG_FROM_CACHE),
|
|
|
|
FE(INTERNET_FLAG_SECURE),
|
|
|
|
FE(INTERNET_FLAG_KEEP_CONNECTION),
|
|
|
|
FE(INTERNET_FLAG_NO_AUTO_REDIRECT),
|
|
|
|
FE(INTERNET_FLAG_READ_PREFETCH),
|
|
|
|
FE(INTERNET_FLAG_NO_COOKIES),
|
|
|
|
FE(INTERNET_FLAG_NO_AUTH),
|
|
|
|
FE(INTERNET_FLAG_CACHE_IF_NET_FAIL),
|
|
|
|
FE(INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP),
|
|
|
|
FE(INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS),
|
|
|
|
FE(INTERNET_FLAG_IGNORE_CERT_DATE_INVALID),
|
|
|
|
FE(INTERNET_FLAG_IGNORE_CERT_CN_INVALID),
|
|
|
|
FE(INTERNET_FLAG_RESYNCHRONIZE),
|
|
|
|
FE(INTERNET_FLAG_HYPERLINK),
|
|
|
|
FE(INTERNET_FLAG_NO_UI),
|
|
|
|
FE(INTERNET_FLAG_PRAGMA_NOCACHE),
|
|
|
|
FE(INTERNET_FLAG_CACHE_ASYNC),
|
|
|
|
FE(INTERNET_FLAG_FORMS_SUBMIT),
|
|
|
|
FE(INTERNET_FLAG_NEED_FILE),
|
|
|
|
FE(INTERNET_FLAG_TRANSFER_ASCII),
|
|
|
|
FE(INTERNET_FLAG_TRANSFER_BINARY)
|
|
|
|
};
|
|
|
|
#undef FE
|
2008-12-08 17:51:08 +01:00
|
|
|
unsigned int i;
|
|
|
|
|
2018-09-20 19:13:59 +02:00
|
|
|
for (i = 0; i < ARRAY_SIZE(flag); i++) {
|
2005-12-03 18:03:08 +01:00
|
|
|
if (flag[i].val & dwFlags) {
|
|
|
|
TRACE(" %s", flag[i].name);
|
|
|
|
dwFlags &= ~flag[i].val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dwFlags)
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE(" Unknown flags (%08x)\n", dwFlags);
|
2005-12-03 18:03:08 +01:00
|
|
|
else
|
|
|
|
TRACE("\n");
|
|
|
|
}
|
|
|
|
|
2008-02-26 20:20:41 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_CloseHandle (internal)
|
|
|
|
*
|
|
|
|
* Close internet handle
|
|
|
|
*
|
|
|
|
*/
|
2009-07-07 21:46:09 +02:00
|
|
|
static VOID APPINFO_Destroy(object_header_t *hdr)
|
2008-02-26 20:20:41 +01:00
|
|
|
{
|
2009-07-13 01:45:06 +02:00
|
|
|
appinfo_t *lpwai = (appinfo_t*)hdr;
|
2008-02-26 20:20:41 +01:00
|
|
|
|
|
|
|
TRACE("%p\n",lpwai);
|
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(lpwai->agent);
|
|
|
|
heap_free(lpwai->proxy);
|
|
|
|
heap_free(lpwai->proxyBypass);
|
|
|
|
heap_free(lpwai->proxyUsername);
|
|
|
|
heap_free(lpwai->proxyPassword);
|
2008-02-26 20:20:41 +01:00
|
|
|
}
|
|
|
|
|
2009-07-07 21:46:09 +02:00
|
|
|
static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
|
2008-03-12 02:23:20 +01:00
|
|
|
{
|
2009-07-13 01:45:06 +02:00
|
|
|
appinfo_t *ai = (appinfo_t*)hdr;
|
2008-07-19 12:29:01 +02:00
|
|
|
|
2008-03-12 02:23:20 +01:00
|
|
|
switch(option) {
|
|
|
|
case INTERNET_OPTION_HANDLE_TYPE:
|
|
|
|
TRACE("INTERNET_OPTION_HANDLE_TYPE\n");
|
|
|
|
|
|
|
|
if (*size < sizeof(ULONG))
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
|
|
|
|
*size = sizeof(DWORD);
|
|
|
|
*(DWORD*)buffer = INTERNET_HANDLE_TYPE_INTERNET;
|
|
|
|
return ERROR_SUCCESS;
|
2008-07-19 12:29:01 +02:00
|
|
|
|
|
|
|
case INTERNET_OPTION_USER_AGENT: {
|
|
|
|
DWORD bufsize;
|
|
|
|
|
|
|
|
TRACE("INTERNET_OPTION_USER_AGENT\n");
|
|
|
|
|
|
|
|
bufsize = *size;
|
|
|
|
|
|
|
|
if (unicode) {
|
2011-03-01 20:00:49 +01:00
|
|
|
DWORD len = ai->agent ? strlenW(ai->agent) : 0;
|
2009-10-02 17:31:31 +02:00
|
|
|
|
|
|
|
*size = (len + 1) * sizeof(WCHAR);
|
2008-07-19 12:29:01 +02:00
|
|
|
if(!buffer || bufsize < *size)
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
|
2011-03-01 20:00:49 +01:00
|
|
|
if (ai->agent)
|
|
|
|
strcpyW(buffer, ai->agent);
|
2009-10-02 17:31:31 +02:00
|
|
|
else
|
|
|
|
*(WCHAR *)buffer = 0;
|
|
|
|
/* If the buffer is copied, the returned length doesn't include
|
|
|
|
* the NULL terminator.
|
|
|
|
*/
|
2013-04-22 11:02:50 +02:00
|
|
|
*size = len;
|
2008-07-19 12:29:01 +02:00
|
|
|
}else {
|
2011-03-01 20:00:49 +01:00
|
|
|
if (ai->agent)
|
|
|
|
*size = WideCharToMultiByte(CP_ACP, 0, ai->agent, -1, NULL, 0, NULL, NULL);
|
2009-10-02 17:31:31 +02:00
|
|
|
else
|
|
|
|
*size = 1;
|
2008-07-19 12:29:01 +02:00
|
|
|
if(!buffer || bufsize < *size)
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
|
2011-03-01 20:00:49 +01:00
|
|
|
if (ai->agent)
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, ai->agent, -1, buffer, *size, NULL, NULL);
|
2009-10-02 17:31:31 +02:00
|
|
|
else
|
|
|
|
*(char *)buffer = 0;
|
|
|
|
/* If the buffer is copied, the returned length doesn't include
|
|
|
|
* the NULL terminator.
|
|
|
|
*/
|
|
|
|
*size -= 1;
|
2008-07-19 12:29:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2008-07-19 12:29:56 +02:00
|
|
|
|
|
|
|
case INTERNET_OPTION_PROXY:
|
2011-08-23 21:01:44 +02:00
|
|
|
if(!size) return ERROR_INVALID_PARAMETER;
|
2008-07-19 12:29:56 +02:00
|
|
|
if (unicode) {
|
|
|
|
INTERNET_PROXY_INFOW *pi = (INTERNET_PROXY_INFOW *)buffer;
|
|
|
|
DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
|
|
|
|
LPWSTR proxy, proxy_bypass;
|
|
|
|
|
2011-03-01 20:00:49 +01:00
|
|
|
if (ai->proxy)
|
|
|
|
proxyBytesRequired = (lstrlenW(ai->proxy) + 1) * sizeof(WCHAR);
|
|
|
|
if (ai->proxyBypass)
|
|
|
|
proxyBypassBytesRequired = (lstrlenW(ai->proxyBypass) + 1) * sizeof(WCHAR);
|
2013-01-07 18:12:01 +01:00
|
|
|
if (!pi || *size < sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired)
|
2008-10-17 16:24:15 +02:00
|
|
|
{
|
|
|
|
*size = sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired;
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
}
|
2008-07-19 12:29:56 +02:00
|
|
|
proxy = (LPWSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOW));
|
|
|
|
proxy_bypass = (LPWSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired);
|
|
|
|
|
2011-03-01 20:00:49 +01:00
|
|
|
pi->dwAccessType = ai->accessType;
|
2008-07-19 12:29:56 +02:00
|
|
|
pi->lpszProxy = NULL;
|
|
|
|
pi->lpszProxyBypass = NULL;
|
2011-03-01 20:00:49 +01:00
|
|
|
if (ai->proxy) {
|
|
|
|
lstrcpyW(proxy, ai->proxy);
|
2008-07-19 12:29:56 +02:00
|
|
|
pi->lpszProxy = proxy;
|
|
|
|
}
|
|
|
|
|
2011-03-01 20:00:49 +01:00
|
|
|
if (ai->proxyBypass) {
|
|
|
|
lstrcpyW(proxy_bypass, ai->proxyBypass);
|
2008-07-19 12:29:56 +02:00
|
|
|
pi->lpszProxyBypass = proxy_bypass;
|
|
|
|
}
|
|
|
|
|
|
|
|
*size = sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}else {
|
|
|
|
INTERNET_PROXY_INFOA *pi = (INTERNET_PROXY_INFOA *)buffer;
|
|
|
|
DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
|
|
|
|
LPSTR proxy, proxy_bypass;
|
|
|
|
|
2011-03-01 20:00:49 +01:00
|
|
|
if (ai->proxy)
|
|
|
|
proxyBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, NULL, 0, NULL, NULL);
|
|
|
|
if (ai->proxyBypass)
|
|
|
|
proxyBypassBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1,
|
2008-07-19 12:29:56 +02:00
|
|
|
NULL, 0, NULL, NULL);
|
2013-01-07 18:12:01 +01:00
|
|
|
if (!pi || *size < sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired)
|
2008-10-17 16:24:15 +02:00
|
|
|
{
|
|
|
|
*size = sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired;
|
2008-07-19 12:29:56 +02:00
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
2008-10-17 16:24:15 +02:00
|
|
|
}
|
2008-07-19 12:29:56 +02:00
|
|
|
proxy = (LPSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOA));
|
|
|
|
proxy_bypass = (LPSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired);
|
|
|
|
|
2011-03-01 20:00:49 +01:00
|
|
|
pi->dwAccessType = ai->accessType;
|
2008-07-19 12:29:56 +02:00
|
|
|
pi->lpszProxy = NULL;
|
|
|
|
pi->lpszProxyBypass = NULL;
|
2011-03-01 20:00:49 +01:00
|
|
|
if (ai->proxy) {
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, proxy, proxyBytesRequired, NULL, NULL);
|
2008-07-19 12:29:56 +02:00
|
|
|
pi->lpszProxy = proxy;
|
|
|
|
}
|
|
|
|
|
2011-03-01 20:00:49 +01:00
|
|
|
if (ai->proxyBypass) {
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1, proxy_bypass,
|
2008-07-19 12:29:56 +02:00
|
|
|
proxyBypassBytesRequired, NULL, NULL);
|
|
|
|
pi->lpszProxyBypass = proxy_bypass;
|
|
|
|
}
|
|
|
|
|
|
|
|
*size = sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2012-05-14 13:49:29 +02:00
|
|
|
|
|
|
|
case INTERNET_OPTION_CONNECT_TIMEOUT:
|
|
|
|
TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
|
|
|
|
|
|
|
|
if (*size < sizeof(ULONG))
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
|
|
|
|
*(ULONG*)buffer = ai->connect_timeout;
|
|
|
|
*size = sizeof(ULONG);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
2008-03-12 02:23:20 +01:00
|
|
|
}
|
|
|
|
|
2010-05-25 12:19:32 +02:00
|
|
|
return INET_QueryOption(hdr, option, buffer, size, unicode);
|
2008-03-12 02:23:20 +01:00
|
|
|
}
|
|
|
|
|
2012-05-14 13:49:29 +02:00
|
|
|
static DWORD APPINFO_SetOption(object_header_t *hdr, DWORD option, void *buf, DWORD size)
|
|
|
|
{
|
|
|
|
appinfo_t *ai = (appinfo_t*)hdr;
|
|
|
|
|
|
|
|
switch(option) {
|
|
|
|
case INTERNET_OPTION_CONNECT_TIMEOUT:
|
|
|
|
TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
|
|
|
|
|
|
|
|
if(size != sizeof(connect_timeout))
|
|
|
|
return ERROR_INTERNET_BAD_OPTION_LENGTH;
|
|
|
|
if(!*(ULONG*)buf)
|
|
|
|
return ERROR_BAD_ARGUMENTS;
|
|
|
|
|
|
|
|
ai->connect_timeout = *(ULONG*)buf;
|
|
|
|
return ERROR_SUCCESS;
|
2012-05-18 09:29:57 +02:00
|
|
|
case INTERNET_OPTION_USER_AGENT:
|
|
|
|
heap_free(ai->agent);
|
|
|
|
if (!(ai->agent = heap_strdupW(buf))) return ERROR_OUTOFMEMORY;
|
|
|
|
return ERROR_SUCCESS;
|
2018-05-03 17:14:36 +02:00
|
|
|
case INTERNET_OPTION_REFRESH:
|
|
|
|
FIXME("INTERNET_OPTION_REFRESH\n");
|
|
|
|
return ERROR_SUCCESS;
|
2012-05-14 13:49:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return INET_SetOption(hdr, option, buf, size);
|
|
|
|
}
|
|
|
|
|
2009-07-07 21:46:09 +02:00
|
|
|
static const object_vtbl_t APPINFOVtbl = {
|
2008-02-26 20:21:00 +01:00
|
|
|
APPINFO_Destroy,
|
2008-02-26 20:21:34 +01:00
|
|
|
NULL,
|
2008-03-12 02:23:20 +01:00
|
|
|
APPINFO_QueryOption,
|
2012-05-14 13:49:29 +02:00
|
|
|
APPINFO_SetOption,
|
2008-02-27 18:55:09 +01:00
|
|
|
NULL,
|
2008-02-29 12:57:57 +01:00
|
|
|
NULL,
|
2008-02-26 20:21:00 +01:00
|
|
|
NULL
|
2008-02-26 20:20:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
/***********************************************************************
|
2004-06-28 22:28:38 +02:00
|
|
|
* InternetOpenW (WININET.@)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* Per-application initialization of wininet
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* HINTERNET on success
|
|
|
|
* NULL on failure
|
|
|
|
*
|
|
|
|
*/
|
2004-03-25 06:29:47 +01:00
|
|
|
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
|
|
|
|
LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2009-07-13 01:45:06 +02:00
|
|
|
appinfo_t *lpwai = NULL;
|
2004-02-09 23:01:49 +01:00
|
|
|
|
|
|
|
if (TRACE_ON(wininet)) {
|
|
|
|
#define FE(x) { x, #x }
|
|
|
|
static const wininet_flag_info access_type[] = {
|
|
|
|
FE(INTERNET_OPEN_TYPE_PRECONFIG),
|
|
|
|
FE(INTERNET_OPEN_TYPE_DIRECT),
|
|
|
|
FE(INTERNET_OPEN_TYPE_PROXY),
|
|
|
|
FE(INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY)
|
|
|
|
};
|
|
|
|
#undef FE
|
2004-08-09 20:54:23 +02:00
|
|
|
DWORD i;
|
2004-02-09 23:01:49 +01:00
|
|
|
const char *access_type_str = "Unknown";
|
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("(%s, %i, %s, %s, %i)\n", debugstr_w(lpszAgent), dwAccessType,
|
2004-03-25 06:29:47 +01:00
|
|
|
debugstr_w(lpszProxy), debugstr_w(lpszProxyBypass), dwFlags);
|
2018-09-20 19:13:59 +02:00
|
|
|
for (i = 0; i < ARRAY_SIZE(access_type); i++) {
|
2004-02-09 23:01:49 +01:00
|
|
|
if (access_type[i].val == dwAccessType) {
|
|
|
|
access_type_str = access_type[i].name;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TRACE(" access type : %s\n", access_type_str);
|
|
|
|
TRACE(" flags :");
|
2004-12-23 12:18:29 +01:00
|
|
|
dump_INTERNET_FLAGS(dwFlags);
|
2004-02-09 23:01:49 +01:00
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
/* Clear any error information */
|
|
|
|
INTERNET_SetLastError(0);
|
|
|
|
|
2013-05-06 18:52:37 +02:00
|
|
|
if((dwAccessType == INTERNET_OPEN_TYPE_PROXY) && !lpszProxy) {
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-02-02 22:51:13 +01:00
|
|
|
lpwai = alloc_object(NULL, &APPINFOVtbl, sizeof(appinfo_t));
|
|
|
|
if (!lpwai) {
|
|
|
|
SetLastError(ERROR_OUTOFMEMORY);
|
|
|
|
return NULL;
|
2003-07-22 05:17:52 +02:00
|
|
|
}
|
2007-04-25 00:57:55 +02:00
|
|
|
|
2003-07-22 05:17:52 +02:00
|
|
|
lpwai->hdr.htype = WH_HINIT;
|
|
|
|
lpwai->hdr.dwFlags = dwFlags;
|
2011-03-01 20:00:49 +01:00
|
|
|
lpwai->accessType = dwAccessType;
|
|
|
|
lpwai->proxyUsername = NULL;
|
|
|
|
lpwai->proxyPassword = NULL;
|
2012-05-14 13:49:29 +02:00
|
|
|
lpwai->connect_timeout = connect_timeout;
|
2003-07-22 05:17:52 +02:00
|
|
|
|
2011-03-01 20:00:49 +01:00
|
|
|
lpwai->agent = heap_strdupW(lpszAgent);
|
2003-07-22 05:17:52 +02:00
|
|
|
if(dwAccessType == INTERNET_OPEN_TYPE_PRECONFIG)
|
2008-03-30 20:16:11 +02:00
|
|
|
INTERNET_ConfigureProxy( lpwai );
|
2013-05-06 18:52:37 +02:00
|
|
|
else if(dwAccessType == INTERNET_OPEN_TYPE_PROXY) {
|
2011-03-01 20:00:49 +01:00
|
|
|
lpwai->proxy = heap_strdupW(lpszProxy);
|
2013-05-06 18:52:37 +02:00
|
|
|
lpwai->proxyBypass = heap_strdupW(lpszProxyBypass);
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
TRACE("returning %p\n", lpwai);
|
2004-02-07 02:03:41 +01:00
|
|
|
|
2011-02-02 22:51:13 +01:00
|
|
|
return lpwai->hdr.hInternet;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-28 19:48:24 +01:00
|
|
|
/***********************************************************************
|
2004-06-28 22:28:38 +02:00
|
|
|
* InternetOpenA (WININET.@)
|
2002-10-28 19:48:24 +01:00
|
|
|
*
|
|
|
|
* Per-application initialization of wininet
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* HINTERNET on success
|
|
|
|
* NULL on failure
|
|
|
|
*
|
|
|
|
*/
|
2004-03-25 06:29:47 +01:00
|
|
|
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
|
|
|
|
LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
|
2002-10-28 19:48:24 +01:00
|
|
|
{
|
2009-07-17 02:05:36 +02:00
|
|
|
WCHAR *szAgent, *szProxy, *szBypass;
|
|
|
|
HINTERNET rc;
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("(%s, 0x%08x, %s, %s, 0x%08x)\n", debugstr_a(lpszAgent),
|
2004-03-25 06:29:47 +01:00
|
|
|
dwAccessType, debugstr_a(lpszProxy), debugstr_a(lpszProxyBypass), dwFlags);
|
2003-12-12 07:01:20 +01:00
|
|
|
|
2009-07-17 02:05:36 +02:00
|
|
|
szAgent = heap_strdupAtoW(lpszAgent);
|
|
|
|
szProxy = heap_strdupAtoW(lpszProxy);
|
|
|
|
szBypass = heap_strdupAtoW(lpszProxyBypass);
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2004-03-25 06:29:47 +01:00
|
|
|
rc = InternetOpenW(szAgent, dwAccessType, szProxy, szBypass, dwFlags);
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(szAgent);
|
|
|
|
heap_free(szProxy);
|
|
|
|
heap_free(szBypass);
|
2002-10-28 19:48:24 +01:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* InternetGetLastResponseInfoA (WININET.@)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* Return last wininet error description on the calling thread
|
|
|
|
*
|
|
|
|
* RETURNS
|
2003-11-18 21:41:24 +01:00
|
|
|
* TRUE on success of writing to buffer
|
2000-04-11 22:07:00 +02:00
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2000-04-15 22:44:21 +02:00
|
|
|
BOOL WINAPI InternetGetLastResponseInfoA(LPDWORD lpdwError,
|
2000-04-11 22:07:00 +02:00
|
|
|
LPSTR lpszBuffer, LPDWORD lpdwBufferLength)
|
|
|
|
{
|
2008-12-01 02:09:30 +01:00
|
|
|
LPWITHREADERROR lpwite = TlsGetValue(g_dwTlsErrIndex);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
2006-04-20 12:46:38 +02:00
|
|
|
if (lpwite)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2006-04-20 12:46:38 +02:00
|
|
|
*lpdwError = lpwite->dwError;
|
|
|
|
if (lpwite->dwError)
|
|
|
|
{
|
|
|
|
memcpy(lpszBuffer, lpwite->response, *lpdwBufferLength);
|
|
|
|
*lpdwBufferLength = strlen(lpszBuffer);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*lpdwBufferLength = 0;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
else
|
2006-04-20 12:46:38 +02:00
|
|
|
{
|
|
|
|
*lpdwError = 0;
|
2000-04-11 22:07:00 +02:00
|
|
|
*lpdwBufferLength = 0;
|
2006-04-20 12:46:38 +02:00
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetLastResponseInfoW (WININET.@)
|
|
|
|
*
|
|
|
|
* Return last wininet error description on the calling thread
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success of writing to buffer
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetGetLastResponseInfoW(LPDWORD lpdwError,
|
|
|
|
LPWSTR lpszBuffer, LPDWORD lpdwBufferLength)
|
|
|
|
{
|
2008-12-01 02:09:30 +01:00
|
|
|
LPWITHREADERROR lpwite = TlsGetValue(g_dwTlsErrIndex);
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
2006-04-20 12:46:38 +02:00
|
|
|
if (lpwite)
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
{
|
2006-04-20 12:46:38 +02:00
|
|
|
*lpdwError = lpwite->dwError;
|
|
|
|
if (lpwite->dwError)
|
|
|
|
{
|
|
|
|
memcpy(lpszBuffer, lpwite->response, *lpdwBufferLength);
|
|
|
|
*lpdwBufferLength = lstrlenW(lpszBuffer);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*lpdwBufferLength = 0;
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
}
|
|
|
|
else
|
2006-04-20 12:46:38 +02:00
|
|
|
{
|
|
|
|
*lpdwError = 0;
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
*lpdwBufferLength = 0;
|
2006-04-20 12:46:38 +02:00
|
|
|
}
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2000-04-23 21:55:26 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* InternetGetConnectedState (WININET.@)
|
2000-04-23 21:55:26 +02:00
|
|
|
*
|
|
|
|
* Return connected state
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE if connected
|
2002-06-01 01:06:46 +02:00
|
|
|
* if lpdwStatus is not null, return the status (off line,
|
2000-04-23 21:55:26 +02:00
|
|
|
* modem, lan...) in it.
|
|
|
|
* FALSE if not connected
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetGetConnectedState(LPDWORD lpdwStatus, DWORD dwReserved)
|
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("(%p, 0x%08x)\n", lpdwStatus, dwReserved);
|
2003-12-12 07:01:20 +01:00
|
|
|
|
2017-03-06 05:24:29 +01:00
|
|
|
return InternetGetConnectedStateExW(lpdwStatus, NULL, 0, dwReserved);
|
2000-04-23 21:55:26 +02:00
|
|
|
}
|
|
|
|
|
2004-11-04 22:05:03 +01:00
|
|
|
|
2003-06-06 20:17:00 +02:00
|
|
|
/***********************************************************************
|
2004-11-04 22:05:03 +01:00
|
|
|
* InternetGetConnectedStateExW (WININET.@)
|
2003-06-06 20:17:00 +02:00
|
|
|
*
|
|
|
|
* Return connected state
|
|
|
|
*
|
2004-11-21 16:42:57 +01:00
|
|
|
* PARAMS
|
|
|
|
*
|
|
|
|
* lpdwStatus [O] Flags specifying the status of the internet connection.
|
|
|
|
* lpszConnectionName [O] Pointer to buffer to receive the friendly name of the internet connection.
|
|
|
|
* dwNameLen [I] Size of the buffer, in characters.
|
|
|
|
* dwReserved [I] Reserved. Must be set to 0.
|
|
|
|
*
|
2003-06-06 20:17:00 +02:00
|
|
|
* RETURNS
|
|
|
|
* TRUE if connected
|
|
|
|
* if lpdwStatus is not null, return the status (off line,
|
|
|
|
* modem, lan...) in it.
|
|
|
|
* FALSE if not connected
|
2004-11-21 16:42:57 +01:00
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* If the system has no available network connections, an empty string is
|
|
|
|
* stored in lpszConnectionName. If there is a LAN connection, a localized
|
|
|
|
* "LAN Connection" string is stored. Presumably, if only a dial-up
|
|
|
|
* connection is available then the name of the dial-up connection is
|
|
|
|
* returned. Why any application, other than the "Internet Settings" CPL,
|
|
|
|
* would want to use this function instead of the simpler InternetGetConnectedStateW
|
|
|
|
* function is beyond me.
|
2003-06-06 20:17:00 +02:00
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetGetConnectedStateExW(LPDWORD lpdwStatus, LPWSTR lpszConnectionName,
|
|
|
|
DWORD dwNameLen, DWORD dwReserved)
|
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("(%p, %p, %d, 0x%08x)\n", lpdwStatus, lpszConnectionName, dwNameLen, dwReserved);
|
2003-12-12 07:01:20 +01:00
|
|
|
|
2003-06-06 20:17:00 +02:00
|
|
|
/* Must be zero */
|
|
|
|
if(dwReserved)
|
2014-10-27 23:41:02 +01:00
|
|
|
return FALSE;
|
2003-06-06 20:17:00 +02:00
|
|
|
|
|
|
|
if (lpdwStatus) {
|
2008-11-05 22:21:04 +01:00
|
|
|
WARN("always returning LAN connection.\n");
|
2003-06-06 20:17:00 +02:00
|
|
|
*lpdwStatus = INTERNET_CONNECTION_LAN;
|
|
|
|
}
|
2014-10-27 23:41:02 +01:00
|
|
|
|
|
|
|
/* When the buffer size is zero LoadStringW fills the buffer with a pointer to
|
|
|
|
* the resource, avoid it as we must not change the buffer in this case */
|
|
|
|
if(lpszConnectionName && dwNameLen) {
|
|
|
|
*lpszConnectionName = '\0';
|
|
|
|
LoadStringW(WININET_hModule, IDS_LANCONNECTION, lpszConnectionName, dwNameLen);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2003-06-06 20:17:00 +02:00
|
|
|
}
|
2000-04-23 21:55:26 +02:00
|
|
|
|
2004-11-04 22:05:03 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetConnectedStateExA (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetGetConnectedStateExA(LPDWORD lpdwStatus, LPSTR lpszConnectionName,
|
|
|
|
DWORD dwNameLen, DWORD dwReserved)
|
|
|
|
{
|
|
|
|
LPWSTR lpwszConnectionName = NULL;
|
|
|
|
BOOL rc;
|
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("(%p, %p, %d, 0x%08x)\n", lpdwStatus, lpszConnectionName, dwNameLen, dwReserved);
|
2004-11-04 22:05:03 +01:00
|
|
|
|
|
|
|
if (lpszConnectionName && dwNameLen > 0)
|
2011-04-21 13:39:03 +02:00
|
|
|
lpwszConnectionName = heap_alloc(dwNameLen * sizeof(WCHAR));
|
2004-11-04 22:05:03 +01:00
|
|
|
|
|
|
|
rc = InternetGetConnectedStateExW(lpdwStatus,lpwszConnectionName, dwNameLen,
|
|
|
|
dwReserved);
|
|
|
|
if (rc && lpwszConnectionName)
|
|
|
|
WideCharToMultiByte(CP_ACP,0,lpwszConnectionName,-1,lpszConnectionName,
|
|
|
|
dwNameLen, NULL, NULL);
|
2014-07-24 12:19:49 +02:00
|
|
|
|
|
|
|
heap_free(lpwszConnectionName);
|
2004-11-04 22:05:03 +01:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
/***********************************************************************
|
2004-06-28 22:28:38 +02:00
|
|
|
* InternetConnectW (WININET.@)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* Open a ftp, gopher or http session
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* HINTERNET a session handle on success
|
|
|
|
* NULL on failure
|
|
|
|
*
|
|
|
|
*/
|
2004-03-30 06:36:09 +02:00
|
|
|
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet,
|
|
|
|
LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
|
|
|
|
LPCWSTR lpszUserName, LPCWSTR lpszPassword,
|
2007-08-30 16:21:33 +02:00
|
|
|
DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2009-07-13 01:45:06 +02:00
|
|
|
appinfo_t *hIC;
|
2006-05-15 15:01:55 +02:00
|
|
|
HINTERNET rc = NULL;
|
2009-12-21 13:58:53 +01:00
|
|
|
DWORD res = ERROR_SUCCESS;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2015-08-27 15:05:16 +02:00
|
|
|
TRACE("(%p, %s, %u, %s, %p, %u, %x, %lx)\n", hInternet, debugstr_w(lpszServerName),
|
|
|
|
nServerPort, debugstr_w(lpszUserName), lpszPassword, dwService, dwFlags, dwContext);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2006-05-15 15:01:55 +02:00
|
|
|
if (!lpszServerName)
|
|
|
|
{
|
2009-12-21 13:58:53 +01:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2006-05-15 15:01:55 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
hIC = (appinfo_t*)get_handle_object( hInternet );
|
2004-07-19 23:49:39 +02:00
|
|
|
if ( (hIC == NULL) || (hIC->hdr.htype != WH_HINIT) )
|
2006-05-15 15:01:55 +02:00
|
|
|
{
|
2009-12-21 13:58:53 +01:00
|
|
|
res = ERROR_INVALID_HANDLE;
|
2004-07-19 23:49:39 +02:00
|
|
|
goto lend;
|
2006-05-15 15:01:55 +02:00
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
switch (dwService)
|
|
|
|
{
|
|
|
|
case INTERNET_SERVICE_FTP:
|
2004-07-19 23:49:39 +02:00
|
|
|
rc = FTP_Connect(hIC, lpszServerName, nServerPort,
|
2004-05-13 07:17:25 +02:00
|
|
|
lpszUserName, lpszPassword, dwFlags, dwContext, 0);
|
2009-12-21 13:58:53 +01:00
|
|
|
if(!rc)
|
|
|
|
res = INTERNET_GetLastError();
|
2000-04-11 22:07:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case INTERNET_SERVICE_HTTP:
|
2009-12-21 13:58:53 +01:00
|
|
|
res = HTTP_Connect(hIC, lpszServerName, nServerPort,
|
|
|
|
lpszUserName, lpszPassword, dwFlags, dwContext, 0, &rc);
|
2000-04-11 22:07:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case INTERNET_SERVICE_GOPHER:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-07-19 23:49:39 +02:00
|
|
|
lend:
|
|
|
|
if( hIC )
|
|
|
|
WININET_Release( &hIC->hdr );
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2003-06-21 01:26:56 +02:00
|
|
|
TRACE("returning %p\n", rc);
|
2009-12-21 13:58:53 +01:00
|
|
|
SetLastError(res);
|
2000-04-11 22:07:00 +02:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2002-10-28 19:48:24 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
2004-03-30 06:36:09 +02:00
|
|
|
* InternetConnectA (WININET.@)
|
2002-10-28 19:48:24 +01:00
|
|
|
*
|
|
|
|
* Open a ftp, gopher or http session
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* HINTERNET a session handle on success
|
|
|
|
* NULL on failure
|
|
|
|
*
|
|
|
|
*/
|
2004-03-30 06:36:09 +02:00
|
|
|
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet,
|
|
|
|
LPCSTR lpszServerName, INTERNET_PORT nServerPort,
|
|
|
|
LPCSTR lpszUserName, LPCSTR lpszPassword,
|
2007-08-30 16:21:33 +02:00
|
|
|
DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
|
2002-10-28 19:48:24 +01:00
|
|
|
{
|
2008-02-04 23:07:57 +01:00
|
|
|
HINTERNET rc = NULL;
|
2009-07-17 02:05:36 +02:00
|
|
|
LPWSTR szServerName;
|
|
|
|
LPWSTR szUserName;
|
|
|
|
LPWSTR szPassword;
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2009-07-17 02:05:36 +02:00
|
|
|
szServerName = heap_strdupAtoW(lpszServerName);
|
|
|
|
szUserName = heap_strdupAtoW(lpszUserName);
|
|
|
|
szPassword = heap_strdupAtoW(lpszPassword);
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2004-03-30 06:36:09 +02:00
|
|
|
rc = InternetConnectW(hInternet, szServerName, nServerPort,
|
2002-10-28 19:48:24 +01:00
|
|
|
szUserName, szPassword, dwService, dwFlags, dwContext);
|
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(szServerName);
|
|
|
|
heap_free(szUserName);
|
|
|
|
heap_free(szPassword);
|
2002-10-28 19:48:24 +01:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* InternetFindNextFileA (WININET.@)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* Continues a file search from a previous call to FindFirstFile
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2000-04-15 22:44:21 +02:00
|
|
|
BOOL WINAPI InternetFindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
|
2004-05-25 06:02:05 +02:00
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
WIN32_FIND_DATAW fd;
|
|
|
|
|
|
|
|
ret = InternetFindNextFileW(hFind, lpvFindData?&fd:NULL);
|
|
|
|
if(lpvFindData)
|
|
|
|
WININET_find_data_WtoA(&fd, (LPWIN32_FIND_DATAA)lpvFindData);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetFindNextFileW (WININET.@)
|
|
|
|
*
|
|
|
|
* Continues a file search from a previous call to FindFirstFile
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetFindNextFileW(HINTERNET hFind, LPVOID lpvFindData)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *hdr;
|
2008-02-27 18:55:09 +01:00
|
|
|
DWORD res;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
hdr = get_handle_object(hFind);
|
2008-02-27 18:55:09 +01:00
|
|
|
if(!hdr) {
|
|
|
|
WARN("Invalid handle\n");
|
|
|
|
SetLastError(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
2008-02-27 18:55:09 +01:00
|
|
|
if(hdr->vtbl->FindNextFileW) {
|
|
|
|
res = hdr->vtbl->FindNextFileW(hdr, lpvFindData);
|
|
|
|
}else {
|
|
|
|
WARN("Handle doesn't support NextFile\n");
|
|
|
|
res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2008-02-27 18:55:09 +01:00
|
|
|
WININET_Release(hdr);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2008-02-27 18:55:09 +01:00
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
SetLastError(res);
|
|
|
|
return res == ERROR_SUCCESS;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* InternetCloseHandle (WININET.@)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
2000-06-11 22:04:44 +02:00
|
|
|
* Generic close handle function
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2000-04-15 22:44:21 +02:00
|
|
|
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2011-02-02 22:50:46 +01:00
|
|
|
object_header_t *obj;
|
2004-07-19 23:49:39 +02:00
|
|
|
|
2011-02-02 22:50:46 +01:00
|
|
|
TRACE("%p\n", hInternet);
|
2004-02-07 02:03:41 +01:00
|
|
|
|
2011-02-02 22:50:46 +01:00
|
|
|
obj = get_handle_object( hInternet );
|
|
|
|
if (!obj) {
|
|
|
|
SetLastError(ERROR_INVALID_HANDLE);
|
2000-04-11 22:07:00 +02:00
|
|
|
return FALSE;
|
2004-02-07 02:03:41 +01:00
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2011-02-02 22:50:46 +01:00
|
|
|
invalidate_handle(obj);
|
|
|
|
WININET_Release(obj);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
return TRUE;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
2016-04-27 14:17:59 +02:00
|
|
|
static BOOL set_url_component(WCHAR **component, DWORD *component_length, const WCHAR *value, DWORD len)
|
|
|
|
{
|
|
|
|
TRACE("%s (%d)\n", debugstr_wn(value, len), len);
|
|
|
|
|
|
|
|
if (!*component_length)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (!*component) {
|
|
|
|
*(const WCHAR**)component = value;
|
|
|
|
*component_length = len;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*component_length < len+1) {
|
|
|
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*component_length = len;
|
|
|
|
if(len)
|
|
|
|
memcpy(*component, value, len*sizeof(WCHAR));
|
|
|
|
(*component)[len] = 0;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2016-04-27 14:18:31 +02:00
|
|
|
static BOOL set_url_component_WtoA(const WCHAR *comp_w, DWORD length, const WCHAR *url_w, char **comp, DWORD *ret_length,
|
|
|
|
const char *url_a)
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
2016-04-27 14:18:31 +02:00
|
|
|
size_t size, ret_size = *ret_length;
|
2009-10-27 10:03:14 +01:00
|
|
|
|
2016-04-27 14:18:31 +02:00
|
|
|
if (!*ret_length)
|
|
|
|
return TRUE;
|
|
|
|
size = WideCharToMultiByte(CP_ACP, 0, comp_w, length, NULL, 0, NULL, NULL);
|
|
|
|
|
|
|
|
if (!*comp) {
|
|
|
|
*comp = comp_w ? (char*)url_a + WideCharToMultiByte(CP_ACP, 0, url_w, comp_w-url_w, NULL, 0, NULL, NULL) : NULL;
|
|
|
|
*ret_length = size;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size+1 > ret_size) {
|
|
|
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
*ret_length = size+1;
|
|
|
|
return FALSE;
|
2000-06-11 22:04:44 +02:00
|
|
|
}
|
2016-04-27 14:18:31 +02:00
|
|
|
|
|
|
|
*ret_length = size;
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, comp_w, length, *comp, ret_size-1, NULL, NULL);
|
|
|
|
(*comp)[size] = 0;
|
|
|
|
return TRUE;
|
2000-06-11 22:04:44 +02:00
|
|
|
}
|
|
|
|
|
2016-04-27 14:18:31 +02:00
|
|
|
static BOOL set_url_component_AtoW(const char *comp_a, DWORD len_a, WCHAR **comp_w, DWORD *len_w, WCHAR **buf)
|
|
|
|
{
|
|
|
|
*len_w = len_a;
|
|
|
|
|
|
|
|
if(!comp_a) {
|
|
|
|
*comp_w = NULL;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!(*comp_w = *buf = heap_alloc(len_a*sizeof(WCHAR)))) {
|
|
|
|
SetLastError(ERROR_OUTOFMEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* InternetCrackUrlA (WININET.@)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
2006-03-21 14:45:03 +01:00
|
|
|
* See InternetCrackUrlW.
|
2000-04-11 22:07:00 +02:00
|
|
|
*/
|
2016-04-27 14:18:31 +02:00
|
|
|
BOOL WINAPI InternetCrackUrlA(const char *url, DWORD url_length, DWORD flags, URL_COMPONENTSA *ret_comp)
|
2003-01-03 00:08:22 +01:00
|
|
|
{
|
2016-04-27 14:18:31 +02:00
|
|
|
WCHAR *host = NULL, *user = NULL, *pass = NULL, *path = NULL, *scheme = NULL, *extra = NULL;
|
|
|
|
URL_COMPONENTSW comp;
|
2016-05-17 19:15:34 +02:00
|
|
|
WCHAR *url_w = NULL;
|
2016-04-27 14:18:31 +02:00
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
TRACE("(%s %u %x %p)\n", url_length ? debugstr_an(url, url_length) : debugstr_a(url), url_length, flags, ret_comp);
|
|
|
|
|
|
|
|
if (!url || !*url || !ret_comp || ret_comp->dwStructSize != sizeof(URL_COMPONENTSA)) {
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
2008-06-29 16:03:15 +02:00
|
|
|
}
|
2016-04-27 14:18:31 +02:00
|
|
|
|
|
|
|
comp.dwStructSize = sizeof(comp);
|
|
|
|
|
|
|
|
ret = set_url_component_AtoW(ret_comp->lpszHostName, ret_comp->dwHostNameLength,
|
|
|
|
&comp.lpszHostName, &comp.dwHostNameLength, &host)
|
|
|
|
&& set_url_component_AtoW(ret_comp->lpszUserName, ret_comp->dwUserNameLength,
|
|
|
|
&comp.lpszUserName, &comp.dwUserNameLength, &user)
|
|
|
|
&& set_url_component_AtoW(ret_comp->lpszPassword, ret_comp->dwPasswordLength,
|
|
|
|
&comp.lpszPassword, &comp.dwPasswordLength, &pass)
|
|
|
|
&& set_url_component_AtoW(ret_comp->lpszUrlPath, ret_comp->dwUrlPathLength,
|
|
|
|
&comp.lpszUrlPath, &comp.dwUrlPathLength, &path)
|
|
|
|
&& set_url_component_AtoW(ret_comp->lpszScheme, ret_comp->dwSchemeLength,
|
|
|
|
&comp.lpszScheme, &comp.dwSchemeLength, &scheme)
|
|
|
|
&& set_url_component_AtoW(ret_comp->lpszExtraInfo, ret_comp->dwExtraInfoLength,
|
|
|
|
&comp.lpszExtraInfo, &comp.dwExtraInfoLength, &extra);
|
|
|
|
|
|
|
|
if(ret && !(url_w = heap_strndupAtoW(url, url_length ? url_length : -1, &url_length))) {
|
|
|
|
SetLastError(ERROR_OUTOFMEMORY);
|
|
|
|
ret = FALSE;
|
2008-06-29 16:03:15 +02:00
|
|
|
}
|
2016-04-27 14:18:31 +02:00
|
|
|
|
|
|
|
if (ret && (ret = InternetCrackUrlW(url_w, url_length, flags, &comp))) {
|
|
|
|
ret_comp->nScheme = comp.nScheme;
|
|
|
|
ret_comp->nPort = comp.nPort;
|
|
|
|
|
|
|
|
ret = set_url_component_WtoA(comp.lpszHostName, comp.dwHostNameLength, url_w,
|
|
|
|
&ret_comp->lpszHostName, &ret_comp->dwHostNameLength, url)
|
|
|
|
&& set_url_component_WtoA(comp.lpszUserName, comp.dwUserNameLength, url_w,
|
|
|
|
&ret_comp->lpszUserName, &ret_comp->dwUserNameLength, url)
|
|
|
|
&& set_url_component_WtoA(comp.lpszPassword, comp.dwPasswordLength, url_w,
|
|
|
|
&ret_comp->lpszPassword, &ret_comp->dwPasswordLength, url)
|
|
|
|
&& set_url_component_WtoA(comp.lpszUrlPath, comp.dwUrlPathLength, url_w,
|
|
|
|
&ret_comp->lpszUrlPath, &ret_comp->dwUrlPathLength, url)
|
|
|
|
&& set_url_component_WtoA(comp.lpszScheme, comp.dwSchemeLength, url_w,
|
|
|
|
&ret_comp->lpszScheme, &ret_comp->dwSchemeLength, url)
|
|
|
|
&& set_url_component_WtoA(comp.lpszExtraInfo, comp.dwExtraInfoLength, url_w,
|
|
|
|
&ret_comp->lpszExtraInfo, &ret_comp->dwExtraInfoLength, url);
|
|
|
|
|
|
|
|
if(ret)
|
|
|
|
TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", debugstr_a(url),
|
|
|
|
debugstr_an(ret_comp->lpszScheme, ret_comp->dwSchemeLength),
|
|
|
|
debugstr_an(ret_comp->lpszHostName, ret_comp->dwHostNameLength),
|
|
|
|
debugstr_an(ret_comp->lpszUrlPath, ret_comp->dwUrlPathLength),
|
|
|
|
debugstr_an(ret_comp->lpszExtraInfo, ret_comp->dwExtraInfoLength));
|
2008-06-29 16:03:15 +02:00
|
|
|
}
|
2016-04-27 14:18:31 +02:00
|
|
|
|
|
|
|
heap_free(host);
|
|
|
|
heap_free(user);
|
|
|
|
heap_free(pass);
|
|
|
|
heap_free(path);
|
|
|
|
heap_free(scheme);
|
|
|
|
heap_free(extra);
|
|
|
|
heap_free(url_w);
|
|
|
|
return ret;
|
2003-01-03 00:08:22 +01:00
|
|
|
}
|
|
|
|
|
2006-03-09 16:14:21 +01:00
|
|
|
static const WCHAR url_schemes[][7] =
|
|
|
|
{
|
|
|
|
{'f','t','p',0},
|
|
|
|
{'g','o','p','h','e','r',0},
|
|
|
|
{'h','t','t','p',0},
|
|
|
|
{'h','t','t','p','s',0},
|
|
|
|
{'f','i','l','e',0},
|
|
|
|
{'n','e','w','s',0},
|
|
|
|
{'m','a','i','l','t','o',0},
|
|
|
|
{'r','e','s',0},
|
|
|
|
};
|
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* GetInternetSchemeW (internal)
|
|
|
|
*
|
|
|
|
* Get scheme of url
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* scheme on success
|
|
|
|
* INTERNET_SCHEME_UNKNOWN on failure
|
|
|
|
*
|
|
|
|
*/
|
2004-08-09 20:54:23 +02:00
|
|
|
static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp)
|
2003-01-03 00:08:22 +01:00
|
|
|
{
|
2006-03-09 16:14:21 +01:00
|
|
|
int i;
|
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("%s %d\n",debugstr_wn(lpszScheme, nMaxCmp), nMaxCmp);
|
2006-03-09 16:14:21 +01:00
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
if(lpszScheme==NULL)
|
|
|
|
return INTERNET_SCHEME_UNKNOWN;
|
|
|
|
|
2018-09-20 19:13:59 +02:00
|
|
|
for (i = 0; i < ARRAY_SIZE(url_schemes); i++)
|
2013-04-01 13:11:37 +02:00
|
|
|
if (!strncmpiW(lpszScheme, url_schemes[i], nMaxCmp))
|
2006-03-09 16:14:21 +01:00
|
|
|
return INTERNET_SCHEME_FIRST + i;
|
|
|
|
|
|
|
|
return INTERNET_SCHEME_UNKNOWN;
|
2003-01-03 00:08:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetCrackUrlW (WININET.@)
|
2006-03-21 14:45:03 +01:00
|
|
|
*
|
|
|
|
* Break up URL into its components
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
2003-01-03 00:08:22 +01:00
|
|
|
*/
|
2016-04-27 14:17:31 +02:00
|
|
|
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* RFC 1808
|
|
|
|
* <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
|
|
|
|
*
|
|
|
|
*/
|
2004-06-01 22:19:56 +02:00
|
|
|
LPCWSTR lpszParam = NULL;
|
2012-12-31 21:33:20 +01:00
|
|
|
BOOL found_colon = FALSE;
|
2016-04-27 14:17:31 +02:00
|
|
|
LPCWSTR lpszap;
|
2012-12-31 21:33:20 +01:00
|
|
|
LPCWSTR lpszcp = NULL, lpszNetLoc;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2008-06-29 16:02:27 +02:00
|
|
|
TRACE("(%s %u %x %p)\n",
|
|
|
|
lpszUrl ? debugstr_wn(lpszUrl, dwUrlLength ? dwUrlLength : strlenW(lpszUrl)) : "(null)",
|
|
|
|
dwUrlLength, dwFlags, lpUC);
|
2006-07-15 01:45:46 +02:00
|
|
|
|
2016-04-27 14:17:31 +02:00
|
|
|
if (!lpszUrl || !*lpszUrl || !lpUC)
|
2006-07-15 01:45:46 +02:00
|
|
|
{
|
2016-04-27 14:17:31 +02:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2006-07-15 01:45:46 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
2007-08-09 18:33:41 +02:00
|
|
|
if (!dwUrlLength) dwUrlLength = strlenW(lpszUrl);
|
2006-07-15 01:45:46 +02:00
|
|
|
|
2005-05-24 13:43:35 +02:00
|
|
|
if (dwFlags & ICU_DECODE)
|
|
|
|
{
|
2018-08-31 04:29:05 +02:00
|
|
|
WCHAR *url_tmp, *buffer;
|
2008-06-29 16:02:27 +02:00
|
|
|
DWORD len = dwUrlLength + 1;
|
2016-04-27 14:17:31 +02:00
|
|
|
BOOL ret;
|
2008-06-29 16:02:27 +02:00
|
|
|
|
2016-04-27 14:17:31 +02:00
|
|
|
if (!(url_tmp = heap_strndupW(lpszUrl, dwUrlLength)))
|
2008-06-29 16:02:27 +02:00
|
|
|
{
|
2016-04-27 14:17:31 +02:00
|
|
|
SetLastError(ERROR_OUTOFMEMORY);
|
2008-06-29 16:02:27 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
2018-08-31 04:29:05 +02:00
|
|
|
|
|
|
|
buffer = url_tmp;
|
|
|
|
ret = InternetCanonicalizeUrlW(url_tmp, buffer, &len, ICU_DECODE | ICU_NO_ENCODE);
|
|
|
|
if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
|
|
|
{
|
|
|
|
buffer = heap_alloc(len * sizeof(WCHAR));
|
|
|
|
if (!buffer)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_OUTOFMEMORY);
|
|
|
|
heap_free(url_tmp);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
ret = InternetCanonicalizeUrlW(url_tmp, buffer, &len, ICU_DECODE | ICU_NO_ENCODE);
|
|
|
|
}
|
2016-04-27 14:17:31 +02:00
|
|
|
if (ret)
|
2018-08-31 04:29:05 +02:00
|
|
|
ret = InternetCrackUrlW(buffer, len, dwFlags & ~ICU_DECODE, lpUC);
|
|
|
|
|
|
|
|
if (buffer != url_tmp) heap_free(buffer);
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(url_tmp);
|
2016-04-27 14:17:31 +02:00
|
|
|
return ret;
|
2005-05-24 13:43:35 +02:00
|
|
|
}
|
|
|
|
lpszap = lpszUrl;
|
|
|
|
|
2000-06-11 22:04:44 +02:00
|
|
|
/* Determine if the URI is absolute. */
|
2008-06-29 16:02:27 +02:00
|
|
|
while (lpszap - lpszUrl < dwUrlLength)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2009-08-25 22:37:12 +02:00
|
|
|
if (isalnumW(*lpszap) || *lpszap == '+' || *lpszap == '.' || *lpszap == '-')
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2000-06-11 22:04:44 +02:00
|
|
|
lpszap++;
|
2000-04-11 22:07:00 +02:00
|
|
|
continue;
|
|
|
|
}
|
2012-12-31 21:33:20 +01:00
|
|
|
if (*lpszap == ':')
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2012-12-31 21:33:20 +01:00
|
|
|
found_colon = TRUE;
|
2000-06-11 22:04:44 +02:00
|
|
|
lpszcp = lpszap;
|
|
|
|
}
|
2003-01-03 00:08:22 +01:00
|
|
|
else
|
|
|
|
{
|
2004-06-01 22:19:56 +02:00
|
|
|
lpszcp = lpszUrl; /* Relative url */
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
if(!found_colon){
|
|
|
|
SetLastError(ERROR_INTERNET_UNRECOGNIZED_SCHEME);
|
2014-01-29 22:28:25 +01:00
|
|
|
return FALSE;
|
2012-12-31 21:33:20 +01:00
|
|
|
}
|
|
|
|
|
2006-03-14 15:35:37 +01:00
|
|
|
lpUC->nScheme = INTERNET_SCHEME_UNKNOWN;
|
|
|
|
lpUC->nPort = INTERNET_INVALID_PORT_NUMBER;
|
|
|
|
|
2000-06-11 22:04:44 +02:00
|
|
|
/* Parse <params> */
|
2012-11-15 18:23:52 +01:00
|
|
|
lpszParam = memchrW(lpszap, '?', dwUrlLength - (lpszap - lpszUrl));
|
2009-09-28 22:49:16 +02:00
|
|
|
if(!lpszParam)
|
|
|
|
lpszParam = memchrW(lpszap, '#', dwUrlLength - (lpszap - lpszUrl));
|
2008-06-29 16:02:27 +02:00
|
|
|
|
2016-04-27 14:17:59 +02:00
|
|
|
if(!set_url_component(&lpUC->lpszExtraInfo, &lpUC->dwExtraInfoLength,
|
|
|
|
lpszParam, lpszParam ? dwUrlLength-(lpszParam-lpszUrl) : 0))
|
|
|
|
return FALSE;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
/* Get scheme first. */
|
|
|
|
lpUC->nScheme = GetInternetSchemeW(lpszUrl, lpszcp - lpszUrl);
|
2016-04-27 14:17:59 +02:00
|
|
|
if(!set_url_component(&lpUC->lpszScheme, &lpUC->dwSchemeLength, lpszUrl, lpszcp - lpszUrl))
|
|
|
|
return FALSE;
|
2012-12-31 21:33:20 +01:00
|
|
|
|
|
|
|
/* Eat ':' in protocol. */
|
|
|
|
lpszcp++;
|
|
|
|
|
|
|
|
/* double slash indicates the net_loc portion is present */
|
|
|
|
if ((lpszcp[0] == '/') && (lpszcp[1] == '/'))
|
|
|
|
{
|
|
|
|
lpszcp += 2;
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
lpszNetLoc = memchrW(lpszcp, '/', dwUrlLength - (lpszcp - lpszUrl));
|
|
|
|
if (lpszParam)
|
|
|
|
{
|
|
|
|
if (lpszNetLoc)
|
|
|
|
lpszNetLoc = min(lpszNetLoc, lpszParam);
|
|
|
|
else
|
|
|
|
lpszNetLoc = lpszParam;
|
|
|
|
}
|
|
|
|
else if (!lpszNetLoc)
|
|
|
|
lpszNetLoc = lpszcp + dwUrlLength-(lpszcp-lpszUrl);
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
/* Parse net-loc */
|
|
|
|
if (lpszNetLoc)
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
2012-12-31 21:33:20 +01:00
|
|
|
LPCWSTR lpszHost;
|
|
|
|
LPCWSTR lpszPort;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
/* [<user>[<:password>]@]<host>[:<port>] */
|
|
|
|
/* First find the user and password if they exist */
|
|
|
|
|
|
|
|
lpszHost = memchrW(lpszcp, '@', dwUrlLength - (lpszcp - lpszUrl));
|
|
|
|
if (lpszHost == NULL || lpszHost > lpszNetLoc)
|
2003-01-03 00:08:22 +01:00
|
|
|
{
|
2012-12-31 21:33:20 +01:00
|
|
|
/* username and password not specified. */
|
2016-04-27 14:17:59 +02:00
|
|
|
set_url_component(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0);
|
|
|
|
set_url_component(&lpUC->lpszPassword, &lpUC->dwPasswordLength, NULL, 0);
|
2003-01-03 00:08:22 +01:00
|
|
|
}
|
2012-12-31 21:33:20 +01:00
|
|
|
else /* Parse out username and password */
|
2003-01-03 00:08:22 +01:00
|
|
|
{
|
2012-12-31 21:33:20 +01:00
|
|
|
LPCWSTR lpszUser = lpszcp;
|
|
|
|
LPCWSTR lpszPasswd = lpszHost;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
while (lpszcp < lpszHost)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2012-12-31 21:33:20 +01:00
|
|
|
if (*lpszcp == ':')
|
|
|
|
lpszPasswd = lpszcp;
|
|
|
|
|
|
|
|
lpszcp++;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2016-04-27 14:17:59 +02:00
|
|
|
if(!set_url_component(&lpUC->lpszUserName, &lpUC->dwUserNameLength, lpszUser, lpszPasswd - lpszUser))
|
|
|
|
return FALSE;
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
if (lpszPasswd != lpszHost)
|
|
|
|
lpszPasswd++;
|
2016-04-27 14:17:59 +02:00
|
|
|
if(!set_url_component(&lpUC->lpszPassword, &lpUC->dwPasswordLength,
|
|
|
|
lpszPasswd == lpszHost ? NULL : lpszPasswd, lpszHost - lpszPasswd))
|
|
|
|
return FALSE;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
lpszcp++; /* Advance to beginning of host */
|
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
/* Parse <host><:port> */
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
lpszHost = lpszcp;
|
|
|
|
lpszPort = lpszNetLoc;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
/* special case for res:// URLs: there is no port here, so the host is the
|
|
|
|
entire string up to the first '/' */
|
|
|
|
if(lpUC->nScheme==INTERNET_SCHEME_RES)
|
|
|
|
{
|
2016-04-27 14:17:59 +02:00
|
|
|
if(!set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, lpszHost, lpszPort - lpszHost))
|
|
|
|
return FALSE;
|
2012-12-31 21:33:20 +01:00
|
|
|
lpszcp=lpszNetLoc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (lpszcp < lpszNetLoc)
|
|
|
|
{
|
|
|
|
if (*lpszcp == ':')
|
|
|
|
lpszPort = lpszcp;
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
lpszcp++;
|
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2012-12-31 21:33:20 +01:00
|
|
|
/* If the scheme is "file" and the host is just one letter, it's not a host */
|
|
|
|
if(lpUC->nScheme==INTERNET_SCHEME_FILE && lpszPort <= lpszHost+1)
|
2003-01-03 00:08:22 +01:00
|
|
|
{
|
2012-12-31 21:33:20 +01:00
|
|
|
lpszcp=lpszHost;
|
2016-04-27 14:17:59 +02:00
|
|
|
set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, NULL, 0);
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
2003-01-03 00:08:22 +01:00
|
|
|
else
|
|
|
|
{
|
2016-04-27 14:17:59 +02:00
|
|
|
if(!set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, lpszHost, lpszPort - lpszHost))
|
|
|
|
return FALSE;
|
2012-12-31 21:33:20 +01:00
|
|
|
if (lpszPort != lpszNetLoc)
|
|
|
|
lpUC->nPort = atoiW(++lpszPort);
|
|
|
|
else switch (lpUC->nScheme)
|
2003-01-03 00:08:22 +01:00
|
|
|
{
|
2012-12-31 21:33:20 +01:00
|
|
|
case INTERNET_SCHEME_HTTP:
|
|
|
|
lpUC->nPort = INTERNET_DEFAULT_HTTP_PORT;
|
|
|
|
break;
|
|
|
|
case INTERNET_SCHEME_HTTPS:
|
|
|
|
lpUC->nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
|
|
|
break;
|
|
|
|
case INTERNET_SCHEME_FTP:
|
|
|
|
lpUC->nPort = INTERNET_DEFAULT_FTP_PORT;
|
|
|
|
break;
|
|
|
|
case INTERNET_SCHEME_GOPHER:
|
|
|
|
lpUC->nPort = INTERNET_DEFAULT_GOPHER_PORT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2003-01-03 00:08:22 +01:00
|
|
|
}
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
}
|
2003-01-03 00:08:22 +01:00
|
|
|
}
|
2006-03-14 15:35:37 +01:00
|
|
|
else
|
|
|
|
{
|
2016-04-27 14:17:59 +02:00
|
|
|
set_url_component(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0);
|
|
|
|
set_url_component(&lpUC->lpszPassword, &lpUC->dwPasswordLength, NULL, 0);
|
|
|
|
set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, NULL, 0);
|
2006-03-14 15:35:37 +01:00
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
|
|
|
|
/* Here lpszcp points to:
|
|
|
|
*
|
|
|
|
* <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
|
|
|
|
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
*/
|
2009-12-09 22:09:06 +01:00
|
|
|
if (lpszcp != 0 && lpszcp - lpszUrl < dwUrlLength && (!lpszParam || lpszcp <= lpszParam))
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
2010-10-05 17:28:42 +02:00
|
|
|
DWORD len;
|
2000-07-23 15:34:21 +02:00
|
|
|
|
|
|
|
/* Only truncate the parameter list if it's already been saved
|
2003-01-03 00:08:22 +01:00
|
|
|
* in lpUC->lpszExtraInfo.
|
2000-07-23 15:34:21 +02:00
|
|
|
*/
|
2004-08-06 20:57:53 +02:00
|
|
|
if (lpszParam && lpUC->dwExtraInfoLength && lpUC->lpszExtraInfo)
|
2000-07-23 15:34:21 +02:00
|
|
|
len = lpszParam - lpszcp;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Leave the parameter list in lpszUrlPath. Strip off any trailing
|
|
|
|
* newlines if necessary.
|
|
|
|
*/
|
2008-06-29 16:02:27 +02:00
|
|
|
LPWSTR lpsznewline = memchrW(lpszcp, '\n', dwUrlLength - (lpszcp - lpszUrl));
|
2000-07-23 15:34:21 +02:00
|
|
|
if (lpsznewline != NULL)
|
|
|
|
len = lpsznewline - lpszcp;
|
|
|
|
else
|
2003-01-03 00:08:22 +01:00
|
|
|
len = dwUrlLength-(lpszcp-lpszUrl);
|
2000-07-23 15:34:21 +02:00
|
|
|
}
|
2010-10-05 17:28:42 +02:00
|
|
|
if (lpUC->dwUrlPathLength && lpUC->lpszUrlPath &&
|
|
|
|
lpUC->nScheme == INTERNET_SCHEME_FILE)
|
|
|
|
{
|
|
|
|
WCHAR tmppath[MAX_PATH];
|
|
|
|
if (*lpszcp == '/')
|
|
|
|
{
|
|
|
|
len = MAX_PATH;
|
2016-04-27 14:17:31 +02:00
|
|
|
PathCreateFromUrlW(lpszUrl, tmppath, &len, 0);
|
2010-10-05 17:28:42 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WCHAR *iter;
|
|
|
|
memcpy(tmppath, lpszcp, len * sizeof(WCHAR));
|
|
|
|
tmppath[len] = '\0';
|
|
|
|
|
|
|
|
iter = tmppath;
|
|
|
|
while (*iter) {
|
|
|
|
if (*iter == '/')
|
|
|
|
*iter = '\\';
|
|
|
|
++iter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* if ends in \. or \.. append a backslash */
|
|
|
|
if (tmppath[len - 1] == '.' &&
|
|
|
|
(tmppath[len - 2] == '\\' ||
|
|
|
|
(tmppath[len - 2] == '.' && tmppath[len - 3] == '\\')))
|
|
|
|
{
|
|
|
|
if (len < MAX_PATH - 1)
|
|
|
|
{
|
|
|
|
tmppath[len] = '\\';
|
|
|
|
tmppath[len+1] = '\0';
|
|
|
|
++len;
|
|
|
|
}
|
|
|
|
}
|
2016-04-27 14:17:59 +02:00
|
|
|
if(!set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, tmppath, len))
|
|
|
|
return FALSE;
|
2010-10-05 17:28:42 +02:00
|
|
|
}
|
2016-04-27 14:17:59 +02:00
|
|
|
else if(!set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, lpszcp, len))
|
|
|
|
return FALSE;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
else
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
2016-07-08 12:07:43 +02:00
|
|
|
set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, lpszcp, 0);
|
2000-06-11 22:04:44 +02:00
|
|
|
}
|
|
|
|
|
2005-05-24 13:43:35 +02:00
|
|
|
TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", debugstr_wn(lpszUrl,dwUrlLength),
|
|
|
|
debugstr_wn(lpUC->lpszScheme,lpUC->dwSchemeLength),
|
2003-01-03 00:08:22 +01:00
|
|
|
debugstr_wn(lpUC->lpszHostName,lpUC->dwHostNameLength),
|
|
|
|
debugstr_wn(lpUC->lpszUrlPath,lpUC->dwUrlPathLength),
|
|
|
|
debugstr_wn(lpUC->lpszExtraInfo,lpUC->dwExtraInfoLength));
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* InternetAttemptConnect (WININET.@)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* Attempt to make a connection to the internet
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* ERROR_SUCCESS on success
|
|
|
|
* Error value on failure
|
|
|
|
*
|
|
|
|
*/
|
2001-09-11 02:32:32 +02:00
|
|
|
DWORD WINAPI InternetAttemptConnect(DWORD dwReserved)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
|
|
|
FIXME("Stub\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-30 07:42:36 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* convert_url_canonicalization_flags
|
|
|
|
*
|
|
|
|
* Helper for InternetCanonicalizeUrl
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* dwFlags [I] Flags suitable for InternetCanonicalizeUrl
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Flags suitable for UrlCanonicalize
|
|
|
|
*/
|
|
|
|
static DWORD convert_url_canonicalization_flags(DWORD dwFlags)
|
|
|
|
{
|
|
|
|
DWORD dwUrlFlags = URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE;
|
|
|
|
|
|
|
|
if (dwFlags & ICU_BROWSER_MODE) dwUrlFlags |= URL_BROWSER_MODE;
|
|
|
|
if (dwFlags & ICU_DECODE) dwUrlFlags |= URL_UNESCAPE;
|
|
|
|
if (dwFlags & ICU_ENCODE_PERCENT) dwUrlFlags |= URL_ESCAPE_PERCENT;
|
|
|
|
if (dwFlags & ICU_ENCODE_SPACES_ONLY) dwUrlFlags |= URL_ESCAPE_SPACES_ONLY;
|
|
|
|
/* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
|
|
|
|
if (dwFlags & ICU_NO_ENCODE) dwUrlFlags ^= URL_ESCAPE_UNSAFE;
|
|
|
|
if (dwFlags & ICU_NO_META) dwUrlFlags |= URL_NO_META;
|
|
|
|
|
|
|
|
return dwUrlFlags;
|
|
|
|
}
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* InternetCanonicalizeUrlA (WININET.@)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* Escape unsafe characters and spaces
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2000-04-15 22:44:21 +02:00
|
|
|
BOOL WINAPI InternetCanonicalizeUrlA(LPCSTR lpszUrl, LPSTR lpszBuffer,
|
2000-04-11 22:07:00 +02:00
|
|
|
LPDWORD lpdwBufferLength, DWORD dwFlags)
|
|
|
|
{
|
2001-01-06 01:36:43 +01:00
|
|
|
HRESULT hr;
|
2007-10-12 09:36:54 +02:00
|
|
|
|
2014-06-19 23:30:35 +02:00
|
|
|
TRACE("(%s, %p, %p, 0x%08x) buffer length: %d\n", debugstr_a(lpszUrl), lpszBuffer,
|
2010-05-08 18:01:15 +02:00
|
|
|
lpdwBufferLength, dwFlags, lpdwBufferLength ? *lpdwBufferLength : -1);
|
2007-10-12 09:36:54 +02:00
|
|
|
|
2012-07-30 07:42:36 +02:00
|
|
|
dwFlags = convert_url_canonicalization_flags(dwFlags);
|
|
|
|
hr = UrlCanonicalizeA(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
|
2007-10-12 09:36:54 +02:00
|
|
|
if (hr == E_POINTER) SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
if (hr == E_INVALIDARG) SetLastError(ERROR_INVALID_PARAMETER);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2012-07-30 07:42:36 +02:00
|
|
|
return hr == S_OK;
|
2001-01-06 01:36:43 +01:00
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2002-10-28 19:48:24 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetCanonicalizeUrlW (WININET.@)
|
|
|
|
*
|
|
|
|
* Escape unsafe characters and spaces
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer,
|
|
|
|
LPDWORD lpdwBufferLength, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
2007-10-12 09:36:54 +02:00
|
|
|
|
2014-06-19 23:30:35 +02:00
|
|
|
TRACE("(%s, %p, %p, 0x%08x) buffer length: %d\n", debugstr_w(lpszUrl), lpszBuffer,
|
2008-06-29 16:02:27 +02:00
|
|
|
lpdwBufferLength, dwFlags, lpdwBufferLength ? *lpdwBufferLength : -1);
|
2007-10-12 09:36:54 +02:00
|
|
|
|
2012-07-30 07:42:36 +02:00
|
|
|
dwFlags = convert_url_canonicalization_flags(dwFlags);
|
|
|
|
hr = UrlCanonicalizeW(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
|
2007-10-12 09:36:54 +02:00
|
|
|
if (hr == E_POINTER) SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
if (hr == E_INVALIDARG) SetLastError(ERROR_INVALID_PARAMETER);
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2012-07-30 07:42:36 +02:00
|
|
|
return hr == S_OK;
|
2002-10-28 19:48:24 +01:00
|
|
|
}
|
|
|
|
|
2007-10-12 09:36:54 +02:00
|
|
|
/* #################################################### */
|
|
|
|
|
2007-08-09 18:34:22 +02:00
|
|
|
static INTERNET_STATUS_CALLBACK set_status_callback(
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *lpwh, INTERNET_STATUS_CALLBACK callback, BOOL unicode)
|
2007-08-09 18:34:22 +02:00
|
|
|
{
|
|
|
|
INTERNET_STATUS_CALLBACK ret;
|
|
|
|
|
|
|
|
if (unicode) lpwh->dwInternalFlags |= INET_CALLBACKW;
|
|
|
|
else lpwh->dwInternalFlags &= ~INET_CALLBACKW;
|
|
|
|
|
|
|
|
ret = lpwh->lpfnStatusCB;
|
|
|
|
lpwh->lpfnStatusCB = callback;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
/***********************************************************************
|
2003-03-28 20:30:55 +01:00
|
|
|
* InternetSetStatusCallbackA (WININET.@)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* Sets up a callback function which is called as progress is made
|
2002-06-01 01:06:46 +02:00
|
|
|
* during an operation.
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Previous callback or NULL on success
|
|
|
|
* INTERNET_INVALID_STATUS_CALLBACK on failure
|
|
|
|
*
|
|
|
|
*/
|
2003-03-28 20:30:55 +01:00
|
|
|
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA(
|
2000-04-11 22:07:00 +02:00
|
|
|
HINTERNET hInternet ,INTERNET_STATUS_CALLBACK lpfnIntCB)
|
|
|
|
{
|
2004-09-20 21:10:31 +02:00
|
|
|
INTERNET_STATUS_CALLBACK retVal;
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *lpwh;
|
2004-02-07 02:03:41 +01:00
|
|
|
|
2009-01-08 13:13:22 +01:00
|
|
|
TRACE("%p\n", hInternet);
|
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
if (!(lpwh = get_handle_object(hInternet)))
|
2004-09-20 21:10:31 +02:00
|
|
|
return INTERNET_INVALID_STATUS_CALLBACK;
|
2004-05-25 06:02:05 +02:00
|
|
|
|
2007-08-09 18:34:22 +02:00
|
|
|
retVal = set_status_callback(lpwh, lpfnIntCB, FALSE);
|
2004-09-20 21:10:31 +02:00
|
|
|
|
|
|
|
WININET_Release( lpwh );
|
2004-05-25 06:02:05 +02:00
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetStatusCallbackW (WININET.@)
|
|
|
|
*
|
|
|
|
* Sets up a callback function which is called as progress is made
|
|
|
|
* during an operation.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Previous callback or NULL on success
|
|
|
|
* INTERNET_INVALID_STATUS_CALLBACK on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(
|
|
|
|
HINTERNET hInternet ,INTERNET_STATUS_CALLBACK lpfnIntCB)
|
|
|
|
{
|
2004-09-20 21:10:31 +02:00
|
|
|
INTERNET_STATUS_CALLBACK retVal;
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *lpwh;
|
2004-05-25 06:02:05 +02:00
|
|
|
|
2009-01-08 13:13:22 +01:00
|
|
|
TRACE("%p\n", hInternet);
|
2007-08-09 18:34:22 +02:00
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
if (!(lpwh = get_handle_object(hInternet)))
|
2004-09-20 21:10:31 +02:00
|
|
|
return INTERNET_INVALID_STATUS_CALLBACK;
|
2004-05-25 06:02:05 +02:00
|
|
|
|
2007-08-09 18:34:22 +02:00
|
|
|
retVal = set_status_callback(lpwh, lpfnIntCB, TRUE);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
WININET_Release( lpwh );
|
2000-04-11 22:07:00 +02:00
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
|
2003-11-09 02:23:32 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetFilePointer (WININET.@)
|
|
|
|
*/
|
2005-10-28 12:08:44 +02:00
|
|
|
DWORD WINAPI InternetSetFilePointer(HINTERNET hFile, LONG lDistanceToMove,
|
2007-08-30 16:21:33 +02:00
|
|
|
PVOID pReserved, DWORD dwMoveContext, DWORD_PTR dwContext)
|
2003-11-09 02:23:32 +01:00
|
|
|
{
|
2011-11-13 19:20:38 +01:00
|
|
|
FIXME("(%p %d %p %d %lx): stub\n", hFile, lDistanceToMove, pReserved, dwMoveContext, dwContext);
|
2003-11-09 02:23:32 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* InternetWriteFile (WININET.@)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
2002-06-01 01:06:46 +02:00
|
|
|
* Write data to an open internet file
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2008-02-26 20:21:34 +01:00
|
|
|
BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer,
|
2000-04-11 22:07:00 +02:00
|
|
|
DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
|
|
|
|
{
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *lpwh;
|
2009-11-30 00:13:39 +01:00
|
|
|
BOOL res;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2008-02-26 20:21:34 +01:00
|
|
|
TRACE("(%p %p %d %p)\n", hFile, lpBuffer, dwNumOfBytesToWrite, lpdwNumOfBytesWritten);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
lpwh = get_handle_object( hFile );
|
2008-03-14 22:34:54 +01:00
|
|
|
if (!lpwh) {
|
|
|
|
WARN("Invalid handle\n");
|
|
|
|
SetLastError(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2008-03-14 22:34:54 +01:00
|
|
|
if(lpwh->vtbl->WriteFile) {
|
2009-11-30 00:13:39 +01:00
|
|
|
res = lpwh->vtbl->WriteFile(lpwh, lpBuffer, dwNumOfBytesToWrite, lpdwNumOfBytesWritten);
|
2008-02-26 20:21:34 +01:00
|
|
|
}else {
|
2008-03-14 22:34:54 +01:00
|
|
|
WARN("No Writefile method.\n");
|
2009-11-30 00:13:39 +01:00
|
|
|
res = ERROR_INVALID_HANDLE;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
WININET_Release( lpwh );
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2009-11-30 00:13:39 +01:00
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
SetLastError(res);
|
|
|
|
return res == ERROR_SUCCESS;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-12 20:10:56 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetReadFile (WININET.@)
|
|
|
|
*
|
|
|
|
* Read data from an open internet file
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
|
2008-03-02 19:35:11 +01:00
|
|
|
DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
|
2005-11-12 20:10:56 +01:00
|
|
|
{
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *hdr;
|
2008-03-02 19:35:11 +01:00
|
|
|
DWORD res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
2005-11-12 20:10:56 +01:00
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("%p %p %d %p\n", hFile, lpBuffer, dwNumOfBytesToRead, pdwNumOfBytesRead);
|
2005-11-12 20:10:56 +01:00
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
hdr = get_handle_object(hFile);
|
2008-03-02 19:35:11 +01:00
|
|
|
if (!hdr) {
|
2007-01-09 12:30:45 +01:00
|
|
|
INTERNET_SetLastError(ERROR_INVALID_HANDLE);
|
2005-11-12 20:10:56 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-03-09 18:20:14 +01:00
|
|
|
if(hdr->vtbl->ReadFile) {
|
|
|
|
res = hdr->vtbl->ReadFile(hdr, lpBuffer, dwNumOfBytesToRead, pdwNumOfBytesRead, 0, 0);
|
|
|
|
if(res == ERROR_IO_PENDING)
|
|
|
|
*pdwNumOfBytesRead = 0;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2008-03-02 19:35:11 +01:00
|
|
|
WININET_Release(hdr);
|
|
|
|
|
|
|
|
TRACE("-- %s (%u) (bytes read: %d)\n", res == ERROR_SUCCESS ? "TRUE": "FALSE", res,
|
|
|
|
pdwNumOfBytesRead ? *pdwNumOfBytesRead : -1);
|
|
|
|
|
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
SetLastError(res);
|
|
|
|
return res == ERROR_SUCCESS;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
2002-09-28 00:05:23 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetReadFileExA (WININET.@)
|
|
|
|
*
|
|
|
|
* Read data from an open internet file
|
|
|
|
*
|
2005-11-12 20:10:56 +01:00
|
|
|
* PARAMS
|
|
|
|
* hFile [I] Handle returned by InternetOpenUrl or HttpOpenRequest.
|
|
|
|
* lpBuffersOut [I/O] Buffer.
|
|
|
|
* dwFlags [I] Flags. See notes.
|
|
|
|
* dwContext [I] Context for callbacks.
|
|
|
|
*
|
2002-09-28 00:05:23 +02:00
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
2005-11-12 20:10:56 +01:00
|
|
|
* NOTES
|
|
|
|
* The parameter dwFlags include zero or more of the following flags:
|
|
|
|
*|IRF_ASYNC - Makes the call asynchronous.
|
|
|
|
*|IRF_SYNC - Makes the call synchronous.
|
|
|
|
*|IRF_USE_CONTEXT - Forces dwContext to be used.
|
|
|
|
*|IRF_NO_WAIT - Don't block if the data is not available, just return what is available.
|
|
|
|
*
|
|
|
|
* However, in testing IRF_USE_CONTEXT seems to have no effect - dwContext isn't used.
|
|
|
|
*
|
|
|
|
* SEE
|
|
|
|
* InternetOpenUrlA(), HttpOpenRequestA()
|
2002-09-28 00:05:23 +02:00
|
|
|
*/
|
2005-11-12 20:10:56 +01:00
|
|
|
BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOut,
|
2007-08-30 16:21:33 +02:00
|
|
|
DWORD dwFlags, DWORD_PTR dwContext)
|
2002-09-28 00:05:23 +02:00
|
|
|
{
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *hdr;
|
2008-03-03 18:07:20 +01:00
|
|
|
DWORD res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
2005-11-12 20:10:56 +01:00
|
|
|
|
2007-08-30 16:21:33 +02:00
|
|
|
TRACE("(%p %p 0x%x 0x%lx)\n", hFile, lpBuffersOut, dwFlags, dwContext);
|
2005-11-12 20:10:56 +01:00
|
|
|
|
2012-11-23 15:18:52 +01:00
|
|
|
if (lpBuffersOut->dwStructSize != sizeof(*lpBuffersOut)) {
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
hdr = get_handle_object(hFile);
|
2008-03-03 18:07:20 +01:00
|
|
|
if (!hdr) {
|
2007-01-09 12:30:45 +01:00
|
|
|
INTERNET_SetLastError(ERROR_INVALID_HANDLE);
|
2005-11-12 20:10:56 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-03-09 18:20:14 +01:00
|
|
|
if(hdr->vtbl->ReadFile)
|
|
|
|
res = hdr->vtbl->ReadFile(hdr, lpBuffersOut->lpvBuffer, lpBuffersOut->dwBufferLength,
|
2012-11-23 15:18:52 +01:00
|
|
|
&lpBuffersOut->dwBufferLength, dwFlags, dwContext);
|
2005-11-12 20:10:56 +01:00
|
|
|
|
2008-03-03 18:07:20 +01:00
|
|
|
WININET_Release(hdr);
|
2007-06-05 20:45:26 +02:00
|
|
|
|
2008-03-03 18:07:20 +01:00
|
|
|
TRACE("-- %s (%u, bytes read: %d)\n", res == ERROR_SUCCESS ? "TRUE": "FALSE",
|
|
|
|
res, lpBuffersOut->dwBufferLength);
|
2005-11-12 20:10:56 +01:00
|
|
|
|
2008-03-03 18:07:20 +01:00
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
SetLastError(res);
|
|
|
|
return res == ERROR_SUCCESS;
|
2002-09-28 00:05:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetReadFileExW (WININET.@)
|
2009-01-15 16:41:42 +01:00
|
|
|
* SEE
|
|
|
|
* InternetReadFileExA()
|
2002-09-28 00:05:23 +02:00
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer,
|
2007-08-30 16:21:33 +02:00
|
|
|
DWORD dwFlags, DWORD_PTR dwContext)
|
2002-09-28 00:05:23 +02:00
|
|
|
{
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *hdr;
|
2009-01-15 16:41:42 +01:00
|
|
|
DWORD res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
|
|
|
|
|
|
|
TRACE("(%p %p 0x%x 0x%lx)\n", hFile, lpBuffer, dwFlags, dwContext);
|
2002-09-28 00:05:23 +02:00
|
|
|
|
2016-05-16 22:42:19 +02:00
|
|
|
if (!lpBuffer || lpBuffer->dwStructSize != sizeof(*lpBuffer)) {
|
2012-11-23 15:18:31 +01:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
hdr = get_handle_object(hFile);
|
2009-01-15 16:41:42 +01:00
|
|
|
if (!hdr) {
|
|
|
|
INTERNET_SetLastError(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-03-09 18:20:14 +01:00
|
|
|
if(hdr->vtbl->ReadFile)
|
|
|
|
res = hdr->vtbl->ReadFile(hdr, lpBuffer->lpvBuffer, lpBuffer->dwBufferLength, &lpBuffer->dwBufferLength,
|
2012-11-23 15:18:31 +01:00
|
|
|
dwFlags, dwContext);
|
2009-01-15 16:41:42 +01:00
|
|
|
|
|
|
|
WININET_Release(hdr);
|
|
|
|
|
|
|
|
TRACE("-- %s (%u, bytes read: %d)\n", res == ERROR_SUCCESS ? "TRUE": "FALSE",
|
|
|
|
res, lpBuffer->dwBufferLength);
|
|
|
|
|
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
SetLastError(res);
|
|
|
|
return res == ERROR_SUCCESS;
|
2002-09-28 00:05:23 +02:00
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2016-05-17 19:16:21 +02:00
|
|
|
static WCHAR *get_proxy_autoconfig_url(void)
|
2014-05-06 11:33:18 +02:00
|
|
|
{
|
2014-05-19 11:13:25 +02:00
|
|
|
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
|
|
|
|
2014-05-06 11:33:18 +02:00
|
|
|
CFDictionaryRef settings = CFNetworkCopySystemProxySettings();
|
2016-05-17 19:16:21 +02:00
|
|
|
WCHAR *ret = NULL;
|
|
|
|
SIZE_T len;
|
2014-05-06 11:33:18 +02:00
|
|
|
const void *ref;
|
|
|
|
|
2016-05-20 14:10:14 +02:00
|
|
|
if (!settings) return NULL;
|
2014-05-06 11:33:18 +02:00
|
|
|
|
|
|
|
if (!(ref = CFDictionaryGetValue( settings, kCFNetworkProxiesProxyAutoConfigURLString )))
|
|
|
|
{
|
|
|
|
CFRelease( settings );
|
2016-05-20 14:10:14 +02:00
|
|
|
return NULL;
|
2014-05-06 11:33:18 +02:00
|
|
|
}
|
2016-05-17 19:16:21 +02:00
|
|
|
len = CFStringGetLength( ref );
|
|
|
|
if (len)
|
|
|
|
ret = heap_alloc( (len+1) * sizeof(WCHAR) );
|
|
|
|
if (ret)
|
2014-05-06 11:33:18 +02:00
|
|
|
{
|
2016-05-17 19:16:21 +02:00
|
|
|
CFStringGetCharacters( ref, CFRangeMake(0, len), ret );
|
|
|
|
ret[len] = 0;
|
2014-05-06 11:33:18 +02:00
|
|
|
}
|
2016-05-17 19:16:21 +02:00
|
|
|
TRACE( "returning %s\n", debugstr_w(ret) );
|
2014-05-06 11:33:18 +02:00
|
|
|
CFRelease( settings );
|
|
|
|
return ret;
|
|
|
|
#else
|
|
|
|
FIXME( "no support on this platform\n" );
|
2016-05-17 19:16:21 +02:00
|
|
|
return NULL;
|
2014-05-06 11:33:18 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-03-08 12:21:12 +01:00
|
|
|
static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL unicode)
|
2008-07-19 12:29:28 +02:00
|
|
|
{
|
2012-03-08 12:21:12 +01:00
|
|
|
/* FIXME: This function currently handles more options than it should. Options requiring
|
|
|
|
* proper handles should be moved to proper functions */
|
2008-07-19 12:29:28 +02:00
|
|
|
switch(option) {
|
|
|
|
case INTERNET_OPTION_HTTP_VERSION:
|
|
|
|
if (*size < sizeof(HTTP_VERSION_INFO))
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Presently hardcoded to 1.1
|
|
|
|
*/
|
|
|
|
((HTTP_VERSION_INFO*)buffer)->dwMajorVersion = 1;
|
|
|
|
((HTTP_VERSION_INFO*)buffer)->dwMinorVersion = 1;
|
|
|
|
*size = sizeof(HTTP_VERSION_INFO);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
case INTERNET_OPTION_CONNECTED_STATE:
|
2012-03-08 12:21:12 +01:00
|
|
|
FIXME("INTERNET_OPTION_CONNECTED_STATE: semi-stub\n");
|
|
|
|
|
2008-07-19 12:29:28 +02:00
|
|
|
if (*size < sizeof(ULONG))
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
|
|
|
|
*(ULONG*)buffer = INTERNET_STATE_CONNECTED;
|
|
|
|
*size = sizeof(ULONG);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
2008-07-19 12:29:56 +02:00
|
|
|
|
|
|
|
case INTERNET_OPTION_PROXY: {
|
2009-07-13 01:45:06 +02:00
|
|
|
appinfo_t ai;
|
2009-08-11 00:18:00 +02:00
|
|
|
BOOL ret;
|
2008-07-19 12:29:56 +02:00
|
|
|
|
|
|
|
TRACE("Getting global proxy info\n");
|
2009-07-13 01:45:06 +02:00
|
|
|
memset(&ai, 0, sizeof(appinfo_t));
|
2008-07-19 12:29:56 +02:00
|
|
|
INTERNET_ConfigureProxy(&ai);
|
|
|
|
|
2009-08-11 00:18:00 +02:00
|
|
|
ret = APPINFO_QueryOption(&ai.hdr, INTERNET_OPTION_PROXY, buffer, size, unicode); /* FIXME */
|
|
|
|
APPINFO_Destroy(&ai.hdr);
|
|
|
|
return ret;
|
2008-07-19 12:29:56 +02:00
|
|
|
}
|
2008-07-19 12:29:28 +02:00
|
|
|
|
2008-07-19 12:30:19 +02:00
|
|
|
case INTERNET_OPTION_MAX_CONNS_PER_SERVER:
|
|
|
|
TRACE("INTERNET_OPTION_MAX_CONNS_PER_SERVER\n");
|
2008-07-19 12:29:28 +02:00
|
|
|
|
2008-07-19 12:30:19 +02:00
|
|
|
if (*size < sizeof(ULONG))
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2012-03-08 12:20:53 +01:00
|
|
|
*(ULONG*)buffer = max_conns;
|
2008-07-19 12:30:19 +02:00
|
|
|
*size = sizeof(ULONG);
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2008-07-19 12:30:19 +02:00
|
|
|
return ERROR_SUCCESS;
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2008-07-19 12:30:19 +02:00
|
|
|
case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER:
|
|
|
|
TRACE("INTERNET_OPTION_MAX_CONNS_1_0_SERVER\n");
|
2005-02-08 14:43:09 +01:00
|
|
|
|
2008-07-19 12:30:19 +02:00
|
|
|
if (*size < sizeof(ULONG))
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
2008-03-12 02:23:20 +01:00
|
|
|
|
2012-03-08 12:20:53 +01:00
|
|
|
*(ULONG*)buffer = max_1_0_conns;
|
2008-07-19 12:30:19 +02:00
|
|
|
*size = sizeof(ULONG);
|
2008-07-19 12:29:28 +02:00
|
|
|
|
2008-07-19 12:30:19 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
case INTERNET_OPTION_SECURITY_FLAGS:
|
|
|
|
FIXME("INTERNET_OPTION_SECURITY_FLAGS: Stub\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
case INTERNET_OPTION_VERSION: {
|
|
|
|
static const INTERNET_VERSION_INFO info = { 1, 2 };
|
|
|
|
|
|
|
|
TRACE("INTERNET_OPTION_VERSION\n");
|
|
|
|
|
|
|
|
if (*size < sizeof(INTERNET_VERSION_INFO))
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
|
|
|
|
memcpy(buffer, &info, sizeof(info));
|
|
|
|
*size = sizeof(info);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
case INTERNET_OPTION_PER_CONNECTION_OPTION: {
|
2016-05-17 19:16:21 +02:00
|
|
|
WCHAR *url;
|
2008-07-19 12:30:19 +02:00
|
|
|
INTERNET_PER_CONN_OPTION_LISTW *con = buffer;
|
2009-08-11 00:18:15 +02:00
|
|
|
INTERNET_PER_CONN_OPTION_LISTA *conA = buffer;
|
2008-07-19 12:30:19 +02:00
|
|
|
DWORD res = ERROR_SUCCESS, i;
|
2010-01-20 21:48:55 +01:00
|
|
|
proxyinfo_t pi;
|
|
|
|
LONG ret;
|
2009-08-11 00:18:15 +02:00
|
|
|
|
|
|
|
TRACE("Getting global proxy info\n");
|
2010-01-20 21:48:55 +01:00
|
|
|
if((ret = INTERNET_LoadProxySettings(&pi)))
|
|
|
|
return ret;
|
2008-07-19 12:30:19 +02:00
|
|
|
|
|
|
|
FIXME("INTERNET_OPTION_PER_CONNECTION_OPTION stub\n");
|
|
|
|
|
2009-08-11 00:18:15 +02:00
|
|
|
if (*size < sizeof(INTERNET_PER_CONN_OPTION_LISTW)) {
|
2010-01-20 21:48:55 +01:00
|
|
|
FreeProxyInfo(&pi);
|
2008-07-19 12:30:19 +02:00
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
2009-08-11 00:18:15 +02:00
|
|
|
}
|
2008-07-19 12:30:19 +02:00
|
|
|
|
2016-05-17 19:16:21 +02:00
|
|
|
url = get_proxy_autoconfig_url();
|
|
|
|
|
2008-07-19 12:30:19 +02:00
|
|
|
for (i = 0; i < con->dwOptionCount; i++) {
|
2011-03-09 10:08:52 +01:00
|
|
|
INTERNET_PER_CONN_OPTIONW *optionW = con->pOptions + i;
|
2009-08-11 00:18:15 +02:00
|
|
|
INTERNET_PER_CONN_OPTIONA *optionA = conA->pOptions + i;
|
2008-07-19 12:30:19 +02:00
|
|
|
|
2011-03-09 10:08:52 +01:00
|
|
|
switch (optionW->dwOption) {
|
2008-07-19 12:30:19 +02:00
|
|
|
case INTERNET_PER_CONN_FLAGS:
|
2011-07-21 21:54:27 +02:00
|
|
|
if(pi.proxyEnabled)
|
2011-03-09 10:08:52 +01:00
|
|
|
optionW->Value.dwValue = PROXY_TYPE_PROXY;
|
2010-01-20 21:48:55 +01:00
|
|
|
else
|
2011-03-09 10:08:52 +01:00
|
|
|
optionW->Value.dwValue = PROXY_TYPE_DIRECT;
|
2016-05-17 19:16:21 +02:00
|
|
|
if (url)
|
2014-05-06 11:33:18 +02:00
|
|
|
/* native includes PROXY_TYPE_DIRECT even if PROXY_TYPE_PROXY is set */
|
|
|
|
optionW->Value.dwValue |= PROXY_TYPE_DIRECT|PROXY_TYPE_AUTO_PROXY_URL;
|
2008-07-19 12:30:19 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case INTERNET_PER_CONN_PROXY_SERVER:
|
2009-08-11 00:18:15 +02:00
|
|
|
if (unicode)
|
2011-07-21 21:54:27 +02:00
|
|
|
optionW->Value.pszValue = heap_strdupW(pi.proxy);
|
2009-08-11 00:18:15 +02:00
|
|
|
else
|
2011-07-21 21:54:27 +02:00
|
|
|
optionA->Value.pszValue = heap_strdupWtoA(pi.proxy);
|
2009-08-11 00:18:15 +02:00
|
|
|
break;
|
|
|
|
|
2008-07-19 12:30:19 +02:00
|
|
|
case INTERNET_PER_CONN_PROXY_BYPASS:
|
2009-08-11 00:18:15 +02:00
|
|
|
if (unicode)
|
2011-07-21 21:54:27 +02:00
|
|
|
optionW->Value.pszValue = heap_strdupW(pi.proxyBypass);
|
2009-08-11 00:18:15 +02:00
|
|
|
else
|
2011-07-21 21:54:27 +02:00
|
|
|
optionA->Value.pszValue = heap_strdupWtoA(pi.proxyBypass);
|
2009-08-11 00:18:15 +02:00
|
|
|
break;
|
|
|
|
|
2008-07-19 12:30:19 +02:00
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_URL:
|
2016-05-17 19:16:21 +02:00
|
|
|
if (!url)
|
2014-05-06 11:33:18 +02:00
|
|
|
optionW->Value.pszValue = NULL;
|
|
|
|
else if (unicode)
|
2016-05-17 19:16:21 +02:00
|
|
|
optionW->Value.pszValue = heap_strdupW(url);
|
2014-05-06 11:33:18 +02:00
|
|
|
else
|
2016-05-17 19:16:21 +02:00
|
|
|
optionA->Value.pszValue = heap_strdupWtoA(url);
|
2014-05-06 11:33:18 +02:00
|
|
|
break;
|
|
|
|
|
2008-07-19 12:30:19 +02:00
|
|
|
case INTERNET_PER_CONN_AUTODISCOVERY_FLAGS:
|
2014-05-06 11:33:18 +02:00
|
|
|
optionW->Value.dwValue = AUTO_PROXY_FLAG_ALWAYS_DETECT;
|
|
|
|
break;
|
|
|
|
|
2008-07-19 12:30:19 +02:00
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL:
|
2011-03-09 10:08:52 +01:00
|
|
|
FIXME("Unhandled dwOption %d\n", optionW->dwOption);
|
|
|
|
memset(&optionW->Value, 0, sizeof(optionW->Value));
|
2008-07-19 12:30:19 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-03-09 10:08:52 +01:00
|
|
|
FIXME("Unknown dwOption %d\n", optionW->dwOption);
|
2008-07-19 12:30:19 +02:00
|
|
|
res = ERROR_INVALID_PARAMETER;
|
|
|
|
break;
|
|
|
|
}
|
2008-03-12 02:23:20 +01:00
|
|
|
}
|
2016-05-17 19:16:21 +02:00
|
|
|
heap_free(url);
|
2010-01-20 21:48:55 +01:00
|
|
|
FreeProxyInfo(&pi);
|
2008-07-19 12:30:19 +02:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
2012-05-23 18:24:02 +02:00
|
|
|
case INTERNET_OPTION_REQUEST_FLAGS:
|
2009-10-02 17:34:39 +02:00
|
|
|
case INTERNET_OPTION_USER_AGENT:
|
2012-05-23 18:24:02 +02:00
|
|
|
*size = 0;
|
2009-10-02 17:34:39 +02:00
|
|
|
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
2010-01-20 21:46:44 +01:00
|
|
|
case INTERNET_OPTION_POLICY:
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
2012-05-14 13:49:29 +02:00
|
|
|
case INTERNET_OPTION_CONNECT_TIMEOUT:
|
|
|
|
TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
|
|
|
|
|
|
|
|
if (*size < sizeof(ULONG))
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
|
|
|
|
*(ULONG*)buffer = connect_timeout;
|
|
|
|
*size = sizeof(ULONG);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
2012-03-08 12:21:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("Stub for %d\n", option);
|
|
|
|
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
|
|
|
|
{
|
|
|
|
switch(option) {
|
2010-05-25 12:19:45 +02:00
|
|
|
case INTERNET_OPTION_CONTEXT_VALUE:
|
|
|
|
if (!size)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
2012-03-08 12:21:12 +01:00
|
|
|
if (*size < sizeof(DWORD_PTR)) {
|
2010-05-25 12:19:45 +02:00
|
|
|
*size = sizeof(DWORD_PTR);
|
|
|
|
return ERROR_INSUFFICIENT_BUFFER;
|
|
|
|
}
|
|
|
|
if (!buffer)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
*(DWORD_PTR *)buffer = hdr->dwContext;
|
|
|
|
*size = sizeof(DWORD_PTR);
|
|
|
|
return ERROR_SUCCESS;
|
2012-03-08 12:21:12 +01:00
|
|
|
|
2012-05-23 18:24:02 +02:00
|
|
|
case INTERNET_OPTION_REQUEST_FLAGS:
|
|
|
|
WARN("INTERNET_OPTION_REQUEST_FLAGS\n");
|
|
|
|
*size = sizeof(DWORD);
|
|
|
|
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
|
|
|
|
2012-03-08 12:21:12 +01:00
|
|
|
case INTERNET_OPTION_MAX_CONNS_PER_SERVER:
|
|
|
|
case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER:
|
|
|
|
WARN("Called on global option %u\n", option);
|
|
|
|
return ERROR_INTERNET_INVALID_OPERATION;
|
2000-06-11 22:04:44 +02:00
|
|
|
}
|
|
|
|
|
2012-03-08 12:21:12 +01:00
|
|
|
/* FIXME: we shouldn't call it here */
|
|
|
|
return query_global_option(option, buffer, size, unicode);
|
2000-06-11 22:04:44 +02:00
|
|
|
}
|
|
|
|
|
2002-12-05 20:54:40 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetQueryOptionW (WININET.@)
|
|
|
|
*
|
|
|
|
* Queries an options on the specified handle
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption,
|
|
|
|
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
|
|
|
|
{
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *hdr;
|
2008-07-19 12:30:19 +02:00
|
|
|
DWORD res = ERROR_INVALID_HANDLE;
|
|
|
|
|
|
|
|
TRACE("%p %d %p %p\n", hInternet, dwOption, lpBuffer, lpdwBufferLength);
|
|
|
|
|
|
|
|
if(hInternet) {
|
2011-02-02 22:50:31 +01:00
|
|
|
hdr = get_handle_object(hInternet);
|
2008-07-19 12:30:19 +02:00
|
|
|
if (hdr) {
|
|
|
|
res = hdr->vtbl->QueryOption(hdr, dwOption, lpBuffer, lpdwBufferLength, TRUE);
|
|
|
|
WININET_Release(hdr);
|
|
|
|
}
|
|
|
|
}else {
|
2012-03-08 12:21:12 +01:00
|
|
|
res = query_global_option(dwOption, lpBuffer, lpdwBufferLength, TRUE);
|
2008-07-19 12:30:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
SetLastError(res);
|
|
|
|
return res == ERROR_SUCCESS;
|
2002-12-05 20:54:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetQueryOptionA (WININET.@)
|
|
|
|
*
|
|
|
|
* Queries an options on the specified handle
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
|
|
|
|
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
|
|
|
|
{
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *hdr;
|
2008-07-19 12:30:19 +02:00
|
|
|
DWORD res = ERROR_INVALID_HANDLE;
|
|
|
|
|
|
|
|
TRACE("%p %d %p %p\n", hInternet, dwOption, lpBuffer, lpdwBufferLength);
|
|
|
|
|
|
|
|
if(hInternet) {
|
2011-02-02 22:50:31 +01:00
|
|
|
hdr = get_handle_object(hInternet);
|
2008-07-19 12:30:19 +02:00
|
|
|
if (hdr) {
|
|
|
|
res = hdr->vtbl->QueryOption(hdr, dwOption, lpBuffer, lpdwBufferLength, FALSE);
|
|
|
|
WININET_Release(hdr);
|
|
|
|
}
|
|
|
|
}else {
|
2012-03-08 12:21:12 +01:00
|
|
|
res = query_global_option(dwOption, lpBuffer, lpdwBufferLength, FALSE);
|
2008-07-19 12:30:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
SetLastError(res);
|
|
|
|
return res == ERROR_SUCCESS;
|
2002-12-05 20:54:40 +01:00
|
|
|
}
|
|
|
|
|
2012-03-08 12:19:14 +01:00
|
|
|
DWORD INET_SetOption(object_header_t *hdr, DWORD option, void *buf, DWORD size)
|
|
|
|
{
|
|
|
|
switch(option) {
|
2018-05-03 17:14:21 +02:00
|
|
|
case INTERNET_OPTION_SETTINGS_CHANGED:
|
|
|
|
FIXME("INTERNETOPTION_SETTINGS_CHANGED semi-stub\n");
|
|
|
|
collect_connections(COLLECT_CONNECTIONS);
|
|
|
|
return ERROR_SUCCESS;
|
2012-03-08 12:19:14 +01:00
|
|
|
case INTERNET_OPTION_CALLBACK:
|
|
|
|
WARN("Not settable option %u\n", option);
|
|
|
|
return ERROR_INTERNET_OPTION_NOT_SETTABLE;
|
2012-03-08 12:20:53 +01:00
|
|
|
case INTERNET_OPTION_MAX_CONNS_PER_SERVER:
|
|
|
|
case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER:
|
|
|
|
WARN("Called on global option %u\n", option);
|
|
|
|
return ERROR_INTERNET_INVALID_OPERATION;
|
2018-05-03 17:14:36 +02:00
|
|
|
case INTERNET_OPTION_REFRESH:
|
|
|
|
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
2012-03-08 12:19:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_INTERNET_INVALID_OPTION;
|
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2012-03-08 12:19:37 +01:00
|
|
|
static DWORD set_global_option(DWORD option, void *buf, DWORD size)
|
|
|
|
{
|
|
|
|
switch(option) {
|
|
|
|
case INTERNET_OPTION_CALLBACK:
|
|
|
|
WARN("Not global option %u\n", option);
|
|
|
|
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
2012-03-08 12:20:53 +01:00
|
|
|
|
|
|
|
case INTERNET_OPTION_MAX_CONNS_PER_SERVER:
|
|
|
|
TRACE("INTERNET_OPTION_MAX_CONNS_PER_SERVER\n");
|
|
|
|
|
|
|
|
if(size != sizeof(max_conns))
|
|
|
|
return ERROR_INTERNET_BAD_OPTION_LENGTH;
|
|
|
|
if(!*(ULONG*)buf)
|
|
|
|
return ERROR_BAD_ARGUMENTS;
|
|
|
|
|
|
|
|
max_conns = *(ULONG*)buf;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER:
|
|
|
|
TRACE("INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER\n");
|
|
|
|
|
|
|
|
if(size != sizeof(max_1_0_conns))
|
|
|
|
return ERROR_INTERNET_BAD_OPTION_LENGTH;
|
|
|
|
if(!*(ULONG*)buf)
|
|
|
|
return ERROR_BAD_ARGUMENTS;
|
|
|
|
|
|
|
|
max_1_0_conns = *(ULONG*)buf;
|
|
|
|
return ERROR_SUCCESS;
|
2012-05-14 13:49:29 +02:00
|
|
|
|
|
|
|
case INTERNET_OPTION_CONNECT_TIMEOUT:
|
|
|
|
TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
|
|
|
|
|
|
|
|
if(size != sizeof(connect_timeout))
|
|
|
|
return ERROR_INTERNET_BAD_OPTION_LENGTH;
|
|
|
|
if(!*(ULONG*)buf)
|
|
|
|
return ERROR_BAD_ARGUMENTS;
|
|
|
|
|
|
|
|
connect_timeout = *(ULONG*)buf;
|
|
|
|
return ERROR_SUCCESS;
|
2012-05-25 16:35:48 +02:00
|
|
|
|
2015-07-29 11:38:39 +02:00
|
|
|
case INTERNET_OPTION_SUPPRESS_BEHAVIOR:
|
|
|
|
FIXME("INTERNET_OPTION_SUPPRESS_BEHAVIOR stub\n");
|
|
|
|
|
|
|
|
if(size != sizeof(ULONG))
|
|
|
|
return ERROR_INTERNET_BAD_OPTION_LENGTH;
|
|
|
|
|
|
|
|
FIXME("%08x\n", *(ULONG*)buf);
|
|
|
|
return ERROR_SUCCESS;
|
2012-03-08 12:19:37 +01:00
|
|
|
}
|
|
|
|
|
2018-05-03 17:14:21 +02:00
|
|
|
return INET_SetOption(NULL, option, buf, size);
|
2012-03-08 12:19:37 +01:00
|
|
|
}
|
|
|
|
|
2002-03-11 02:09:25 +01:00
|
|
|
/***********************************************************************
|
2002-03-23 22:39:05 +01:00
|
|
|
* InternetSetOptionW (WININET.@)
|
2002-03-11 02:09:25 +01:00
|
|
|
*
|
|
|
|
* Sets an options on the specified handle
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2002-03-23 22:39:05 +01:00
|
|
|
BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
|
2002-03-11 02:09:25 +01:00
|
|
|
LPVOID lpBuffer, DWORD dwBufferLength)
|
|
|
|
{
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *lpwhh;
|
2004-07-19 23:49:39 +02:00
|
|
|
BOOL ret = TRUE;
|
2012-03-08 12:19:37 +01:00
|
|
|
DWORD res;
|
2002-03-11 02:09:25 +01:00
|
|
|
|
2008-02-26 20:22:02 +01:00
|
|
|
TRACE("(%p %d %p %d)\n", hInternet, dwOption, lpBuffer, dwBufferLength);
|
2002-03-11 02:09:25 +01:00
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
lpwhh = (object_header_t*) get_handle_object( hInternet );
|
2012-03-08 12:19:37 +01:00
|
|
|
if(lpwhh)
|
2008-02-26 20:22:02 +01:00
|
|
|
res = lpwhh->vtbl->SetOption(lpwhh, dwOption, lpBuffer, dwBufferLength);
|
2012-03-08 12:19:37 +01:00
|
|
|
else
|
|
|
|
res = set_global_option(dwOption, lpBuffer, dwBufferLength);
|
2008-02-26 20:22:02 +01:00
|
|
|
|
2012-03-08 12:19:37 +01:00
|
|
|
if(res != ERROR_INTERNET_INVALID_OPTION) {
|
|
|
|
if(lpwhh)
|
|
|
|
WININET_Release(lpwhh);
|
2008-02-26 20:22:02 +01:00
|
|
|
|
2012-03-08 12:19:37 +01:00
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
SetLastError(res);
|
|
|
|
|
|
|
|
return res == ERROR_SUCCESS;
|
2008-02-26 20:22:02 +01:00
|
|
|
}
|
2002-03-11 02:09:25 +01:00
|
|
|
|
|
|
|
switch (dwOption)
|
|
|
|
{
|
2002-12-05 20:54:40 +01:00
|
|
|
case INTERNET_OPTION_HTTP_VERSION:
|
|
|
|
{
|
|
|
|
HTTP_VERSION_INFO* pVersion=(HTTP_VERSION_INFO*)lpBuffer;
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("Option INTERNET_OPTION_HTTP_VERSION(%d,%d): STUB\n",pVersion->dwMajorVersion,pVersion->dwMinorVersion);
|
2002-12-05 20:54:40 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_ERROR_MASK:
|
|
|
|
{
|
2010-05-19 12:29:09 +02:00
|
|
|
if(!lpwhh) {
|
|
|
|
SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
|
|
|
return FALSE;
|
|
|
|
} else if(*(ULONG*)lpBuffer & (~(INTERNET_ERROR_MASK_INSERT_CDROM|
|
|
|
|
INTERNET_ERROR_MASK_COMBINED_SEC_CERT|
|
|
|
|
INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY))) {
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
ret = FALSE;
|
|
|
|
} else if(dwBufferLength != sizeof(ULONG)) {
|
|
|
|
SetLastError(ERROR_INTERNET_BAD_OPTION_LENGTH);
|
|
|
|
ret = FALSE;
|
|
|
|
} else
|
2012-06-06 17:38:16 +02:00
|
|
|
TRACE("INTERNET_OPTION_ERROR_MASK: %x\n", *(ULONG*)lpBuffer);
|
2010-05-19 12:29:09 +02:00
|
|
|
lpwhh->ErrorMask = *(ULONG*)lpBuffer;
|
2002-12-05 20:54:40 +01:00
|
|
|
}
|
|
|
|
break;
|
2011-07-21 22:17:21 +02:00
|
|
|
case INTERNET_OPTION_PROXY:
|
|
|
|
{
|
|
|
|
INTERNET_PROXY_INFOW *info = lpBuffer;
|
|
|
|
|
|
|
|
if (!lpBuffer || dwBufferLength < sizeof(INTERNET_PROXY_INFOW))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (!hInternet)
|
|
|
|
{
|
|
|
|
EnterCriticalSection( &WININET_cs );
|
|
|
|
free_global_proxy();
|
|
|
|
global_proxy = heap_alloc( sizeof(proxyinfo_t) );
|
|
|
|
if (global_proxy)
|
|
|
|
{
|
|
|
|
if (info->dwAccessType == INTERNET_OPEN_TYPE_PROXY)
|
|
|
|
{
|
|
|
|
global_proxy->proxyEnabled = 1;
|
|
|
|
global_proxy->proxy = heap_strdupW( info->lpszProxy );
|
|
|
|
global_proxy->proxyBypass = heap_strdupW( info->lpszProxyBypass );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
global_proxy->proxyEnabled = 0;
|
|
|
|
global_proxy->proxy = global_proxy->proxyBypass = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LeaveCriticalSection( &WININET_cs );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* In general, each type of object should handle
|
|
|
|
* INTERNET_OPTION_PROXY directly. This FIXME ensures it doesn't
|
|
|
|
* get silently dropped.
|
|
|
|
*/
|
|
|
|
FIXME("INTERNET_OPTION_PROXY unimplemented\n");
|
|
|
|
SetLastError(ERROR_INTERNET_INVALID_OPTION);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2002-12-05 20:54:40 +01:00
|
|
|
case INTERNET_OPTION_CODEPAGE:
|
|
|
|
{
|
2008-06-23 20:58:53 +02:00
|
|
|
ULONG codepage = *(ULONG *)lpBuffer;
|
|
|
|
FIXME("Option INTERNET_OPTION_CODEPAGE (%d): STUB\n", codepage);
|
2002-12-05 20:54:40 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_REQUEST_PRIORITY:
|
|
|
|
{
|
2008-06-23 20:58:53 +02:00
|
|
|
ULONG priority = *(ULONG *)lpBuffer;
|
|
|
|
FIXME("Option INTERNET_OPTION_REQUEST_PRIORITY (%d): STUB\n", priority);
|
2002-12-05 20:54:40 +01:00
|
|
|
}
|
|
|
|
break;
|
2003-12-30 20:16:37 +01:00
|
|
|
case INTERNET_OPTION_CONNECT_TIMEOUT:
|
|
|
|
{
|
2008-06-23 20:58:53 +02:00
|
|
|
ULONG connecttimeout = *(ULONG *)lpBuffer;
|
|
|
|
FIXME("Option INTERNET_OPTION_CONNECT_TIMEOUT (%d): STUB\n", connecttimeout);
|
2003-12-30 20:16:37 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_DATA_RECEIVE_TIMEOUT:
|
|
|
|
{
|
2008-06-23 20:58:53 +02:00
|
|
|
ULONG receivetimeout = *(ULONG *)lpBuffer;
|
|
|
|
FIXME("Option INTERNET_OPTION_DATA_RECEIVE_TIMEOUT (%d): STUB\n", receivetimeout);
|
2003-12-30 20:16:37 +01:00
|
|
|
}
|
|
|
|
break;
|
2003-12-12 07:01:20 +01:00
|
|
|
case INTERNET_OPTION_RESET_URLCACHE_SESSION:
|
|
|
|
FIXME("Option INTERNET_OPTION_RESET_URLCACHE_SESSION: STUB\n");
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_END_BROWSER_SESSION:
|
2016-07-06 13:44:15 +02:00
|
|
|
FIXME("Option INTERNET_OPTION_END_BROWSER_SESSION: semi-stub\n");
|
|
|
|
free_cookie();
|
2003-12-12 07:01:20 +01:00
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_CONNECTED_STATE:
|
|
|
|
FIXME("Option INTERNET_OPTION_CONNECTED_STATE: STUB\n");
|
|
|
|
break;
|
2005-06-21 22:02:21 +02:00
|
|
|
case INTERNET_OPTION_DISABLE_PASSPORT_AUTH:
|
|
|
|
TRACE("Option INTERNET_OPTION_DISABLE_PASSPORT_AUTH: harmless stub, since not enabled\n");
|
|
|
|
break;
|
2005-06-30 12:13:50 +02:00
|
|
|
case INTERNET_OPTION_SEND_TIMEOUT:
|
2006-03-14 15:36:11 +01:00
|
|
|
case INTERNET_OPTION_RECEIVE_TIMEOUT:
|
2011-04-12 17:44:42 +02:00
|
|
|
case INTERNET_OPTION_DATA_SEND_TIMEOUT:
|
2008-06-23 20:58:01 +02:00
|
|
|
{
|
|
|
|
ULONG timeout = *(ULONG *)lpBuffer;
|
2011-04-12 17:44:42 +02:00
|
|
|
FIXME("INTERNET_OPTION_SEND/RECEIVE_TIMEOUT/DATA_SEND_TIMEOUT %d\n", timeout);
|
2005-06-30 12:13:50 +02:00
|
|
|
break;
|
2008-06-23 20:58:01 +02:00
|
|
|
}
|
2005-06-30 12:13:50 +02:00
|
|
|
case INTERNET_OPTION_CONNECT_RETRIES:
|
2008-06-23 20:58:01 +02:00
|
|
|
{
|
|
|
|
ULONG retries = *(ULONG *)lpBuffer;
|
|
|
|
FIXME("INTERNET_OPTION_CONNECT_RETRIES %d\n", retries);
|
2005-06-30 12:13:50 +02:00
|
|
|
break;
|
2008-06-23 20:58:01 +02:00
|
|
|
}
|
2006-03-06 14:04:47 +01:00
|
|
|
case INTERNET_OPTION_CONTEXT_VALUE:
|
2010-05-25 12:19:17 +02:00
|
|
|
{
|
2010-05-26 09:53:55 +02:00
|
|
|
if (!lpwhh)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2010-05-25 12:19:17 +02:00
|
|
|
if (!lpBuffer || dwBufferLength != sizeof(DWORD_PTR))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
lpwhh->dwContext = *(DWORD_PTR *)lpBuffer;
|
|
|
|
break;
|
|
|
|
}
|
2006-08-07 18:35:09 +02:00
|
|
|
case INTERNET_OPTION_SECURITY_FLAGS:
|
|
|
|
FIXME("Option INTERNET_OPTION_SECURITY_FLAGS; STUB\n");
|
|
|
|
break;
|
2008-05-31 21:47:01 +02:00
|
|
|
case INTERNET_OPTION_DISABLE_AUTODIAL:
|
|
|
|
FIXME("Option INTERNET_OPTION_DISABLE_AUTODIAL; STUB\n");
|
|
|
|
break;
|
2009-02-11 17:50:36 +01:00
|
|
|
case INTERNET_OPTION_HTTP_DECODING:
|
|
|
|
FIXME("INTERNET_OPTION_HTTP_DECODING; STUB\n");
|
2009-12-21 13:59:18 +01:00
|
|
|
SetLastError(ERROR_INTERNET_INVALID_OPTION);
|
2009-02-11 17:50:36 +01:00
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_COOKIES_3RD_PARTY:
|
|
|
|
FIXME("INTERNET_OPTION_COOKIES_3RD_PARTY; STUB\n");
|
2009-12-21 13:59:18 +01:00
|
|
|
SetLastError(ERROR_INTERNET_INVALID_OPTION);
|
2009-02-11 17:50:36 +01:00
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_SEND_UTF8_SERVERNAME_TO_PROXY:
|
|
|
|
FIXME("INTERNET_OPTION_SEND_UTF8_SERVERNAME_TO_PROXY; STUB\n");
|
2009-12-21 13:59:18 +01:00
|
|
|
SetLastError(ERROR_INTERNET_INVALID_OPTION);
|
2009-02-11 17:50:36 +01:00
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_CODEPAGE_PATH:
|
|
|
|
FIXME("INTERNET_OPTION_CODEPAGE_PATH; STUB\n");
|
2009-12-21 13:59:18 +01:00
|
|
|
SetLastError(ERROR_INTERNET_INVALID_OPTION);
|
2009-02-11 17:50:36 +01:00
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_CODEPAGE_EXTRA:
|
|
|
|
FIXME("INTERNET_OPTION_CODEPAGE_EXTRA; STUB\n");
|
2009-12-21 13:59:18 +01:00
|
|
|
SetLastError(ERROR_INTERNET_INVALID_OPTION);
|
2009-02-11 17:50:36 +01:00
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_IDN:
|
|
|
|
FIXME("INTERNET_OPTION_IDN; STUB\n");
|
2009-12-21 13:59:18 +01:00
|
|
|
SetLastError(ERROR_INTERNET_INVALID_OPTION);
|
2009-02-11 17:50:36 +01:00
|
|
|
ret = FALSE;
|
2008-02-29 12:57:57 +01:00
|
|
|
break;
|
2010-01-20 21:46:44 +01:00
|
|
|
case INTERNET_OPTION_POLICY:
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
ret = FALSE;
|
|
|
|
break;
|
2010-01-20 21:49:05 +01:00
|
|
|
case INTERNET_OPTION_PER_CONNECTION_OPTION: {
|
|
|
|
INTERNET_PER_CONN_OPTION_LISTW *con = lpBuffer;
|
|
|
|
LONG res;
|
2013-03-12 23:28:49 +01:00
|
|
|
unsigned int i;
|
2010-01-20 21:49:05 +01:00
|
|
|
proxyinfo_t pi;
|
|
|
|
|
2014-05-06 11:31:53 +02:00
|
|
|
if (INTERNET_LoadProxySettings(&pi)) return FALSE;
|
2010-01-20 21:49:05 +01:00
|
|
|
|
|
|
|
for (i = 0; i < con->dwOptionCount; i++) {
|
|
|
|
INTERNET_PER_CONN_OPTIONW *option = con->pOptions + i;
|
|
|
|
|
|
|
|
switch (option->dwOption) {
|
|
|
|
case INTERNET_PER_CONN_PROXY_SERVER:
|
2011-07-21 21:54:27 +02:00
|
|
|
heap_free(pi.proxy);
|
|
|
|
pi.proxy = heap_strdupW(option->Value.pszValue);
|
2010-01-20 21:49:05 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case INTERNET_PER_CONN_FLAGS:
|
2010-01-25 17:17:31 +01:00
|
|
|
if(option->Value.dwValue & PROXY_TYPE_PROXY)
|
2011-07-21 21:54:27 +02:00
|
|
|
pi.proxyEnabled = 1;
|
2010-01-25 17:17:31 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if(option->Value.dwValue != PROXY_TYPE_DIRECT)
|
|
|
|
FIXME("Unhandled flags: 0x%x\n", option->Value.dwValue);
|
2011-07-21 21:54:27 +02:00
|
|
|
pi.proxyEnabled = 0;
|
2010-01-20 21:49:13 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2013-10-27 23:01:22 +01:00
|
|
|
case INTERNET_PER_CONN_PROXY_BYPASS:
|
|
|
|
heap_free(pi.proxyBypass);
|
|
|
|
pi.proxyBypass = heap_strdupW(option->Value.pszValue);
|
|
|
|
break;
|
|
|
|
|
2010-01-20 21:49:05 +01:00
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_URL:
|
|
|
|
case INTERNET_PER_CONN_AUTODISCOVERY_FLAGS:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL:
|
|
|
|
FIXME("Unhandled dwOption %d\n", option->dwOption);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
FIXME("Unknown dwOption %d\n", option->dwOption);
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((res = INTERNET_SaveProxySettings(&pi)))
|
|
|
|
SetLastError(res);
|
|
|
|
|
|
|
|
FreeProxyInfo(&pi);
|
|
|
|
|
|
|
|
ret = (res == ERROR_SUCCESS);
|
|
|
|
break;
|
|
|
|
}
|
2002-03-11 02:09:25 +01:00
|
|
|
default:
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("Option %d STUB\n",dwOption);
|
2009-12-21 13:59:18 +01:00
|
|
|
SetLastError(ERROR_INTERNET_INVALID_OPTION);
|
2004-07-19 23:49:39 +02:00
|
|
|
ret = FALSE;
|
|
|
|
break;
|
2002-03-11 02:09:25 +01:00
|
|
|
}
|
2008-02-26 20:22:02 +01:00
|
|
|
|
|
|
|
if(lpwhh)
|
|
|
|
WININET_Release( lpwhh );
|
2002-03-11 02:09:25 +01:00
|
|
|
|
2005-06-21 22:02:21 +02:00
|
|
|
return ret;
|
2002-03-11 02:09:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2002-03-23 22:39:05 +01:00
|
|
|
* InternetSetOptionA (WININET.@)
|
2002-03-11 02:09:25 +01:00
|
|
|
*
|
|
|
|
* Sets an options on the specified handle.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2002-03-23 22:39:05 +01:00
|
|
|
BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption,
|
2002-03-11 02:09:25 +01:00
|
|
|
LPVOID lpBuffer, DWORD dwBufferLength)
|
|
|
|
{
|
2003-05-11 04:59:52 +02:00
|
|
|
LPVOID wbuffer;
|
|
|
|
DWORD wlen;
|
|
|
|
BOOL r;
|
|
|
|
|
|
|
|
switch( dwOption )
|
|
|
|
{
|
|
|
|
case INTERNET_OPTION_PROXY:
|
|
|
|
{
|
|
|
|
LPINTERNET_PROXY_INFOA pi = (LPINTERNET_PROXY_INFOA) lpBuffer;
|
|
|
|
LPINTERNET_PROXY_INFOW piw;
|
|
|
|
DWORD proxlen, prbylen;
|
|
|
|
LPWSTR prox, prby;
|
|
|
|
|
|
|
|
proxlen = MultiByteToWideChar( CP_ACP, 0, pi->lpszProxy, -1, NULL, 0);
|
|
|
|
prbylen= MultiByteToWideChar( CP_ACP, 0, pi->lpszProxyBypass, -1, NULL, 0);
|
2003-06-18 21:45:22 +02:00
|
|
|
wlen = sizeof(*piw) + proxlen + prbylen;
|
2011-04-21 13:39:03 +02:00
|
|
|
wbuffer = heap_alloc(wlen*sizeof(WCHAR) );
|
2003-05-11 04:59:52 +02:00
|
|
|
piw = (LPINTERNET_PROXY_INFOW) wbuffer;
|
|
|
|
piw->dwAccessType = pi->dwAccessType;
|
|
|
|
prox = (LPWSTR) &piw[1];
|
|
|
|
prby = &prox[proxlen+1];
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, pi->lpszProxy, -1, prox, proxlen);
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, pi->lpszProxyBypass, -1, prby, prbylen);
|
|
|
|
piw->lpszProxy = prox;
|
|
|
|
piw->lpszProxyBypass = prby;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_USER_AGENT:
|
|
|
|
case INTERNET_OPTION_USERNAME:
|
|
|
|
case INTERNET_OPTION_PASSWORD:
|
2013-04-22 11:02:50 +02:00
|
|
|
case INTERNET_OPTION_PROXY_USERNAME:
|
|
|
|
case INTERNET_OPTION_PROXY_PASSWORD:
|
|
|
|
wlen = MultiByteToWideChar( CP_ACP, 0, lpBuffer, -1, NULL, 0 );
|
|
|
|
if (!(wbuffer = heap_alloc( wlen * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY;
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, lpBuffer, -1, wbuffer, wlen );
|
2003-05-11 04:59:52 +02:00
|
|
|
break;
|
2010-01-20 21:48:47 +01:00
|
|
|
case INTERNET_OPTION_PER_CONNECTION_OPTION: {
|
2013-03-12 23:28:49 +01:00
|
|
|
unsigned int i;
|
2010-01-20 21:48:47 +01:00
|
|
|
INTERNET_PER_CONN_OPTION_LISTW *listW;
|
|
|
|
INTERNET_PER_CONN_OPTION_LISTA *listA = lpBuffer;
|
|
|
|
wlen = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
|
2011-04-21 13:39:03 +02:00
|
|
|
wbuffer = heap_alloc(wlen);
|
2010-01-20 21:48:47 +01:00
|
|
|
listW = wbuffer;
|
|
|
|
|
|
|
|
listW->dwSize = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
|
|
|
|
if (listA->pszConnection)
|
|
|
|
{
|
|
|
|
wlen = MultiByteToWideChar( CP_ACP, 0, listA->pszConnection, -1, NULL, 0 );
|
2011-04-21 13:39:03 +02:00
|
|
|
listW->pszConnection = heap_alloc(wlen*sizeof(WCHAR));
|
2010-01-20 21:48:47 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, listA->pszConnection, -1, listW->pszConnection, wlen );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
listW->pszConnection = NULL;
|
|
|
|
listW->dwOptionCount = listA->dwOptionCount;
|
|
|
|
listW->dwOptionError = listA->dwOptionError;
|
2011-04-21 13:39:03 +02:00
|
|
|
listW->pOptions = heap_alloc(sizeof(INTERNET_PER_CONN_OPTIONW) * listA->dwOptionCount);
|
2010-01-20 21:48:47 +01:00
|
|
|
|
|
|
|
for (i = 0; i < listA->dwOptionCount; ++i) {
|
|
|
|
INTERNET_PER_CONN_OPTIONA *optA = listA->pOptions + i;
|
|
|
|
INTERNET_PER_CONN_OPTIONW *optW = listW->pOptions + i;
|
|
|
|
|
|
|
|
optW->dwOption = optA->dwOption;
|
|
|
|
|
|
|
|
switch (optA->dwOption) {
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_URL:
|
|
|
|
case INTERNET_PER_CONN_PROXY_BYPASS:
|
|
|
|
case INTERNET_PER_CONN_PROXY_SERVER:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL:
|
|
|
|
if (optA->Value.pszValue)
|
|
|
|
{
|
|
|
|
wlen = MultiByteToWideChar( CP_ACP, 0, optA->Value.pszValue, -1, NULL, 0 );
|
2011-04-21 13:39:03 +02:00
|
|
|
optW->Value.pszValue = heap_alloc(wlen*sizeof(WCHAR));
|
2010-01-20 21:48:47 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, optA->Value.pszValue, -1, optW->Value.pszValue, wlen );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
optW->Value.pszValue = NULL;
|
|
|
|
break;
|
|
|
|
case INTERNET_PER_CONN_AUTODISCOVERY_FLAGS:
|
|
|
|
case INTERNET_PER_CONN_FLAGS:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS:
|
|
|
|
optW->Value.dwValue = optA->Value.dwValue;
|
|
|
|
break;
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME:
|
|
|
|
optW->Value.ftValue = optA->Value.ftValue;
|
2011-03-18 22:14:58 +01:00
|
|
|
break;
|
2010-01-20 21:48:47 +01:00
|
|
|
default:
|
|
|
|
WARN("Unknown PER_CONN dwOption: %d, guessing at conversion to Wide\n", optA->dwOption);
|
|
|
|
optW->Value.dwValue = optA->Value.dwValue;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-05-11 04:59:52 +02:00
|
|
|
default:
|
|
|
|
wbuffer = lpBuffer;
|
|
|
|
wlen = dwBufferLength;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = InternetSetOptionW(hInternet,dwOption, wbuffer, wlen);
|
|
|
|
|
|
|
|
if( lpBuffer != wbuffer )
|
2010-01-20 21:48:47 +01:00
|
|
|
{
|
|
|
|
if (dwOption == INTERNET_OPTION_PER_CONNECTION_OPTION)
|
|
|
|
{
|
|
|
|
INTERNET_PER_CONN_OPTION_LISTW *list = wbuffer;
|
2013-03-12 23:28:49 +01:00
|
|
|
unsigned int i;
|
2010-01-20 21:48:47 +01:00
|
|
|
for (i = 0; i < list->dwOptionCount; ++i) {
|
|
|
|
INTERNET_PER_CONN_OPTIONW *opt = list->pOptions + i;
|
|
|
|
switch (opt->dwOption) {
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_URL:
|
|
|
|
case INTERNET_PER_CONN_PROXY_BYPASS:
|
|
|
|
case INTERNET_PER_CONN_PROXY_SERVER:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL:
|
|
|
|
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL:
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free( opt->Value.pszValue );
|
2010-01-20 21:48:47 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free( list->pOptions );
|
2010-01-20 21:48:47 +01:00
|
|
|
}
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free( wbuffer );
|
2010-01-20 21:48:47 +01:00
|
|
|
}
|
2003-05-11 04:59:52 +02:00
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetOptionExA (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetSetOptionExA(HINTERNET hInternet, DWORD dwOption,
|
|
|
|
LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags)
|
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("Flags %08x ignored\n", dwFlags);
|
2003-05-11 04:59:52 +02:00
|
|
|
return InternetSetOptionA( hInternet, dwOption, lpBuffer, dwBufferLength );
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetOptionExW (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetSetOptionExW(HINTERNET hInternet, DWORD dwOption,
|
|
|
|
LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags)
|
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("Flags %08x ignored\n", dwFlags);
|
2003-05-11 04:59:52 +02:00
|
|
|
if( dwFlags & ~ISO_VALID_FLAGS )
|
|
|
|
{
|
2009-12-21 13:59:18 +01:00
|
|
|
SetLastError( ERROR_INVALID_PARAMETER );
|
2003-05-11 04:59:52 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return InternetSetOptionW( hInternet, dwOption, lpBuffer, dwBufferLength );
|
2002-03-11 02:09:25 +01:00
|
|
|
}
|
|
|
|
|
2005-01-18 12:43:40 +01:00
|
|
|
static const WCHAR WININET_wkday[7][4] =
|
|
|
|
{ { 'S','u','n', 0 }, { 'M','o','n', 0 }, { 'T','u','e', 0 }, { 'W','e','d', 0 },
|
|
|
|
{ 'T','h','u', 0 }, { 'F','r','i', 0 }, { 'S','a','t', 0 } };
|
|
|
|
static const WCHAR WININET_month[12][4] =
|
|
|
|
{ { 'J','a','n', 0 }, { 'F','e','b', 0 }, { 'M','a','r', 0 }, { 'A','p','r', 0 },
|
|
|
|
{ 'M','a','y', 0 }, { 'J','u','n', 0 }, { 'J','u','l', 0 }, { 'A','u','g', 0 },
|
|
|
|
{ 'S','e','p', 0 }, { 'O','c','t', 0 }, { 'N','o','v', 0 }, { 'D','e','c', 0 } };
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetTimeFromSystemTimeA (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetTimeFromSystemTimeA( const SYSTEMTIME* time, DWORD format, LPSTR string, DWORD size )
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
WCHAR stringW[INTERNET_RFC1123_BUFSIZE];
|
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE( "%p 0x%08x %p 0x%08x\n", time, format, string, size );
|
2005-01-18 12:43:40 +01:00
|
|
|
|
2008-10-03 13:58:32 +02:00
|
|
|
if (!time || !string || format != INTERNET_RFC1123_FORMAT)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-10-02 12:38:38 +02:00
|
|
|
if (size < INTERNET_RFC1123_BUFSIZE * sizeof(*string))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-01-18 12:43:40 +01:00
|
|
|
ret = InternetTimeFromSystemTimeW( time, format, stringW, sizeof(stringW) );
|
|
|
|
if (ret) WideCharToMultiByte( CP_ACP, 0, stringW, -1, string, size, NULL, NULL );
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetTimeFromSystemTimeW (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetTimeFromSystemTimeW( const SYSTEMTIME* time, DWORD format, LPWSTR string, DWORD size )
|
|
|
|
{
|
|
|
|
static const WCHAR date[] =
|
|
|
|
{ '%','s',',',' ','%','0','2','d',' ','%','s',' ','%','4','d',' ','%','0',
|
|
|
|
'2','d',':','%','0','2','d',':','%','0','2','d',' ','G','M','T', 0 };
|
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE( "%p 0x%08x %p 0x%08x\n", time, format, string, size );
|
2005-01-18 12:43:40 +01:00
|
|
|
|
2008-10-02 12:38:38 +02:00
|
|
|
if (!time || !string || format != INTERNET_RFC1123_FORMAT)
|
2008-10-03 13:58:32 +02:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2008-10-02 12:38:38 +02:00
|
|
|
return FALSE;
|
2008-10-03 13:58:32 +02:00
|
|
|
}
|
2005-01-18 12:43:40 +01:00
|
|
|
|
2008-10-02 12:38:38 +02:00
|
|
|
if (size < INTERNET_RFC1123_BUFSIZE * sizeof(*string))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
2005-01-18 12:43:40 +01:00
|
|
|
return FALSE;
|
2008-10-02 12:38:38 +02:00
|
|
|
}
|
2005-01-18 12:43:40 +01:00
|
|
|
|
|
|
|
sprintfW( string, date,
|
|
|
|
WININET_wkday[time->wDayOfWeek],
|
|
|
|
time->wDay,
|
|
|
|
WININET_month[time->wMonth - 1],
|
|
|
|
time->wYear,
|
|
|
|
time->wHour,
|
|
|
|
time->wMinute,
|
|
|
|
time->wSecond );
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetTimeToSystemTimeA (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetTimeToSystemTimeA( LPCSTR string, SYSTEMTIME* time, DWORD reserved )
|
|
|
|
{
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
WCHAR *stringW;
|
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE( "%s %p 0x%08x\n", debugstr_a(string), time, reserved );
|
2005-01-18 12:43:40 +01:00
|
|
|
|
2009-07-17 02:05:36 +02:00
|
|
|
stringW = heap_strdupAtoW(string);
|
2005-01-18 12:43:40 +01:00
|
|
|
if (stringW)
|
|
|
|
{
|
|
|
|
ret = InternetTimeToSystemTimeW( stringW, time, reserved );
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free( stringW );
|
2005-01-18 12:43:40 +01:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetTimeToSystemTimeW (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD reserved )
|
|
|
|
{
|
|
|
|
unsigned int i;
|
2006-11-21 23:20:41 +01:00
|
|
|
const WCHAR *s = string;
|
|
|
|
WCHAR *end;
|
2005-01-18 12:43:40 +01:00
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE( "%s %p 0x%08x\n", debugstr_w(string), time, reserved );
|
2005-01-18 12:43:40 +01:00
|
|
|
|
2005-03-17 19:55:41 +01:00
|
|
|
if (!string || !time) return FALSE;
|
|
|
|
|
|
|
|
/* Windows does this too */
|
|
|
|
GetSystemTime( time );
|
2005-01-18 12:43:40 +01:00
|
|
|
|
|
|
|
/* Convert an RFC1123 time such as 'Fri, 07 Jan 2005 12:06:35 GMT' into
|
|
|
|
* a SYSTEMTIME structure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
while (*s && !isalphaW( *s )) s++;
|
2005-03-17 19:55:41 +01:00
|
|
|
if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
|
2005-01-18 12:43:40 +01:00
|
|
|
time->wDayOfWeek = 7;
|
|
|
|
|
|
|
|
for (i = 0; i < 7; i++)
|
|
|
|
{
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
if (toupperW( WININET_wkday[i][0] ) == toupperW( s[0] ) &&
|
|
|
|
toupperW( WININET_wkday[i][1] ) == toupperW( s[1] ) &&
|
|
|
|
toupperW( WININET_wkday[i][2] ) == toupperW( s[2] ) )
|
2005-01-18 12:43:40 +01:00
|
|
|
{
|
|
|
|
time->wDayOfWeek = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-17 19:55:41 +01:00
|
|
|
if (time->wDayOfWeek > 6) return TRUE;
|
2005-01-18 12:43:40 +01:00
|
|
|
while (*s && !isdigitW( *s )) s++;
|
2006-11-21 23:20:41 +01:00
|
|
|
time->wDay = strtolW( s, &end, 10 );
|
|
|
|
s = end;
|
2005-01-18 12:43:40 +01:00
|
|
|
|
|
|
|
while (*s && !isalphaW( *s )) s++;
|
2005-03-17 19:55:41 +01:00
|
|
|
if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
|
2005-01-18 12:43:40 +01:00
|
|
|
time->wMonth = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < 12; i++)
|
|
|
|
{
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
if (toupperW( WININET_month[i][0]) == toupperW( s[0] ) &&
|
|
|
|
toupperW( WININET_month[i][1]) == toupperW( s[1] ) &&
|
|
|
|
toupperW( WININET_month[i][2]) == toupperW( s[2] ) )
|
2005-01-18 12:43:40 +01:00
|
|
|
{
|
|
|
|
time->wMonth = i + 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-03-17 19:55:41 +01:00
|
|
|
if (time->wMonth == 0) return TRUE;
|
2005-01-18 12:43:40 +01:00
|
|
|
|
|
|
|
while (*s && !isdigitW( *s )) s++;
|
2005-03-17 19:55:41 +01:00
|
|
|
if (*s == '\0') return TRUE;
|
2006-11-21 23:20:41 +01:00
|
|
|
time->wYear = strtolW( s, &end, 10 );
|
|
|
|
s = end;
|
2005-01-18 12:43:40 +01:00
|
|
|
|
|
|
|
while (*s && !isdigitW( *s )) s++;
|
2005-03-17 19:55:41 +01:00
|
|
|
if (*s == '\0') return TRUE;
|
2006-11-21 23:20:41 +01:00
|
|
|
time->wHour = strtolW( s, &end, 10 );
|
|
|
|
s = end;
|
2005-01-18 12:43:40 +01:00
|
|
|
|
|
|
|
while (*s && !isdigitW( *s )) s++;
|
2005-03-17 19:55:41 +01:00
|
|
|
if (*s == '\0') return TRUE;
|
2006-11-21 23:20:41 +01:00
|
|
|
time->wMinute = strtolW( s, &end, 10 );
|
|
|
|
s = end;
|
2005-01-18 12:43:40 +01:00
|
|
|
|
|
|
|
while (*s && !isdigitW( *s )) s++;
|
2005-03-17 19:55:41 +01:00
|
|
|
if (*s == '\0') return TRUE;
|
2006-11-21 23:20:41 +01:00
|
|
|
time->wSecond = strtolW( s, &end, 10 );
|
|
|
|
s = end;
|
2005-01-18 12:43:40 +01:00
|
|
|
|
|
|
|
time->wMilliseconds = 0;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2002-03-11 02:09:25 +01:00
|
|
|
|
2000-08-01 22:53:42 +02:00
|
|
|
/***********************************************************************
|
2005-11-08 17:09:20 +01:00
|
|
|
* InternetCheckConnectionW (WININET.@)
|
2000-08-01 22:53:42 +02:00
|
|
|
*
|
|
|
|
* Pings a requested host to check internet connection
|
|
|
|
*
|
|
|
|
* RETURNS
|
2002-10-28 19:48:24 +01:00
|
|
|
* TRUE on success and FALSE on failure. If a failure then
|
2005-11-08 17:09:20 +01:00
|
|
|
* ERROR_NOT_CONNECTED is placed into GetLastError
|
2000-08-01 22:53:42 +02:00
|
|
|
*
|
|
|
|
*/
|
2005-11-08 17:09:20 +01:00
|
|
|
BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwReserved )
|
2000-08-01 22:53:42 +02:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* this is a kludge which runs the resident ping program and reads the output.
|
|
|
|
*
|
|
|
|
* Anyone have a better idea?
|
|
|
|
*/
|
|
|
|
|
|
|
|
BOOL rc = FALSE;
|
2007-02-28 21:04:58 +01:00
|
|
|
static const CHAR ping[] = "ping -c 1 ";
|
2005-11-08 17:09:20 +01:00
|
|
|
static const CHAR redirect[] = " >/dev/null 2>/dev/null";
|
2016-04-27 19:20:39 +02:00
|
|
|
WCHAR *host;
|
|
|
|
DWORD len, host_len;
|
2007-09-17 17:40:04 +02:00
|
|
|
INTERNET_PORT port;
|
2000-08-01 22:53:42 +02:00
|
|
|
int status = -1;
|
|
|
|
|
2016-04-27 19:20:39 +02:00
|
|
|
FIXME("(%s %x %x)\n", debugstr_w(lpszUrl), dwFlags, dwReserved);
|
2002-06-22 01:59:49 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/*
|
2000-08-01 22:53:42 +02:00
|
|
|
* Crack or set the Address
|
|
|
|
*/
|
|
|
|
if (lpszUrl == NULL)
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
/*
|
2008-01-04 20:37:14 +01:00
|
|
|
* According to the doc we are supposed to use the ip for the next
|
2002-06-01 01:06:46 +02:00
|
|
|
* server in the WnInet internal server database. I have
|
2000-08-01 22:53:42 +02:00
|
|
|
* no idea what that is or how to get it.
|
|
|
|
*
|
|
|
|
* So someone needs to implement this.
|
|
|
|
*/
|
2001-05-09 19:31:31 +02:00
|
|
|
FIXME("Unimplemented with URL of NULL\n");
|
2000-08-01 22:53:42 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-27 19:20:39 +02:00
|
|
|
URL_COMPONENTSW components = {sizeof(components)};
|
2000-08-01 22:53:42 +02:00
|
|
|
|
2016-04-27 19:20:39 +02:00
|
|
|
components.dwHostNameLength = 1;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-11-08 17:09:20 +01:00
|
|
|
if (!InternetCrackUrlW(lpszUrl,0,0,&components))
|
2000-08-01 22:53:42 +02:00
|
|
|
goto End;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2016-04-27 19:20:39 +02:00
|
|
|
host = components.lpszHostName;
|
|
|
|
host_len = components.dwHostNameLength;
|
2007-09-17 17:40:04 +02:00
|
|
|
port = components.nPort;
|
2016-04-27 19:20:39 +02:00
|
|
|
TRACE("host name: %s port: %d\n",debugstr_wn(host, host_len), port);
|
2000-08-01 22:53:42 +02:00
|
|
|
}
|
|
|
|
|
2007-09-17 17:40:04 +02:00
|
|
|
if (dwFlags & FLAG_ICC_FORCE_CONNECTION)
|
|
|
|
{
|
2009-07-09 19:58:15 +02:00
|
|
|
struct sockaddr_storage saddr;
|
2016-05-17 19:15:49 +02:00
|
|
|
int sa_len = sizeof(saddr);
|
2016-04-27 19:20:39 +02:00
|
|
|
WCHAR *host_z;
|
2007-09-17 17:40:04 +02:00
|
|
|
int fd;
|
2016-04-27 19:20:39 +02:00
|
|
|
BOOL b;
|
2007-09-17 17:40:04 +02:00
|
|
|
|
2016-04-27 19:20:39 +02:00
|
|
|
host_z = heap_strndupW(host, host_len);
|
|
|
|
if (!host_z)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
b = GetAddress(host_z, port, (struct sockaddr *)&saddr, &sa_len, NULL);
|
|
|
|
heap_free(host_z);
|
|
|
|
if(!b)
|
2007-09-17 17:40:04 +02:00
|
|
|
goto End;
|
2015-02-12 12:05:23 +01:00
|
|
|
init_winsock();
|
2009-07-09 19:58:15 +02:00
|
|
|
fd = socket(saddr.ss_family, SOCK_STREAM, 0);
|
2007-09-17 17:40:04 +02:00
|
|
|
if (fd != -1)
|
|
|
|
{
|
2009-07-09 19:58:15 +02:00
|
|
|
if (connect(fd, (struct sockaddr *)&saddr, sa_len) == 0)
|
2007-09-17 17:40:04 +02:00
|
|
|
rc = TRUE;
|
2015-02-13 12:12:29 +01:00
|
|
|
closesocket(fd);
|
2007-09-17 17:40:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Build our ping command
|
|
|
|
*/
|
2016-04-27 19:20:39 +02:00
|
|
|
char *command;
|
|
|
|
|
|
|
|
len = WideCharToMultiByte(CP_UNIXCP, 0, host, host_len, NULL, 0, NULL, NULL);
|
|
|
|
command = heap_alloc(strlen(ping)+len+strlen(redirect)+1);
|
|
|
|
strcpy(command, ping);
|
|
|
|
WideCharToMultiByte(CP_UNIXCP, 0, host, host_len, command+sizeof(ping)-1, len, NULL, NULL);
|
|
|
|
strcpy(command+sizeof(ping)-1+len, redirect);
|
2000-08-01 22:53:42 +02:00
|
|
|
|
2007-09-17 17:40:04 +02:00
|
|
|
TRACE("Ping command is : %s\n",command);
|
2000-08-01 22:53:42 +02:00
|
|
|
|
2007-09-17 17:40:04 +02:00
|
|
|
status = system(command);
|
2016-04-27 19:20:39 +02:00
|
|
|
heap_free( command );
|
2000-08-01 22:53:42 +02:00
|
|
|
|
2007-09-17 17:40:04 +02:00
|
|
|
TRACE("Ping returned a code of %i\n",status);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2007-09-17 17:40:04 +02:00
|
|
|
/* Ping return code of 0 indicates success */
|
|
|
|
if (status == 0)
|
|
|
|
rc = TRUE;
|
|
|
|
}
|
2000-08-01 22:53:42 +02:00
|
|
|
|
|
|
|
End:
|
|
|
|
if (rc == FALSE)
|
2007-01-09 12:30:45 +01:00
|
|
|
INTERNET_SetLastError(ERROR_NOT_CONNECTED);
|
2000-08-01 22:53:42 +02:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2002-10-28 19:48:24 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
2005-11-08 17:09:20 +01:00
|
|
|
* InternetCheckConnectionA (WININET.@)
|
2002-10-28 19:48:24 +01:00
|
|
|
*
|
|
|
|
* Pings a requested host to check internet connection
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success and FALSE on failure. If a failure then
|
|
|
|
* ERROR_NOT_CONNECTED is placed into GetLastError
|
|
|
|
*
|
|
|
|
*/
|
2005-11-08 17:09:20 +01:00
|
|
|
BOOL WINAPI InternetCheckConnectionA(LPCSTR lpszUrl, DWORD dwFlags, DWORD dwReserved)
|
2002-10-28 19:48:24 +01:00
|
|
|
{
|
2009-07-17 02:05:36 +02:00
|
|
|
WCHAR *url = NULL;
|
2002-10-28 19:48:24 +01:00
|
|
|
BOOL rc;
|
|
|
|
|
2009-07-17 02:05:36 +02:00
|
|
|
if(lpszUrl) {
|
|
|
|
url = heap_strdupAtoW(lpszUrl);
|
|
|
|
if(!url)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = InternetCheckConnectionW(url, dwFlags, dwReserved);
|
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(url);
|
2002-10-28 19:48:24 +01:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-20 01:56:49 +01:00
|
|
|
/**********************************************************
|
2004-05-10 21:59:05 +02:00
|
|
|
* INTERNET_InternetOpenUrlW (internal)
|
2002-03-20 01:56:49 +01:00
|
|
|
*
|
|
|
|
* Opens an URL
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
2002-03-20 01:56:49 +01:00
|
|
|
* RETURNS
|
|
|
|
* handle of connection or NULL on failure
|
|
|
|
*/
|
2009-07-13 01:45:06 +02:00
|
|
|
static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl,
|
2007-08-30 16:21:33 +02:00
|
|
|
LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
|
2002-03-20 01:56:49 +01:00
|
|
|
{
|
2016-05-17 19:15:24 +02:00
|
|
|
URL_COMPONENTSW urlComponents = { sizeof(urlComponents) };
|
|
|
|
WCHAR *host, *user = NULL, *pass = NULL, *path;
|
2004-02-09 22:45:38 +01:00
|
|
|
HINTERNET client = NULL, client1 = NULL;
|
2009-12-21 13:58:53 +01:00
|
|
|
DWORD res;
|
2004-02-09 22:45:38 +01:00
|
|
|
|
2007-08-30 16:21:33 +02:00
|
|
|
TRACE("(%p, %s, %s, %08x, %08x, %08lx)\n", hIC, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
|
2004-02-09 22:45:38 +01:00
|
|
|
dwHeadersLength, dwFlags, dwContext);
|
|
|
|
|
2016-05-17 19:15:24 +02:00
|
|
|
urlComponents.dwHostNameLength = 1;
|
|
|
|
urlComponents.dwUserNameLength = 1;
|
|
|
|
urlComponents.dwPasswordLength = 1;
|
|
|
|
urlComponents.dwUrlPathLength = 1;
|
|
|
|
urlComponents.dwExtraInfoLength = 1;
|
2004-03-30 06:36:09 +02:00
|
|
|
if(!InternetCrackUrlW(lpszUrl, strlenW(lpszUrl), 0, &urlComponents))
|
2004-02-09 22:45:38 +01:00
|
|
|
return NULL;
|
2016-05-17 19:15:24 +02:00
|
|
|
|
2017-02-23 12:31:06 +01:00
|
|
|
if ((urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS) &&
|
|
|
|
urlComponents.dwExtraInfoLength)
|
|
|
|
{
|
2016-05-17 19:15:24 +02:00
|
|
|
assert(urlComponents.lpszUrlPath + urlComponents.dwUrlPathLength == urlComponents.lpszExtraInfo);
|
|
|
|
urlComponents.dwUrlPathLength += urlComponents.dwExtraInfoLength;
|
|
|
|
}
|
|
|
|
|
|
|
|
host = heap_strndupW(urlComponents.lpszHostName, urlComponents.dwHostNameLength);
|
|
|
|
path = heap_strndupW(urlComponents.lpszUrlPath, urlComponents.dwUrlPathLength);
|
|
|
|
if(urlComponents.dwUserNameLength)
|
|
|
|
user = heap_strndupW(urlComponents.lpszUserName, urlComponents.dwUserNameLength);
|
|
|
|
if(urlComponents.dwPasswordLength)
|
|
|
|
pass = heap_strndupW(urlComponents.lpszPassword, urlComponents.dwPasswordLength);
|
|
|
|
|
2004-02-09 22:45:38 +01:00
|
|
|
switch(urlComponents.nScheme) {
|
|
|
|
case INTERNET_SCHEME_FTP:
|
2016-05-17 19:15:24 +02:00
|
|
|
client = FTP_Connect(hIC, host, urlComponents.nPort,
|
|
|
|
user, pass, dwFlags, dwContext, INET_OPENURL);
|
2004-05-25 06:02:05 +02:00
|
|
|
if(client == NULL)
|
|
|
|
break;
|
2004-03-30 06:36:09 +02:00
|
|
|
client1 = FtpOpenFileW(client, path, GENERIC_READ, dwFlags, dwContext);
|
2004-05-25 06:02:05 +02:00
|
|
|
if(client1 == NULL) {
|
|
|
|
InternetCloseHandle(client);
|
|
|
|
break;
|
|
|
|
}
|
2004-02-09 22:45:38 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case INTERNET_SCHEME_HTTP:
|
|
|
|
case INTERNET_SCHEME_HTTPS: {
|
2004-04-19 22:12:14 +02:00
|
|
|
static const WCHAR szStars[] = { '*','/','*', 0 };
|
2004-03-30 06:36:09 +02:00
|
|
|
LPCWSTR accept[2] = { szStars, NULL };
|
2016-05-17 19:20:21 +02:00
|
|
|
|
2008-12-08 12:35:32 +01:00
|
|
|
if (urlComponents.nScheme == INTERNET_SCHEME_HTTPS) dwFlags |= INTERNET_FLAG_SECURE;
|
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
/* FIXME: should use pointers, not handles, as handles are not thread-safe */
|
2016-05-17 19:15:24 +02:00
|
|
|
res = HTTP_Connect(hIC, host, urlComponents.nPort,
|
|
|
|
user, pass, dwFlags, dwContext, INET_OPENURL, &client);
|
2009-12-21 13:58:53 +01:00
|
|
|
if(res != ERROR_SUCCESS) {
|
|
|
|
INTERNET_SetLastError(res);
|
2004-02-09 22:45:38 +01:00
|
|
|
break;
|
2009-12-21 13:58:53 +01:00
|
|
|
}
|
2007-02-19 11:08:52 +01:00
|
|
|
|
2016-05-17 19:15:24 +02:00
|
|
|
client1 = HttpOpenRequestW(client, NULL, path, NULL, NULL, accept, dwFlags, dwContext);
|
2004-02-09 22:45:38 +01:00
|
|
|
if(client1 == NULL) {
|
|
|
|
InternetCloseHandle(client);
|
|
|
|
break;
|
|
|
|
}
|
2004-03-30 06:36:09 +02:00
|
|
|
HttpAddRequestHeadersW(client1, lpszHeaders, dwHeadersLength, HTTP_ADDREQ_FLAG_ADD);
|
2006-10-18 21:22:21 +02:00
|
|
|
if (!HttpSendRequestW(client1, NULL, 0, NULL, 0) &&
|
|
|
|
GetLastError() != ERROR_IO_PENDING) {
|
2004-02-09 22:45:38 +01:00
|
|
|
InternetCloseHandle(client1);
|
|
|
|
client1 = NULL;
|
|
|
|
break;
|
|
|
|
}
|
2002-03-20 01:56:49 +01:00
|
|
|
}
|
2004-02-09 22:45:38 +01:00
|
|
|
case INTERNET_SCHEME_GOPHER:
|
|
|
|
/* gopher doesn't seem to be implemented in wine, but it's supposed
|
|
|
|
* to be supported by InternetOpenUrlA. */
|
|
|
|
default:
|
2009-12-03 14:47:43 +01:00
|
|
|
SetLastError(ERROR_INTERNET_UNRECOGNIZED_SCHEME);
|
2004-02-09 22:45:38 +01:00
|
|
|
break;
|
2002-03-20 01:56:49 +01:00
|
|
|
}
|
2004-02-09 22:45:38 +01:00
|
|
|
|
|
|
|
TRACE(" %p <--\n", client1);
|
2016-05-17 19:15:24 +02:00
|
|
|
|
|
|
|
heap_free(host);
|
|
|
|
heap_free(path);
|
|
|
|
heap_free(user);
|
|
|
|
heap_free(pass);
|
2002-03-20 01:56:49 +01:00
|
|
|
return client1;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-02-09 22:45:38 +01:00
|
|
|
/**********************************************************
|
2004-05-10 21:59:05 +02:00
|
|
|
* InternetOpenUrlW (WININET.@)
|
2004-02-09 22:45:38 +01:00
|
|
|
*
|
|
|
|
* Opens an URL
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* handle of connection or NULL on failure
|
|
|
|
*/
|
2013-01-28 11:23:45 +01:00
|
|
|
typedef struct {
|
|
|
|
task_header_t hdr;
|
|
|
|
WCHAR *url;
|
|
|
|
WCHAR *headers;
|
|
|
|
DWORD headers_len;
|
|
|
|
DWORD flags;
|
|
|
|
DWORD_PTR context;
|
|
|
|
} open_url_task_t;
|
|
|
|
|
|
|
|
static void AsyncInternetOpenUrlProc(task_header_t *hdr)
|
2006-12-25 21:33:49 +01:00
|
|
|
{
|
2013-01-28 11:23:45 +01:00
|
|
|
open_url_task_t *task = (open_url_task_t*)hdr;
|
2006-12-25 21:33:49 +01:00
|
|
|
|
2013-01-28 11:23:45 +01:00
|
|
|
TRACE("%p\n", task->hdr.hdr);
|
2006-12-25 21:33:49 +01:00
|
|
|
|
2013-01-28 11:23:45 +01:00
|
|
|
INTERNET_InternetOpenUrlW((appinfo_t*)task->hdr.hdr, task->url, task->headers,
|
|
|
|
task->headers_len, task->flags, task->context);
|
|
|
|
heap_free(task->url);
|
|
|
|
heap_free(task->headers);
|
2006-12-25 21:33:49 +01:00
|
|
|
}
|
|
|
|
|
2004-03-30 06:36:09 +02:00
|
|
|
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
|
2007-08-30 16:21:33 +02:00
|
|
|
LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
|
2004-02-09 22:45:38 +01:00
|
|
|
{
|
|
|
|
HINTERNET ret = NULL;
|
2009-07-13 01:45:06 +02:00
|
|
|
appinfo_t *hIC = NULL;
|
2004-02-09 22:45:38 +01:00
|
|
|
|
2004-12-23 12:18:29 +01:00
|
|
|
if (TRACE_ON(wininet)) {
|
2007-08-30 16:21:33 +02:00
|
|
|
TRACE("(%p, %s, %s, %08x, %08x, %08lx)\n", hInternet, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
|
2004-12-23 12:18:29 +01:00
|
|
|
dwHeadersLength, dwFlags, dwContext);
|
|
|
|
TRACE(" flags :");
|
|
|
|
dump_INTERNET_FLAGS(dwFlags);
|
|
|
|
}
|
|
|
|
|
2006-05-15 15:02:34 +02:00
|
|
|
if (!lpszUrl)
|
|
|
|
{
|
2009-12-03 14:47:43 +01:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2006-05-15 15:02:34 +02:00
|
|
|
goto lend;
|
|
|
|
}
|
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
hIC = (appinfo_t*)get_handle_object( hInternet );
|
2004-02-09 22:45:38 +01:00
|
|
|
if (NULL == hIC || hIC->hdr.htype != WH_HINIT) {
|
2009-12-03 14:47:43 +01:00
|
|
|
SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
2004-02-09 22:45:38 +01:00
|
|
|
goto lend;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) {
|
2013-01-28 11:23:45 +01:00
|
|
|
open_url_task_t *task;
|
2006-12-25 21:33:49 +01:00
|
|
|
|
2013-01-28 11:23:03 +01:00
|
|
|
task = alloc_async_task(&hIC->hdr, AsyncInternetOpenUrlProc, sizeof(*task));
|
2013-01-28 11:23:45 +01:00
|
|
|
task->url = heap_strdupW(lpszUrl);
|
|
|
|
task->headers = heap_strdupW(lpszHeaders);
|
|
|
|
task->headers_len = dwHeadersLength;
|
|
|
|
task->flags = dwFlags;
|
|
|
|
task->context = dwContext;
|
2004-02-09 22:45:38 +01:00
|
|
|
|
2013-01-28 11:23:45 +01:00
|
|
|
INTERNET_AsyncCall(&task->hdr);
|
|
|
|
SetLastError(ERROR_IO_PENDING);
|
2004-02-09 22:45:38 +01:00
|
|
|
} else {
|
2004-07-19 23:49:39 +02:00
|
|
|
ret = INTERNET_InternetOpenUrlW(hIC, lpszUrl, lpszHeaders, dwHeadersLength, dwFlags, dwContext);
|
2004-02-09 22:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
lend:
|
2004-07-19 23:49:39 +02:00
|
|
|
if( hIC )
|
|
|
|
WININET_Release( &hIC->hdr );
|
2004-02-09 22:45:38 +01:00
|
|
|
TRACE(" %p <--\n", ret);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2002-10-28 19:48:24 +01:00
|
|
|
/**********************************************************
|
2004-05-10 21:59:05 +02:00
|
|
|
* InternetOpenUrlA (WININET.@)
|
2002-10-28 19:48:24 +01:00
|
|
|
*
|
|
|
|
* Opens an URL
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* handle of connection or NULL on failure
|
|
|
|
*/
|
2004-03-30 06:36:09 +02:00
|
|
|
HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
|
2007-08-30 16:21:33 +02:00
|
|
|
LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
|
2002-10-28 19:48:24 +01:00
|
|
|
{
|
2008-02-04 23:07:57 +01:00
|
|
|
HINTERNET rc = NULL;
|
2004-05-10 21:59:05 +02:00
|
|
|
LPWSTR szUrl = NULL;
|
2016-04-27 14:18:21 +02:00
|
|
|
WCHAR *headers = NULL;
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2003-12-12 07:01:20 +01:00
|
|
|
TRACE("\n");
|
|
|
|
|
2004-05-10 21:59:05 +02:00
|
|
|
if(lpszUrl) {
|
2009-07-17 02:05:36 +02:00
|
|
|
szUrl = heap_strdupAtoW(lpszUrl);
|
2004-05-10 21:59:05 +02:00
|
|
|
if(!szUrl)
|
2008-02-04 23:07:57 +01:00
|
|
|
return NULL;
|
2002-10-28 19:48:24 +01:00
|
|
|
}
|
2008-02-04 23:07:57 +01:00
|
|
|
|
2004-05-10 21:59:05 +02:00
|
|
|
if(lpszHeaders) {
|
2016-04-27 14:18:21 +02:00
|
|
|
headers = heap_strndupAtoW(lpszHeaders, dwHeadersLength, &dwHeadersLength);
|
|
|
|
if(!headers) {
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(szUrl);
|
2008-02-04 23:07:57 +01:00
|
|
|
return NULL;
|
2004-05-10 21:59:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-27 14:18:21 +02:00
|
|
|
rc = InternetOpenUrlW(hInternet, szUrl, headers, dwHeadersLength, dwFlags, dwContext);
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(szUrl);
|
2016-04-27 14:18:21 +02:00
|
|
|
heap_free(headers);
|
2002-10-28 19:48:24 +01:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-04-26 16:44:14 +02:00
|
|
|
static LPWITHREADERROR INTERNET_AllocThreadError(void)
|
|
|
|
{
|
2011-04-21 13:39:03 +02:00
|
|
|
LPWITHREADERROR lpwite = heap_alloc(sizeof(*lpwite));
|
2006-04-26 16:44:14 +02:00
|
|
|
|
|
|
|
if (lpwite)
|
|
|
|
{
|
|
|
|
lpwite->dwError = 0;
|
|
|
|
lpwite->response[0] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!TlsSetValue(g_dwTlsErrIndex, lpwite))
|
|
|
|
{
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(lpwite);
|
2006-04-26 16:44:14 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return lpwite;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_SetLastError (internal)
|
|
|
|
*
|
|
|
|
* Set last thread specific error
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void INTERNET_SetLastError(DWORD dwError)
|
|
|
|
{
|
2008-12-01 02:09:30 +01:00
|
|
|
LPWITHREADERROR lpwite = TlsGetValue(g_dwTlsErrIndex);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2006-04-20 12:46:38 +02:00
|
|
|
if (!lpwite)
|
2006-04-26 16:44:14 +02:00
|
|
|
lpwite = INTERNET_AllocThreadError();
|
2006-04-20 12:46:38 +02:00
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
SetLastError(dwError);
|
2002-12-05 20:54:40 +01:00
|
|
|
if(lpwite)
|
|
|
|
lpwite->dwError = dwError;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_GetLastError (internal)
|
|
|
|
*
|
|
|
|
* Get last thread specific error
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
2004-11-29 19:00:10 +01:00
|
|
|
DWORD INTERNET_GetLastError(void)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2008-12-01 02:09:30 +01:00
|
|
|
LPWITHREADERROR lpwite = TlsGetValue(g_dwTlsErrIndex);
|
2006-04-20 12:46:38 +02:00
|
|
|
if (!lpwite) return 0;
|
2005-12-03 18:10:14 +01:00
|
|
|
/* TlsGetValue clears last error, so set it again here */
|
|
|
|
SetLastError(lpwite->dwError);
|
2000-04-11 22:07:00 +02:00
|
|
|
return lpwite->dwError;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_WorkerThreadFunc (internal)
|
|
|
|
*
|
|
|
|
* Worker thread execution function
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
2005-11-15 19:12:42 +01:00
|
|
|
static DWORD CALLBACK INTERNET_WorkerThreadFunc(LPVOID lpvParam)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2013-01-28 11:23:03 +01:00
|
|
|
task_header_t *task = lpvParam;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
2013-01-28 11:23:03 +01:00
|
|
|
task->proc(task);
|
|
|
|
WININET_Release(task->hdr);
|
|
|
|
heap_free(task);
|
2009-12-22 09:08:30 +01:00
|
|
|
|
|
|
|
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
|
|
|
|
{
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(TlsGetValue(g_dwTlsErrIndex));
|
2009-12-22 09:08:30 +01:00
|
|
|
TlsSetValue(g_dwTlsErrIndex, NULL);
|
|
|
|
}
|
2007-01-04 19:26:31 +01:00
|
|
|
return TRUE;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
2013-01-28 11:23:03 +01:00
|
|
|
void *alloc_async_task(object_header_t *hdr, async_task_proc_t proc, size_t size)
|
|
|
|
{
|
|
|
|
task_header_t *task;
|
|
|
|
|
|
|
|
task = heap_alloc(size);
|
|
|
|
if(!task)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
task->hdr = WININET_AddRef(hdr);
|
|
|
|
task->proc = proc;
|
|
|
|
return task;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_AsyncCall (internal)
|
|
|
|
*
|
|
|
|
* Retrieves work request from queue
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
2013-01-30 11:39:34 +01:00
|
|
|
DWORD INTERNET_AsyncCall(task_header_t *task)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2007-01-04 19:26:31 +01:00
|
|
|
BOOL bSuccess;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
2013-01-30 11:39:34 +01:00
|
|
|
bSuccess = QueueUserWorkItem(INTERNET_WorkerThreadFunc, task, WT_EXECUTELONGFUNCTION);
|
2007-01-04 19:26:31 +01:00
|
|
|
if (!bSuccess)
|
|
|
|
{
|
2013-01-30 11:39:34 +01:00
|
|
|
heap_free(task);
|
2009-12-21 13:57:49 +01:00
|
|
|
return ERROR_INTERNET_ASYNC_THREAD_FAILED;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
2009-12-21 13:57:49 +01:00
|
|
|
return ERROR_SUCCESS;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2005-11-23 20:14:04 +01:00
|
|
|
* INTERNET_GetResponseBuffer (internal)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
2004-11-29 19:00:10 +01:00
|
|
|
LPSTR INTERNET_GetResponseBuffer(void)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2008-12-01 02:09:30 +01:00
|
|
|
LPWITHREADERROR lpwite = TlsGetValue(g_dwTlsErrIndex);
|
2006-04-20 12:46:38 +02:00
|
|
|
if (!lpwite)
|
2006-04-26 16:44:14 +02:00
|
|
|
lpwite = INTERNET_AllocThreadError();
|
2002-06-22 01:59:49 +02:00
|
|
|
TRACE("\n");
|
2000-04-11 22:07:00 +02:00
|
|
|
return lpwite->response;
|
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2005-07-15 11:56:34 +02:00
|
|
|
/**********************************************************
|
|
|
|
* InternetQueryDataAvailable (WININET.@)
|
|
|
|
*
|
|
|
|
* Determines how much data is available to be read.
|
2002-06-22 01:59:49 +02:00
|
|
|
*
|
2005-07-15 11:56:34 +02:00
|
|
|
* RETURNS
|
2007-07-15 23:32:57 +02:00
|
|
|
* TRUE on success, FALSE if an error occurred. If
|
|
|
|
* INTERNET_FLAG_ASYNC was specified in InternetOpen, and
|
|
|
|
* no data is presently available, FALSE is returned with
|
|
|
|
* the last error ERROR_IO_PENDING; a callback with status
|
|
|
|
* INTERNET_STATUS_REQUEST_COMPLETE will be sent when more
|
|
|
|
* data is available.
|
2002-06-22 01:59:49 +02:00
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile,
|
2012-05-15 09:47:01 +02:00
|
|
|
LPDWORD lpdwNumberOfBytesAvailable,
|
2007-08-30 16:21:33 +02:00
|
|
|
DWORD dwFlags, DWORD_PTR dwContext)
|
2002-06-22 01:59:49 +02:00
|
|
|
{
|
2009-07-07 21:46:09 +02:00
|
|
|
object_header_t *hdr;
|
2008-02-29 12:57:57 +01:00
|
|
|
DWORD res;
|
2002-06-22 01:59:49 +02:00
|
|
|
|
2012-05-15 09:47:01 +02:00
|
|
|
TRACE("(%p %p %x %lx)\n", hFile, lpdwNumberOfBytesAvailable, dwFlags, dwContext);
|
2008-02-29 12:57:57 +01:00
|
|
|
|
2011-02-02 22:50:31 +01:00
|
|
|
hdr = get_handle_object( hFile );
|
2008-02-29 12:57:57 +01:00
|
|
|
if (!hdr) {
|
2009-12-03 14:47:43 +01:00
|
|
|
SetLastError(ERROR_INVALID_HANDLE);
|
2002-06-22 01:59:49 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-02-29 12:57:57 +01:00
|
|
|
if(hdr->vtbl->QueryDataAvailable) {
|
2012-05-15 09:47:01 +02:00
|
|
|
res = hdr->vtbl->QueryDataAvailable(hdr, lpdwNumberOfBytesAvailable, dwFlags, dwContext);
|
2008-02-29 12:57:57 +01:00
|
|
|
}else {
|
|
|
|
WARN("wrong handle\n");
|
|
|
|
res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
2002-06-22 01:59:49 +02:00
|
|
|
}
|
|
|
|
|
2008-02-29 12:57:57 +01:00
|
|
|
WININET_Release(hdr);
|
|
|
|
|
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
SetLastError(res);
|
|
|
|
return res == ERROR_SUCCESS;
|
2002-06-22 01:59:49 +02:00
|
|
|
}
|
|
|
|
|
2013-10-04 16:52:43 +02:00
|
|
|
DWORD create_req_file(const WCHAR *file_name, req_file_t **ret)
|
|
|
|
{
|
|
|
|
req_file_t *req_file;
|
|
|
|
|
|
|
|
req_file = heap_alloc_zero(sizeof(*req_file));
|
|
|
|
if(!req_file)
|
|
|
|
return ERROR_NOT_ENOUGH_MEMORY;
|
|
|
|
|
|
|
|
req_file->ref = 1;
|
|
|
|
|
|
|
|
req_file->file_name = heap_strdupW(file_name);
|
|
|
|
if(!req_file->file_name) {
|
|
|
|
heap_free(req_file);
|
|
|
|
return ERROR_NOT_ENOUGH_MEMORY;
|
|
|
|
}
|
|
|
|
|
2013-10-04 16:53:22 +02:00
|
|
|
req_file->file_handle = CreateFileW(req_file->file_name, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE,
|
|
|
|
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
|
|
if(req_file->file_handle == INVALID_HANDLE_VALUE) {
|
|
|
|
req_file_release(req_file);
|
|
|
|
return GetLastError();
|
|
|
|
}
|
|
|
|
|
2013-10-04 16:52:43 +02:00
|
|
|
*ret = req_file;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void req_file_release(req_file_t *req_file)
|
|
|
|
{
|
|
|
|
if(InterlockedDecrement(&req_file->ref))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(!req_file->is_committed)
|
|
|
|
DeleteFileW(req_file->file_name);
|
2013-10-04 16:53:22 +02:00
|
|
|
if(req_file->file_handle && req_file->file_handle != INVALID_HANDLE_VALUE)
|
|
|
|
CloseHandle(req_file->file_handle);
|
2013-10-04 16:52:43 +02:00
|
|
|
heap_free(req_file->file_name);
|
2016-05-17 19:14:38 +02:00
|
|
|
heap_free(req_file->url);
|
2013-10-04 16:52:43 +02:00
|
|
|
heap_free(req_file);
|
|
|
|
}
|
2002-06-22 01:59:49 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2005-11-23 20:14:04 +01:00
|
|
|
* InternetLockRequestFile (WININET.@)
|
2002-06-22 01:59:49 +02:00
|
|
|
*/
|
2013-10-04 16:52:58 +02:00
|
|
|
BOOL WINAPI InternetLockRequestFile(HINTERNET hInternet, HANDLE *lphLockReqHandle)
|
2002-06-22 01:59:49 +02:00
|
|
|
{
|
2013-10-04 16:52:58 +02:00
|
|
|
req_file_t *req_file = NULL;
|
|
|
|
object_header_t *hdr;
|
|
|
|
DWORD res;
|
|
|
|
|
|
|
|
TRACE("(%p %p)\n", hInternet, lphLockReqHandle);
|
|
|
|
|
|
|
|
hdr = get_handle_object(hInternet);
|
|
|
|
if (!hdr) {
|
|
|
|
SetLastError(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(hdr->vtbl->LockRequestFile) {
|
|
|
|
res = hdr->vtbl->LockRequestFile(hdr, &req_file);
|
|
|
|
}else {
|
|
|
|
WARN("wrong handle\n");
|
|
|
|
res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
|
|
|
}
|
|
|
|
|
|
|
|
WININET_Release(hdr);
|
|
|
|
|
|
|
|
*lphLockReqHandle = req_file;
|
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
SetLastError(res);
|
|
|
|
return res == ERROR_SUCCESS;
|
2002-06-22 01:59:49 +02:00
|
|
|
}
|
|
|
|
|
2013-10-04 16:53:07 +02:00
|
|
|
BOOL WINAPI InternetUnlockRequestFile(HANDLE hLockHandle)
|
2002-06-22 01:59:49 +02:00
|
|
|
{
|
2013-10-04 16:53:07 +02:00
|
|
|
TRACE("(%p)\n", hLockHandle);
|
|
|
|
|
|
|
|
req_file_release(hLockHandle);
|
|
|
|
return TRUE;
|
2002-06-22 01:59:49 +02:00
|
|
|
}
|
2002-07-22 22:34:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2005-11-23 20:14:04 +01:00
|
|
|
* InternetAutodial (WININET.@)
|
2002-07-22 22:34:41 +02:00
|
|
|
*
|
|
|
|
* On windows this function is supposed to dial the default internet
|
|
|
|
* connection. We don't want to have Wine dial out to the internet so
|
|
|
|
* we return TRUE by default. It might be nice to check if we are connected.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2003-01-28 01:17:15 +01:00
|
|
|
BOOL WINAPI InternetAutodial(DWORD dwFlags, HWND hwndParent)
|
2002-07-22 22:34:41 +02:00
|
|
|
{
|
|
|
|
FIXME("STUB\n");
|
|
|
|
|
|
|
|
/* Tell that we are connected to the internet. */
|
|
|
|
return TRUE;
|
|
|
|
}
|
2002-10-28 19:48:24 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
2005-11-23 20:14:04 +01:00
|
|
|
* InternetAutodialHangup (WININET.@)
|
2002-10-28 19:48:24 +01:00
|
|
|
*
|
2005-03-30 19:08:31 +02:00
|
|
|
* Hangs up a connection made with InternetAutodial
|
2002-10-28 19:48:24 +01:00
|
|
|
*
|
|
|
|
* PARAM
|
|
|
|
* dwReserved
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetAutodialHangup(DWORD dwReserved)
|
|
|
|
{
|
|
|
|
FIXME("STUB\n");
|
|
|
|
|
|
|
|
/* we didn't dial, we don't disconnect */
|
|
|
|
return TRUE;
|
|
|
|
}
|
2002-12-05 20:54:40 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
2005-11-23 20:14:04 +01:00
|
|
|
* InternetCombineUrlA (WININET.@)
|
2002-12-05 20:54:40 +01:00
|
|
|
*
|
|
|
|
* Combine a base URL with a relative URL
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
BOOL WINAPI InternetCombineUrlA(LPCSTR lpszBaseUrl, LPCSTR lpszRelativeUrl,
|
|
|
|
LPSTR lpszBuffer, LPDWORD lpdwBufferLength,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
|
|
|
HRESULT hr=S_OK;
|
2003-12-12 07:01:20 +01:00
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_a(lpszBaseUrl), debugstr_a(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
|
2003-12-12 07:01:20 +01:00
|
|
|
|
2002-12-05 20:54:40 +01:00
|
|
|
/* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
|
|
|
|
dwFlags ^= ICU_NO_ENCODE;
|
|
|
|
hr=UrlCombineA(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
|
|
|
|
|
|
|
|
return (hr==S_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2005-11-23 20:14:04 +01:00
|
|
|
* InternetCombineUrlW (WININET.@)
|
2002-12-05 20:54:40 +01:00
|
|
|
*
|
|
|
|
* Combine a base URL with a relative URL
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
BOOL WINAPI InternetCombineUrlW(LPCWSTR lpszBaseUrl, LPCWSTR lpszRelativeUrl,
|
|
|
|
LPWSTR lpszBuffer, LPDWORD lpdwBufferLength,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
|
|
|
HRESULT hr=S_OK;
|
2003-12-12 07:01:20 +01:00
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_w(lpszBaseUrl), debugstr_w(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
|
2003-12-12 07:01:20 +01:00
|
|
|
|
2002-12-05 20:54:40 +01:00
|
|
|
/* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
|
|
|
|
dwFlags ^= ICU_NO_ENCODE;
|
|
|
|
hr=UrlCombineW(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
|
|
|
|
|
|
|
|
return (hr==S_OK);
|
|
|
|
}
|
2003-07-19 05:08:05 +02:00
|
|
|
|
2005-10-31 15:06:35 +01:00
|
|
|
/* max port num is 65535 => 5 digits */
|
|
|
|
#define MAX_WORD_DIGITS 5
|
|
|
|
|
2006-03-06 18:31:56 +01:00
|
|
|
#define URL_GET_COMP_LENGTH(url, component) ((url)->dw##component##Length ? \
|
|
|
|
(url)->dw##component##Length : strlenW((url)->lpsz##component))
|
|
|
|
#define URL_GET_COMP_LENGTHA(url, component) ((url)->dw##component##Length ? \
|
|
|
|
(url)->dw##component##Length : strlen((url)->lpsz##component))
|
|
|
|
|
2006-03-09 16:16:41 +01:00
|
|
|
static BOOL url_uses_default_port(INTERNET_SCHEME nScheme, INTERNET_PORT nPort)
|
2006-03-06 18:31:56 +01:00
|
|
|
{
|
2006-03-09 16:16:41 +01:00
|
|
|
if ((nScheme == INTERNET_SCHEME_HTTP) &&
|
|
|
|
(nPort == INTERNET_DEFAULT_HTTP_PORT))
|
2006-03-06 18:31:56 +01:00
|
|
|
return TRUE;
|
2006-03-09 16:16:41 +01:00
|
|
|
if ((nScheme == INTERNET_SCHEME_HTTPS) &&
|
|
|
|
(nPort == INTERNET_DEFAULT_HTTPS_PORT))
|
2006-03-06 18:31:56 +01:00
|
|
|
return TRUE;
|
2006-03-09 16:16:41 +01:00
|
|
|
if ((nScheme == INTERNET_SCHEME_FTP) &&
|
|
|
|
(nPort == INTERNET_DEFAULT_FTP_PORT))
|
2006-03-06 18:31:56 +01:00
|
|
|
return TRUE;
|
2006-03-09 16:16:41 +01:00
|
|
|
if ((nScheme == INTERNET_SCHEME_GOPHER) &&
|
|
|
|
(nPort == INTERNET_DEFAULT_GOPHER_PORT))
|
2006-03-06 18:31:56 +01:00
|
|
|
return TRUE;
|
|
|
|
|
2006-03-09 16:17:49 +01:00
|
|
|
if (nPort == INTERNET_INVALID_PORT_NUMBER)
|
|
|
|
return TRUE;
|
|
|
|
|
2006-03-06 18:31:56 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-03-09 16:17:49 +01:00
|
|
|
/* opaque urls do not fit into the standard url hierarchy and don't have
|
|
|
|
* two following slashes */
|
|
|
|
static inline BOOL scheme_is_opaque(INTERNET_SCHEME nScheme)
|
|
|
|
{
|
|
|
|
return (nScheme != INTERNET_SCHEME_FTP) &&
|
|
|
|
(nScheme != INTERNET_SCHEME_GOPHER) &&
|
|
|
|
(nScheme != INTERNET_SCHEME_HTTP) &&
|
|
|
|
(nScheme != INTERNET_SCHEME_HTTPS) &&
|
|
|
|
(nScheme != INTERNET_SCHEME_FILE);
|
|
|
|
}
|
|
|
|
|
2006-03-09 16:15:45 +01:00
|
|
|
static LPCWSTR INTERNET_GetSchemeString(INTERNET_SCHEME scheme)
|
|
|
|
{
|
|
|
|
int index;
|
|
|
|
if (scheme < INTERNET_SCHEME_FIRST)
|
|
|
|
return NULL;
|
|
|
|
index = scheme - INTERNET_SCHEME_FIRST;
|
2018-09-20 19:13:59 +02:00
|
|
|
if (index >= ARRAY_SIZE(url_schemes))
|
2006-03-09 16:15:45 +01:00
|
|
|
return NULL;
|
2008-07-12 21:37:31 +02:00
|
|
|
return (LPCWSTR)url_schemes[index];
|
2006-03-09 16:15:45 +01:00
|
|
|
}
|
|
|
|
|
2005-10-31 15:06:35 +01:00
|
|
|
/* we can calculate using ansi strings because we're just
|
|
|
|
* calculating string length, not size
|
|
|
|
*/
|
|
|
|
static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
|
2006-03-06 18:31:56 +01:00
|
|
|
LPDWORD lpdwUrlLength)
|
2005-10-31 15:06:35 +01:00
|
|
|
{
|
2006-03-09 16:16:41 +01:00
|
|
|
INTERNET_SCHEME nScheme;
|
|
|
|
|
2005-10-31 15:06:35 +01:00
|
|
|
*lpdwUrlLength = 0;
|
|
|
|
|
2006-03-09 16:15:45 +01:00
|
|
|
if (lpUrlComponents->lpszScheme)
|
2006-03-09 16:16:41 +01:00
|
|
|
{
|
|
|
|
DWORD dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Scheme);
|
|
|
|
*lpdwUrlLength += dwLen;
|
|
|
|
nScheme = GetInternetSchemeW(lpUrlComponents->lpszScheme, dwLen);
|
|
|
|
}
|
2006-03-09 16:15:45 +01:00
|
|
|
else
|
|
|
|
{
|
2006-03-09 16:16:41 +01:00
|
|
|
LPCWSTR scheme;
|
|
|
|
|
|
|
|
nScheme = lpUrlComponents->nScheme;
|
|
|
|
|
|
|
|
if (nScheme == INTERNET_SCHEME_DEFAULT)
|
|
|
|
nScheme = INTERNET_SCHEME_HTTP;
|
|
|
|
scheme = INTERNET_GetSchemeString(nScheme);
|
2006-03-09 16:15:45 +01:00
|
|
|
*lpdwUrlLength += strlenW(scheme);
|
|
|
|
}
|
|
|
|
|
2006-03-09 16:17:49 +01:00
|
|
|
(*lpdwUrlLength)++; /* ':' */
|
|
|
|
if (!scheme_is_opaque(nScheme) || lpUrlComponents->lpszHostName)
|
|
|
|
*lpdwUrlLength += strlen("//");
|
2005-10-31 15:06:35 +01:00
|
|
|
|
|
|
|
if (lpUrlComponents->lpszUserName)
|
|
|
|
{
|
2006-03-06 18:31:56 +01:00
|
|
|
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UserName);
|
2005-10-31 15:06:35 +01:00
|
|
|
*lpdwUrlLength += strlen("@");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (lpUrlComponents->lpszPassword)
|
|
|
|
{
|
2007-01-09 12:30:45 +01:00
|
|
|
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
|
2005-10-31 15:06:35 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lpUrlComponents->lpszPassword)
|
|
|
|
{
|
|
|
|
*lpdwUrlLength += strlen(":");
|
2006-03-06 18:31:56 +01:00
|
|
|
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, Password);
|
2005-10-31 15:06:35 +01:00
|
|
|
}
|
|
|
|
|
2006-03-09 16:15:00 +01:00
|
|
|
if (lpUrlComponents->lpszHostName)
|
2006-03-09 16:18:24 +01:00
|
|
|
{
|
2006-03-09 16:15:00 +01:00
|
|
|
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
|
2006-03-09 16:19:15 +01:00
|
|
|
|
|
|
|
if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
|
|
|
|
{
|
2006-03-09 16:19:46 +01:00
|
|
|
char szPort[MAX_WORD_DIGITS+1];
|
2006-03-09 16:19:15 +01:00
|
|
|
|
2016-11-12 10:36:20 +01:00
|
|
|
*lpdwUrlLength += sprintf(szPort, "%d", lpUrlComponents->nPort);
|
2006-03-09 16:19:15 +01:00
|
|
|
*lpdwUrlLength += strlen(":");
|
|
|
|
}
|
|
|
|
|
2006-03-09 16:18:24 +01:00
|
|
|
if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
|
|
|
|
(*lpdwUrlLength)++; /* '/' */
|
|
|
|
}
|
2005-10-31 15:06:35 +01:00
|
|
|
|
2006-03-09 16:19:15 +01:00
|
|
|
if (lpUrlComponents->lpszUrlPath)
|
|
|
|
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
|
2005-10-31 15:06:35 +01:00
|
|
|
|
2008-12-01 16:37:57 +01:00
|
|
|
if (lpUrlComponents->lpszExtraInfo)
|
|
|
|
*lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, ExtraInfo);
|
|
|
|
|
2005-10-31 15:06:35 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPONENTSW urlCompW)
|
|
|
|
{
|
|
|
|
INT len;
|
|
|
|
|
|
|
|
ZeroMemory(urlCompW, sizeof(URL_COMPONENTSW));
|
|
|
|
|
|
|
|
urlCompW->dwStructSize = sizeof(URL_COMPONENTSW);
|
|
|
|
urlCompW->dwSchemeLength = lpUrlComponents->dwSchemeLength;
|
|
|
|
urlCompW->nScheme = lpUrlComponents->nScheme;
|
|
|
|
urlCompW->dwHostNameLength = lpUrlComponents->dwHostNameLength;
|
|
|
|
urlCompW->nPort = lpUrlComponents->nPort;
|
|
|
|
urlCompW->dwUserNameLength = lpUrlComponents->dwUserNameLength;
|
|
|
|
urlCompW->dwPasswordLength = lpUrlComponents->dwPasswordLength;
|
|
|
|
urlCompW->dwUrlPathLength = lpUrlComponents->dwUrlPathLength;
|
|
|
|
urlCompW->dwExtraInfoLength = lpUrlComponents->dwExtraInfoLength;
|
|
|
|
|
|
|
|
if (lpUrlComponents->lpszScheme)
|
|
|
|
{
|
2006-03-06 18:31:56 +01:00
|
|
|
len = URL_GET_COMP_LENGTHA(lpUrlComponents, Scheme) + 1;
|
2011-04-21 13:39:03 +02:00
|
|
|
urlCompW->lpszScheme = heap_alloc(len * sizeof(WCHAR));
|
2005-10-31 15:06:35 +01:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszScheme,
|
|
|
|
-1, urlCompW->lpszScheme, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lpUrlComponents->lpszHostName)
|
|
|
|
{
|
2006-03-06 18:31:56 +01:00
|
|
|
len = URL_GET_COMP_LENGTHA(lpUrlComponents, HostName) + 1;
|
2011-04-21 13:39:03 +02:00
|
|
|
urlCompW->lpszHostName = heap_alloc(len * sizeof(WCHAR));
|
2005-10-31 15:06:35 +01:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszHostName,
|
|
|
|
-1, urlCompW->lpszHostName, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lpUrlComponents->lpszUserName)
|
|
|
|
{
|
2006-03-06 18:31:56 +01:00
|
|
|
len = URL_GET_COMP_LENGTHA(lpUrlComponents, UserName) + 1;
|
2011-04-21 13:39:03 +02:00
|
|
|
urlCompW->lpszUserName = heap_alloc(len * sizeof(WCHAR));
|
2005-10-31 15:06:35 +01:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUserName,
|
|
|
|
-1, urlCompW->lpszUserName, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lpUrlComponents->lpszPassword)
|
|
|
|
{
|
2006-03-06 18:31:56 +01:00
|
|
|
len = URL_GET_COMP_LENGTHA(lpUrlComponents, Password) + 1;
|
2011-04-21 13:39:03 +02:00
|
|
|
urlCompW->lpszPassword = heap_alloc(len * sizeof(WCHAR));
|
2005-10-31 15:06:35 +01:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszPassword,
|
|
|
|
-1, urlCompW->lpszPassword, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lpUrlComponents->lpszUrlPath)
|
|
|
|
{
|
2006-03-06 18:31:56 +01:00
|
|
|
len = URL_GET_COMP_LENGTHA(lpUrlComponents, UrlPath) + 1;
|
2011-04-21 13:39:03 +02:00
|
|
|
urlCompW->lpszUrlPath = heap_alloc(len * sizeof(WCHAR));
|
2005-10-31 15:06:35 +01:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUrlPath,
|
|
|
|
-1, urlCompW->lpszUrlPath, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lpUrlComponents->lpszExtraInfo)
|
|
|
|
{
|
2006-03-06 18:31:56 +01:00
|
|
|
len = URL_GET_COMP_LENGTHA(lpUrlComponents, ExtraInfo) + 1;
|
2011-04-21 13:39:03 +02:00
|
|
|
urlCompW->lpszExtraInfo = heap_alloc(len * sizeof(WCHAR));
|
2005-10-31 15:06:35 +01:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszExtraInfo,
|
|
|
|
-1, urlCompW->lpszExtraInfo, len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-08 23:07:23 +02:00
|
|
|
/***********************************************************************
|
2005-11-23 20:14:04 +01:00
|
|
|
* InternetCreateUrlA (WININET.@)
|
2003-08-08 23:07:23 +02:00
|
|
|
*
|
2006-03-21 14:44:36 +01:00
|
|
|
* See InternetCreateUrlW.
|
2003-08-08 23:07:23 +02:00
|
|
|
*/
|
2003-07-19 05:08:05 +02:00
|
|
|
BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags,
|
|
|
|
LPSTR lpszUrl, LPDWORD lpdwUrlLength)
|
|
|
|
{
|
2005-10-31 15:06:35 +01:00
|
|
|
BOOL ret;
|
|
|
|
LPWSTR urlW = NULL;
|
|
|
|
URL_COMPONENTSW urlCompW;
|
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
|
2005-10-31 15:06:35 +01:00
|
|
|
|
2007-08-09 18:34:09 +02:00
|
|
|
if (!lpUrlComponents || lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
|
2005-10-31 15:06:35 +01:00
|
|
|
{
|
2009-12-03 14:47:43 +01:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2005-10-31 15:06:35 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
convert_urlcomp_atow(lpUrlComponents, &urlCompW);
|
|
|
|
|
|
|
|
if (lpszUrl)
|
2011-04-21 13:39:03 +02:00
|
|
|
urlW = heap_alloc(*lpdwUrlLength * sizeof(WCHAR));
|
2005-10-31 15:06:35 +01:00
|
|
|
|
|
|
|
ret = InternetCreateUrlW(&urlCompW, dwFlags, urlW, lpdwUrlLength);
|
|
|
|
|
2006-03-21 14:44:36 +01:00
|
|
|
if (!ret && (GetLastError() == ERROR_INSUFFICIENT_BUFFER))
|
|
|
|
*lpdwUrlLength /= sizeof(WCHAR);
|
|
|
|
|
2005-10-31 15:06:35 +01:00
|
|
|
/* on success, lpdwUrlLength points to the size of urlW in WCHARS
|
|
|
|
* minus one, so add one to leave room for NULL terminator
|
|
|
|
*/
|
|
|
|
if (ret)
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, urlW, -1, lpszUrl, *lpdwUrlLength + 1, NULL, NULL);
|
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(urlCompW.lpszScheme);
|
|
|
|
heap_free(urlCompW.lpszHostName);
|
|
|
|
heap_free(urlCompW.lpszUserName);
|
|
|
|
heap_free(urlCompW.lpszPassword);
|
|
|
|
heap_free(urlCompW.lpszUrlPath);
|
|
|
|
heap_free(urlCompW.lpszExtraInfo);
|
|
|
|
heap_free(urlW);
|
2005-10-31 15:06:35 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2005-11-23 20:14:04 +01:00
|
|
|
* InternetCreateUrlW (WININET.@)
|
2005-10-31 15:06:35 +01:00
|
|
|
*
|
2006-03-21 14:44:36 +01:00
|
|
|
* Creates a URL from its component parts.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpUrlComponents [I] URL Components.
|
|
|
|
* dwFlags [I] Flags. See notes.
|
|
|
|
* lpszUrl [I] Buffer in which to store the created URL.
|
|
|
|
* lpdwUrlLength [I/O] On input, the length of the buffer pointed to by
|
|
|
|
* lpszUrl in characters. On output, the number of bytes
|
|
|
|
* required to store the URL including terminator.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
*
|
|
|
|
* The dwFlags parameter can be zero or more of the following:
|
|
|
|
*|ICU_ESCAPE - Generates escape sequences for unsafe characters in the path and extra info of the URL.
|
|
|
|
*
|
2005-10-31 15:06:35 +01:00
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
|
|
|
|
LPWSTR lpszUrl, LPDWORD lpdwUrlLength)
|
|
|
|
{
|
2006-03-06 18:31:56 +01:00
|
|
|
DWORD dwLen;
|
2006-03-09 16:16:41 +01:00
|
|
|
INTERNET_SCHEME nScheme;
|
2005-10-31 15:06:35 +01:00
|
|
|
|
2006-03-09 16:17:49 +01:00
|
|
|
static const WCHAR slashSlashW[] = {'/','/'};
|
2011-03-28 22:47:27 +02:00
|
|
|
static const WCHAR fmtW[] = {'%','u',0};
|
2005-10-31 15:06:35 +01:00
|
|
|
|
2006-10-05 13:18:56 +02:00
|
|
|
TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
|
2005-10-31 15:06:35 +01:00
|
|
|
|
2007-08-09 18:34:09 +02:00
|
|
|
if (!lpUrlComponents || lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
|
2005-10-31 15:06:35 +01:00
|
|
|
{
|
2007-01-09 12:30:45 +01:00
|
|
|
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
|
2005-10-31 15:06:35 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-03-06 18:31:56 +01:00
|
|
|
if (!calc_url_length(lpUrlComponents, &dwLen))
|
2005-10-31 15:06:35 +01:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!lpszUrl || *lpdwUrlLength < dwLen)
|
|
|
|
{
|
2006-03-21 14:44:36 +01:00
|
|
|
*lpdwUrlLength = (dwLen + 1) * sizeof(WCHAR);
|
2007-01-09 12:30:45 +01:00
|
|
|
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
2005-10-31 15:06:35 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*lpdwUrlLength = dwLen;
|
|
|
|
lpszUrl[0] = 0x00;
|
|
|
|
|
2006-03-06 18:31:56 +01:00
|
|
|
dwLen = 0;
|
|
|
|
|
2005-10-31 15:06:35 +01:00
|
|
|
if (lpUrlComponents->lpszScheme)
|
2006-03-06 18:31:56 +01:00
|
|
|
{
|
|
|
|
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Scheme);
|
|
|
|
memcpy(lpszUrl, lpUrlComponents->lpszScheme, dwLen * sizeof(WCHAR));
|
|
|
|
lpszUrl += dwLen;
|
2006-03-09 16:16:41 +01:00
|
|
|
|
|
|
|
nScheme = GetInternetSchemeW(lpUrlComponents->lpszScheme, dwLen);
|
2006-03-06 18:31:56 +01:00
|
|
|
}
|
2006-03-09 16:15:45 +01:00
|
|
|
else
|
|
|
|
{
|
2006-03-09 16:16:41 +01:00
|
|
|
LPCWSTR scheme;
|
|
|
|
nScheme = lpUrlComponents->nScheme;
|
|
|
|
|
|
|
|
if (nScheme == INTERNET_SCHEME_DEFAULT)
|
|
|
|
nScheme = INTERNET_SCHEME_HTTP;
|
|
|
|
|
|
|
|
scheme = INTERNET_GetSchemeString(nScheme);
|
2006-03-09 16:15:45 +01:00
|
|
|
dwLen = strlenW(scheme);
|
|
|
|
memcpy(lpszUrl, scheme, dwLen * sizeof(WCHAR));
|
|
|
|
lpszUrl += dwLen;
|
|
|
|
}
|
2005-10-31 15:06:35 +01:00
|
|
|
|
2006-03-09 16:17:49 +01:00
|
|
|
/* all schemes are followed by at least a colon */
|
|
|
|
*lpszUrl = ':';
|
|
|
|
lpszUrl++;
|
|
|
|
|
|
|
|
if (!scheme_is_opaque(nScheme) || lpUrlComponents->lpszHostName)
|
|
|
|
{
|
|
|
|
memcpy(lpszUrl, slashSlashW, sizeof(slashSlashW));
|
2018-09-20 19:13:59 +02:00
|
|
|
lpszUrl += ARRAY_SIZE(slashSlashW);
|
2006-03-09 16:17:49 +01:00
|
|
|
}
|
2005-10-31 15:06:35 +01:00
|
|
|
|
|
|
|
if (lpUrlComponents->lpszUserName)
|
|
|
|
{
|
2006-03-06 18:31:56 +01:00
|
|
|
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, UserName);
|
|
|
|
memcpy(lpszUrl, lpUrlComponents->lpszUserName, dwLen * sizeof(WCHAR));
|
|
|
|
lpszUrl += dwLen;
|
2005-10-31 15:06:35 +01:00
|
|
|
|
|
|
|
if (lpUrlComponents->lpszPassword)
|
|
|
|
{
|
2006-03-06 18:31:56 +01:00
|
|
|
*lpszUrl = ':';
|
|
|
|
lpszUrl++;
|
2005-10-31 15:06:35 +01:00
|
|
|
|
2006-03-06 18:31:56 +01:00
|
|
|
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Password);
|
|
|
|
memcpy(lpszUrl, lpUrlComponents->lpszPassword, dwLen * sizeof(WCHAR));
|
|
|
|
lpszUrl += dwLen;
|
2005-10-31 15:06:35 +01:00
|
|
|
}
|
|
|
|
|
2006-03-06 18:31:56 +01:00
|
|
|
*lpszUrl = '@';
|
|
|
|
lpszUrl++;
|
2005-10-31 15:06:35 +01:00
|
|
|
}
|
|
|
|
|
2006-03-09 16:15:00 +01:00
|
|
|
if (lpUrlComponents->lpszHostName)
|
|
|
|
{
|
|
|
|
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
|
|
|
|
memcpy(lpszUrl, lpUrlComponents->lpszHostName, dwLen * sizeof(WCHAR));
|
|
|
|
lpszUrl += dwLen;
|
2006-03-09 16:18:24 +01:00
|
|
|
|
2006-03-09 16:19:15 +01:00
|
|
|
if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
|
|
|
|
{
|
|
|
|
*lpszUrl = ':';
|
|
|
|
lpszUrl++;
|
2016-11-12 10:36:20 +01:00
|
|
|
lpszUrl += sprintfW(lpszUrl, fmtW, lpUrlComponents->nPort);
|
2006-03-09 16:19:15 +01:00
|
|
|
}
|
|
|
|
|
2006-03-09 16:18:24 +01:00
|
|
|
/* add slash between hostname and path if necessary */
|
|
|
|
if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
|
|
|
|
{
|
|
|
|
*lpszUrl = '/';
|
|
|
|
lpszUrl++;
|
|
|
|
}
|
2006-03-09 16:15:00 +01:00
|
|
|
}
|
2005-10-31 15:06:35 +01:00
|
|
|
|
2006-03-09 16:19:15 +01:00
|
|
|
if (lpUrlComponents->lpszUrlPath)
|
|
|
|
{
|
|
|
|
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
|
|
|
|
memcpy(lpszUrl, lpUrlComponents->lpszUrlPath, dwLen * sizeof(WCHAR));
|
2006-03-06 18:31:56 +01:00
|
|
|
lpszUrl += dwLen;
|
2005-10-31 15:06:35 +01:00
|
|
|
}
|
|
|
|
|
2008-12-01 16:37:57 +01:00
|
|
|
if (lpUrlComponents->lpszExtraInfo)
|
|
|
|
{
|
|
|
|
dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, ExtraInfo);
|
|
|
|
memcpy(lpszUrl, lpUrlComponents->lpszExtraInfo, dwLen * sizeof(WCHAR));
|
|
|
|
lpszUrl += dwLen;
|
|
|
|
}
|
|
|
|
|
2006-03-06 18:31:56 +01:00
|
|
|
*lpszUrl = '\0';
|
2005-10-31 15:06:35 +01:00
|
|
|
|
|
|
|
return TRUE;
|
2003-07-19 05:08:05 +02:00
|
|
|
}
|
|
|
|
|
2005-11-23 20:14:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetConfirmZoneCrossingA (WININET.@)
|
|
|
|
*
|
|
|
|
*/
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
DWORD WINAPI InternetConfirmZoneCrossingA( HWND hWnd, LPSTR szUrlPrev, LPSTR szUrlNew, BOOL bPost )
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s, %s, %x) stub\n", hWnd, debugstr_a(szUrlPrev), debugstr_a(szUrlNew), bPost);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-11-23 20:14:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetConfirmZoneCrossingW (WININET.@)
|
|
|
|
*
|
|
|
|
*/
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
DWORD WINAPI InternetConfirmZoneCrossingW( HWND hWnd, LPWSTR szUrlPrev, LPWSTR szUrlNew, BOOL bPost )
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s, %s, %x) stub\n", hWnd, debugstr_w(szUrlPrev), debugstr_w(szUrlNew), bPost);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2009-06-25 11:52:14 +02:00
|
|
|
static DWORD zone_preference = 3;
|
|
|
|
|
2009-04-27 20:04:34 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* PrivacySetZonePreferenceW (WININET.@)
|
|
|
|
*/
|
|
|
|
DWORD WINAPI PrivacySetZonePreferenceW( DWORD zone, DWORD type, DWORD template, LPCWSTR preference )
|
|
|
|
{
|
|
|
|
FIXME( "%x %x %x %s: stub\n", zone, type, template, debugstr_w(preference) );
|
2009-06-25 11:52:14 +02:00
|
|
|
|
|
|
|
zone_preference = template;
|
2009-04-27 20:04:34 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PrivacyGetZonePreferenceW (WININET.@)
|
|
|
|
*/
|
|
|
|
DWORD WINAPI PrivacyGetZonePreferenceW( DWORD zone, DWORD type, LPDWORD template,
|
|
|
|
LPWSTR preference, LPDWORD length )
|
|
|
|
{
|
2009-06-25 11:52:14 +02:00
|
|
|
FIXME( "%x %x %p %p %p: stub\n", zone, type, template, preference, length );
|
|
|
|
|
|
|
|
if (template) *template = zone_preference;
|
2009-04-27 20:04:34 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-06-06 17:38:16 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetSecurityInfoByURLA (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetGetSecurityInfoByURLA(LPSTR lpszURL, PCCERT_CHAIN_CONTEXT *ppCertChain, DWORD *pdwSecureFlags)
|
|
|
|
{
|
2012-06-11 10:22:38 +02:00
|
|
|
WCHAR *url;
|
|
|
|
BOOL res;
|
|
|
|
|
|
|
|
TRACE("(%s %p %p)\n", debugstr_a(lpszURL), ppCertChain, pdwSecureFlags);
|
|
|
|
|
|
|
|
url = heap_strdupAtoW(lpszURL);
|
|
|
|
if(!url)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
res = InternetGetSecurityInfoByURLW(url, ppCertChain, pdwSecureFlags);
|
|
|
|
heap_free(url);
|
|
|
|
return res;
|
2012-06-06 17:38:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetSecurityInfoByURLW (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetGetSecurityInfoByURLW(LPCWSTR lpszURL, PCCERT_CHAIN_CONTEXT *ppCertChain, DWORD *pdwSecureFlags)
|
|
|
|
{
|
2012-06-11 10:22:38 +02:00
|
|
|
URL_COMPONENTSW url = {sizeof(url)};
|
|
|
|
server_t *server;
|
2016-04-27 19:19:47 +02:00
|
|
|
BOOL res;
|
2012-06-11 10:22:38 +02:00
|
|
|
|
|
|
|
TRACE("(%s %p %p)\n", debugstr_w(lpszURL), ppCertChain, pdwSecureFlags);
|
|
|
|
|
2018-01-09 12:06:25 +01:00
|
|
|
if (!ppCertChain && !pdwSecureFlags) {
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2016-04-27 19:19:47 +02:00
|
|
|
url.dwHostNameLength = 1;
|
2012-06-11 10:22:38 +02:00
|
|
|
res = InternetCrackUrlW(lpszURL, 0, 0, &url);
|
|
|
|
if(!res || url.nScheme != INTERNET_SCHEME_HTTPS) {
|
|
|
|
SetLastError(ERROR_INTERNET_ITEM_NOT_FOUND);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2016-05-17 19:18:32 +02:00
|
|
|
server = get_server(substr(url.lpszHostName, url.dwHostNameLength), url.nPort, TRUE, FALSE);
|
2012-06-11 10:22:38 +02:00
|
|
|
if(!server) {
|
|
|
|
SetLastError(ERROR_INTERNET_ITEM_NOT_FOUND);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(server->cert_chain) {
|
2018-01-09 12:06:25 +01:00
|
|
|
if(pdwSecureFlags)
|
2012-06-11 10:22:38 +02:00
|
|
|
*pdwSecureFlags = server->security_flags & _SECURITY_ERROR_FLAGS_MASK;
|
2018-01-09 12:06:25 +01:00
|
|
|
|
|
|
|
if(ppCertChain && !(*ppCertChain = CertDuplicateCertificateChain(server->cert_chain)))
|
2012-06-11 10:22:38 +02:00
|
|
|
res = FALSE;
|
|
|
|
}else {
|
|
|
|
SetLastError(ERROR_INTERNET_ITEM_NOT_FOUND);
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
server_release(server);
|
|
|
|
return res;
|
2012-06-06 17:38:16 +02:00
|
|
|
}
|
|
|
|
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
DWORD WINAPI InternetDialA( HWND hwndParent, LPSTR lpszConnectoid, DWORD dwFlags,
|
2007-08-30 16:21:33 +02:00
|
|
|
DWORD_PTR* lpdwConnection, DWORD dwReserved )
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("(%p, %p, 0x%08x, %p, 0x%08x) stub\n", hwndParent, lpszConnectoid, dwFlags,
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
lpdwConnection, dwReserved);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD WINAPI InternetDialW( HWND hwndParent, LPWSTR lpszConnectoid, DWORD dwFlags,
|
2007-08-30 16:21:33 +02:00
|
|
|
DWORD_PTR* lpdwConnection, DWORD dwReserved )
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("(%p, %p, 0x%08x, %p, 0x%08x) stub\n", hwndParent, lpszConnectoid, dwFlags,
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
lpdwConnection, dwReserved);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetGoOnlineA( LPSTR lpszURL, HWND hwndParent, DWORD dwReserved )
|
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("(%s, %p, 0x%08x) stub\n", debugstr_a(lpszURL), hwndParent, dwReserved);
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetGoOnlineW( LPWSTR lpszURL, HWND hwndParent, DWORD dwReserved )
|
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("(%s, %p, 0x%08x) stub\n", debugstr_w(lpszURL), hwndParent, dwReserved);
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-08-30 16:21:33 +02:00
|
|
|
DWORD WINAPI InternetHangUp( DWORD_PTR dwConnection, DWORD dwReserved )
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
{
|
2007-08-30 16:21:33 +02:00
|
|
|
FIXME("(0x%08lx, 0x%08x) stub\n", dwConnection, dwReserved);
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI CreateMD5SSOHash( PWSTR pszChallengeInfo, PWSTR pwszRealm, PWSTR pwszTarget,
|
|
|
|
PBYTE pbHexHash )
|
|
|
|
{
|
|
|
|
FIXME("(%s, %s, %s, %p) stub\n", debugstr_w(pszChallengeInfo), debugstr_w(pwszRealm),
|
|
|
|
debugstr_w(pwszTarget), pbHexHash);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI ResumeSuspendedDownload( HINTERNET hInternet, DWORD dwError )
|
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("(%p, 0x%08x) stub\n", hInternet, dwError);
|
- Stub implementations for FtpGetFileSize, FtpCommand{A,W},
HttpSendRequestExW, InternetGetLastResponseInfoW,
InternetConfirmZoneCrossing{A,W}, InternetDial{A,W},
InternetGoOnline{A,W}, InternetHangUp, CreateMD5SSOHash,
InternetClearAllPerSiteCookieDecisions,
InternetEnumPerSiteCookieDecision{A,W}, InternetGetCookieEx{A,W},
InternetGetPerSiteCookieDecision{A,W},
InternetSetPerSiteCookieDecision{A,W}, InternetSetCookieEx{A,W},
ResumeSuspendedDownload, RetrieveUrlCacheEntryFileW,
UnlockUrlCacheEntryFileW, {Create,Delete}UrlCacheEntryW,
CommitUrlCacheEntryW, RetrieveUrlCacheEntryStreamW,
FindCloseUrlCache, FindFirstUrlCacheEntryEx{A,W},
FindFirstUrlCacheGroup, FindNextUrlCacheEntry{,Ex}{A,W},
FindNextUrlCacheGroup, SetUrlCacheEntryGroup{A,W},
{Get,Set}UrlCacheGroupAttribute{A,W}, SetUrlCacheConfigInfo{A,W}.
- Spec file stubs for new undocumented functions
ForceNexusLookup{,ExW}, Ftp{Get,Put}FileEx, HttpCheckDavCompliance,
InternetAlgIdToString{A,W}, InternetFortezzaCommand,
InternetGetCertByURLA, InternetQueryFortezzaStatus,
InternetSecurityProtocolToString{A,W}, InternetSetDialState{A,W},
InternetShowSecurityInfoByURL{A,W}, IsUrlCacheEntryExpired{A,W},
Privacy{Get,Set}ZonePreferenceW, RegisterUrlCacheNotification,
UrlZonesDetach.
- Use memcpy instead of strncpy in InternetGetLastResponseInfoA.
- Add and improve some traces.
- Fix my own coding style in InternetTimeToSystemTimeW.
- Fix a couple of signedness warnings.
2005-02-01 19:50:53 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
2007-07-19 12:25:18 +02:00
|
|
|
|
2007-08-09 10:38:07 +02:00
|
|
|
BOOL WINAPI InternetQueryFortezzaStatus(DWORD *a, DWORD_PTR b)
|
2007-07-19 12:25:18 +02:00
|
|
|
{
|
2007-08-09 10:38:07 +02:00
|
|
|
FIXME("(%p, %08lx) stub\n", a, b);
|
2013-11-27 08:51:58 +01:00
|
|
|
return FALSE;
|
2007-07-19 12:25:18 +02:00
|
|
|
}
|
2011-10-31 19:37:47 +01:00
|
|
|
|
|
|
|
DWORD WINAPI ShowClientAuthCerts(HWND parent)
|
|
|
|
{
|
|
|
|
FIXME("%p: stub\n", parent);
|
|
|
|
return 0;
|
|
|
|
}
|