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
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2000-04-11 22:07:00 +02:00
|
|
|
*/
|
|
|
|
|
2000-04-15 22:44:21 +02:00
|
|
|
#include "config.h"
|
2003-11-27 01:59:36 +01:00
|
|
|
#include "wine/port.h"
|
2000-04-15 22:44:21 +02:00
|
|
|
|
2002-03-20 01:56:49 +01:00
|
|
|
#define MAXHOSTNAME 100 /* from http.c */
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
#include <string.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2002-03-20 01:56:49 +01:00
|
|
|
#include <stdio.h>
|
2000-04-11 22:07:00 +02:00
|
|
|
#include <sys/types.h>
|
2000-04-15 22:44:21 +02:00
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
# include <sys/socket.h>
|
|
|
|
#endif
|
2002-08-17 02:43:16 +02:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
# include <sys/time.h>
|
|
|
|
#endif
|
2000-04-11 22:07:00 +02:00
|
|
|
#include <stdlib.h>
|
2000-06-11 22:04:44 +02:00
|
|
|
#include <ctype.h>
|
2002-08-17 02:43:16 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2004-07-19 23:49:39 +02:00
|
|
|
#include <assert.h>
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "ntstatus.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"
|
2002-12-13 00:34:01 +01:00
|
|
|
#include "excpt.h"
|
2002-07-19 05:12:18 +02:00
|
|
|
|
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
|
|
|
|
|
|
|
#define MAX_IDLE_WORKER 1000*60*1
|
|
|
|
#define MAX_WORKER_THREADS 10
|
2000-06-11 22:04:44 +02:00
|
|
|
#define RESPONSE_TIMEOUT 30
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
#define GET_HWININET_FROM_LPWININETFINDNEXT(lpwh) \
|
2004-05-25 06:02:05 +02:00
|
|
|
(LPWININETAPPINFOW)(((LPWININETFTPSESSIONW)(lpwh->hdr.lpwhparent))->hdr.lpwhparent)
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2002-07-19 05:12:18 +02:00
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD dwError;
|
|
|
|
CHAR response[MAX_REPLY_LEN];
|
|
|
|
} WITHREADERROR, *LPWITHREADERROR;
|
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
static VOID INTERNET_CloseHandle(LPWININETHANDLEHEADER hdr);
|
|
|
|
BOOL WINAPI INTERNET_FindNextFileW(LPWININETFINDNEXTW lpwh, LPVOID lpvFindData);
|
|
|
|
HINTERNET WINAPI INTERNET_InternetOpenUrlW(LPWININETAPPINFOW hIC, LPCWSTR lpszUrl,
|
|
|
|
LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext);
|
2004-12-13 22:19:01 +01:00
|
|
|
static VOID INTERNET_ExecuteWork(void);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-11-29 19:00:10 +01:00
|
|
|
static DWORD g_dwTlsErrIndex = TLS_OUT_OF_INDEXES;
|
|
|
|
static DWORD dwNumThreads;
|
|
|
|
static DWORD dwNumIdleThreads;
|
|
|
|
static DWORD dwNumJobs;
|
|
|
|
static HANDLE hEventArray[2];
|
2000-04-11 22:07:00 +02:00
|
|
|
#define hQuitEvent hEventArray[0]
|
|
|
|
#define hWorkEvent hEventArray[1]
|
2004-11-29 19:00:10 +01:00
|
|
|
static CRITICAL_SECTION csQueue;
|
|
|
|
static LPWORKREQUEST lpHeadWorkQueue;
|
|
|
|
static LPWORKREQUEST lpWorkQueueTail;
|
|
|
|
static HMODULE WININET_hModule;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-12-13 22:19:01 +01:00
|
|
|
extern void URLCacheContainers_CreateDefaults(void);
|
|
|
|
extern void URLCacheContainers_DeleteAll(void);
|
2003-12-12 07:01:20 +01:00
|
|
|
|
2004-02-07 02:03:41 +01:00
|
|
|
#define HANDLE_CHUNK_SIZE 0x10
|
|
|
|
|
|
|
|
static CRITICAL_SECTION WININET_cs;
|
|
|
|
static CRITICAL_SECTION_DEBUG WININET_cs_debug =
|
|
|
|
{
|
|
|
|
0, 0, &WININET_cs,
|
|
|
|
{ &WININET_cs_debug.ProcessLocksList, &WININET_cs_debug.ProcessLocksList },
|
|
|
|
0, 0, { 0, (DWORD)(__FILE__ ": WININET_cs") }
|
|
|
|
};
|
|
|
|
static CRITICAL_SECTION WININET_cs = { &WININET_cs_debug, -1, 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
static LPWININETHANDLEHEADER *WININET_Handles;
|
|
|
|
static UINT WININET_dwNextHandle;
|
|
|
|
static UINT WININET_dwMaxHandles;
|
|
|
|
|
|
|
|
HINTERNET WININET_AllocHandle( LPWININETHANDLEHEADER info )
|
|
|
|
{
|
|
|
|
LPWININETHANDLEHEADER *p;
|
|
|
|
UINT handle = 0, num;
|
|
|
|
|
|
|
|
EnterCriticalSection( &WININET_cs );
|
|
|
|
if( !WININET_dwMaxHandles )
|
|
|
|
{
|
|
|
|
num = HANDLE_CHUNK_SIZE;
|
|
|
|
p = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
sizeof (UINT)* num);
|
|
|
|
if( !p )
|
|
|
|
goto end;
|
|
|
|
WININET_Handles = p;
|
|
|
|
WININET_dwMaxHandles = num;
|
|
|
|
}
|
|
|
|
if( WININET_dwMaxHandles == WININET_dwNextHandle )
|
|
|
|
{
|
|
|
|
num = WININET_dwMaxHandles + HANDLE_CHUNK_SIZE;
|
|
|
|
p = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
WININET_Handles, sizeof (UINT)* num);
|
|
|
|
if( !p )
|
|
|
|
goto end;
|
|
|
|
WININET_Handles = p;
|
|
|
|
WININET_dwMaxHandles = num;
|
|
|
|
}
|
|
|
|
|
|
|
|
handle = WININET_dwNextHandle;
|
|
|
|
if( WININET_Handles[handle] )
|
|
|
|
ERR("handle isn't free but should be\n");
|
2004-07-19 23:49:39 +02:00
|
|
|
WININET_Handles[handle] = WININET_AddRef( info );
|
2004-02-07 02:03:41 +01:00
|
|
|
|
|
|
|
while( WININET_Handles[WININET_dwNextHandle] &&
|
|
|
|
(WININET_dwNextHandle < WININET_dwMaxHandles ) )
|
|
|
|
WININET_dwNextHandle++;
|
|
|
|
|
|
|
|
end:
|
|
|
|
LeaveCriticalSection( &WININET_cs );
|
|
|
|
|
|
|
|
return (HINTERNET) (handle+1);
|
|
|
|
}
|
|
|
|
|
|
|
|
HINTERNET WININET_FindHandle( LPWININETHANDLEHEADER info )
|
|
|
|
{
|
|
|
|
UINT i, handle = 0;
|
|
|
|
|
|
|
|
EnterCriticalSection( &WININET_cs );
|
|
|
|
for( i=0; i<WININET_dwMaxHandles; i++ )
|
|
|
|
{
|
|
|
|
if( info == WININET_Handles[i] )
|
|
|
|
{
|
2004-07-19 23:49:39 +02:00
|
|
|
WININET_AddRef( info );
|
2004-02-07 02:03:41 +01:00
|
|
|
handle = i+1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LeaveCriticalSection( &WININET_cs );
|
|
|
|
|
|
|
|
return (HINTERNET) handle;
|
|
|
|
}
|
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETHANDLEHEADER WININET_AddRef( LPWININETHANDLEHEADER info )
|
|
|
|
{
|
|
|
|
info->dwRefCount++;
|
|
|
|
TRACE("%p -> refcount = %ld\n", info, info->dwRefCount );
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2004-02-07 02:03:41 +01:00
|
|
|
LPWININETHANDLEHEADER WININET_GetObject( HINTERNET hinternet )
|
|
|
|
{
|
|
|
|
LPWININETHANDLEHEADER info = NULL;
|
|
|
|
UINT handle = (UINT) hinternet;
|
|
|
|
|
|
|
|
EnterCriticalSection( &WININET_cs );
|
|
|
|
|
2004-09-24 00:53:04 +02:00
|
|
|
if( (handle > 0) && ( handle <= WININET_dwMaxHandles ) &&
|
|
|
|
WININET_Handles[handle-1] )
|
2004-07-19 23:49:39 +02:00
|
|
|
info = WININET_AddRef( WININET_Handles[handle-1] );
|
2004-02-07 02:03:41 +01:00
|
|
|
|
|
|
|
LeaveCriticalSection( &WININET_cs );
|
|
|
|
|
|
|
|
TRACE("handle %d -> %p\n", handle, info);
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
BOOL WININET_Release( LPWININETHANDLEHEADER info )
|
|
|
|
{
|
|
|
|
info->dwRefCount--;
|
|
|
|
TRACE( "object %p refcount = %ld\n", info, info->dwRefCount );
|
|
|
|
if( !info->dwRefCount )
|
|
|
|
{
|
|
|
|
TRACE( "destroying object %p\n", info);
|
|
|
|
info->destroy( info );
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-02-07 02:03:41 +01:00
|
|
|
BOOL WININET_FreeHandle( HINTERNET hinternet )
|
|
|
|
{
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
UINT handle = (UINT) hinternet;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETHANDLEHEADER info = NULL;
|
2004-02-07 02:03:41 +01:00
|
|
|
|
|
|
|
EnterCriticalSection( &WININET_cs );
|
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
if( (handle > 0) && ( handle <= WININET_dwMaxHandles ) )
|
2004-02-07 02:03:41 +01:00
|
|
|
{
|
|
|
|
handle--;
|
|
|
|
if( WININET_Handles[handle] )
|
|
|
|
{
|
2004-07-19 23:49:39 +02:00
|
|
|
info = WININET_Handles[handle];
|
|
|
|
TRACE( "destroying handle %d for object %p\n", handle+1, info);
|
2004-02-07 02:03:41 +01:00
|
|
|
WININET_Handles[handle] = NULL;
|
|
|
|
ret = TRUE;
|
|
|
|
if( WININET_dwNextHandle > handle )
|
|
|
|
WININET_dwNextHandle = handle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LeaveCriticalSection( &WININET_cs );
|
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
if( info )
|
|
|
|
WININET_Release( info );
|
|
|
|
|
2004-02-07 02:03:41 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2002-10-19 01:48:57 +02:00
|
|
|
TRACE("%p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
switch (fdwReason) {
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
|
|
|
|
g_dwTlsErrIndex = TlsAlloc();
|
|
|
|
|
|
|
|
if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES)
|
|
|
|
return FALSE;
|
|
|
|
|
2005-01-07 16:40:09 +01:00
|
|
|
hQuitEvent = CreateEventW(0, TRUE, FALSE, NULL);
|
|
|
|
hWorkEvent = CreateEventW(0, FALSE, FALSE, NULL);
|
2000-04-11 22:07:00 +02:00
|
|
|
InitializeCriticalSection(&csQueue);
|
|
|
|
|
2003-12-12 07:01:20 +01:00
|
|
|
URLCacheContainers_CreateDefaults();
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
dwNumThreads = 0;
|
|
|
|
dwNumIdleThreads = 0;
|
2002-11-13 20:40:50 +01:00
|
|
|
dwNumJobs = 0;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-11-21 16:42:57 +01:00
|
|
|
WININET_hModule = (HMODULE)hinstDLL;
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
case DLL_THREAD_ATTACH:
|
|
|
|
{
|
|
|
|
LPWITHREADERROR lpwite = HeapAlloc(GetProcessHeap(), 0, sizeof(WITHREADERROR));
|
2002-06-01 01:06:46 +02:00
|
|
|
if (NULL == lpwite)
|
2000-04-11 22:07:00 +02:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
TlsSetValue(g_dwTlsErrIndex, (LPVOID)lpwite);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DLL_THREAD_DETACH:
|
|
|
|
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
|
|
|
LPVOID lpwite = TlsGetValue(g_dwTlsErrIndex);
|
2004-12-21 15:42:35 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, lpwite);
|
2000-06-11 22:04:44 +02:00
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DLL_PROCESS_DETACH:
|
|
|
|
|
2003-12-12 07:01:20 +01:00
|
|
|
URLCacheContainers_DeleteAll();
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, TlsGetValue(g_dwTlsErrIndex));
|
|
|
|
TlsFree(g_dwTlsErrIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetEvent(hQuitEvent);
|
|
|
|
|
|
|
|
CloseHandle(hQuitEvent);
|
|
|
|
CloseHandle(hWorkEvent);
|
|
|
|
DeleteCriticalSection(&csQueue);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
INTERNET_SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
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");
|
|
|
|
INTERNET_SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2003-07-22 05:17:52 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_ConfigureProxyFromReg
|
|
|
|
*
|
|
|
|
* FIXME:
|
|
|
|
* The proxy may be specified in the form 'http=proxy.my.org'
|
|
|
|
* Presumably that means there can be ftp=ftpproxy.my.org too.
|
|
|
|
*/
|
2004-03-25 06:29:47 +01:00
|
|
|
static BOOL INTERNET_ConfigureProxyFromReg( LPWININETAPPINFOW lpwai )
|
2003-07-22 05:17:52 +02:00
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
DWORD r, keytype, len, enabled;
|
|
|
|
LPSTR lpszInternetSettings =
|
|
|
|
"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
|
2004-04-19 22:12:14 +02:00
|
|
|
static const WCHAR szProxyServer[] = { 'P','r','o','x','y','S','e','r','v','e','r', 0 };
|
2003-07-22 05:17:52 +02:00
|
|
|
|
|
|
|
r = RegOpenKeyA(HKEY_CURRENT_USER, lpszInternetSettings, &key);
|
|
|
|
if ( r != ERROR_SUCCESS )
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
len = sizeof enabled;
|
|
|
|
r = RegQueryValueExA( key, "ProxyEnable", NULL, &keytype,
|
|
|
|
(BYTE*)&enabled, &len);
|
|
|
|
if( (r == ERROR_SUCCESS) && enabled )
|
|
|
|
{
|
|
|
|
TRACE("Proxy is enabled.\n");
|
|
|
|
|
|
|
|
/* figure out how much memory the proxy setting takes */
|
2004-03-25 06:29:47 +01:00
|
|
|
r = RegQueryValueExW( key, szProxyServer, NULL, &keytype,
|
2003-07-22 05:17:52 +02:00
|
|
|
NULL, &len);
|
|
|
|
if( (r == ERROR_SUCCESS) && len && (keytype == REG_SZ) )
|
|
|
|
{
|
2004-03-25 06:29:47 +01:00
|
|
|
LPWSTR szProxy, p;
|
2004-04-19 22:12:14 +02:00
|
|
|
static const WCHAR szHttp[] = {'h','t','t','p','=',0};
|
2003-07-22 05:17:52 +02:00
|
|
|
|
2004-03-25 06:29:47 +01:00
|
|
|
szProxy=HeapAlloc( GetProcessHeap(), 0, len );
|
|
|
|
RegQueryValueExW( key, szProxyServer, NULL, &keytype,
|
2003-07-22 05:17:52 +02:00
|
|
|
(BYTE*)szProxy, &len);
|
|
|
|
|
|
|
|
/* find the http proxy, and strip away everything else */
|
2004-03-25 06:29:47 +01:00
|
|
|
p = strstrW( szProxy, szHttp );
|
2003-07-22 05:17:52 +02:00
|
|
|
if( p )
|
|
|
|
{
|
2004-03-25 06:29:47 +01:00
|
|
|
p += lstrlenW(szHttp);
|
|
|
|
lstrcpyW( szProxy, p );
|
2003-07-22 05:17:52 +02:00
|
|
|
}
|
2004-03-25 06:29:47 +01:00
|
|
|
p = strchrW( szProxy, ' ' );
|
2003-07-22 05:17:52 +02:00
|
|
|
if( p )
|
|
|
|
*p = 0;
|
|
|
|
|
|
|
|
lpwai->dwAccessType = INTERNET_OPEN_TYPE_PROXY;
|
|
|
|
lpwai->lpszProxy = szProxy;
|
|
|
|
|
2004-03-25 06:29:47 +01:00
|
|
|
TRACE("http proxy = %s\n", debugstr_w(lpwai->lpszProxy));
|
2003-07-22 05:17:52 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("Couldn't read proxy server settings.\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
TRACE("Proxy is not enabled.\n");
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
return enabled;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2004-03-25 06:29:47 +01:00
|
|
|
LPWININETAPPINFOW lpwai = NULL;
|
2004-02-09 23:01:49 +01:00
|
|
|
HINTERNET handle = NULL;
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
2004-03-25 06:29:47 +01:00
|
|
|
TRACE("(%s, %li, %s, %s, %li)\n", debugstr_w(lpszAgent), dwAccessType,
|
|
|
|
debugstr_w(lpszProxy), debugstr_w(lpszProxyBypass), dwFlags);
|
2004-02-09 23:01:49 +01:00
|
|
|
for (i = 0; i < (sizeof(access_type) / sizeof(access_type[0])); i++) {
|
|
|
|
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);
|
|
|
|
|
2004-03-25 06:29:47 +01:00
|
|
|
lpwai = HeapAlloc(GetProcessHeap(), 0, sizeof(WININETAPPINFOW));
|
2000-04-11 22:07:00 +02:00
|
|
|
if (NULL == lpwai)
|
2003-07-22 05:17:52 +02:00
|
|
|
{
|
2000-04-11 22:07:00 +02:00
|
|
|
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
|
2004-02-09 23:01:49 +01:00
|
|
|
goto lend;
|
2003-07-22 05:17:52 +02:00
|
|
|
}
|
|
|
|
|
2004-03-25 06:29:47 +01:00
|
|
|
memset(lpwai, 0, sizeof(WININETAPPINFOW));
|
2003-07-22 05:17:52 +02:00
|
|
|
lpwai->hdr.htype = WH_HINIT;
|
|
|
|
lpwai->hdr.lpwhparent = NULL;
|
|
|
|
lpwai->hdr.dwFlags = dwFlags;
|
2004-07-19 23:49:39 +02:00
|
|
|
lpwai->hdr.dwRefCount = 1;
|
|
|
|
lpwai->hdr.destroy = INTERNET_CloseHandle;
|
2003-07-22 05:17:52 +02:00
|
|
|
lpwai->dwAccessType = dwAccessType;
|
|
|
|
lpwai->lpszProxyUsername = NULL;
|
|
|
|
lpwai->lpszProxyPassword = NULL;
|
|
|
|
|
2004-02-07 02:03:41 +01:00
|
|
|
handle = WININET_AllocHandle( &lpwai->hdr );
|
|
|
|
if( !handle )
|
|
|
|
{
|
|
|
|
HeapFree( GetProcessHeap(), 0, lpwai );
|
|
|
|
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
|
2004-02-09 23:01:49 +01:00
|
|
|
goto lend;
|
2004-02-07 02:03:41 +01:00
|
|
|
}
|
|
|
|
|
2003-07-22 05:17:52 +02:00
|
|
|
if (NULL != lpszAgent)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2003-07-22 05:17:52 +02:00
|
|
|
lpwai->lpszAgent = HeapAlloc( GetProcessHeap(),0,
|
2004-03-25 06:29:47 +01:00
|
|
|
(strlenW(lpszAgent)+1)*sizeof(WCHAR));
|
2003-07-22 05:17:52 +02:00
|
|
|
if (lpwai->lpszAgent)
|
2004-03-25 06:29:47 +01:00
|
|
|
lstrcpyW( lpwai->lpszAgent, lpszAgent );
|
2003-07-22 05:17:52 +02:00
|
|
|
}
|
|
|
|
if(dwAccessType == INTERNET_OPEN_TYPE_PRECONFIG)
|
|
|
|
INTERNET_ConfigureProxyFromReg( lpwai );
|
|
|
|
else if (NULL != lpszProxy)
|
|
|
|
{
|
|
|
|
lpwai->lpszProxy = HeapAlloc( GetProcessHeap(), 0,
|
2004-03-25 06:29:47 +01:00
|
|
|
(strlenW(lpszProxy)+1)*sizeof(WCHAR));
|
2003-07-22 05:17:52 +02:00
|
|
|
if (lpwai->lpszProxy)
|
2004-03-25 06:29:47 +01:00
|
|
|
lstrcpyW( lpwai->lpszProxy, lpszProxy );
|
2003-07-22 05:17:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != lpszProxyBypass)
|
|
|
|
{
|
|
|
|
lpwai->lpszProxyBypass = HeapAlloc( GetProcessHeap(), 0,
|
2004-03-25 06:29:47 +01:00
|
|
|
(strlenW(lpszProxyBypass)+1)*sizeof(WCHAR));
|
2003-07-22 05:17:52 +02:00
|
|
|
if (lpwai->lpszProxyBypass)
|
2004-03-25 06:29:47 +01:00
|
|
|
lstrcpyW( lpwai->lpszProxyBypass, lpszProxyBypass );
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
lend:
|
|
|
|
if( lpwai )
|
|
|
|
WININET_Release( &lpwai->hdr );
|
|
|
|
|
|
|
|
TRACE("returning %p\n", lpwai);
|
2004-02-07 02:03:41 +01:00
|
|
|
|
|
|
|
return handle;
|
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
|
|
|
{
|
|
|
|
HINTERNET rc = (HINTERNET)NULL;
|
2004-03-25 06:29:47 +01:00
|
|
|
INT len;
|
|
|
|
WCHAR *szAgent = NULL, *szProxy = NULL, *szBypass = NULL;
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2004-03-25 06:29:47 +01:00
|
|
|
TRACE("(%s, 0x%08lx, %s, %s, 0x%08lx)\n", debugstr_a(lpszAgent),
|
|
|
|
dwAccessType, debugstr_a(lpszProxy), debugstr_a(lpszProxyBypass), dwFlags);
|
2003-12-12 07:01:20 +01:00
|
|
|
|
2004-03-25 06:29:47 +01:00
|
|
|
if( lpszAgent )
|
2002-10-28 19:48:24 +01:00
|
|
|
{
|
2004-03-25 06:29:47 +01:00
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, lpszAgent, -1, NULL, 0);
|
|
|
|
szAgent = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszAgent, -1, szAgent, len);
|
2002-10-28 19:48:24 +01:00
|
|
|
}
|
|
|
|
|
2004-03-25 06:29:47 +01:00
|
|
|
if( lpszProxy )
|
|
|
|
{
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, lpszProxy, -1, NULL, 0);
|
|
|
|
szProxy = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszProxy, -1, szProxy, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
if( lpszProxyBypass )
|
|
|
|
{
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, lpszProxyBypass, -1, NULL, 0);
|
|
|
|
szBypass = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszProxyBypass, -1, szBypass, len);
|
|
|
|
}
|
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
|
|
|
|
2004-12-21 15:42:35 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, szAgent);
|
|
|
|
HeapFree(GetProcessHeap(), 0, szProxy);
|
|
|
|
HeapFree(GetProcessHeap(), 0, 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)
|
|
|
|
{
|
|
|
|
LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex);
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
|
|
|
*lpdwError = lpwite->dwError;
|
|
|
|
if (lpwite->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
|
|
|
memcpy(lpszBuffer, lpwite->response, *lpdwBufferLength);
|
|
|
|
*lpdwBufferLength = strlen(lpszBuffer);
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
*lpdwBufferLength = 0;
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex);
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
|
|
|
*lpdwError = lpwite->dwError;
|
|
|
|
if (lpwite->dwError)
|
|
|
|
{
|
|
|
|
memcpy(lpszBuffer, lpwite->response, *lpdwBufferLength);
|
|
|
|
*lpdwBufferLength = lstrlenW(lpszBuffer);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*lpdwBufferLength = 0;
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2003-12-12 07:01:20 +01:00
|
|
|
TRACE("(%p, 0x%08lx)\n", lpdwStatus, dwReserved);
|
|
|
|
|
2001-07-11 19:24:39 +02:00
|
|
|
if (lpdwStatus) {
|
|
|
|
FIXME("always returning LAN connection.\n");
|
|
|
|
*lpdwStatus = INTERNET_CONNECTION_LAN;
|
|
|
|
}
|
|
|
|
return TRUE;
|
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)
|
|
|
|
{
|
2004-11-21 16:42:57 +01:00
|
|
|
TRACE("(%p, %p, %ld, 0x%08lx)\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)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (lpdwStatus) {
|
|
|
|
FIXME("always returning LAN connection.\n");
|
|
|
|
*lpdwStatus = INTERNET_CONNECTION_LAN;
|
|
|
|
}
|
2004-11-21 16:42:57 +01:00
|
|
|
return LoadStringW(WININET_hModule, IDS_LANCONNECTION, lpszConnectionName, dwNameLen);
|
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;
|
|
|
|
|
2004-11-21 16:42:57 +01:00
|
|
|
TRACE("(%p, %p, %ld, 0x%08lx)\n", lpdwStatus, lpszConnectionName, dwNameLen, dwReserved);
|
2004-11-04 22:05:03 +01:00
|
|
|
|
|
|
|
if (lpszConnectionName && dwNameLen > 0)
|
|
|
|
lpwszConnectionName= HeapAlloc(GetProcessHeap(), 0, dwNameLen * sizeof(WCHAR));
|
|
|
|
|
|
|
|
rc = InternetGetConnectedStateExW(lpdwStatus,lpwszConnectionName, dwNameLen,
|
|
|
|
dwReserved);
|
|
|
|
if (rc && lpwszConnectionName)
|
|
|
|
{
|
|
|
|
WideCharToMultiByte(CP_ACP,0,lpwszConnectionName,-1,lpszConnectionName,
|
|
|
|
dwNameLen, NULL, NULL);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(),0,lpwszConnectionName);
|
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
2000-04-11 22:07:00 +02:00
|
|
|
DWORD dwService, DWORD dwFlags, DWORD dwContext)
|
|
|
|
{
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETAPPINFOW hIC;
|
2000-04-11 22:07:00 +02:00
|
|
|
HINTERNET rc = (HINTERNET) NULL;
|
|
|
|
|
2004-03-30 06:36:09 +02:00
|
|
|
TRACE("(%p, %s, %i, %s, %s, %li, %li, %li)\n", hInternet, debugstr_w(lpszServerName),
|
|
|
|
nServerPort, debugstr_w(lpszUserName), debugstr_w(lpszPassword),
|
2003-06-21 01:26:56 +02:00
|
|
|
dwService, dwFlags, dwContext);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
/* Clear any error information */
|
|
|
|
INTERNET_SetLastError(0);
|
2004-07-19 23:49:39 +02:00
|
|
|
hIC = (LPWININETAPPINFOW) WININET_GetObject( hInternet );
|
|
|
|
if ( (hIC == NULL) || (hIC->hdr.htype != WH_HINIT) )
|
|
|
|
goto lend;
|
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);
|
2000-04-11 22:07:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case INTERNET_SERVICE_HTTP:
|
2004-07-19 23:49:39 +02:00
|
|
|
rc = HTTP_Connect(hIC, lpszServerName, nServerPort,
|
2004-05-13 07:17:25 +02:00
|
|
|
lpszUserName, lpszPassword, dwFlags, dwContext, 0);
|
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);
|
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,
|
2002-10-28 19:48:24 +01:00
|
|
|
DWORD dwService, DWORD dwFlags, DWORD dwContext)
|
|
|
|
{
|
|
|
|
HINTERNET rc = (HINTERNET)NULL;
|
2004-03-30 06:36:09 +02:00
|
|
|
INT len = 0;
|
|
|
|
LPWSTR szServerName = NULL;
|
|
|
|
LPWSTR szUserName = NULL;
|
|
|
|
LPWSTR szPassword = NULL;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
|
|
|
if (lpszServerName)
|
2002-10-28 19:48:24 +01:00
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, lpszServerName, -1, NULL, 0);
|
|
|
|
szServerName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszServerName, -1, szServerName, len);
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
if (lpszUserName)
|
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, NULL, 0);
|
|
|
|
szUserName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszUserName, -1, szUserName, len);
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
if (lpszPassword)
|
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, lpszPassword, -1, NULL, 0);
|
|
|
|
szPassword = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszPassword, -1, szPassword, len);
|
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);
|
|
|
|
|
2004-12-21 15:42:35 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, szServerName);
|
|
|
|
HeapFree(GetProcessHeap(), 0, szUserName);
|
|
|
|
HeapFree(GetProcessHeap(), 0, 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
|
|
|
{
|
2004-03-25 06:29:47 +01:00
|
|
|
LPWININETAPPINFOW hIC = NULL;
|
2004-05-25 06:02:05 +02:00
|
|
|
LPWININETFINDNEXTW lpwh;
|
2004-07-19 23:49:39 +02:00
|
|
|
BOOL bSuccess = FALSE;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
lpwh = (LPWININETFINDNEXTW) WININET_GetObject( hFind );
|
2000-04-11 22:07:00 +02:00
|
|
|
if (NULL == lpwh || lpwh->hdr.htype != WH_HFINDNEXT)
|
|
|
|
{
|
|
|
|
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
2004-07-19 23:49:39 +02:00
|
|
|
goto lend;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
hIC = GET_HWININET_FROM_LPWININETFINDNEXT(lpwh);
|
|
|
|
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
|
|
|
|
{
|
|
|
|
WORKREQUEST workRequest;
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_INTERNETFINDNEXTW *req;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
workRequest.asyncall = INTERNETFINDNEXTW;
|
2004-07-19 23:49:39 +02:00
|
|
|
workRequest.hdr = WININET_AddRef( &lpwh->hdr );
|
2004-05-25 06:02:05 +02:00
|
|
|
req = &workRequest.u.InternetFindNextW;
|
2003-09-25 22:25:22 +02:00
|
|
|
req->lpFindFileData = lpvFindData;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
bSuccess = INTERNET_AsyncCall(&workRequest);
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-07-19 23:49:39 +02:00
|
|
|
bSuccess = INTERNET_FindNextFileW(lpwh, lpvFindData);
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
2004-07-19 23:49:39 +02:00
|
|
|
lend:
|
|
|
|
if( lpwh )
|
|
|
|
WININET_Release( &lpwh->hdr );
|
|
|
|
return bSuccess;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2004-05-25 06:02:05 +02:00
|
|
|
* INTERNET_FindNextFileW (Internal)
|
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
|
|
|
|
*
|
|
|
|
*/
|
2004-07-19 23:49:39 +02:00
|
|
|
BOOL WINAPI INTERNET_FindNextFileW(LPWININETFINDNEXTW lpwh, LPVOID lpvFindData)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
|
|
|
BOOL bSuccess = TRUE;
|
2004-05-25 06:02:05 +02:00
|
|
|
LPWIN32_FIND_DATAW lpFindFileData;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
assert (lpwh->hdr.htype == WH_HFINDNEXT);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
/* Clear any error information */
|
|
|
|
INTERNET_SetLastError(0);
|
|
|
|
|
|
|
|
if (lpwh->hdr.lpwhparent->htype != WH_HFTPSESSION)
|
|
|
|
{
|
|
|
|
FIXME("Only FTP find next supported\n");
|
|
|
|
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-08-09 20:54:23 +02:00
|
|
|
TRACE("index(%ld) size(%ld)\n", lpwh->index, lpwh->size);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
lpFindFileData = (LPWIN32_FIND_DATAW) lpvFindData;
|
2000-04-11 22:07:00 +02:00
|
|
|
ZeroMemory(lpFindFileData, sizeof(WIN32_FIND_DATAA));
|
|
|
|
|
|
|
|
if (lpwh->index >= lpwh->size)
|
|
|
|
{
|
|
|
|
INTERNET_SetLastError(ERROR_NO_MORE_FILES);
|
|
|
|
bSuccess = FALSE;
|
|
|
|
goto lend;
|
|
|
|
}
|
|
|
|
|
|
|
|
FTP_ConvertFileProp(&lpwh->lpafp[lpwh->index], lpFindFileData);
|
|
|
|
lpwh->index++;
|
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
TRACE("\nName: %s\nSize: %ld\n", debugstr_w(lpFindFileData->cFileName), lpFindFileData->nFileSizeLow);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
lend:
|
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
if (lpwh->hdr.dwFlags & INTERNET_FLAG_ASYNC && lpwh->hdr.lpfnStatusCB)
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2000-04-11 22:07:00 +02:00
|
|
|
INTERNET_ASYNC_RESULT iar;
|
|
|
|
|
|
|
|
iar.dwResult = (DWORD)bSuccess;
|
2002-06-22 01:59:49 +02:00
|
|
|
iar.dwError = iar.dwError = bSuccess ? ERROR_SUCCESS :
|
|
|
|
INTERNET_GetLastError();
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
SendAsyncCallback(&lpwh->hdr, lpwh->hdr.dwContext,
|
2002-06-22 01:59:49 +02:00
|
|
|
INTERNET_STATUS_REQUEST_COMPLETE, &iar,
|
|
|
|
sizeof(INTERNET_ASYNC_RESULT));
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-11 22:04:44 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_CloseHandle (internal)
|
|
|
|
*
|
|
|
|
* Close internet handle
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Void
|
|
|
|
*
|
|
|
|
*/
|
2004-07-19 23:49:39 +02:00
|
|
|
static VOID INTERNET_CloseHandle(LPWININETHANDLEHEADER hdr)
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETAPPINFOW lpwai = (LPWININETAPPINFOW) hdr;
|
2002-06-22 01:59:49 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
TRACE("%p\n",lpwai);
|
2002-06-22 01:59:49 +02:00
|
|
|
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, lpwai->lpszAgent);
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwai->lpszProxy);
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyBypass);
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyUsername);
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyPassword);
|
2000-06-11 22:04:44 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, lpwai);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2004-09-20 21:10:31 +02:00
|
|
|
LPWININETHANDLEHEADER lpwh;
|
2004-07-19 23:49:39 +02:00
|
|
|
|
2002-06-22 01:59:49 +02:00
|
|
|
TRACE("%p\n",hInternet);
|
2004-02-07 02:03:41 +01:00
|
|
|
|
|
|
|
lpwh = WININET_GetObject( hInternet );
|
2000-04-11 22:07:00 +02:00
|
|
|
if (NULL == lpwh)
|
2004-02-07 02:03:41 +01:00
|
|
|
{
|
|
|
|
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
|
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
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
SendAsyncCallback(lpwh, lpwh->dwContext,
|
2004-11-19 18:54:48 +01:00
|
|
|
INTERNET_STATUS_HANDLE_CLOSING, &hInternet,
|
|
|
|
sizeof(HINTERNET*));
|
2002-07-19 05:12:18 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
if( lpwh->lpwhparent )
|
|
|
|
WININET_Release( lpwh->lpwhparent );
|
|
|
|
WININET_FreeHandle( hInternet );
|
|
|
|
WININET_Release( lpwh );
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-11 22:04:44 +02:00
|
|
|
/***********************************************************************
|
2003-01-03 00:08:22 +01:00
|
|
|
* ConvertUrlComponentValue (Internal)
|
2000-06-11 22:04:44 +02:00
|
|
|
*
|
2003-04-14 23:32:36 +02:00
|
|
|
* Helper function for InternetCrackUrlW
|
2000-06-11 22:04:44 +02:00
|
|
|
*
|
|
|
|
*/
|
2004-11-29 19:00:10 +01:00
|
|
|
static void ConvertUrlComponentValue(LPSTR* lppszComponent, LPDWORD dwComponentLen,
|
|
|
|
LPWSTR lpwszComponent, DWORD dwwComponentLen,
|
|
|
|
LPCSTR lpszStart, LPCWSTR lpwszStart)
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
|
|
|
if (*dwComponentLen != 0)
|
|
|
|
{
|
2004-08-09 20:54:23 +02:00
|
|
|
DWORD nASCIILength=WideCharToMultiByte(CP_ACP,0,lpwszComponent,dwwComponentLen,NULL,0,NULL,NULL);
|
2003-01-03 00:08:22 +01:00
|
|
|
if (*lppszComponent == NULL)
|
|
|
|
{
|
|
|
|
int nASCIIOffset=WideCharToMultiByte(CP_ACP,0,lpwszStart,lpwszComponent-lpwszStart,NULL,0,NULL,NULL);
|
|
|
|
*lppszComponent = (LPSTR)lpszStart+nASCIIOffset;
|
|
|
|
*dwComponentLen = nASCIILength;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-08-09 20:54:23 +02:00
|
|
|
DWORD ncpylen = min((*dwComponentLen)-1, nASCIILength);
|
2003-01-03 00:08:22 +01:00
|
|
|
WideCharToMultiByte(CP_ACP,0,lpwszComponent,dwwComponentLen,*lppszComponent,ncpylen+1,NULL,NULL);
|
|
|
|
(*lppszComponent)[ncpylen]=0;
|
|
|
|
*dwComponentLen = ncpylen;
|
|
|
|
}
|
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
|
|
|
*
|
|
|
|
* Break up URL into its components
|
|
|
|
*
|
2002-03-20 01:56:49 +01:00
|
|
|
* TODO: Handle dwFlags
|
2000-06-11 22:04:44 +02:00
|
|
|
*
|
2000-04-11 22:07:00 +02:00
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
|
2002-10-28 19:48:24 +01:00
|
|
|
LPURL_COMPONENTSA lpUrlComponents)
|
2003-01-03 00:08:22 +01:00
|
|
|
{
|
|
|
|
DWORD nLength;
|
|
|
|
URL_COMPONENTSW UCW;
|
|
|
|
WCHAR* lpwszUrl;
|
2004-07-04 02:06:44 +02:00
|
|
|
|
|
|
|
if(dwUrlLength<=0)
|
|
|
|
dwUrlLength=-1;
|
|
|
|
nLength=MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,NULL,0);
|
|
|
|
lpwszUrl=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WCHAR)*nLength);
|
|
|
|
MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,nLength);
|
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
memset(&UCW,0,sizeof(UCW));
|
|
|
|
if(lpUrlComponents->dwHostNameLength!=0)
|
|
|
|
UCW.dwHostNameLength=1;
|
|
|
|
if(lpUrlComponents->dwUserNameLength!=0)
|
|
|
|
UCW.dwUserNameLength=1;
|
|
|
|
if(lpUrlComponents->dwPasswordLength!=0)
|
|
|
|
UCW.dwPasswordLength=1;
|
|
|
|
if(lpUrlComponents->dwUrlPathLength!=0)
|
|
|
|
UCW.dwUrlPathLength=1;
|
|
|
|
if(lpUrlComponents->dwSchemeLength!=0)
|
|
|
|
UCW.dwSchemeLength=1;
|
|
|
|
if(lpUrlComponents->dwExtraInfoLength!=0)
|
|
|
|
UCW.dwExtraInfoLength=1;
|
|
|
|
if(!InternetCrackUrlW(lpwszUrl,nLength,dwFlags,&UCW))
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwszUrl);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-11-29 19:00:10 +01:00
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
ConvertUrlComponentValue(&lpUrlComponents->lpszHostName, &lpUrlComponents->dwHostNameLength,
|
|
|
|
UCW.lpszHostName, UCW.dwHostNameLength,
|
|
|
|
lpszUrl, lpwszUrl);
|
|
|
|
ConvertUrlComponentValue(&lpUrlComponents->lpszUserName, &lpUrlComponents->dwUserNameLength,
|
|
|
|
UCW.lpszUserName, UCW.dwUserNameLength,
|
|
|
|
lpszUrl, lpwszUrl);
|
|
|
|
ConvertUrlComponentValue(&lpUrlComponents->lpszPassword, &lpUrlComponents->dwPasswordLength,
|
|
|
|
UCW.lpszPassword, UCW.dwPasswordLength,
|
|
|
|
lpszUrl, lpwszUrl);
|
|
|
|
ConvertUrlComponentValue(&lpUrlComponents->lpszUrlPath, &lpUrlComponents->dwUrlPathLength,
|
|
|
|
UCW.lpszUrlPath, UCW.dwUrlPathLength,
|
|
|
|
lpszUrl, lpwszUrl);
|
|
|
|
ConvertUrlComponentValue(&lpUrlComponents->lpszScheme, &lpUrlComponents->dwSchemeLength,
|
|
|
|
UCW.lpszScheme, UCW.dwSchemeLength,
|
|
|
|
lpszUrl, lpwszUrl);
|
|
|
|
ConvertUrlComponentValue(&lpUrlComponents->lpszExtraInfo, &lpUrlComponents->dwExtraInfoLength,
|
|
|
|
UCW.lpszExtraInfo, UCW.dwExtraInfoLength,
|
|
|
|
lpszUrl, lpwszUrl);
|
|
|
|
lpUrlComponents->nScheme=UCW.nScheme;
|
|
|
|
lpUrlComponents->nPort=UCW.nPort;
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwszUrl);
|
|
|
|
|
|
|
|
TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", lpszUrl,
|
|
|
|
debugstr_an(lpUrlComponents->lpszScheme,lpUrlComponents->dwSchemeLength),
|
|
|
|
debugstr_an(lpUrlComponents->lpszHostName,lpUrlComponents->dwHostNameLength),
|
|
|
|
debugstr_an(lpUrlComponents->lpszUrlPath,lpUrlComponents->dwUrlPathLength),
|
|
|
|
debugstr_an(lpUrlComponents->lpszExtraInfo,lpUrlComponents->dwExtraInfoLength));
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* 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
|
|
|
{
|
|
|
|
INTERNET_SCHEME iScheme=INTERNET_SCHEME_UNKNOWN;
|
2004-04-19 22:12:14 +02:00
|
|
|
static const WCHAR lpszFtp[]={'f','t','p',0};
|
|
|
|
static const WCHAR lpszGopher[]={'g','o','p','h','e','r',0};
|
|
|
|
static const WCHAR lpszHttp[]={'h','t','t','p',0};
|
|
|
|
static const WCHAR lpszHttps[]={'h','t','t','p','s',0};
|
|
|
|
static const WCHAR lpszFile[]={'f','i','l','e',0};
|
|
|
|
static const WCHAR lpszNews[]={'n','e','w','s',0};
|
|
|
|
static const WCHAR lpszMailto[]={'m','a','i','l','t','o',0};
|
|
|
|
static const WCHAR lpszRes[]={'r','e','s',0};
|
2003-01-03 00:08:22 +01:00
|
|
|
WCHAR* tempBuffer=NULL;
|
|
|
|
TRACE("\n");
|
|
|
|
if(lpszScheme==NULL)
|
|
|
|
return INTERNET_SCHEME_UNKNOWN;
|
|
|
|
|
2003-09-22 21:45:50 +02:00
|
|
|
tempBuffer=HeapAlloc(GetProcessHeap(),0,(nMaxCmp+1)*sizeof(WCHAR));
|
2005-03-28 16:17:51 +02:00
|
|
|
lstrcpynW(tempBuffer,lpszScheme,nMaxCmp+1);
|
2003-01-03 00:08:22 +01:00
|
|
|
strlwrW(tempBuffer);
|
|
|
|
if (nMaxCmp==strlenW(lpszFtp) && !strncmpW(lpszFtp, tempBuffer, nMaxCmp))
|
|
|
|
iScheme=INTERNET_SCHEME_FTP;
|
|
|
|
else if (nMaxCmp==strlenW(lpszGopher) && !strncmpW(lpszGopher, tempBuffer, nMaxCmp))
|
|
|
|
iScheme=INTERNET_SCHEME_GOPHER;
|
|
|
|
else if (nMaxCmp==strlenW(lpszHttp) && !strncmpW(lpszHttp, tempBuffer, nMaxCmp))
|
|
|
|
iScheme=INTERNET_SCHEME_HTTP;
|
|
|
|
else if (nMaxCmp==strlenW(lpszHttps) && !strncmpW(lpszHttps, tempBuffer, nMaxCmp))
|
|
|
|
iScheme=INTERNET_SCHEME_HTTPS;
|
|
|
|
else if (nMaxCmp==strlenW(lpszFile) && !strncmpW(lpszFile, tempBuffer, nMaxCmp))
|
|
|
|
iScheme=INTERNET_SCHEME_FILE;
|
|
|
|
else if (nMaxCmp==strlenW(lpszNews) && !strncmpW(lpszNews, tempBuffer, nMaxCmp))
|
|
|
|
iScheme=INTERNET_SCHEME_NEWS;
|
|
|
|
else if (nMaxCmp==strlenW(lpszMailto) && !strncmpW(lpszMailto, tempBuffer, nMaxCmp))
|
|
|
|
iScheme=INTERNET_SCHEME_MAILTO;
|
|
|
|
else if (nMaxCmp==strlenW(lpszRes) && !strncmpW(lpszRes, tempBuffer, nMaxCmp))
|
|
|
|
iScheme=INTERNET_SCHEME_RES;
|
2003-09-22 21:45:50 +02:00
|
|
|
HeapFree(GetProcessHeap(),0,tempBuffer);
|
2003-01-03 00:08:22 +01:00
|
|
|
return iScheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SetUrlComponentValueW (Internal)
|
|
|
|
*
|
|
|
|
* Helper function for InternetCrackUrlW
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2004-08-09 20:54:23 +02:00
|
|
|
static BOOL SetUrlComponentValueW(LPWSTR* lppszComponent, LPDWORD dwComponentLen, LPCWSTR lpszStart, DWORD len)
|
2003-01-03 00:08:22 +01:00
|
|
|
{
|
2004-08-09 20:54:23 +02:00
|
|
|
TRACE("%s (%ld)\n", debugstr_wn(lpszStart,len), len);
|
2003-01-03 00:08:22 +01:00
|
|
|
|
2004-08-06 20:57:53 +02:00
|
|
|
if ( (*dwComponentLen == 0) && (*lppszComponent == NULL) )
|
|
|
|
return FALSE;
|
|
|
|
|
2003-06-21 01:26:56 +02:00
|
|
|
if (*dwComponentLen != 0 || *lppszComponent == NULL)
|
2003-01-03 00:08:22 +01:00
|
|
|
{
|
|
|
|
if (*lppszComponent == NULL)
|
|
|
|
{
|
|
|
|
*lppszComponent = (LPWSTR)lpszStart;
|
|
|
|
*dwComponentLen = len;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-08-09 20:54:23 +02:00
|
|
|
DWORD ncpylen = min((*dwComponentLen)-1, len);
|
2003-01-03 00:08:22 +01:00
|
|
|
strncpyW(*lppszComponent, lpszStart, ncpylen);
|
|
|
|
(*lppszComponent)[ncpylen] = '\0';
|
|
|
|
*dwComponentLen = ncpylen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetCrackUrlW (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
|
|
|
|
LPURL_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;
|
2000-04-11 22:07:00 +02:00
|
|
|
BOOL bIsAbsolute = FALSE;
|
2004-06-01 22:19:56 +02:00
|
|
|
LPCWSTR lpszap = lpszUrl;
|
|
|
|
LPCWSTR lpszcp = NULL;
|
2004-04-13 01:13:53 +02:00
|
|
|
const WCHAR lpszSeparators[3]={';','?',0};
|
|
|
|
const WCHAR lpszSlash[2]={'/',0};
|
2003-01-03 00:08:22 +01:00
|
|
|
if(dwUrlLength==0)
|
|
|
|
dwUrlLength=strlenW(lpszUrl);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-11-29 19:00:10 +01:00
|
|
|
TRACE("(%s %lu %lx %p)\n", debugstr_w(lpszUrl), dwUrlLength, dwFlags, lpUC);
|
2000-06-11 22:04:44 +02:00
|
|
|
|
|
|
|
/* Determine if the URI is absolute. */
|
|
|
|
while (*lpszap != '\0')
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2003-01-03 00:08:22 +01:00
|
|
|
if (isalnumW(*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;
|
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
if ((*lpszap == ':') && (lpszap - lpszUrl >= 2))
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
|
|
|
bIsAbsolute = 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;
|
|
|
|
}
|
|
|
|
|
2000-06-11 22:04:44 +02:00
|
|
|
/* Parse <params> */
|
2003-01-03 00:08:22 +01:00
|
|
|
lpszParam = strpbrkW(lpszap, lpszSeparators);
|
2000-06-11 22:04:44 +02:00
|
|
|
if (lpszParam != NULL)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2004-08-06 20:57:53 +02:00
|
|
|
SetUrlComponentValueW(&lpUC->lpszExtraInfo, &lpUC->dwExtraInfoLength,
|
|
|
|
lpszParam, dwUrlLength-(lpszParam-lpszUrl));
|
2003-01-03 00:08:22 +01:00
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2000-06-11 22:04:44 +02:00
|
|
|
if (bIsAbsolute) /* Parse <protocol>:[//<net_loc>] */
|
2003-01-03 00:08:22 +01:00
|
|
|
{
|
2004-06-01 22:19:56 +02:00
|
|
|
LPCWSTR lpszNetLoc;
|
2004-04-19 22:12:14 +02:00
|
|
|
static const WCHAR wszAbout[]={'a','b','o','u','t',':',0};
|
2000-06-11 22:04:44 +02:00
|
|
|
|
|
|
|
/* Get scheme first. */
|
2003-01-03 00:08:22 +01:00
|
|
|
lpUC->nScheme = GetInternetSchemeW(lpszUrl, lpszcp - lpszUrl);
|
2004-08-06 20:57:53 +02:00
|
|
|
SetUrlComponentValueW(&lpUC->lpszScheme, &lpUC->dwSchemeLength,
|
|
|
|
lpszUrl, lpszcp - lpszUrl);
|
2000-06-11 22:04:44 +02:00
|
|
|
|
|
|
|
/* Eat ':' in protocol. */
|
|
|
|
lpszcp++;
|
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
/* if the scheme is "about", there is no host */
|
|
|
|
if(strncmpW(wszAbout,lpszUrl, lpszcp - lpszUrl)==0)
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
2003-01-03 00:08:22 +01:00
|
|
|
SetUrlComponentValueW(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0);
|
|
|
|
SetUrlComponentValueW(&lpUC->lpszPassword, &lpUC->dwPasswordLength, NULL, 0);
|
|
|
|
SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength, NULL, 0);
|
|
|
|
lpUC->nPort = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Skip over slashes. */
|
2000-06-11 22:04:44 +02:00
|
|
|
if (*lpszcp == '/')
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2000-06-11 22:04:44 +02:00
|
|
|
lpszcp++;
|
|
|
|
if (*lpszcp == '/')
|
2003-01-03 00:08:22 +01:00
|
|
|
{
|
2000-06-11 22:04:44 +02:00
|
|
|
lpszcp++;
|
2003-01-03 00:08:22 +01:00
|
|
|
if (*lpszcp == '/')
|
|
|
|
lpszcp++;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
lpszNetLoc = strpbrkW(lpszcp, lpszSlash);
|
|
|
|
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
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
/* Parse net-loc */
|
|
|
|
if (lpszNetLoc)
|
|
|
|
{
|
2004-06-01 22:19:56 +02:00
|
|
|
LPCWSTR lpszHost;
|
|
|
|
LPCWSTR lpszPort;
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
/* [<user>[<:password>]@]<host>[:<port>] */
|
2003-01-03 00:08:22 +01:00
|
|
|
/* First find the user and password if they exist */
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
lpszHost = strchrW(lpszcp, '@');
|
|
|
|
if (lpszHost == NULL || lpszHost > lpszNetLoc)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2003-01-03 00:08:22 +01:00
|
|
|
/* username and password not specified. */
|
|
|
|
SetUrlComponentValueW(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0);
|
|
|
|
SetUrlComponentValueW(&lpUC->lpszPassword, &lpUC->dwPasswordLength, NULL, 0);
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
2003-01-03 00:08:22 +01:00
|
|
|
else /* Parse out username and password */
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2004-06-01 22:19:56 +02:00
|
|
|
LPCWSTR lpszUser = lpszcp;
|
|
|
|
LPCWSTR lpszPasswd = lpszHost;
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
while (lpszcp < lpszHost)
|
|
|
|
{
|
|
|
|
if (*lpszcp == ':')
|
|
|
|
lpszPasswd = lpszcp;
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
lpszcp++;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
SetUrlComponentValueW(&lpUC->lpszUserName, &lpUC->dwUserNameLength,
|
|
|
|
lpszUser, lpszPasswd - lpszUser);
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
if (lpszPasswd != lpszHost)
|
|
|
|
lpszPasswd++;
|
|
|
|
SetUrlComponentValueW(&lpUC->lpszPassword, &lpUC->dwPasswordLength,
|
|
|
|
lpszPasswd == lpszHost ? NULL : lpszPasswd,
|
|
|
|
lpszHost - lpszPasswd);
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
lpszcp++; /* Advance to beginning of host */
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
/* Parse <host><:port> */
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
lpszHost = lpszcp;
|
|
|
|
lpszPort = lpszNetLoc;
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2003-01-03 00:08:22 +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)
|
|
|
|
{
|
|
|
|
SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength,
|
|
|
|
lpszHost, lpszPort - lpszHost);
|
|
|
|
lpUC->nPort = 0;
|
|
|
|
lpszcp=lpszNetLoc;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
2003-01-03 00:08:22 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
while (lpszcp < lpszNetLoc)
|
|
|
|
{
|
|
|
|
if (*lpszcp == ':')
|
|
|
|
lpszPort = lpszcp;
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
lpszcp++;
|
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2003-01-03 00:08:22 +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)
|
|
|
|
{
|
|
|
|
lpszcp=lpszHost;
|
|
|
|
SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength,
|
|
|
|
NULL, 0);
|
|
|
|
lpUC->nPort = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength,
|
|
|
|
lpszHost, lpszPort - lpszHost);
|
|
|
|
if (lpszPort != lpszNetLoc)
|
|
|
|
lpUC->nPort = atoiW(++lpszPort);
|
|
|
|
else
|
|
|
|
lpUC->nPort = 0;
|
|
|
|
}
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
}
|
2003-01-03 00:08:22 +01:00
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
|
|
|
|
/* Here lpszcp points to:
|
|
|
|
*
|
|
|
|
* <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
|
|
|
|
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
*/
|
|
|
|
if (lpszcp != 0 && *lpszcp != '\0' && (!lpszParam || lpszcp < lpszParam))
|
|
|
|
{
|
2000-07-23 15:34:21 +02:00
|
|
|
INT len;
|
|
|
|
|
|
|
|
/* 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.
|
|
|
|
*/
|
2003-01-03 00:08:22 +01:00
|
|
|
LPWSTR lpsznewline = strchrW(lpszcp, '\n');
|
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
|
|
|
}
|
|
|
|
|
2004-08-06 20:57:53 +02:00
|
|
|
SetUrlComponentValueW(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength,
|
|
|
|
lpszcp, len);
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
else
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
2003-01-03 00:08:22 +01:00
|
|
|
lpUC->dwUrlPathLength = 0;
|
2000-06-11 22:04:44 +02:00
|
|
|
}
|
|
|
|
|
2003-01-03 00:08:22 +01:00
|
|
|
TRACE("%s: host(%s) path(%s) extra(%s)\n", debugstr_wn(lpszUrl,dwUrlLength),
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
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;
|
|
|
|
TRACE("%s %p %p %08lx\n",debugstr_a(lpszUrl), lpszBuffer,
|
|
|
|
lpdwBufferLength, dwFlags);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2001-01-06 01:36:43 +01:00
|
|
|
/* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
|
|
|
|
dwFlags ^= ICU_NO_ENCODE;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2001-01-06 01:36:43 +01:00
|
|
|
dwFlags |= 0x80000000; /* Don't know what this means */
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2001-01-06 01:36:43 +01:00
|
|
|
hr = UrlCanonicalizeA(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2001-01-06 01:36:43 +01:00
|
|
|
return (hr == S_OK) ? TRUE : FALSE;
|
|
|
|
}
|
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;
|
|
|
|
TRACE("%s %p %p %08lx\n", debugstr_w(lpszUrl), lpszBuffer,
|
|
|
|
lpdwBufferLength, dwFlags);
|
|
|
|
|
|
|
|
/* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
|
|
|
|
dwFlags ^= ICU_NO_ENCODE;
|
|
|
|
|
|
|
|
dwFlags |= 0x80000000; /* Don't know what this means */
|
|
|
|
|
|
|
|
hr = UrlCanonicalizeW(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
|
|
|
|
|
|
|
|
return (hr == S_OK) ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
LPWININETHANDLEHEADER lpwh;
|
2004-02-07 02:03:41 +01:00
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
TRACE("0x%08lx\n", (ULONG)hInternet);
|
2004-05-25 06:02:05 +02:00
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
lpwh = WININET_GetObject(hInternet);
|
|
|
|
if (!lpwh)
|
|
|
|
return INTERNET_INVALID_STATUS_CALLBACK;
|
2004-05-25 06:02:05 +02:00
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
lpwh->dwInternalFlags &= ~INET_CALLBACKW;
|
|
|
|
retVal = lpwh->lpfnStatusCB;
|
|
|
|
lpwh->lpfnStatusCB = lpfnIntCB;
|
|
|
|
|
|
|
|
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;
|
|
|
|
LPWININETHANDLEHEADER lpwh;
|
2004-05-25 06:02:05 +02:00
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
TRACE("0x%08lx\n", (ULONG)hInternet);
|
2004-05-25 06:02:05 +02:00
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
lpwh = WININET_GetObject(hInternet);
|
|
|
|
if (!lpwh)
|
|
|
|
return INTERNET_INVALID_STATUS_CALLBACK;
|
2004-05-25 06:02:05 +02:00
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
lpwh->dwInternalFlags |= INET_CALLBACKW;
|
|
|
|
retVal = lpwh->lpfnStatusCB;
|
|
|
|
lpwh->lpfnStatusCB = lpfnIntCB;
|
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.@)
|
|
|
|
*/
|
|
|
|
DWORD WINAPI InternetSetFilePointer(HINTERNET f1, LONG f2, PVOID f3, DWORD f4, DWORD f5)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
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
|
|
|
|
*
|
|
|
|
*/
|
2000-04-15 22:44:21 +02:00
|
|
|
BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer ,
|
2000-04-11 22:07:00 +02:00
|
|
|
DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
|
|
|
|
{
|
|
|
|
BOOL retval = FALSE;
|
2001-08-24 21:13:36 +02:00
|
|
|
int nSocket = -1;
|
2004-02-07 02:03:41 +01:00
|
|
|
LPWININETHANDLEHEADER lpwh;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
|
|
|
TRACE("\n");
|
2004-02-07 02:03:41 +01:00
|
|
|
lpwh = (LPWININETHANDLEHEADER) WININET_GetObject( hFile );
|
2000-04-11 22:07:00 +02:00
|
|
|
if (NULL == lpwh)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
switch (lpwh->htype)
|
|
|
|
{
|
|
|
|
case WH_HHTTPREQ:
|
2003-06-21 01:26:56 +02:00
|
|
|
FIXME("This shouldn't be here! We don't support this kind"
|
|
|
|
" of connection anymore. Must use NETCON functions,"
|
|
|
|
" especially if using SSL\n");
|
2004-03-30 06:36:09 +02:00
|
|
|
nSocket = ((LPWININETHTTPREQW)lpwh)->netConnection.socketFD;
|
2000-04-11 22:07:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WH_HFILE:
|
2004-02-07 02:03:41 +01:00
|
|
|
nSocket = ((LPWININETFILE)lpwh)->nDataSocket;
|
2000-04-11 22:07:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-08-24 21:13:36 +02:00
|
|
|
if (nSocket != -1)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2002-06-22 01:59:49 +02:00
|
|
|
int res = send(nSocket, lpBuffer, dwNumOfBytesToWrite, 0);
|
|
|
|
retval = (res >= 0);
|
|
|
|
*lpdwNumOfBytesWritten = retval ? res : 0;
|
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
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* InternetReadFile (WININET.@)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
2002-06-01 01:06:46 +02:00
|
|
|
* Read data from an open internet file
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
|
2000-04-11 22:07:00 +02:00
|
|
|
DWORD dwNumOfBytesToRead, LPDWORD dwNumOfBytesRead)
|
|
|
|
{
|
|
|
|
BOOL retval = FALSE;
|
2001-08-24 21:13:36 +02:00
|
|
|
int nSocket = -1;
|
2004-02-07 02:03:41 +01:00
|
|
|
LPWININETHANDLEHEADER lpwh;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
TRACE("%p %p %ld %p\n", hFile, lpBuffer, dwNumOfBytesToRead, dwNumOfBytesRead);
|
2002-06-22 01:59:49 +02:00
|
|
|
|
2004-02-07 02:03:41 +01:00
|
|
|
lpwh = (LPWININETHANDLEHEADER) WININET_GetObject( hFile );
|
2000-04-11 22:07:00 +02:00
|
|
|
if (NULL == lpwh)
|
|
|
|
return FALSE;
|
|
|
|
|
2003-06-21 01:26:56 +02:00
|
|
|
/* FIXME: this should use NETCON functions! */
|
2000-04-11 22:07:00 +02:00
|
|
|
switch (lpwh->htype)
|
|
|
|
{
|
|
|
|
case WH_HHTTPREQ:
|
2004-03-30 06:36:09 +02:00
|
|
|
if (!NETCON_recv(&((LPWININETHTTPREQW)lpwh)->netConnection, lpBuffer,
|
2004-09-08 03:25:21 +02:00
|
|
|
dwNumOfBytesToRead, MSG_WAITALL, (int *)dwNumOfBytesRead))
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
|
|
|
*dwNumOfBytesRead = 0;
|
|
|
|
retval = TRUE; /* Under windows, it seems to return 0 even if nothing was read... */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
retval = TRUE;
|
2000-04-11 22:07:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WH_HFILE:
|
2003-06-21 01:26:56 +02:00
|
|
|
/* FIXME: FTP should use NETCON_ stuff */
|
2004-02-07 02:03:41 +01:00
|
|
|
nSocket = ((LPWININETFILE)lpwh)->nDataSocket;
|
2003-06-21 01:26:56 +02:00
|
|
|
if (nSocket != -1)
|
|
|
|
{
|
2004-09-08 23:46:33 +02:00
|
|
|
int res = recv(nSocket, lpBuffer, dwNumOfBytesToRead, MSG_WAITALL);
|
2003-06-21 01:26:56 +02:00
|
|
|
retval = (res >= 0);
|
|
|
|
*dwNumOfBytesRead = retval ? res : 0;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-07-19 23:49:39 +02:00
|
|
|
WININET_Release( lpwh );
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-08-19 21:02:17 +02:00
|
|
|
TRACE("-- %s (bytes read: %ld)\n", retval ? "TRUE": "FALSE", dwNumOfBytesRead ? *dwNumOfBytesRead : -1);
|
2000-04-11 22:07:00 +02:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2002-09-28 00:05:23 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetReadFileExA (WININET.@)
|
|
|
|
*
|
|
|
|
* Read data from an open internet file
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffer,
|
|
|
|
DWORD dwFlags, DWORD dwContext)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetReadFileExW (WININET.@)
|
|
|
|
*
|
|
|
|
* Read data from an open internet file
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer,
|
|
|
|
DWORD dwFlags, DWORD dwContext)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
|
|
|
|
INTERNET_SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2000-06-11 22:04:44 +02:00
|
|
|
/***********************************************************************
|
2002-12-05 20:54:40 +01:00
|
|
|
* INET_QueryOptionHelper (internal)
|
2000-06-11 22:04:44 +02:00
|
|
|
*/
|
2002-12-05 20:54:40 +01:00
|
|
|
static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD dwOption,
|
|
|
|
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
|
|
|
LPWININETHANDLEHEADER lpwhh;
|
|
|
|
BOOL bSuccess = FALSE;
|
|
|
|
|
2003-06-21 01:26:56 +02:00
|
|
|
TRACE("(%p, 0x%08lx, %p, %p)\n", hInternet, dwOption, lpBuffer, lpdwBufferLength);
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2004-02-07 02:03:41 +01:00
|
|
|
lpwhh = (LPWININETHANDLEHEADER) WININET_GetObject( hInternet );
|
2000-06-11 22:04:44 +02:00
|
|
|
|
|
|
|
switch (dwOption)
|
|
|
|
{
|
2002-06-22 01:59:49 +02:00
|
|
|
case INTERNET_OPTION_HANDLE_TYPE:
|
|
|
|
{
|
2004-07-24 01:00:07 +02:00
|
|
|
ULONG type;
|
|
|
|
|
|
|
|
if (!lpwhh)
|
|
|
|
{
|
|
|
|
WARN("Invalid hInternet handle\n");
|
|
|
|
SetLastError(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
type = lpwhh->htype;
|
|
|
|
|
2002-06-22 01:59:49 +02:00
|
|
|
TRACE("INTERNET_OPTION_HANDLE_TYPE: %ld\n", type);
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2002-06-22 01:59:49 +02:00
|
|
|
if (*lpdwBufferLength < sizeof(ULONG))
|
|
|
|
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memcpy(lpBuffer, &type, sizeof(ULONG));
|
2004-11-29 19:00:10 +01:00
|
|
|
*lpdwBufferLength = sizeof(ULONG);
|
2002-06-22 01:59:49 +02:00
|
|
|
bSuccess = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case INTERNET_OPTION_REQUEST_FLAGS:
|
|
|
|
{
|
|
|
|
ULONG flags = 4;
|
|
|
|
TRACE("INTERNET_OPTION_REQUEST_FLAGS: %ld\n", flags);
|
|
|
|
if (*lpdwBufferLength < sizeof(ULONG))
|
|
|
|
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memcpy(lpBuffer, &flags, sizeof(ULONG));
|
2004-11-29 19:00:10 +01:00
|
|
|
*lpdwBufferLength = sizeof(ULONG);
|
2002-06-22 01:59:49 +02:00
|
|
|
bSuccess = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case INTERNET_OPTION_URL:
|
|
|
|
case INTERNET_OPTION_DATAFILE_NAME:
|
|
|
|
{
|
2004-07-24 01:00:07 +02:00
|
|
|
if (!lpwhh)
|
|
|
|
{
|
|
|
|
WARN("Invalid hInternet handle\n");
|
|
|
|
SetLastError(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (lpwhh->htype == WH_HHTTPREQ)
|
2002-06-22 01:59:49 +02:00
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
LPWININETHTTPREQW lpreq = (LPWININETHTTPREQW) lpwhh;
|
|
|
|
WCHAR url[1023];
|
2004-04-19 22:12:14 +02:00
|
|
|
static const WCHAR szFmt[] = {'h','t','t','p',':','/','/','%','s','%','s',0};
|
2002-06-22 01:59:49 +02:00
|
|
|
|
2004-09-13 21:33:17 +02:00
|
|
|
sprintfW(url,szFmt,lpreq->StdHeaders[HTTP_QUERY_HOST].lpszValue,lpreq->lpszPath);
|
2004-03-30 06:36:09 +02:00
|
|
|
TRACE("INTERNET_OPTION_URL: %s\n",debugstr_w(url));
|
|
|
|
if (*lpdwBufferLength < strlenW(url)+1)
|
2002-06-22 01:59:49 +02:00
|
|
|
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
else
|
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
if(!bIsUnicode)
|
2002-12-05 20:54:40 +01:00
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
*lpdwBufferLength=WideCharToMultiByte(CP_ACP,0,url,-1,lpBuffer,*lpdwBufferLength,NULL,NULL);
|
2002-12-05 20:54:40 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
strcpyW(lpBuffer, url);
|
|
|
|
*lpdwBufferLength = strlenW(url)+1;
|
2002-12-05 20:54:40 +01:00
|
|
|
}
|
2002-06-22 01:59:49 +02:00
|
|
|
bSuccess = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case INTERNET_OPTION_HTTP_VERSION:
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Presently hardcoded to 1.1
|
|
|
|
*/
|
|
|
|
((HTTP_VERSION_INFO*)lpBuffer)->dwMajorVersion = 1;
|
|
|
|
((HTTP_VERSION_INFO*)lpBuffer)->dwMinorVersion = 1;
|
|
|
|
bSuccess = TRUE;
|
2004-07-24 01:00:07 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case INTERNET_OPTION_CONNECTED_STATE:
|
|
|
|
{
|
|
|
|
INTERNET_CONNECTED_INFO * pCi = (INTERNET_CONNECTED_INFO *)lpBuffer;
|
|
|
|
FIXME("INTERNET_OPTION_CONNECTED_STATE: semi-stub\n");
|
2005-02-08 14:43:09 +01:00
|
|
|
|
|
|
|
if (*lpdwBufferLength < sizeof(INTERNET_CONNECTED_INFO))
|
|
|
|
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pCi->dwConnectedState = INTERNET_STATE_CONNECTED;
|
|
|
|
pCi->dwFlags = 0;
|
|
|
|
*lpdwBufferLength = sizeof(INTERNET_CONNECTED_INFO);
|
|
|
|
bSuccess = TRUE;
|
|
|
|
}
|
2004-07-24 01:00:07 +02:00
|
|
|
break;
|
2000-06-11 22:04:44 +02:00
|
|
|
}
|
2003-12-12 07:01:20 +01:00
|
|
|
case INTERNET_OPTION_SECURITY_FLAGS:
|
|
|
|
FIXME("INTERNET_OPTION_SECURITY_FLAGS: Stub\n");
|
|
|
|
break;
|
2000-06-11 22:04:44 +02:00
|
|
|
|
|
|
|
default:
|
2002-06-22 01:59:49 +02:00
|
|
|
FIXME("Stub! %ld \n",dwOption);
|
2000-06-11 22:04:44 +02:00
|
|
|
break;
|
|
|
|
}
|
2004-07-24 01:00:07 +02:00
|
|
|
if (lpwhh)
|
|
|
|
WININET_Release( lpwhh );
|
2000-06-11 22:04:44 +02:00
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
return INET_QueryOptionHelper(TRUE, hInternet, dwOption, lpBuffer, lpdwBufferLength);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* 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)
|
|
|
|
{
|
|
|
|
return INET_QueryOptionHelper(FALSE, hInternet, dwOption, lpBuffer, lpdwBufferLength);
|
|
|
|
}
|
|
|
|
|
2000-06-11 22:04:44 +02: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)
|
|
|
|
{
|
|
|
|
LPWININETHANDLEHEADER lpwhh;
|
2004-07-19 23:49:39 +02:00
|
|
|
BOOL ret = TRUE;
|
2002-03-11 02:09:25 +01:00
|
|
|
|
|
|
|
TRACE("0x%08lx\n", dwOption);
|
|
|
|
|
2004-02-07 02:03:41 +01:00
|
|
|
lpwhh = (LPWININETHANDLEHEADER) WININET_GetObject( hInternet );
|
|
|
|
if( !lpwhh )
|
|
|
|
return FALSE;
|
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;
|
|
|
|
FIXME("Option INTERNET_OPTION_HTTP_VERSION(%ld,%ld): STUB\n",pVersion->dwMajorVersion,pVersion->dwMinorVersion);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_ERROR_MASK:
|
|
|
|
{
|
|
|
|
unsigned long flags=*(unsigned long*)lpBuffer;
|
|
|
|
FIXME("Option INTERNET_OPTION_ERROR_MASK(%ld): STUB\n",flags);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_CODEPAGE:
|
|
|
|
{
|
|
|
|
unsigned long codepage=*(unsigned long*)lpBuffer;
|
|
|
|
FIXME("Option INTERNET_OPTION_CODEPAGE (%ld): STUB\n",codepage);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_REQUEST_PRIORITY:
|
|
|
|
{
|
|
|
|
unsigned long priority=*(unsigned long*)lpBuffer;
|
|
|
|
FIXME("Option INTERNET_OPTION_REQUEST_PRIORITY (%ld): STUB\n",priority);
|
|
|
|
}
|
|
|
|
break;
|
2003-12-30 20:16:37 +01:00
|
|
|
case INTERNET_OPTION_CONNECT_TIMEOUT:
|
|
|
|
{
|
|
|
|
unsigned long connecttimeout=*(unsigned long*)lpBuffer;
|
|
|
|
FIXME("Option INTERNET_OPTION_CONNECT_TIMEOUT (%ld): STUB\n",connecttimeout);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_DATA_RECEIVE_TIMEOUT:
|
|
|
|
{
|
|
|
|
unsigned long receivetimeout=*(unsigned long*)lpBuffer;
|
|
|
|
FIXME("Option INTERNET_OPTION_DATA_RECEIVE_TIMEOUT (%ld): STUB\n",receivetimeout);
|
|
|
|
}
|
|
|
|
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:
|
|
|
|
FIXME("Option INTERNET_OPTION_END_BROWSER_SESSION: STUB\n");
|
|
|
|
break;
|
|
|
|
case INTERNET_OPTION_CONNECTED_STATE:
|
|
|
|
FIXME("Option INTERNET_OPTION_CONNECTED_STATE: STUB\n");
|
|
|
|
break;
|
2002-03-11 02:09:25 +01:00
|
|
|
default:
|
2002-12-05 20:54:40 +01:00
|
|
|
FIXME("Option %ld STUB\n",dwOption);
|
2002-03-11 02:09:25 +01:00
|
|
|
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
|
2004-07-19 23:49:39 +02:00
|
|
|
ret = FALSE;
|
|
|
|
break;
|
2002-03-11 02:09:25 +01:00
|
|
|
}
|
2004-07-19 23:49:39 +02:00
|
|
|
WININET_Release( lpwhh );
|
2002-03-11 02:09:25 +01:00
|
|
|
|
2002-12-05 20:54:40 +01:00
|
|
|
return TRUE;
|
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;
|
2003-07-10 00:15:33 +02:00
|
|
|
wbuffer = HeapAlloc( GetProcessHeap(), 0, 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:
|
|
|
|
wlen = MultiByteToWideChar( CP_ACP, 0, lpBuffer, dwBufferLength,
|
|
|
|
NULL, 0 );
|
2003-07-10 00:15:33 +02:00
|
|
|
wbuffer = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) );
|
2003-05-11 04:59:52 +02:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, lpBuffer, dwBufferLength,
|
|
|
|
wbuffer, wlen );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
wbuffer = lpBuffer;
|
|
|
|
wlen = dwBufferLength;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = InternetSetOptionW(hInternet,dwOption, wbuffer, wlen);
|
|
|
|
|
|
|
|
if( lpBuffer != wbuffer )
|
|
|
|
HeapFree( GetProcessHeap(), 0, wbuffer );
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetOptionExA (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetSetOptionExA(HINTERNET hInternet, DWORD dwOption,
|
|
|
|
LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
FIXME("Flags %08lx ignored\n", dwFlags);
|
|
|
|
return InternetSetOptionA( hInternet, dwOption, lpBuffer, dwBufferLength );
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetOptionExW (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetSetOptionExW(HINTERNET hInternet, DWORD dwOption,
|
|
|
|
LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
FIXME("Flags %08lx ignored\n", dwFlags);
|
|
|
|
if( dwFlags & ~ISO_VALID_FLAGS )
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_INVALID_PARAMETER );
|
|
|
|
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];
|
|
|
|
|
|
|
|
TRACE( "%p 0x%08lx %p 0x%08lx\n", time, format, string, size );
|
|
|
|
|
|
|
|
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 };
|
|
|
|
|
|
|
|
TRACE( "%p 0x%08lx %p 0x%08lx\n", time, format, string, size );
|
|
|
|
|
|
|
|
if (!time || !string) return FALSE;
|
|
|
|
|
|
|
|
if (format != INTERNET_RFC1123_FORMAT || size < INTERNET_RFC1123_BUFSIZE * sizeof(WCHAR))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
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;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
TRACE( "%s %p 0x%08lx\n", debugstr_a(string), time, reserved );
|
|
|
|
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, string, -1, NULL, 0 );
|
|
|
|
stringW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
|
|
|
|
|
|
|
if (stringW)
|
|
|
|
{
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, string, -1, stringW, len );
|
|
|
|
ret = InternetTimeToSystemTimeW( stringW, time, reserved );
|
|
|
|
HeapFree( GetProcessHeap(), 0, stringW );
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetTimeToSystemTimeW (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetTimeToSystemTimeW( LPCWSTR string, SYSTEMTIME* time, DWORD reserved )
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
WCHAR *s = (LPWSTR)string;
|
|
|
|
|
|
|
|
TRACE( "%s %p 0x%08lx\n", debugstr_w(string), time, reserved );
|
|
|
|
|
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++;
|
|
|
|
time->wDay = strtolW( s, &s, 10 );
|
|
|
|
|
|
|
|
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;
|
2005-01-18 12:43:40 +01:00
|
|
|
time->wYear = strtolW( s, &s, 10 );
|
|
|
|
|
|
|
|
while (*s && !isdigitW( *s )) s++;
|
2005-03-17 19:55:41 +01:00
|
|
|
if (*s == '\0') return TRUE;
|
2005-01-18 12:43:40 +01:00
|
|
|
time->wHour = strtolW( s, &s, 10 );
|
|
|
|
|
|
|
|
while (*s && !isdigitW( *s )) s++;
|
2005-03-17 19:55:41 +01:00
|
|
|
if (*s == '\0') return TRUE;
|
2005-01-18 12:43:40 +01:00
|
|
|
time->wMinute = strtolW( s, &s, 10 );
|
|
|
|
|
|
|
|
while (*s && !isdigitW( *s )) s++;
|
2005-03-17 19:55:41 +01:00
|
|
|
if (*s == '\0') return TRUE;
|
2005-01-18 12:43:40 +01:00
|
|
|
time->wSecond = strtolW( s, &s, 10 );
|
|
|
|
|
|
|
|
time->wMilliseconds = 0;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2002-03-11 02:09:25 +01:00
|
|
|
|
2000-08-01 22:53:42 +02:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* InternetCheckConnectionA (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
|
|
|
|
* ERROR_NOT_CONNECTED is placesd into GetLastError
|
2000-08-01 22:53:42 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetCheckConnectionA( LPCSTR lpszUrl, DWORD dwFlags, DWORD dwReserved )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* this is a kludge which runs the resident ping program and reads the output.
|
|
|
|
*
|
|
|
|
* Anyone have a better idea?
|
|
|
|
*/
|
|
|
|
|
|
|
|
BOOL rc = FALSE;
|
|
|
|
char command[1024];
|
|
|
|
char host[1024];
|
|
|
|
int status = -1;
|
|
|
|
|
2002-06-22 01:59:49 +02:00
|
|
|
FIXME("\n");
|
|
|
|
|
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
|
|
|
/*
|
2000-08-01 22:53:42 +02:00
|
|
|
* According to the doc we are supost 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
|
|
|
|
{
|
2005-01-18 12:43:40 +01:00
|
|
|
URL_COMPONENTSA components;
|
2000-08-01 22:53:42 +02:00
|
|
|
|
2005-01-18 12:43:40 +01:00
|
|
|
ZeroMemory(&components,sizeof(URL_COMPONENTSA));
|
|
|
|
components.lpszHostName = (LPSTR)&host;
|
|
|
|
components.dwHostNameLength = 1024;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-01-18 12:43:40 +01:00
|
|
|
if (!InternetCrackUrlA(lpszUrl,0,0,&components))
|
2000-08-01 22:53:42 +02:00
|
|
|
goto End;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-01-18 12:43:40 +01:00
|
|
|
TRACE("host name : %s\n",components.lpszHostName);
|
2000-08-01 22:53:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Build our ping command
|
|
|
|
*/
|
|
|
|
strcpy(command,"ping -w 1 ");
|
|
|
|
strcat(command,host);
|
|
|
|
strcat(command," >/dev/null 2>/dev/null");
|
|
|
|
|
|
|
|
TRACE("Ping command is : %s\n",command);
|
|
|
|
|
|
|
|
status = system(command);
|
|
|
|
|
|
|
|
TRACE("Ping returned a code of %i \n",status);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
/* Ping return code of 0 indicates success */
|
2000-08-01 22:53:42 +02:00
|
|
|
if (status == 0)
|
|
|
|
rc = TRUE;
|
|
|
|
|
|
|
|
End:
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-01 22:53:42 +02:00
|
|
|
if (rc == FALSE)
|
|
|
|
SetLastError(ERROR_NOT_CONNECTED);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2002-10-28 19:48:24 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetCheckConnectionW (WININET.@)
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetCheckConnectionW(LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwReserved)
|
|
|
|
{
|
|
|
|
CHAR *szUrl;
|
|
|
|
INT len;
|
|
|
|
BOOL rc;
|
|
|
|
|
2003-09-22 21:45:50 +02:00
|
|
|
len = WideCharToMultiByte(CP_ACP, 0, lpszUrl, -1, NULL, 0, NULL, NULL);
|
2005-03-24 22:01:35 +01:00
|
|
|
if (!(szUrl = HeapAlloc(GetProcessHeap(), 0, len*sizeof(CHAR))))
|
2002-10-28 19:48:24 +01:00
|
|
|
return FALSE;
|
2003-09-22 21:45:50 +02:00
|
|
|
WideCharToMultiByte(CP_ACP, 0, lpszUrl, -1, szUrl, len, NULL, NULL);
|
2002-10-28 19:48:24 +01:00
|
|
|
rc = InternetCheckConnectionA((LPCSTR)szUrl, dwFlags, dwReserved);
|
2003-06-21 01:26:56 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, szUrl);
|
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
|
|
|
|
*/
|
2004-07-19 23:49:39 +02:00
|
|
|
HINTERNET WINAPI INTERNET_InternetOpenUrlW(LPWININETAPPINFOW hIC, LPCWSTR lpszUrl,
|
2004-03-30 06:36:09 +02:00
|
|
|
LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext)
|
2002-03-20 01:56:49 +01:00
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
URL_COMPONENTSW urlComponents;
|
|
|
|
WCHAR protocol[32], hostName[MAXHOSTNAME], userName[1024];
|
|
|
|
WCHAR password[1024], path[2048], extra[1024];
|
2004-02-09 22:45:38 +01:00
|
|
|
HINTERNET client = NULL, client1 = NULL;
|
|
|
|
|
2004-12-23 12:18:29 +01:00
|
|
|
TRACE("(%p, %s, %s, %08lx, %08lx, %08lx)\n", hIC, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
|
2004-02-09 22:45:38 +01:00
|
|
|
dwHeadersLength, dwFlags, dwContext);
|
|
|
|
|
2004-03-30 06:36:09 +02:00
|
|
|
urlComponents.dwStructSize = sizeof(URL_COMPONENTSW);
|
2004-02-09 22:45:38 +01:00
|
|
|
urlComponents.lpszScheme = protocol;
|
|
|
|
urlComponents.dwSchemeLength = 32;
|
|
|
|
urlComponents.lpszHostName = hostName;
|
|
|
|
urlComponents.dwHostNameLength = MAXHOSTNAME;
|
|
|
|
urlComponents.lpszUserName = userName;
|
|
|
|
urlComponents.dwUserNameLength = 1024;
|
|
|
|
urlComponents.lpszPassword = password;
|
|
|
|
urlComponents.dwPasswordLength = 1024;
|
|
|
|
urlComponents.lpszUrlPath = path;
|
|
|
|
urlComponents.dwUrlPathLength = 2048;
|
|
|
|
urlComponents.lpszExtraInfo = extra;
|
|
|
|
urlComponents.dwExtraInfoLength = 1024;
|
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;
|
|
|
|
switch(urlComponents.nScheme) {
|
|
|
|
case INTERNET_SCHEME_FTP:
|
|
|
|
if(urlComponents.nPort == 0)
|
|
|
|
urlComponents.nPort = INTERNET_DEFAULT_FTP_PORT;
|
2004-07-19 23:49:39 +02:00
|
|
|
client = FTP_Connect(hIC, hostName, urlComponents.nPort,
|
2004-05-13 07:17:25 +02:00
|
|
|
userName, password, 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 };
|
2004-02-09 22:45:38 +01:00
|
|
|
if(urlComponents.nPort == 0) {
|
|
|
|
if(urlComponents.nScheme == INTERNET_SCHEME_HTTP)
|
|
|
|
urlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT;
|
|
|
|
else
|
|
|
|
urlComponents.nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
|
|
|
}
|
2004-07-19 23:49:39 +02:00
|
|
|
/* FIXME: should use pointers, not handles, as handles are not thread-safe */
|
|
|
|
client = HTTP_Connect(hIC, hostName, urlComponents.nPort,
|
2004-05-13 07:17:25 +02:00
|
|
|
userName, password, dwFlags, dwContext, INET_OPENURL);
|
2004-02-09 22:45:38 +01:00
|
|
|
if(client == NULL)
|
|
|
|
break;
|
2004-03-30 06:36:09 +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);
|
2004-07-19 23:49:39 +02:00
|
|
|
if (!HttpSendRequestW(client1, NULL, 0, NULL, 0)) {
|
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:
|
|
|
|
break;
|
2002-03-20 01:56:49 +01:00
|
|
|
}
|
2004-02-09 22:45:38 +01:00
|
|
|
|
|
|
|
TRACE(" %p <--\n", client1);
|
|
|
|
|
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
|
|
|
|
*/
|
2004-03-30 06:36:09 +02:00
|
|
|
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
|
|
|
|
LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext)
|
2004-02-09 22:45:38 +01:00
|
|
|
{
|
|
|
|
HINTERNET ret = NULL;
|
2004-03-25 06:29:47 +01:00
|
|
|
LPWININETAPPINFOW hIC = NULL;
|
2004-02-09 22:45:38 +01:00
|
|
|
|
2004-12-23 12:18:29 +01:00
|
|
|
if (TRACE_ON(wininet)) {
|
|
|
|
TRACE("(%p, %s, %s, %08lx, %08lx, %08lx)\n", hInternet, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
|
|
|
|
dwHeadersLength, dwFlags, dwContext);
|
|
|
|
TRACE(" flags :");
|
|
|
|
dump_INTERNET_FLAGS(dwFlags);
|
|
|
|
}
|
|
|
|
|
2004-03-25 06:29:47 +01:00
|
|
|
hIC = (LPWININETAPPINFOW) WININET_GetObject( hInternet );
|
2004-02-09 22:45:38 +01:00
|
|
|
if (NULL == hIC || hIC->hdr.htype != WH_HINIT) {
|
|
|
|
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
|
|
|
|
goto lend;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) {
|
|
|
|
WORKREQUEST workRequest;
|
2004-03-30 06:36:09 +02:00
|
|
|
struct WORKREQ_INTERNETOPENURLW *req;
|
2004-02-09 22:45:38 +01:00
|
|
|
|
2004-03-30 06:36:09 +02:00
|
|
|
workRequest.asyncall = INTERNETOPENURLW;
|
2004-07-19 23:49:39 +02:00
|
|
|
workRequest.hdr = WININET_AddRef( &hIC->hdr );
|
2004-03-30 06:36:09 +02:00
|
|
|
req = &workRequest.u.InternetOpenUrlW;
|
2004-02-09 22:45:38 +01:00
|
|
|
if (lpszUrl)
|
2004-03-30 06:36:09 +02:00
|
|
|
req->lpszUrl = WININET_strdupW(lpszUrl);
|
2004-02-09 22:45:38 +01:00
|
|
|
else
|
|
|
|
req->lpszUrl = 0;
|
|
|
|
if (lpszHeaders)
|
2004-03-30 06:36:09 +02:00
|
|
|
req->lpszHeaders = WININET_strdupW(lpszHeaders);
|
2004-02-09 22:45:38 +01:00
|
|
|
else
|
|
|
|
req->lpszHeaders = 0;
|
|
|
|
req->dwHeadersLength = dwHeadersLength;
|
|
|
|
req->dwFlags = dwFlags;
|
|
|
|
req->dwContext = dwContext;
|
|
|
|
|
|
|
|
INTERNET_AsyncCall(&workRequest);
|
|
|
|
/*
|
|
|
|
* This is from windows.
|
|
|
|
*/
|
|
|
|
SetLastError(ERROR_IO_PENDING);
|
|
|
|
} 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,
|
|
|
|
LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD dwContext)
|
2002-10-28 19:48:24 +01:00
|
|
|
{
|
|
|
|
HINTERNET rc = (HINTERNET)NULL;
|
|
|
|
|
2004-05-10 21:59:05 +02:00
|
|
|
INT lenUrl;
|
|
|
|
INT lenHeaders = 0;
|
|
|
|
LPWSTR szUrl = NULL;
|
|
|
|
LPWSTR szHeaders = 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) {
|
|
|
|
lenUrl = MultiByteToWideChar(CP_ACP, 0, lpszUrl, -1, NULL, 0 );
|
|
|
|
szUrl = HeapAlloc(GetProcessHeap(), 0, lenUrl*sizeof(WCHAR));
|
|
|
|
if(!szUrl)
|
|
|
|
return (HINTERNET)NULL;
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszUrl, -1, szUrl, lenUrl);
|
2002-10-28 19:48:24 +01:00
|
|
|
}
|
2004-05-10 21:59:05 +02:00
|
|
|
|
|
|
|
if(lpszHeaders) {
|
|
|
|
lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, NULL, 0 );
|
|
|
|
szHeaders = HeapAlloc(GetProcessHeap(), 0, lenHeaders*sizeof(WCHAR));
|
|
|
|
if(!szHeaders) {
|
2004-12-21 15:42:35 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, szUrl);
|
2004-05-10 21:59:05 +02:00
|
|
|
return (HINTERNET)NULL;
|
|
|
|
}
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, szHeaders, lenHeaders);
|
|
|
|
}
|
|
|
|
|
2004-03-30 06:36:09 +02:00
|
|
|
rc = InternetOpenUrlW(hInternet, szUrl, szHeaders,
|
2004-05-10 21:59:05 +02:00
|
|
|
lenHeaders, dwFlags, dwContext);
|
2002-10-28 19:48:24 +01:00
|
|
|
|
2004-12-21 15:42:35 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, szUrl);
|
|
|
|
HeapFree(GetProcessHeap(), 0, szHeaders);
|
2002-10-28 19:48:24 +01:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-11 22:07:00 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_SetLastError (internal)
|
|
|
|
*
|
|
|
|
* Set last thread specific error
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void INTERNET_SetLastError(DWORD dwError)
|
|
|
|
{
|
|
|
|
LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex);
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex);
|
|
|
|
return lpwite->dwError;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_WorkerThreadFunc (internal)
|
|
|
|
*
|
|
|
|
* Worker thread execution function
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
2004-11-29 19:00:10 +01:00
|
|
|
static DWORD INTERNET_WorkerThreadFunc(LPVOID *lpvParam)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
|
|
|
DWORD dwWaitRes;
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2002-11-13 20:40:50 +01:00
|
|
|
if(dwNumJobs > 0) {
|
|
|
|
INTERNET_ExecuteWork();
|
|
|
|
continue;
|
|
|
|
}
|
2000-04-11 22:07:00 +02:00
|
|
|
dwWaitRes = WaitForMultipleObjects(2, hEventArray, FALSE, MAX_IDLE_WORKER);
|
|
|
|
|
|
|
|
if (dwWaitRes == WAIT_OBJECT_0 + 1)
|
|
|
|
INTERNET_ExecuteWork();
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
|
|
|
|
InterlockedIncrement(&dwNumIdleThreads);
|
|
|
|
}
|
|
|
|
|
|
|
|
InterlockedDecrement(&dwNumIdleThreads);
|
|
|
|
InterlockedDecrement(&dwNumThreads);
|
|
|
|
TRACE("Worker thread exiting\n");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_InsertWorkRequest (internal)
|
|
|
|
*
|
|
|
|
* Insert work request into queue
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
2004-11-29 19:00:10 +01:00
|
|
|
static BOOL INTERNET_InsertWorkRequest(LPWORKREQUEST lpWorkRequest)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
|
|
|
BOOL bSuccess = FALSE;
|
|
|
|
LPWORKREQUEST lpNewRequest;
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
|
|
|
lpNewRequest = HeapAlloc(GetProcessHeap(), 0, sizeof(WORKREQUEST));
|
|
|
|
if (lpNewRequest)
|
|
|
|
{
|
|
|
|
memcpy(lpNewRequest, lpWorkRequest, sizeof(WORKREQUEST));
|
|
|
|
lpNewRequest->prev = NULL;
|
|
|
|
|
|
|
|
EnterCriticalSection(&csQueue);
|
|
|
|
|
|
|
|
lpNewRequest->next = lpWorkQueueTail;
|
|
|
|
if (lpWorkQueueTail)
|
|
|
|
lpWorkQueueTail->prev = lpNewRequest;
|
|
|
|
lpWorkQueueTail = lpNewRequest;
|
|
|
|
if (!lpHeadWorkQueue)
|
|
|
|
lpHeadWorkQueue = lpWorkQueueTail;
|
|
|
|
|
|
|
|
LeaveCriticalSection(&csQueue);
|
|
|
|
|
|
|
|
bSuccess = TRUE;
|
2002-11-13 20:40:50 +01:00
|
|
|
InterlockedIncrement(&dwNumJobs);
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-04-23 21:55:26 +02:00
|
|
|
* INTERNET_GetWorkRequest (internal)
|
2000-04-11 22:07:00 +02:00
|
|
|
*
|
|
|
|
* Retrieves work request from queue
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
2004-11-29 19:00:10 +01:00
|
|
|
static BOOL INTERNET_GetWorkRequest(LPWORKREQUEST lpWorkRequest)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
|
|
|
BOOL bSuccess = FALSE;
|
|
|
|
LPWORKREQUEST lpRequest = NULL;
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
|
|
|
EnterCriticalSection(&csQueue);
|
|
|
|
|
|
|
|
if (lpHeadWorkQueue)
|
|
|
|
{
|
|
|
|
lpRequest = lpHeadWorkQueue;
|
|
|
|
lpHeadWorkQueue = lpHeadWorkQueue->prev;
|
|
|
|
if (lpRequest == lpWorkQueueTail)
|
|
|
|
lpWorkQueueTail = lpHeadWorkQueue;
|
|
|
|
}
|
|
|
|
|
|
|
|
LeaveCriticalSection(&csQueue);
|
|
|
|
|
|
|
|
if (lpRequest)
|
|
|
|
{
|
|
|
|
memcpy(lpWorkRequest, lpRequest, sizeof(WORKREQUEST));
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpRequest);
|
|
|
|
bSuccess = TRUE;
|
2002-11-13 20:40:50 +01:00
|
|
|
InterlockedDecrement(&dwNumJobs);
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_AsyncCall (internal)
|
|
|
|
*
|
|
|
|
* Retrieves work request from queue
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest)
|
|
|
|
{
|
|
|
|
HANDLE hThread;
|
|
|
|
DWORD dwTID;
|
|
|
|
BOOL bSuccess = FALSE;
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
|
|
|
if (InterlockedDecrement(&dwNumIdleThreads) < 0)
|
|
|
|
{
|
|
|
|
InterlockedIncrement(&dwNumIdleThreads);
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if (InterlockedIncrement(&dwNumThreads) > MAX_WORKER_THREADS ||
|
|
|
|
!(hThread = CreateThread(NULL, 0,
|
2000-04-11 22:07:00 +02:00
|
|
|
(LPTHREAD_START_ROUTINE)INTERNET_WorkerThreadFunc, NULL, 0, &dwTID)))
|
|
|
|
{
|
|
|
|
InterlockedDecrement(&dwNumThreads);
|
|
|
|
INTERNET_SetLastError(ERROR_INTERNET_ASYNC_THREAD_FAILED);
|
|
|
|
goto lerror;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Created new thread\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
bSuccess = TRUE;
|
|
|
|
INTERNET_InsertWorkRequest(lpWorkRequest);
|
|
|
|
SetEvent(hWorkEvent);
|
|
|
|
|
|
|
|
lerror:
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_ExecuteWork (internal)
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
2004-11-29 19:00:10 +01:00
|
|
|
static VOID INTERNET_ExecuteWork(void)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
|
|
|
WORKREQUEST workRequest;
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
2003-09-25 22:25:22 +02:00
|
|
|
if (!INTERNET_GetWorkRequest(&workRequest))
|
|
|
|
return;
|
2004-02-09 23:01:49 +01:00
|
|
|
|
2003-09-25 22:25:22 +02:00
|
|
|
switch (workRequest.asyncall)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
case FTPPUTFILEW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_FTPPUTFILEW *req = &workRequest.u.FtpPutFileW;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETFTPSESSIONW lpwfs = (LPWININETFTPSESSIONW) workRequest.hdr;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
TRACE("FTPPUTFILEW %p\n", lpwfs);
|
|
|
|
|
|
|
|
FTP_FtpPutFileW(lpwfs, req->lpszLocalFile,
|
2003-09-25 22:25:22 +02:00
|
|
|
req->lpszNewRemoteFile, req->dwFlags, req->dwContext);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2003-09-25 22:25:22 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszLocalFile);
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszNewRemoteFile);
|
|
|
|
}
|
|
|
|
break;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
case FTPSETCURRENTDIRECTORYW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_FTPSETCURRENTDIRECTORYW *req;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETFTPSESSIONW lpwfs = (LPWININETFTPSESSIONW) workRequest.hdr;
|
|
|
|
|
|
|
|
TRACE("FTPSETCURRENTDIRECTORYW %p\n", lpwfs);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
req = &workRequest.u.FtpSetCurrentDirectoryW;
|
2004-07-19 23:49:39 +02:00
|
|
|
FTP_FtpSetCurrentDirectoryW(lpwfs, req->lpszDirectory);
|
2003-09-25 22:25:22 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
|
|
|
}
|
|
|
|
break;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
case FTPCREATEDIRECTORYW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_FTPCREATEDIRECTORYW *req;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETFTPSESSIONW lpwfs = (LPWININETFTPSESSIONW) workRequest.hdr;
|
|
|
|
|
|
|
|
TRACE("FTPCREATEDIRECTORYW %p\n", lpwfs);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
req = &workRequest.u.FtpCreateDirectoryW;
|
2004-07-19 23:49:39 +02:00
|
|
|
FTP_FtpCreateDirectoryW(lpwfs, req->lpszDirectory);
|
2003-09-25 22:25:22 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
|
|
|
}
|
|
|
|
break;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
case FTPFINDFIRSTFILEW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_FTPFINDFIRSTFILEW *req;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETFTPSESSIONW lpwfs = (LPWININETFTPSESSIONW) workRequest.hdr;
|
|
|
|
|
|
|
|
TRACE("FTPFINDFIRSTFILEW %p\n", lpwfs);
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
req = &workRequest.u.FtpFindFirstFileW;
|
2004-07-19 23:49:39 +02:00
|
|
|
FTP_FtpFindFirstFileW(lpwfs, req->lpszSearchFile,
|
2003-09-25 22:25:22 +02:00
|
|
|
req->lpFindFileData, req->dwFlags, req->dwContext);
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszSearchFile);
|
2003-09-25 22:25:22 +02:00
|
|
|
}
|
|
|
|
break;
|
2000-04-11 22:07:00 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
case FTPGETCURRENTDIRECTORYW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_FTPGETCURRENTDIRECTORYW *req;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETFTPSESSIONW lpwfs = (LPWININETFTPSESSIONW) workRequest.hdr;
|
|
|
|
|
|
|
|
TRACE("FTPGETCURRENTDIRECTORYW %p\n", lpwfs);
|
2000-06-11 22:04:44 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
req = &workRequest.u.FtpGetCurrentDirectoryW;
|
2004-07-19 23:49:39 +02:00
|
|
|
FTP_FtpGetCurrentDirectoryW(lpwfs,
|
2003-09-25 22:25:22 +02:00
|
|
|
req->lpszDirectory, req->lpdwDirectory);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
case FTPOPENFILEW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_FTPOPENFILEW *req = &workRequest.u.FtpOpenFileW;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETFTPSESSIONW lpwfs = (LPWININETFTPSESSIONW) workRequest.hdr;
|
2003-09-25 22:25:22 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
TRACE("FTPOPENFILEW %p\n", lpwfs);
|
|
|
|
|
|
|
|
FTP_FtpOpenFileW(lpwfs, req->lpszFilename,
|
2003-09-25 22:25:22 +02:00
|
|
|
req->dwAccess, req->dwFlags, req->dwContext);
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszFilename);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
case FTPGETFILEW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_FTPGETFILEW *req = &workRequest.u.FtpGetFileW;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETFTPSESSIONW lpwfs = (LPWININETFTPSESSIONW) workRequest.hdr;
|
|
|
|
|
|
|
|
TRACE("FTPGETFILEW %p\n", lpwfs);
|
2003-09-25 22:25:22 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
FTP_FtpGetFileW(lpwfs, req->lpszRemoteFile,
|
2003-09-25 22:25:22 +02:00
|
|
|
req->lpszNewFile, req->fFailIfExists,
|
|
|
|
req->dwLocalFlagsAttribute, req->dwFlags, req->dwContext);
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszRemoteFile);
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszNewFile);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
case FTPDELETEFILEW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_FTPDELETEFILEW *req = &workRequest.u.FtpDeleteFileW;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETFTPSESSIONW lpwfs = (LPWININETFTPSESSIONW) workRequest.hdr;
|
|
|
|
|
|
|
|
TRACE("FTPDELETEFILEW %p\n", lpwfs);
|
2003-09-25 22:25:22 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
FTP_FtpDeleteFileW(lpwfs, req->lpszFilename);
|
2003-09-25 22:25:22 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszFilename);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
case FTPREMOVEDIRECTORYW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_FTPREMOVEDIRECTORYW *req;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETFTPSESSIONW lpwfs = (LPWININETFTPSESSIONW) workRequest.hdr;
|
|
|
|
|
|
|
|
TRACE("FTPREMOVEDIRECTORYW %p\n", lpwfs);
|
2003-09-25 22:25:22 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
req = &workRequest.u.FtpRemoveDirectoryW;
|
2004-07-19 23:49:39 +02:00
|
|
|
FTP_FtpRemoveDirectoryW(lpwfs, req->lpszDirectory);
|
2003-09-25 22:25:22 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszDirectory);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
case FTPRENAMEFILEW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_FTPRENAMEFILEW *req = &workRequest.u.FtpRenameFileW;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETFTPSESSIONW lpwfs = (LPWININETFTPSESSIONW) workRequest.hdr;
|
|
|
|
|
|
|
|
TRACE("FTPRENAMEFILEW %p\n", lpwfs);
|
2003-09-25 22:25:22 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
FTP_FtpRenameFileW(lpwfs, req->lpszSrcFile, req->lpszDestFile);
|
2003-09-25 22:25:22 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszSrcFile);
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszDestFile);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
case INTERNETFINDNEXTW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-05-25 06:02:05 +02:00
|
|
|
struct WORKREQ_INTERNETFINDNEXTW *req;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETFINDNEXTW lpwh = (LPWININETFINDNEXTW) workRequest.hdr;
|
|
|
|
|
|
|
|
TRACE("INTERNETFINDNEXTW %p\n", lpwh);
|
2003-09-25 22:25:22 +02:00
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
req = &workRequest.u.InternetFindNextW;
|
2004-07-19 23:49:39 +02:00
|
|
|
INTERNET_FindNextFileW(lpwh, req->lpFindFileData);
|
2003-09-25 22:25:22 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-03-30 06:36:09 +02:00
|
|
|
case HTTPSENDREQUESTW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
struct WORKREQ_HTTPSENDREQUESTW *req = &workRequest.u.HttpSendRequestW;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) workRequest.hdr;
|
2003-09-25 22:25:22 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
TRACE("HTTPSENDREQUESTW %p\n", lpwhr);
|
|
|
|
|
|
|
|
HTTP_HttpSendRequestW(lpwhr, req->lpszHeader,
|
2003-09-25 22:25:22 +02:00
|
|
|
req->dwHeaderLength, req->lpOptional, req->dwOptionalLength);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszHeader);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-03-30 06:36:09 +02:00
|
|
|
case HTTPOPENREQUESTW:
|
2003-09-25 22:25:22 +02:00
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
struct WORKREQ_HTTPOPENREQUESTW *req = &workRequest.u.HttpOpenRequestW;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETHTTPSESSIONW lpwhs = (LPWININETHTTPSESSIONW) workRequest.hdr;
|
|
|
|
|
|
|
|
TRACE("HTTPOPENREQUESTW %p\n", lpwhs);
|
2003-09-25 22:25:22 +02:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
HTTP_HttpOpenRequestW(lpwhs, req->lpszVerb,
|
2003-09-25 22:25:22 +02:00
|
|
|
req->lpszObjectName, req->lpszVersion, req->lpszReferrer,
|
|
|
|
req->lpszAcceptTypes, req->dwFlags, req->dwContext);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszVerb);
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszObjectName);
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszVersion);
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszReferrer);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SENDCALLBACK:
|
|
|
|
{
|
|
|
|
struct WORKREQ_SENDCALLBACK *req = &workRequest.u.SendCallback;
|
2004-07-19 23:49:39 +02:00
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
TRACE("SENDCALLBACK %p\n", workRequest.hdr);
|
2003-09-25 22:25:22 +02:00
|
|
|
|
2004-09-20 21:10:31 +02:00
|
|
|
SendSyncCallback(workRequest.hdr,
|
2005-01-04 21:38:53 +01:00
|
|
|
req->dwContext, req->dwInternetStatus, req->lpvStatusInfo,
|
|
|
|
req->dwStatusInfoLength);
|
|
|
|
|
|
|
|
/* And frees the copy of the status info */
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpvStatusInfo);
|
2003-09-25 22:25:22 +02:00
|
|
|
}
|
|
|
|
break;
|
2004-02-09 22:45:38 +01:00
|
|
|
|
2004-03-30 06:36:09 +02:00
|
|
|
case INTERNETOPENURLW:
|
2004-02-09 22:45:38 +01:00
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
struct WORKREQ_INTERNETOPENURLW *req = &workRequest.u.InternetOpenUrlW;
|
2004-07-19 23:49:39 +02:00
|
|
|
LPWININETAPPINFOW hIC = (LPWININETAPPINFOW) workRequest.hdr;
|
2004-02-09 22:45:38 +01:00
|
|
|
|
2004-07-19 23:49:39 +02:00
|
|
|
TRACE("INTERNETOPENURLW %p\n", hIC);
|
|
|
|
|
|
|
|
INTERNET_InternetOpenUrlW(hIC, req->lpszUrl,
|
2004-02-09 22:45:38 +01:00
|
|
|
req->lpszHeaders, req->dwHeadersLength, req->dwFlags, req->dwContext);
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszUrl);
|
|
|
|
HeapFree(GetProcessHeap(), 0, req->lpszHeaders);
|
|
|
|
}
|
|
|
|
break;
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
2004-07-19 23:49:39 +02:00
|
|
|
WININET_Release( workRequest.hdr );
|
2000-04-11 22:07:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_GetResponseBuffer
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
*
|
|
|
|
*/
|
2004-11-29 19:00:10 +01:00
|
|
|
LPSTR INTERNET_GetResponseBuffer(void)
|
2000-04-11 22:07:00 +02:00
|
|
|
{
|
|
|
|
LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex);
|
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
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* INTERNET_GetNextLine (internal)
|
|
|
|
*
|
|
|
|
* Parse next line in directory string listing
|
|
|
|
*
|
|
|
|
* RETURNS
|
2001-10-22 21:04:32 +02:00
|
|
|
* Pointer to beginning of next line
|
2000-06-11 22:04:44 +02:00
|
|
|
* NULL on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen)
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
|
|
|
struct timeval tv;
|
|
|
|
fd_set infd;
|
|
|
|
BOOL bSuccess = FALSE;
|
|
|
|
INT nRecv = 0;
|
2004-05-25 06:02:05 +02:00
|
|
|
LPSTR lpszBuffer = INTERNET_GetResponseBuffer();
|
2000-06-11 22:04:44 +02:00
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
|
|
|
FD_ZERO(&infd);
|
|
|
|
FD_SET(nSocket, &infd);
|
|
|
|
tv.tv_sec=RESPONSE_TIMEOUT;
|
|
|
|
tv.tv_usec=0;
|
|
|
|
|
2004-05-25 06:02:05 +02:00
|
|
|
while (nRecv < MAX_REPLY_LEN)
|
2000-06-11 22:04:44 +02:00
|
|
|
{
|
|
|
|
if (select(nSocket+1,&infd,NULL,NULL,&tv) > 0)
|
|
|
|
{
|
|
|
|
if (recv(nSocket, &lpszBuffer[nRecv], 1, 0) <= 0)
|
|
|
|
{
|
|
|
|
INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);
|
|
|
|
goto lend;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lpszBuffer[nRecv] == '\n')
|
|
|
|
{
|
|
|
|
bSuccess = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (lpszBuffer[nRecv] != '\r')
|
|
|
|
nRecv++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
INTERNET_SetLastError(ERROR_INTERNET_TIMEOUT);
|
|
|
|
goto lend;
|
2001-09-11 02:32:32 +02:00
|
|
|
}
|
2000-06-11 22:04:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
lend:
|
|
|
|
if (bSuccess)
|
|
|
|
{
|
|
|
|
lpszBuffer[nRecv] = '\0';
|
2004-05-25 06:02:05 +02:00
|
|
|
*dwLen = nRecv - 1;
|
2000-06-11 22:04:44 +02:00
|
|
|
TRACE(":%d %s\n", nRecv, lpszBuffer);
|
|
|
|
return lpszBuffer;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2002-06-22 01:59:49 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile,
|
|
|
|
LPDWORD lpdwNumberOfBytesAvailble,
|
|
|
|
DWORD dwFlags, DWORD dwConext)
|
|
|
|
{
|
2004-03-30 06:36:09 +02:00
|
|
|
LPWININETHTTPREQW lpwhr;
|
2002-06-22 01:59:49 +02:00
|
|
|
INT retval = -1;
|
2003-06-21 01:26:56 +02:00
|
|
|
char buffer[4048];
|
2002-06-22 01:59:49 +02:00
|
|
|
|
2004-03-30 06:36:09 +02:00
|
|
|
lpwhr = (LPWININETHTTPREQW) WININET_GetObject( hFile );
|
2002-06-22 01:59:49 +02:00
|
|
|
if (NULL == lpwhr)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NO_MORE_FILES);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-06-21 01:26:56 +02:00
|
|
|
TRACE("--> %p %i\n",lpwhr,lpwhr->hdr.htype);
|
2002-06-22 01:59:49 +02:00
|
|
|
|
|
|
|
switch (lpwhr->hdr.htype)
|
|
|
|
{
|
2003-06-21 01:26:56 +02:00
|
|
|
case WH_HHTTPREQ:
|
2004-02-07 02:03:41 +01:00
|
|
|
if (!NETCON_recv(&lpwhr->netConnection, buffer,
|
2003-06-21 01:26:56 +02:00
|
|
|
4048, MSG_PEEK, (int *)lpdwNumberOfBytesAvailble))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NO_MORE_FILES);
|
|
|
|
retval = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
retval = TRUE;
|
|
|
|
break;
|
2002-06-22 01:59:49 +02:00
|
|
|
|
2003-06-21 01:26:56 +02:00
|
|
|
default:
|
2003-07-02 06:37:26 +02:00
|
|
|
FIXME("unsupported file type\n");
|
2003-06-21 01:26:56 +02:00
|
|
|
break;
|
2002-06-22 01:59:49 +02:00
|
|
|
}
|
2004-07-19 23:49:39 +02:00
|
|
|
WININET_Release( &lpwhr->hdr );
|
2002-06-22 01:59:49 +02:00
|
|
|
|
|
|
|
TRACE("<-- %i\n",retval);
|
|
|
|
return (retval+1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetLockRequestFile( HINTERNET hInternet, HANDLE
|
|
|
|
*lphLockReqHandle)
|
|
|
|
{
|
|
|
|
FIXME("STUB\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetUnlockRequestFile( HANDLE hLockHandle)
|
|
|
|
{
|
|
|
|
FIXME("STUB\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-07-22 22:34:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2003-01-28 01:17:15 +01:00
|
|
|
* InternetAutodial
|
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
|
|
|
|
|
|
|
/***********************************************************************
|
2003-01-28 01:17:15 +01:00
|
|
|
* InternetAutodialHangup
|
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
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* InternetCombineUrlA
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
TRACE("(%s, %s, %p, %p, 0x%08lx)\n", debugstr_a(lpszBaseUrl), debugstr_a(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* InternetCombineUrlW
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
TRACE("(%s, %s, %p, %p, 0x%08lx)\n", debugstr_w(lpszBaseUrl), debugstr_w(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
|
|
|
|
|
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
|
|
|
|
2003-08-08 23:07:23 +02:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* InternetCreateUrlA
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2003-07-19 05:08:05 +02:00
|
|
|
BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags,
|
|
|
|
LPSTR lpszUrl, LPDWORD lpdwUrlLength)
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
- 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD WINAPI InternetDialA( HWND hwndParent, LPSTR lpszConnectoid, DWORD dwFlags,
|
|
|
|
LPDWORD lpdwConnection, DWORD dwReserved )
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, 0x%08lx, %p, 0x%08lx) stub\n", hwndParent, lpszConnectoid, dwFlags,
|
|
|
|
lpdwConnection, dwReserved);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD WINAPI InternetDialW( HWND hwndParent, LPWSTR lpszConnectoid, DWORD dwFlags,
|
|
|
|
LPDWORD lpdwConnection, DWORD dwReserved )
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, 0x%08lx, %p, 0x%08lx) stub\n", hwndParent, lpszConnectoid, dwFlags,
|
|
|
|
lpdwConnection, dwReserved);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetGoOnlineA( LPSTR lpszURL, HWND hwndParent, DWORD dwReserved )
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p, 0x%08lx) stub\n", debugstr_a(lpszURL), hwndParent, dwReserved);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetGoOnlineW( LPWSTR lpszURL, HWND hwndParent, DWORD dwReserved )
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p, 0x%08lx) stub\n", debugstr_w(lpszURL), hwndParent, dwReserved);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD WINAPI InternetHangUp( DWORD dwConnection, DWORD dwReserved )
|
|
|
|
{
|
|
|
|
FIXME("(0x%08lx, 0x%08lx) stub\n", dwConnection, dwReserved);
|
|
|
|
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 InternetClearAllPerSiteCookieDecisions( VOID )
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetEnumPerSiteCookieDecisionA( LPSTR pszSiteName, unsigned long *pcSiteNameSize,
|
|
|
|
unsigned long *pdwDecision, unsigned long dwIndex )
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p, %p, 0x%08lx) stub\n",
|
|
|
|
debugstr_a(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetEnumPerSiteCookieDecisionW( LPWSTR pszSiteName, unsigned long *pcSiteNameSize,
|
|
|
|
unsigned long *pdwDecision, unsigned long dwIndex )
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p, %p, 0x%08lx) stub\n",
|
|
|
|
debugstr_w(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetGetCookieExA( LPCSTR pchURL, LPCSTR pchCookieName, LPSTR pchCookieData,
|
|
|
|
LPDWORD pcchCookieData, DWORD dwFlags, LPVOID lpReserved)
|
|
|
|
{
|
|
|
|
FIXME("(%s, %s, %s, %p, 0x%08lx, %p) stub\n",
|
|
|
|
debugstr_a(pchURL), debugstr_a(pchCookieName), debugstr_a(pchCookieData),
|
|
|
|
pcchCookieData, dwFlags, lpReserved);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetGetCookieExW( LPCWSTR pchURL, LPCWSTR pchCookieName, LPWSTR pchCookieData,
|
|
|
|
LPDWORD pcchCookieData, DWORD dwFlags, LPVOID lpReserved)
|
|
|
|
{
|
|
|
|
FIXME("(%s, %s, %s, %p, 0x%08lx, %p) stub\n",
|
|
|
|
debugstr_w(pchURL), debugstr_w(pchCookieName), debugstr_w(pchCookieData),
|
|
|
|
pcchCookieData, dwFlags, lpReserved);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetGetPerSiteCookieDecisionA( LPCSTR pwchHostName, unsigned long *pResult )
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p) stub\n", debugstr_a(pwchHostName), pResult);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetGetPerSiteCookieDecisionW( LPCWSTR pwchHostName, unsigned long *pResult )
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p) stub\n", debugstr_w(pwchHostName), pResult);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetSetPerSiteCookieDecisionA( LPCSTR pchHostName, DWORD dwDecision )
|
|
|
|
{
|
|
|
|
FIXME("(%s, 0x%08lx) stub\n", debugstr_a(pchHostName), dwDecision);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI InternetSetPerSiteCookieDecisionW( LPCWSTR pchHostName, DWORD dwDecision )
|
|
|
|
{
|
|
|
|
FIXME("(%s, 0x%08lx) stub\n", debugstr_w(pchHostName), dwDecision);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD WINAPI InternetSetCookieExA( LPCSTR lpszURL, LPCSTR lpszCookieName, LPCSTR lpszCookieData,
|
|
|
|
DWORD dwFlags, DWORD_PTR dwReserved)
|
|
|
|
{
|
|
|
|
FIXME("(%s, %s, %s, 0x%08lx, 0x%08lx) stub\n",
|
|
|
|
debugstr_a(lpszURL), debugstr_a(lpszCookieName), debugstr_a(lpszCookieData),
|
|
|
|
dwFlags, dwReserved);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD WINAPI InternetSetCookieExW( LPCWSTR lpszURL, LPCWSTR lpszCookieName, LPCWSTR lpszCookieData,
|
|
|
|
DWORD dwFlags, DWORD_PTR dwReserved)
|
|
|
|
{
|
|
|
|
FIXME("(%s, %s, %s, 0x%08lx, 0x%08lx) stub\n",
|
|
|
|
debugstr_w(lpszURL), debugstr_w(lpszCookieName), debugstr_w(lpszCookieData),
|
|
|
|
dwFlags, dwReserved);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI ResumeSuspendedDownload( HINTERNET hInternet, DWORD dwError )
|
|
|
|
{
|
|
|
|
FIXME("(%p, 0x%08lx) stub\n", hInternet, dwError);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-08-08 23:07:23 +02:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* InternetCreateUrlW
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2003-07-19 05:08:05 +02:00
|
|
|
BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
|
|
|
|
LPWSTR lpszUrl, LPDWORD lpdwUrlLength)
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-12-23 12:18:29 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dump_INTERNET_FLAGS
|
|
|
|
*
|
2005-01-07 18:09:39 +01:00
|
|
|
* Helper function to TRACE the internet flags.
|
2004-12-23 12:18:29 +01:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < (sizeof(flag) / sizeof(flag[0])); i++) {
|
|
|
|
if (flag[i].val & dwFlags) {
|
2005-01-07 18:09:39 +01:00
|
|
|
TRACE(" %s", flag[i].name);
|
2004-12-23 12:18:29 +01:00
|
|
|
dwFlags &= ~flag[i].val;
|
|
|
|
}
|
|
|
|
}
|
2005-01-07 18:09:39 +01:00
|
|
|
if (dwFlags)
|
|
|
|
TRACE(" Unknown flags (%08lx)\n", dwFlags);
|
|
|
|
else
|
|
|
|
TRACE("\n");
|
2004-12-23 12:18:29 +01:00
|
|
|
}
|