Commit 819fa8ce authored by Alexandre Julliard's avatar Alexandre Julliard

Merged urlmon.dll and wininet.dll from the Corel tree (implementation

by Ulrich Czekalla <ulrichc@corel.ca>)
parent 114830e8
...@@ -128,6 +128,7 @@ DLLS = \ ...@@ -128,6 +128,7 @@ DLLS = \
stress \ stress \
tapi32 \ tapi32 \
ttydrv \ ttydrv \
urlmon \
user32 \ user32 \
version \ version \
w32skrnl \ w32skrnl \
...@@ -135,6 +136,7 @@ DLLS = \ ...@@ -135,6 +136,7 @@ DLLS = \
windebug \ windebug \
wineoss.drv \ wineoss.drv \
wing \ wing \
wininet \
winmm \ winmm \
winspool \ winspool \
wnaspi32 \ wnaspi32 \
......
...@@ -6271,6 +6271,7 @@ dlls/sound/Makefile ...@@ -6271,6 +6271,7 @@ dlls/sound/Makefile
dlls/stress/Makefile dlls/stress/Makefile
dlls/tapi32/Makefile dlls/tapi32/Makefile
dlls/ttydrv/Makefile dlls/ttydrv/Makefile
dlls/urlmon/Makefile
dlls/user/Makefile dlls/user/Makefile
dlls/version/Makefile dlls/version/Makefile
dlls/win32s/Makefile dlls/win32s/Makefile
...@@ -6278,6 +6279,7 @@ dlls/win87em/Makefile ...@@ -6278,6 +6279,7 @@ dlls/win87em/Makefile
dlls/winaspi/Makefile dlls/winaspi/Makefile
dlls/windebug/Makefile dlls/windebug/Makefile
dlls/wing/Makefile dlls/wing/Makefile
dlls/wininet/Makefile
dlls/winmm/Makefile dlls/winmm/Makefile
dlls/winmm/joystick/Makefile dlls/winmm/joystick/Makefile
dlls/winmm/mcianim/Makefile dlls/winmm/mcianim/Makefile
...@@ -6497,6 +6499,7 @@ dlls/sound/Makefile ...@@ -6497,6 +6499,7 @@ dlls/sound/Makefile
dlls/stress/Makefile dlls/stress/Makefile
dlls/tapi32/Makefile dlls/tapi32/Makefile
dlls/ttydrv/Makefile dlls/ttydrv/Makefile
dlls/urlmon/Makefile
dlls/user/Makefile dlls/user/Makefile
dlls/version/Makefile dlls/version/Makefile
dlls/win32s/Makefile dlls/win32s/Makefile
...@@ -6504,6 +6507,7 @@ dlls/win87em/Makefile ...@@ -6504,6 +6507,7 @@ dlls/win87em/Makefile
dlls/winaspi/Makefile dlls/winaspi/Makefile
dlls/windebug/Makefile dlls/windebug/Makefile
dlls/wing/Makefile dlls/wing/Makefile
dlls/wininet/Makefile
dlls/winmm/Makefile dlls/winmm/Makefile
dlls/winmm/joystick/Makefile dlls/winmm/joystick/Makefile
dlls/winmm/mcianim/Makefile dlls/winmm/mcianim/Makefile
......
...@@ -1027,6 +1027,7 @@ dlls/sound/Makefile ...@@ -1027,6 +1027,7 @@ dlls/sound/Makefile
dlls/stress/Makefile dlls/stress/Makefile
dlls/tapi32/Makefile dlls/tapi32/Makefile
dlls/ttydrv/Makefile dlls/ttydrv/Makefile
dlls/urlmon/Makefile
dlls/user/Makefile dlls/user/Makefile
dlls/version/Makefile dlls/version/Makefile
dlls/win32s/Makefile dlls/win32s/Makefile
...@@ -1034,6 +1035,7 @@ dlls/win87em/Makefile ...@@ -1034,6 +1035,7 @@ dlls/win87em/Makefile
dlls/winaspi/Makefile dlls/winaspi/Makefile
dlls/windebug/Makefile dlls/windebug/Makefile
dlls/wing/Makefile dlls/wing/Makefile
dlls/wininet/Makefile
dlls/winmm/Makefile dlls/winmm/Makefile
dlls/winmm/joystick/Makefile dlls/winmm/joystick/Makefile
dlls/winmm/mcianim/Makefile dlls/winmm/mcianim/Makefile
......
...@@ -37,6 +37,7 @@ DLLFILES = \ ...@@ -37,6 +37,7 @@ DLLFILES = \
stress/libstress.@LIBEXT@ \ stress/libstress.@LIBEXT@ \
tapi32/libtapi32.@LIBEXT@ \ tapi32/libtapi32.@LIBEXT@ \
ttydrv/libttydrv.@LIBEXT@ \ ttydrv/libttydrv.@LIBEXT@ \
urlmon/liburlmon.@LIBEXT@ \
user/libuser32.@LIBEXT@ \ user/libuser32.@LIBEXT@ \
version/libversion.@LIBEXT@ \ version/libversion.@LIBEXT@ \
win32s/libw32skrnl.@LIBEXT@ \ win32s/libw32skrnl.@LIBEXT@ \
...@@ -44,6 +45,7 @@ DLLFILES = \ ...@@ -44,6 +45,7 @@ DLLFILES = \
winaspi/libwnaspi32.@LIBEXT@ \ winaspi/libwnaspi32.@LIBEXT@ \
windebug/libwindebug.@LIBEXT@ \ windebug/libwindebug.@LIBEXT@ \
wing/libwing.@LIBEXT@ \ wing/libwing.@LIBEXT@ \
wininet/libwininet.@LIBEXT@ \
winmm/joystick/libjoystick.drv.@LIBEXT@ \ winmm/joystick/libjoystick.drv.@LIBEXT@ \
winmm/libwinmm.@LIBEXT@ \ winmm/libwinmm.@LIBEXT@ \
winmm/mcianim/libmcianim.drv.@LIBEXT@ \ winmm/mcianim/libmcianim.drv.@LIBEXT@ \
...@@ -118,6 +120,7 @@ SUBDIRS = \ ...@@ -118,6 +120,7 @@ SUBDIRS = \
stress \ stress \
tapi32 \ tapi32 \
ttydrv \ ttydrv \
urlmon \
user \ user \
version \ version \
win32s \ win32s \
...@@ -125,6 +128,7 @@ SUBDIRS = \ ...@@ -125,6 +128,7 @@ SUBDIRS = \
winaspi \ winaspi \
windebug \ windebug \
wing \ wing \
wininet \
winmm \ winmm \
winsock \ winsock \
winspool \ winspool \
...@@ -259,6 +263,9 @@ libtapi32.@LIBEXT@: tapi32/libtapi32.@LIBEXT@ ...@@ -259,6 +263,9 @@ libtapi32.@LIBEXT@: tapi32/libtapi32.@LIBEXT@
libttydrv.@LIBEXT@: ttydrv/libttydrv.@LIBEXT@ libttydrv.@LIBEXT@: ttydrv/libttydrv.@LIBEXT@
$(RM) $@ && $(LN_S) ttydrv/libttydrv.@LIBEXT@ $@ $(RM) $@ && $(LN_S) ttydrv/libttydrv.@LIBEXT@ $@
liburlmon.@LIBEXT@: urlmon/liburlmon.@LIBEXT@
$(RM) $@ && $(LN_S) urlmon/liburlmon.@LIBEXT@ $@
libuser32.@LIBEXT@ libuser.@LIBEXT@: user/libuser32.@LIBEXT@ libuser32.@LIBEXT@ libuser.@LIBEXT@: user/libuser32.@LIBEXT@
$(RM) $@ && $(LN_S) user/libuser32.@LIBEXT@ $@ $(RM) $@ && $(LN_S) user/libuser32.@LIBEXT@ $@
...@@ -280,6 +287,9 @@ libwineoss.drv.@LIBEXT@: winmm/wineoss/libwineoss.drv.@LIBEXT@ ...@@ -280,6 +287,9 @@ libwineoss.drv.@LIBEXT@: winmm/wineoss/libwineoss.drv.@LIBEXT@
libwing.@LIBEXT@: wing/libwing.@LIBEXT@ libwing.@LIBEXT@: wing/libwing.@LIBEXT@
$(RM) $@ && $(LN_S) wing/libwing.@LIBEXT@ $@ $(RM) $@ && $(LN_S) wing/libwing.@LIBEXT@ $@
libwininet.@LIBEXT@: wininet/libwininet.@LIBEXT@
$(RM) $@ && $(LN_S) wininet/libwininet.@LIBEXT@ $@
libwinmm.@LIBEXT@ libmmsystem.@LIBEXT@: winmm/libwinmm.@LIBEXT@ libwinmm.@LIBEXT@ libmmsystem.@LIBEXT@: winmm/libwinmm.@LIBEXT@
$(RM) $@ && $(LN_S) winmm/libwinmm.@LIBEXT@ $@ $(RM) $@ && $(LN_S) winmm/libwinmm.@LIBEXT@ $@
......
Makefile
liburlmon.so.1.0
urlmon.spec.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = urlmon
SOVERSION = 1.0
IMPORTS = ole32
WRCEXTRA = -s -p$(MODULE)
SPEC_SRCS = urlmon.spec
C_SRCS = umon.c
@MAKE_DLL_RULES@
### Dependencies:
/*
* UrlMon
*
* Copyright 1999 Corel Corporation
*
* Ulrich Czekalla
*
*/
#include "windows.h"
#include "objbase.h"
#include "debugtools.h"
#include "urlmon.h"
DEFAULT_DEBUG_CHANNEL(win32);
/***********************************************************************
* CreateURLMoniker (URLMON.22)
*
* Create a url moniker
*
* RETURNS
* S_OK success
* E_OUTOFMEMORY out of memory
* MK_E_SYNTAX not a valid url
*
*/
HRESULT CreateURLMoniker(IMoniker *pmkContext, LPWSTR szURL, IMoniker **ppmk)
{
TRACE("\n");
if (NULL != pmkContext)
FIXME("Non-null pmkContext not implemented\n");
return CreateFileMoniker(szURL, ppmk);
}
name urlmon
type win32
1 stub CDLGetLongPathNameA
2 stub CDLGetLongPathNameW
@ stub AsyncGetClassBits
@ stub AsyncInstallDistributionUnit
@ stub BindAsyncMoniker
@ stub CoGetClassObjectFromURL
@ stub CoInstall
@ stub CoInternetCombineUrl
@ stub CoInternetCompareUrl
@ stub CoInternetCreateSecurityManager
@ stub CoInternetCreateZoneManager
@ stub CoInternetGetProtocolFlags
@ stub CoInternetGetSecurityUrl
@ stub CoInternetGetSession
@ stub CoInternetParseUrl
@ stub CoInternetQueryInfo
@ stub CopyBindInfo
@ stub CopyStgMedium
@ stub CreateAsyncBindCtx
@ stub CreateAsyncBindCtxEx
@ stub CreateFormatEnumerator
@ stdcall CreateURLMoniker(ptr str ptr) CreateURLMoniker
@ stub DllCanUnloadNow
@ stub DllGetClassObject
@ stub DllInstall
@ stub DllRegisterServer
@ stub DllRegisterServerEx
@ stub DllUnregisterServer
@ stub Extract
@ stub FaultInIEFeature
@ stub FindMediaType
@ stub FindMediaTypeClass
@ stub FindMimeFromData
@ stub GetClassFileOrMime
@ stub GetClassURL
@ stub GetComponentIDFromCLSSPEC
@ stub GetMarkOfTheWeb
@ stub GetSoftwareUpdateInfo
@ stub HlinkGoBack
@ stub HlinkGoForward
@ stub HlinkNavigateMoniker
@ stub HlinkNavigateString
@ stub HlinkSimpleNavigateToMoniker
@ stub HlinkSimpleNavigateToString
@ stub IsAsyncMoniker
@ stub IsLoggingEnabledA
@ stub IsLoggingEnabledW
@ stub IsValidURL
@ stub MkParseDisplayNameEx
@ stub ObtainUserAgentString
@ stub PrivateCoInstall
@ stub RegisterBindStatusCallback
@ stub RegisterFormatEnumerator
@ stub RegisterMediaTypeClass
@ stub RegisterMediaTypes
@ stub ReleaseBindInfo
@ stub RevokeBindStatusCallback
@ stub RevokeFormatEnumerator
@ stub SetSoftwareUpdateAdvertisementState
@ stub URLDownloadA
@ stub URLDownloadToCacheFileA
@ stub URLDownloadToCacheFileW
@ stub URLDownloadToFileA
@ stub URLDownloadToFileW
@ stub URLDownloadW
@ stub URLOpenBlockingStreamA
@ stub URLOpenBlockingStreamW
@ stub URLOpenPullStreamA
@ stub URLOpenPullStreamW
@ stub URLOpenStreamA
@ stub URLOpenStreamW
@ stub UrlMkBuildVersion
@ stub UrlMkGetSessionOption
@ stub UrlMkSetSessionOption
@ stub WriteHitLogging
@ stub ZonesReInit
Makefile
libwininet.so.1.0
wininet.spec.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = wininet
SOVERSION = 1.0
SPEC_SRCS = wininet.spec
C_SRCS = \
internet.c \
ftp.c \
utility.c
@MAKE_DLL_RULES@
### Dependencies:
/*
* WININET - Ftp implementation
*
* Copyright 1999 Corel Corporation
*
* Ulrich Czekalla
* Noureddine Jemmali
*/
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "windows.h"
#include "wininet.h"
#include "winerror.h"
#include "winsock.h"
#include "debugtools.h"
#include "internet.h"
DEFAULT_DEBUG_CHANNEL(wininet);
#define NOACCOUNT "noaccount"
#define DATA_PACKET_SIZE 0x2000
#define szCRLF "\r\n"
#define MAX_BACKLOG 5
#define RESPONSE_TIMEOUT 30
typedef enum {
/* FTP commands with arguments. */
FTP_CMD_ACCT,
FTP_CMD_CWD,
FTP_CMD_DELE,
FTP_CMD_MKD,
FTP_CMD_PASS,
FTP_CMD_PORT,
FTP_CMD_RETR,
FTP_CMD_RMD,
FTP_CMD_RNFR,
FTP_CMD_RNTO,
FTP_CMD_STOR,
FTP_CMD_TYPE,
FTP_CMD_USER,
/* FTP commands without arguments. */
FTP_CMD_ABOR,
FTP_CMD_LIST,
FTP_CMD_NLST,
FTP_CMD_PWD,
FTP_CMD_QUIT,
} FTP_COMMAND;
static const CHAR *szFtpCommands[] = {
"ACCT",
"CWD",
"DELE",
"MKD",
"PASS",
"PORT",
"RETR",
"RMD",
"RNFR",
"RNTO",
"STOR",
"TYPE",
"USER",
"ABOR",
"LIST",
"NLST",
"PWD",
"QUIT",
};
static const CHAR szMonths[] = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";
BOOL FTP_SendCommand(INT nSocket, FTP_COMMAND ftpCmd, LPCSTR lpszParam,
INTERNET_STATUS_CALLBACK lpfnStatusCB, HINTERNET hHandle, DWORD dwContext);
BOOL FTP_SendStore(LPWININETFTPSESSIONA lpwfs, LPCSTR lpszRemoteFile, DWORD dwType);
BOOL FTP_InitDataSocket(LPWININETFTPSESSIONA lpwfs, LPINT nDataSocket);
BOOL FTP_SendData(LPWININETFTPSESSIONA lpwfs, INT nDataSocket, HANDLE hFile);
INT FTP_ReceiveResponse(INT nSocket, LPSTR lpszResponse, DWORD dwResponse,
INTERNET_STATUS_CALLBACK lpfnStatusCB, HINTERNET hHandle, DWORD dwContext);
DWORD FTP_SendRetrieve(LPWININETFTPSESSIONA lpwfs, LPCSTR lpszRemoteFile, DWORD dwType);
BOOL FTP_RetrieveFileData(LPWININETFTPSESSIONA lpwfs, INT nDataSocket, DWORD nBytes, HANDLE hFile);
BOOL FTP_InitListenSocket(LPWININETFTPSESSIONA lpwfs);
BOOL FTP_ConnectToHost(LPWININETFTPSESSIONA lpwfs);
BOOL FTP_SendPassword(LPWININETFTPSESSIONA lpwfs);
BOOL FTP_SendAccount(LPWININETFTPSESSIONA lpwfs);
BOOL FTP_SendType(LPWININETFTPSESSIONA lpwfs, DWORD dwType);
BOOL FTP_SendPort(LPWININETFTPSESSIONA lpwfs);
BOOL FTP_ParsePermission(LPCSTR lpszPermission, LPFILEPROPERTIESA lpfp);
BOOL FTP_ParseDirectory(LPWININETFTPSESSIONA lpwfs, INT nSocket, LPFILEPROPERTIESA *lpafp, LPDWORD dwfp);
HINTERNET FTP_ReceiveFileList(LPWININETFTPSESSIONA lpwfs, INT nSocket,
LPWIN32_FIND_DATAA lpFindFileData, DWORD dwContext);
LPSTR FTP_GetNextLine(INT nSocket, LPSTR lpszBuffer, LPDWORD dwBuffer);
DWORD FTP_SetResponseError(DWORD dwResponse);
/***********************************************************************
* FtpPutFileA (WININET.43)
*
* Uploads a file to the FTP server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
LPCSTR lpszNewRemoteFile, DWORD dwFlags, DWORD dwContext)
{
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hConnect;
LPWININETAPPINFOA hIC = NULL;
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
WORKREQUEST workRequest;
workRequest.asyncall = FTPPUTFILEA;
workRequest.HFTPSESSION = (DWORD)hConnect;
workRequest.LPSZLOCALFILE = (DWORD)strdup(lpszLocalFile);
workRequest.LPSZNEWREMOTEFILE = (DWORD)strdup(lpszNewRemoteFile);
workRequest.DWFLAGS = dwFlags;
workRequest.DWCONTEXT = dwContext;
return INTERNET_AsyncCall(&workRequest);
}
else
{
return FTP_FtpPutFileA(hConnect, lpszLocalFile,
lpszNewRemoteFile, dwFlags, dwContext);
}
}
/***********************************************************************
* FTP_FtpPutFileA (Internal)
*
* Uploads a file to the FTP server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
LPCSTR lpszNewRemoteFile, DWORD dwFlags, DWORD dwContext)
{
HANDLE hFile = (HANDLE)NULL;
BOOL bSuccess = FALSE;
LPWININETAPPINFOA hIC = NULL;
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hConnect;
TRACE(" lpszLocalFile(%s) lpszNewRemoteFile(%s)\n", lpszLocalFile, lpszNewRemoteFile);
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
/* Clear any error information */
INTERNET_SetLastError(0);
/* Open file to be uploaded */
if (INVALID_HANDLE_VALUE ==
(hFile = CreateFileA(lpszLocalFile, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0)))
{
INTERNET_SetLastError(ERROR_FILE_NOT_FOUND);
goto lend;
}
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->lpfnStatusCB)
hIC->lpfnStatusCB(hConnect, lpwfs->hdr.dwContext, INTERNET_STATUS_SENDING_REQUEST, NULL, 0);
if (FTP_SendStore(lpwfs, lpszNewRemoteFile, dwFlags))
{
INT nDataSocket;
/* Accept connection from ftp server */
if (FTP_InitDataSocket(lpwfs, &nDataSocket))
{
FTP_SendData(lpwfs, nDataSocket, hFile);
bSuccess = TRUE;
close(nDataSocket);
}
}
lend:
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)bSuccess;
iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError();
hIC->lpfnStatusCB(hConnect, lpwfs->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
if (hFile)
CloseHandle(hFile);
return bSuccess;
}
/***********************************************************************
* FtpSetCurrentDirectoryA (WININET.49)
*
* Change the working directory on the FTP server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
{
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hConnect;
LPWININETAPPINFOA hIC = NULL;
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
TRACE("lpszDirectory(%s)\n", lpszDirectory);
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
WORKREQUEST workRequest;
workRequest.asyncall = FTPSETCURRENTDIRECTORYA;
workRequest.HFTPSESSION = (DWORD)hConnect;
workRequest.LPSZDIRECTORY = (DWORD)strdup(lpszDirectory);
return INTERNET_AsyncCall(&workRequest);
}
else
{
return FTP_FtpSetCurrentDirectoryA(hConnect, lpszDirectory);
}
}
/***********************************************************************
* FTP_FtpSetCurrentDirectoryA (Internal)
*
* Change the working directory on the FTP server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FTP_FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
{
INT nResCode;
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hConnect;
LPWININETAPPINFOA hIC = NULL;
DWORD bSuccess = FALSE;
TRACE("lpszDirectory(%s)\n", lpszDirectory);
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
/* Clear any error information */
INTERNET_SetLastError(0);
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_CWD, lpszDirectory,
hIC->lpfnStatusCB, hConnect, lpwfs->hdr.dwContext))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, hIC->lpfnStatusCB, hConnect, lpwfs->hdr.dwContext);
if (nResCode)
{
if (nResCode == 250)
bSuccess = TRUE;
else
FTP_SetResponseError(nResCode);
}
lend:
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)bSuccess;
iar.dwError = bSuccess ? ERROR_SUCCESS : ERROR_INTERNET_EXTENDED_ERROR;
hIC->lpfnStatusCB(hConnect, lpwfs->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
return bSuccess;
}
/***********************************************************************
* FtpCreateDirectoryA (WININET.31)
*
* Create new directory on the FTP server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
{
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hConnect;
LPWININETAPPINFOA hIC = NULL;
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
WORKREQUEST workRequest;
workRequest.asyncall = FTPCREATEDIRECTORYA;
workRequest.HFTPSESSION = (DWORD)hConnect;
workRequest.LPSZDIRECTORY = (DWORD)strdup(lpszDirectory);
return INTERNET_AsyncCall(&workRequest);
}
else
{
return FTP_FtpCreateDirectoryA(hConnect, lpszDirectory);
}
}
/***********************************************************************
* FTP_FtpCreateDirectoryA (Internal)
*
* Create new directory on the FTP server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FTP_FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
{
INT nResCode;
BOOL bSuccess = FALSE;
LPWININETAPPINFOA hIC = NULL;
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hConnect;
TRACE("\n");
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
/* Clear any error information */
INTERNET_SetLastError(0);
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_MKD, lpszDirectory, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, 0, 0, 0);
if (nResCode)
{
if (nResCode == 257)
bSuccess = TRUE;
else
FTP_SetResponseError(nResCode);
}
lend:
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)bSuccess;
iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError();
hIC->lpfnStatusCB(hConnect, lpwfs->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
return bSuccess;
}
/***********************************************************************
* FtpFindFirstFileA (WININET.35)
*
* Search the specified directory
*
* RETURNS
* HINTERNET on success
* NULL on failure
*
*/
INTERNETAPI HINTERNET WINAPI FtpFindFirstFileA(HINTERNET hConnect,
LPCSTR lpszSearchFile, LPWIN32_FIND_DATAA lpFindFileData, DWORD dwFlags, DWORD dwContext)
{
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hConnect;
LPWININETAPPINFOA hIC = NULL;
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
WORKREQUEST workRequest;
workRequest.asyncall = FTPFINDFIRSTFILEA;
workRequest.HFTPSESSION = (DWORD)hConnect;
workRequest.LPSZSEARCHFILE = (DWORD)strdup(lpszSearchFile);
workRequest.LPFINDFILEDATA = (DWORD)lpFindFileData;
workRequest.DWFLAGS = dwFlags;
workRequest.DWCONTEXT= dwContext;
INTERNET_AsyncCall(&workRequest);
return NULL;
}
else
{
return FTP_FtpFindFirstFileA(hConnect, lpszSearchFile, lpFindFileData,
dwFlags, dwContext);
}
}
/***********************************************************************
* FTP_FtpFindFirstFileA (Internal)
*
* Search the specified directory
*
* RETURNS
* HINTERNET on success
* NULL on failure
*
*/
INTERNETAPI HINTERNET WINAPI FTP_FtpFindFirstFileA(HINTERNET hConnect,
LPCSTR lpszSearchFile, LPWIN32_FIND_DATAA lpFindFileData, DWORD dwFlags, DWORD dwContext)
{
INT nResCode;
LPWININETAPPINFOA hIC = NULL;
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hConnect;
LPWININETFINDNEXTA hFindNext = NULL;
TRACE("\n");
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
/* Clear any error information */
INTERNET_SetLastError(0);
if (!FTP_InitListenSocket(lpwfs))
goto lend;
if (!FTP_SendType(lpwfs, INTERNET_FLAG_TRANSFER_ASCII))
goto lend;
if (!FTP_SendPort(lpwfs))
goto lend;
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_LIST, lpszSearchFile,
hIC->lpfnStatusCB, hConnect, lpwfs->hdr.dwContext))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, hIC->lpfnStatusCB, hConnect, lpwfs->hdr.dwContext);
if (nResCode)
{
if (nResCode == 125 || nResCode == 150)
{
INT nDataSocket;
if (FTP_InitDataSocket(lpwfs, &nDataSocket))
{
hFindNext = FTP_ReceiveFileList(lpwfs, nDataSocket, lpFindFileData, dwContext);
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, hIC->lpfnStatusCB, hConnect, lpwfs->hdr.dwContext);
if (nResCode != 226 && nResCode != 250)
INTERNET_SetLastError(ERROR_NO_MORE_FILES);
close(nDataSocket);
}
}
else
FTP_SetResponseError(nResCode);
}
lend:
if (lpwfs->lstnSocket != INVALID_SOCKET)
close(lpwfs->lstnSocket);
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
if (hFindNext)
{
iar.dwResult = (DWORD)hFindNext;
iar.dwError = ERROR_SUCCESS;
hIC->lpfnStatusCB(hConnect, lpwfs->hdr.dwContext, INTERNET_STATUS_HANDLE_CREATED,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
iar.dwResult = (DWORD)hFindNext;
iar.dwError = hFindNext ? ERROR_SUCCESS : INTERNET_GetLastError();
hIC->lpfnStatusCB(hConnect, lpwfs->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
return (HINTERNET)hFindNext;
}
/***********************************************************************
* FtpGetCurrentDirectoryA (WININET.37)
*
* Retrieves the current directory
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDirectory,
LPDWORD lpdwCurrentDirectory)
{
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hFtpSession;
LPWININETAPPINFOA hIC = NULL;
TRACE("len(%ld)\n", *lpdwCurrentDirectory);
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
WORKREQUEST workRequest;
workRequest.asyncall = FTPGETCURRENTDIRECTORYA;
workRequest.HFTPSESSION = (DWORD)hFtpSession;
workRequest.LPSZDIRECTORY = (DWORD)lpszCurrentDirectory;
workRequest.LPDWDIRECTORY = (DWORD)lpdwCurrentDirectory;
return INTERNET_AsyncCall(&workRequest);
}
else
{
return FTP_FtpGetCurrentDirectoryA(hFtpSession, lpszCurrentDirectory,
lpdwCurrentDirectory);
}
}
/***********************************************************************
* FTP_FtpGetCurrentDirectoryA (Internal)
*
* Retrieves the current directory
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FTP_FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDirectory,
LPDWORD lpdwCurrentDirectory)
{
INT nResCode;
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hFtpSession;
LPWININETAPPINFOA hIC = NULL;
DWORD bSuccess = FALSE;
TRACE("len(%ld)\n", *lpdwCurrentDirectory);
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
/* Clear any error information */
INTERNET_SetLastError(0);
ZeroMemory(lpszCurrentDirectory, *lpdwCurrentDirectory);
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_PWD, NULL,
hIC->lpfnStatusCB, hFtpSession, lpwfs->hdr.dwContext))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, hIC->lpfnStatusCB, hFtpSession, lpwfs->hdr.dwContext);
if (nResCode)
{
if (nResCode == 257) /* Extract directory name */
{
INT firstpos, lastpos, len;
LPSTR lpszResponseBuffer = INTERNET_GetResponseBuffer();
for (firstpos = 0, lastpos = 0; lpszResponseBuffer[lastpos]; lastpos++)
{
if ('"' == lpszResponseBuffer[lastpos])
{
if (!firstpos)
firstpos = lastpos;
else
break;
}
}
len = lastpos - firstpos - 1;
strncpy(lpszCurrentDirectory, &lpszResponseBuffer[firstpos+1],
len < *lpdwCurrentDirectory ? len : *lpdwCurrentDirectory);
*lpdwCurrentDirectory = len;
bSuccess = TRUE;
}
else
FTP_SetResponseError(nResCode);
}
lend:
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)bSuccess;
iar.dwError = bSuccess ? ERROR_SUCCESS : ERROR_INTERNET_EXTENDED_ERROR;
hIC->lpfnStatusCB(hFtpSession, lpwfs->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
return (DWORD) bSuccess;
}
/***********************************************************************
* FtpOpenFileA (WININET.41)
*
* Open a remote file for writing or reading
*
* RETURNS
* HINTERNET handle on success
* NULL on failure
*
*/
INTERNETAPI HINTERNET WINAPI FtpOpenFileA(HINTERNET hFtpSession,
LPCSTR lpszFileName, DWORD fdwAccess, DWORD dwFlags,
DWORD dwContext)
{
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hFtpSession;
LPWININETAPPINFOA hIC = NULL;
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
WORKREQUEST workRequest;
workRequest.asyncall = FTPOPENFILEA;
workRequest.HFTPSESSION = (DWORD)hFtpSession;
workRequest.LPSZFILENAME = (DWORD)strdup(lpszFileName);
workRequest.FDWACCESS = fdwAccess;
workRequest.DWFLAGS = dwFlags;
workRequest.DWCONTEXT = dwContext;
INTERNET_AsyncCall(&workRequest);
return NULL;
}
else
{
return FTP_FtpOpenFileA(hFtpSession, lpszFileName, fdwAccess, dwFlags, dwContext);
}
}
/***********************************************************************
* FTP_FtpOpenFileA (Internal)
*
* Open a remote file for writing or reading
*
* RETURNS
* HINTERNET handle on success
* NULL on failure
*
*/
HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
LPCSTR lpszFileName, DWORD fdwAccess, DWORD dwFlags,
DWORD dwContext)
{
INT nDataSocket;
BOOL bSuccess = FALSE;
LPWININETFILE hFile = NULL;
LPWININETAPPINFOA hIC = NULL;
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hFtpSession;
TRACE("\n");
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
/* Clear any error information */
INTERNET_SetLastError(0);
if (GENERIC_READ == fdwAccess)
{
/* Set up socket to retrieve data */
bSuccess = FTP_SendRetrieve(lpwfs, lpszFileName, dwFlags);
}
else if (GENERIC_WRITE == fdwAccess)
{
/* Set up socket to send data */
bSuccess = FTP_SendStore(lpwfs, lpszFileName, dwFlags);
}
/* Accept connection from server */
if (bSuccess && FTP_InitDataSocket(lpwfs, &nDataSocket))
{
hFile = HeapAlloc(GetProcessHeap(), 0, sizeof(WININETFILE));
hFile->hdr.htype = WH_HFILE;
hFile->hdr.dwFlags = dwFlags;
hFile->hdr.dwContext = dwContext;
hFile->hdr.lpwhparent = hFtpSession;
hFile->nDataSocket = nDataSocket;
}
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
if (hFile)
{
iar.dwResult = (DWORD)hFile;
iar.dwError = ERROR_SUCCESS;
hIC->lpfnStatusCB(hFtpSession, lpwfs->hdr.dwContext, INTERNET_STATUS_HANDLE_CREATED,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
iar.dwResult = (DWORD)bSuccess;
iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError();
hIC->lpfnStatusCB(hFtpSession, lpwfs->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
return (HINTERNET)hFile;
}
/***********************************************************************
* FtpGetFileA (WININET.39)
*
* Retrieve file from the FTP server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszNewFile,
BOOL fFailIfExists, DWORD dwLocalFlagsAttribute, DWORD dwInternetFlags,
DWORD dwContext)
{
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hInternet;
LPWININETAPPINFOA hIC = NULL;
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
WORKREQUEST workRequest;
workRequest.asyncall = FTPGETFILEA;
workRequest.HFTPSESSION = (DWORD)hInternet;
workRequest.LPSZREMOTEFILE = (DWORD)strdup(lpszRemoteFile);
workRequest.LPSZNEWFILE = (DWORD)strdup(lpszNewFile);
workRequest.DWLOCALFLAGSATTRIBUTE = dwLocalFlagsAttribute;
workRequest.FFAILIFEXISTS = (DWORD)fFailIfExists;
workRequest.DWFLAGS = dwInternetFlags;
workRequest.DWCONTEXT = dwContext;
return INTERNET_AsyncCall(&workRequest);
}
else
{
return FTP_FtpGetFileA(hInternet, lpszRemoteFile, lpszNewFile,
fFailIfExists, dwLocalFlagsAttribute, dwInternetFlags, dwContext);
}
}
/***********************************************************************
* FTP_FtpGetFileA (Internal)
*
* Retrieve file from the FTP server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FTP_FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszNewFile,
BOOL fFailIfExists, DWORD dwLocalFlagsAttribute, DWORD dwInternetFlags,
DWORD dwContext)
{
DWORD nBytes;
BOOL bSuccess = FALSE;
HANDLE hFile;
LPWININETAPPINFOA hIC = NULL;
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hInternet;
TRACE("lpszRemoteFile(%s) lpszNewFile(%s)\n", lpszRemoteFile, lpszNewFile);
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
/* Clear any error information */
INTERNET_SetLastError(0);
/* Ensure we can write to lpszNewfile by opening it */
hFile = CreateFileA(lpszNewFile, GENERIC_WRITE, 0, 0, fFailIfExists ?
CREATE_NEW : CREATE_ALWAYS, dwLocalFlagsAttribute, 0);
if (INVALID_HANDLE_VALUE == hFile)
goto lend;
/* Set up socket to retrieve data */
nBytes = FTP_SendRetrieve(lpwfs, lpszRemoteFile, dwInternetFlags);
if (nBytes > 0)
{
INT nDataSocket;
/* Accept connection from ftp server */
if (FTP_InitDataSocket(lpwfs, &nDataSocket))
{
INT nResCode;
/* Receive data */
FTP_RetrieveFileData(lpwfs, nDataSocket, nBytes, hFile);
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, 0, 0, 0);
if (nResCode)
{
if (nResCode == 226)
bSuccess = TRUE;
else
FTP_SetResponseError(nResCode);
}
close(nDataSocket);
}
}
lend:
if (hFile)
CloseHandle(hFile);
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)bSuccess;
iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError();
hIC->lpfnStatusCB(hInternet, lpwfs->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
return bSuccess;
}
/***********************************************************************
* FtpDeleteFileA (WININET.33)
*
* Delete a file on the ftp server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
{
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hFtpSession;
LPWININETAPPINFOA hIC = NULL;
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
WORKREQUEST workRequest;
workRequest.asyncall = FTPRENAMEFILEA;
workRequest.HFTPSESSION = (DWORD)hFtpSession;
workRequest.LPSZFILENAME = (DWORD)strdup(lpszFileName);
return INTERNET_AsyncCall(&workRequest);
}
else
{
return FTP_FtpDeleteFileA(hFtpSession, lpszFileName);
}
}
/***********************************************************************
* FTP_FtpDeleteFileA (Internal)
*
* Delete a file on the ftp server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
{
INT nResCode;
BOOL bSuccess = FALSE;
LPWININETAPPINFOA hIC = NULL;
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hFtpSession;
TRACE("0x%08lx\n", (ULONG) hFtpSession);
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
/* Clear any error information */
INTERNET_SetLastError(0);
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_DELE, lpszFileName, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, 0, 0, 0);
if (nResCode)
{
if (nResCode == 250)
bSuccess = TRUE;
else
FTP_SetResponseError(nResCode);
}
lend:
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)bSuccess;
iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError();
hIC->lpfnStatusCB(hFtpSession, lpwfs->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
return bSuccess;
}
/***********************************************************************
* FtpRemoveDirectoryA (WININET.45)
*
* Remove a directory on the ftp server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
{
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hFtpSession;
LPWININETAPPINFOA hIC = NULL;
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
WORKREQUEST workRequest;
workRequest.asyncall = FTPREMOVEDIRECTORYA;
workRequest.HFTPSESSION = (DWORD)hFtpSession;
workRequest.LPSZDIRECTORY = (DWORD)strdup(lpszDirectory);
return INTERNET_AsyncCall(&workRequest);
}
else
{
return FTP_FtpRemoveDirectoryA(hFtpSession, lpszDirectory);
}
}
/***********************************************************************
* FTP_FtpRemoveDirectoryA (Internal)
*
* Remove a directory on the ftp server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
{
INT nResCode;
BOOL bSuccess = FALSE;
LPWININETAPPINFOA hIC = NULL;
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hFtpSession;
TRACE("\n");
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
/* Clear any error information */
INTERNET_SetLastError(0);
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_RMD, lpszDirectory, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, 0, 0, 0);
if (nResCode)
{
if (nResCode == 250)
bSuccess = TRUE;
else
FTP_SetResponseError(nResCode);
}
lend:
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)bSuccess;
iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError();
hIC->lpfnStatusCB(hFtpSession, lpwfs->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
return bSuccess;
}
/***********************************************************************
* FtpRenameFileA (WININET.47)
*
* Rename a file on the ftp server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDest)
{
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hFtpSession;
LPWININETAPPINFOA hIC = NULL;
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
WORKREQUEST workRequest;
workRequest.asyncall = FTPRENAMEFILEA;
workRequest.HFTPSESSION = (DWORD)hFtpSession;
workRequest.LPSZSRCFILE = (DWORD)strdup(lpszSrc);
workRequest.LPSZDESTFILE = (DWORD)strdup(lpszDest);
return INTERNET_AsyncCall(&workRequest);
}
else
{
return FTP_FtpRenameFileA(hFtpSession, lpszSrc, lpszDest);
}
}
/***********************************************************************
* FTP_FtpRenameFileA (Internal)
*
* Rename a file on the ftp server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDest)
{
INT nResCode;
BOOL bSuccess = FALSE;
LPWININETAPPINFOA hIC = NULL;
LPWININETFTPSESSIONA lpwfs = (LPWININETFTPSESSIONA) hFtpSession;
TRACE("\n");
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
/* Clear any error information */
INTERNET_SetLastError(0);
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_RNFR, lpszSrc, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket,
INTERNET_GetResponseBuffer(), MAX_REPLY_LEN, 0, 0, 0);
if (nResCode == 350)
{
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_RNTO, lpszDest, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket,
INTERNET_GetResponseBuffer(), MAX_REPLY_LEN, 0, 0, 0);
}
if (nResCode == 250)
bSuccess = TRUE;
else
FTP_SetResponseError(nResCode);
lend:
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)bSuccess;
iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError();
hIC->lpfnStatusCB(hFtpSession, lpwfs->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
return bSuccess;
}
/***********************************************************************
* FTP_Connect (internal)
*
* Connect to a ftp server
*
* RETURNS
* HINTERNET a session handle on success
* NULL on failure
*
*/
HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
INTERNET_PORT nServerPort, LPCSTR lpszUserName,
LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext)
{
struct sockaddr_in socketAddr;
struct hostent *phe = NULL;
INT nsocket = INVALID_SOCKET;
LPWININETAPPINFOA hIC = NULL;
BOOL bSuccess = FALSE;
LPWININETFTPSESSIONA lpwfs = NULL;
TRACE("0x%08lx Server(%s) Port(%d) User(%s) Paswd(%s)\n",
(ULONG) hInternet, lpszServerName,
nServerPort, lpszUserName, lpszPassword);
if (((LPWININETHANDLEHEADER)hInternet)->htype != WH_HINIT)
goto lerror;
hIC = (LPWININETAPPINFOA) hInternet;
if (NULL == lpszUserName && NULL != lpszPassword)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_USER_NAME);
goto lerror;
}
if (nServerPort == INTERNET_INVALID_PORT_NUMBER)
nServerPort = INTERNET_DEFAULT_FTP_PORT;
if (hIC->lpfnStatusCB)
hIC->lpfnStatusCB(hInternet, dwContext, INTERNET_STATUS_RESOLVING_NAME,
lpszServerName, strlen(lpszServerName));
if (!GetAddress(lpszServerName, nServerPort, &phe, &socketAddr))
{
INTERNET_SetLastError(ERROR_INTERNET_NAME_NOT_RESOLVED);
goto lerror;
}
if (hIC->lpfnStatusCB)
hIC->lpfnStatusCB(hInternet, dwContext, INTERNET_STATUS_NAME_RESOLVED,
lpszServerName, strlen(lpszServerName));
if (INVALID_SOCKET == (nsocket = socket(AF_INET,SOCK_STREAM,0)))
{
INTERNET_SetLastError(ERROR_INTERNET_CANNOT_CONNECT);
goto lerror;
}
if (hIC->lpfnStatusCB)
hIC->lpfnStatusCB(hInternet, dwContext, INTERNET_STATUS_CONNECTING_TO_SERVER,
&socketAddr, sizeof(struct sockaddr_in));
if (connect(nsocket, (struct sockaddr *)&socketAddr, sizeof(socketAddr)) < 0)
{
ERR("Unable to connect: errno(%d)\n", errno);
INTERNET_SetLastError(ERROR_INTERNET_CANNOT_CONNECT);
}
else
{
TRACE("Connected to server\n");
if (hIC->lpfnStatusCB)
hIC->lpfnStatusCB(hInternet, dwContext, INTERNET_STATUS_CONNECTED_TO_SERVER,
&socketAddr, sizeof(struct sockaddr_in));
lpwfs = HeapAlloc(GetProcessHeap(), 0, sizeof(WININETFTPSESSIONA));
if (NULL == lpwfs)
{
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
goto lerror;
}
lpwfs->hdr.htype = WH_HFTPSESSION;
lpwfs->hdr.dwFlags = dwFlags;
lpwfs->hdr.dwContext = dwContext;
lpwfs->hdr.lpwhparent = (LPWININETHANDLEHEADER)hInternet;
lpwfs->sndSocket = nsocket;
memcpy(&lpwfs->socketAddress, &socketAddr, sizeof(socketAddr));
lpwfs->phostent = phe;
if (NULL == lpszUserName)
{
lpwfs->lpszUserName = strdup("anonymous");
lpwfs->lpszPassword = strdup("user@server");
}
else
{
lpwfs->lpszUserName = strdup(lpszUserName);
lpwfs->lpszPassword = strdup(lpszPassword);
}
if (FTP_ConnectToHost(lpwfs))
{
if (hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)lpwfs;
iar.dwError = ERROR_SUCCESS;
hIC->lpfnStatusCB(hInternet, dwContext, INTERNET_STATUS_HANDLE_CREATED,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
TRACE("Successfully logged into server\n");
bSuccess = TRUE;
}
}
lerror:
if (!bSuccess && INVALID_SOCKET != nsocket)
close(nsocket);
if (!bSuccess && lpwfs)
{
HeapFree(GetProcessHeap(), 0, lpwfs);
lpwfs = NULL;
}
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)lpwfs;
iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError();
hIC->lpfnStatusCB(hInternet, dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
return (HINTERNET) lpwfs;
}
/***********************************************************************
* FTP_ConnectHost (internal)
*
* Connect to a ftp server
*
* RETURNS
* TRUE on success
* NULL on failure
*
*/
BOOL FTP_ConnectToHost(LPWININETFTPSESSIONA lpwfs)
{
INT nResCode;
BOOL bSuccess = FALSE;
TRACE("\n");
FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(), MAX_REPLY_LEN, 0, 0, 0);
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_USER, lpwfs->lpszUserName, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, 0, 0, 0);
if (nResCode)
{
/* Login successful... */
if (nResCode == 230)
bSuccess = TRUE;
/* User name okay, need password... */
else if (nResCode == 331)
bSuccess = FTP_SendPassword(lpwfs);
/* Need account for login... */
else if (nResCode == 332)
bSuccess = FTP_SendAccount(lpwfs);
else
FTP_SetResponseError(nResCode);
}
TRACE("Returning %d\n", bSuccess);
lend:
return bSuccess;
}
/***********************************************************************
* FTP_SendCommand (internal)
*
* Send command to server
*
* RETURNS
* TRUE on success
* NULL on failure
*
*/
BOOL FTP_SendCommand(INT nSocket, FTP_COMMAND ftpCmd, LPCSTR lpszParam,
INTERNET_STATUS_CALLBACK lpfnStatusCB, HINTERNET hHandle, DWORD dwContext)
{
DWORD len;
CHAR *buf;
DWORD nBytesSent = 0;
DWORD nRC = 0;
BOOL bParamHasLen;
TRACE("%d: (%s) %d\n", ftpCmd, lpszParam, nSocket);
if (lpfnStatusCB)
lpfnStatusCB(hHandle, dwContext, INTERNET_STATUS_SENDING_REQUEST, NULL, 0);
bParamHasLen = lpszParam && strlen(lpszParam) > 0;
len = (bParamHasLen ? strlen(lpszParam) : -1) + strlen(szFtpCommands[ftpCmd]) +
strlen(szCRLF)+ 1;
if (NULL == (buf = HeapAlloc(GetProcessHeap(), 0, len+1)))
{
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
sprintf(buf, "%s%s%s%s", szFtpCommands[ftpCmd], bParamHasLen ? " " : "",
bParamHasLen ? lpszParam : "", szCRLF);
TRACE("Sending (%s) len(%ld)\n", buf, len);
while((nBytesSent < len) && (nRC != SOCKET_ERROR))
{
nRC = send(nSocket, buf+nBytesSent, len - nBytesSent, 0);
nBytesSent += nRC;
}
HeapFree(GetProcessHeap(), 0, (LPVOID)buf);
if (lpfnStatusCB)
lpfnStatusCB(hHandle, dwContext, INTERNET_STATUS_REQUEST_SENT,
&nBytesSent, sizeof(DWORD));
TRACE("Sent %ld bytes\n", nBytesSent);
return (nRC != SOCKET_ERROR);
}
/***********************************************************************
* FTP_ReceiveResponse (internal)
*
* Receive response from server
*
* RETURNS
* Reply code on success
* 0 on failure
*
*/
INT FTP_ReceiveResponse(INT nSocket, LPSTR lpszResponse, DWORD dwResponse,
INTERNET_STATUS_CALLBACK lpfnStatusCB, HINTERNET hHandle, DWORD dwContext)
{
DWORD nRecv;
INT rc = 0;
TRACE("socket(%d) \n", nSocket);
if (lpfnStatusCB)
lpfnStatusCB(hHandle, dwContext, INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0);
while(1)
{
nRecv = dwResponse;
if (!FTP_GetNextLine(nSocket, lpszResponse, &nRecv))
goto lerror;
if (nRecv >= 3 && lpszResponse[3] != '-')
break;
}
if (nRecv >= 3)
{
lpszResponse[nRecv] = '\0';
rc = atoi(lpszResponse);
if (lpfnStatusCB)
lpfnStatusCB(hHandle, dwContext, INTERNET_STATUS_RESPONSE_RECEIVED,
&nRecv, sizeof(DWORD));
}
lerror:
TRACE("return %d\n", rc);
return rc;
}
/***********************************************************************
* FTP_SendPassword (internal)
*
* Send password to ftp server
*
* RETURNS
* TRUE on success
* NULL on failure
*
*/
BOOL FTP_SendPassword(LPWININETFTPSESSIONA lpwfs)
{
INT nResCode;
BOOL bSuccess = FALSE;
TRACE("\n");
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_PASS, lpwfs->lpszPassword, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, 0, 0, 0);
if (nResCode)
{
TRACE("Received reply code %d\n", nResCode);
/* Login successful... */
if (nResCode == 230)
bSuccess = TRUE;
/* Command not implemented, superfluous at the server site... */
/* Need account for login... */
else if (nResCode == 332)
bSuccess = FTP_SendAccount(lpwfs);
else
FTP_SetResponseError(nResCode);
}
lend:
TRACE("Returning %d\n", bSuccess);
return bSuccess;
}
/***********************************************************************
* FTP_SendAccount (internal)
*
*
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_SendAccount(LPWININETFTPSESSIONA lpwfs)
{
INT nResCode;
BOOL bSuccess = FALSE;
TRACE("\n");
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_ACCT, NOACCOUNT, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, 0, 0, 0);
if (nResCode)
bSuccess = TRUE;
else
FTP_SetResponseError(nResCode);
lend:
return bSuccess;
}
/***********************************************************************
* FTP_SendStore (internal)
*
* Send request to upload file to ftp server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_SendStore(LPWININETFTPSESSIONA lpwfs, LPCSTR lpszRemoteFile, DWORD dwType)
{
INT nResCode;
BOOL bSuccess = FALSE;
TRACE("\n");
if (!FTP_InitListenSocket(lpwfs))
goto lend;
if (!FTP_SendType(lpwfs, dwType))
goto lend;
if (!FTP_SendPort(lpwfs))
goto lend;
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_STOR, lpszRemoteFile, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, 0, 0, 0);
if (nResCode)
{
if (nResCode == 150)
bSuccess = TRUE;
else
FTP_SetResponseError(nResCode);
}
lend:
if (!bSuccess && INVALID_SOCKET != lpwfs->lstnSocket)
{
close(lpwfs->lstnSocket);
lpwfs->lstnSocket = INVALID_SOCKET;
}
return bSuccess;
}
/***********************************************************************
* FTP_InitListenSocket (internal)
*
* Create a socket to listen for server response
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_InitListenSocket(LPWININETFTPSESSIONA lpwfs)
{
BOOL bSuccess = FALSE;
socklen_t namelen = sizeof(struct sockaddr_in);
TRACE("\n");
lpwfs->lstnSocket = socket(PF_INET, SOCK_STREAM, 0);
if (INVALID_SOCKET == lpwfs->lstnSocket)
{
TRACE("Unable to create listening socket\n");
goto lend;
}
lpwfs->lstnSocketAddress.sin_family = AF_INET;
lpwfs->lstnSocketAddress.sin_port = htons((u_short) 0);
lpwfs->lstnSocketAddress.sin_addr.s_addr = htonl(INADDR_ANY);
if (SOCKET_ERROR == bind(lpwfs->lstnSocket,&lpwfs->lstnSocketAddress, sizeof(struct sockaddr_in)))
{
TRACE("Unable to bind socket\n");
goto lend;
}
if (SOCKET_ERROR == listen(lpwfs->lstnSocket, MAX_BACKLOG))
{
TRACE("listen failed\n");
goto lend;
}
if (SOCKET_ERROR != getsockname(lpwfs->lstnSocket, &lpwfs->lstnSocketAddress, &namelen))
bSuccess = TRUE;
lend:
if (!bSuccess && INVALID_SOCKET == lpwfs->lstnSocket)
{
close(lpwfs->lstnSocket);
lpwfs->lstnSocket = INVALID_SOCKET;
}
return bSuccess;
}
/***********************************************************************
* FTP_SendType (internal)
*
* Tell server type of data being transfered
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_SendType(LPWININETFTPSESSIONA lpwfs, DWORD dwType)
{
INT nResCode;
CHAR type[2] = { "I\0" };
BOOL bSuccess = FALSE;
TRACE("\n");
if (dwType & INTERNET_FLAG_TRANSFER_ASCII)
*type = 'A';
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_TYPE, type, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, 0, 0, 0)/100;
if (nResCode)
{
if (nResCode == 2)
bSuccess = TRUE;
else
FTP_SetResponseError(nResCode);
}
lend:
return bSuccess;
}
/***********************************************************************
* FTP_SendPort (internal)
*
* Tell server which port to use
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_SendPort(LPWININETFTPSESSIONA lpwfs)
{
INT nResCode;
CHAR szIPAddress[64];
BOOL bSuccess = FALSE;
TRACE("\n");
sprintf(szIPAddress, "%d,%d,%d,%d,%d,%d",
lpwfs->socketAddress.sin_addr.s_addr&0x000000FF,
(lpwfs->socketAddress.sin_addr.s_addr&0x0000FF00)>>8,
(lpwfs->socketAddress.sin_addr.s_addr&0x00FF0000)>>16,
(lpwfs->socketAddress.sin_addr.s_addr&0xFF000000)>>24,
lpwfs->lstnSocketAddress.sin_port & 0xFF,
(lpwfs->lstnSocketAddress.sin_port & 0xFF00)>>8);
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_PORT, szIPAddress, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN,0, 0, 0);
if (nResCode)
{
if (nResCode == 200)
bSuccess = TRUE;
else
FTP_SetResponseError(nResCode);
}
lend:
return bSuccess;
}
/***********************************************************************
* FTP_InitDataSocket (internal)
*
*
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_InitDataSocket(LPWININETFTPSESSIONA lpwfs, LPINT nDataSocket)
{
struct sockaddr_in saddr;
socklen_t addrlen = sizeof(struct sockaddr);
TRACE("\n");
*nDataSocket = accept(lpwfs->lstnSocket, &saddr, &addrlen);
close(lpwfs->lstnSocket);
lpwfs->lstnSocket = INVALID_SOCKET;
return *nDataSocket != INVALID_SOCKET;
}
/***********************************************************************
* FTP_SendData (internal)
*
* Send data to the server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_SendData(LPWININETFTPSESSIONA lpwfs, INT nDataSocket, HANDLE hFile)
{
BY_HANDLE_FILE_INFORMATION fi;
DWORD nBytesRead = 0;
DWORD nBytesSent = 0;
DWORD nTotalSent = 0;
DWORD nBytesToSend, nLen, nRC = 1;
time_t s_long_time, e_long_time;
LONG nSeconds;
CHAR *lpszBuffer;
TRACE("\n");
lpszBuffer = HeapAlloc(GetProcessHeap(), 0, sizeof(CHAR)*DATA_PACKET_SIZE);
memset(lpszBuffer, 0, sizeof(CHAR)*DATA_PACKET_SIZE);
/* Get the size of the file. */
GetFileInformationByHandle(hFile, &fi);
time(&s_long_time);
do
{
nBytesToSend = nBytesRead - nBytesSent;
if (nBytesToSend <= 0)
{
/* Read data from file. */
nBytesSent = 0;
if (!ReadFile(hFile, lpszBuffer, DATA_PACKET_SIZE, &nBytesRead, 0))
ERR("Failed reading from file\n");
if (nBytesRead > 0)
nBytesToSend = nBytesRead;
else
break;
}
nLen = DATA_PACKET_SIZE < nBytesToSend ?
DATA_PACKET_SIZE : nBytesToSend;
nRC = send(nDataSocket, lpszBuffer, nLen, 0);
if (nRC != SOCKET_ERROR)
{
nBytesSent += nRC;
nTotalSent += nRC;
}
/* Do some computation to display the status. */
time(&e_long_time);
nSeconds = e_long_time - s_long_time;
if( nSeconds / 60 > 0 )
{
TRACE( "%ld bytes of %d bytes (%ld%%) in %ld min %ld sec estimated remainig time %ld sec\t\t\r",
nTotalSent, fi.nFileSizeLow, nTotalSent*100/fi.nFileSizeLow, nSeconds / 60,
nSeconds % 60, (fi.nFileSizeLow - nTotalSent) * nSeconds / nTotalSent );
}
else
{
TRACE( "%ld bytes of %d bytes (%ld%%) in %ld sec estimated remainig time %ld sec\t\t\r",
nTotalSent, fi.nFileSizeLow, nTotalSent*100/fi.nFileSizeLow, nSeconds,
(fi.nFileSizeLow - nTotalSent) * nSeconds / nTotalSent);
}
} while (nRC != SOCKET_ERROR);
TRACE("file transfer complete!\n");
if(lpszBuffer != NULL)
HeapFree(GetProcessHeap(), 0, lpszBuffer);
return nTotalSent;
}
/***********************************************************************
* FTP_SendRetrieve (internal)
*
* Send request to retrieve a file
*
* RETURNS
* Number of bytes to be received on success
* 0 on failure
*
*/
DWORD FTP_SendRetrieve(LPWININETFTPSESSIONA lpwfs, LPCSTR lpszRemoteFile, DWORD dwType)
{
INT nResCode;
DWORD nResult = 0;
TRACE("\n");
if (!FTP_InitListenSocket(lpwfs))
goto lend;
if (!FTP_SendType(lpwfs, dwType))
goto lend;
if (!FTP_SendPort(lpwfs))
goto lend;
if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_RETR, lpszRemoteFile, 0, 0, 0))
goto lend;
nResCode = FTP_ReceiveResponse(lpwfs->sndSocket, INTERNET_GetResponseBuffer(),
MAX_REPLY_LEN, 0, 0, 0);
if (nResCode)
{
if (nResCode == 125 || nResCode == 150)
{
/* Parse size of data to be retrieved */
INT i, sizepos = -1;
LPSTR lpszResponseBuffer = INTERNET_GetResponseBuffer();
for (i = strlen(lpszResponseBuffer) - 1; i >= 0; i--)
{
if ('(' == lpszResponseBuffer[i])
{
sizepos = i;
break;
}
}
if (sizepos >= 0)
{
nResult = atol(&lpszResponseBuffer[sizepos+1]);
TRACE("Waiting to receive %ld bytes\n", nResult);
}
}
}
lend:
if (0 == nResult && INVALID_SOCKET != lpwfs->lstnSocket)
{
close(lpwfs->lstnSocket);
lpwfs->lstnSocket = INVALID_SOCKET;
}
return nResult;
}
/***********************************************************************
* FTP_RetrieveData (internal)
*
* Retrieve data from server
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_RetrieveFileData(LPWININETFTPSESSIONA lpwfs, INT nDataSocket, DWORD nBytes, HANDLE hFile)
{
DWORD nBytesWritten;
DWORD nBytesReceived = 0;
INT nRC = 0;
CHAR *lpszBuffer;
TRACE("\n");
if (INVALID_HANDLE_VALUE == hFile)
return FALSE;
lpszBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHAR)*DATA_PACKET_SIZE);
if (NULL == lpszBuffer)
{
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
while (nBytesReceived < nBytes && nRC != SOCKET_ERROR)
{
nRC = recv(nDataSocket, lpszBuffer, DATA_PACKET_SIZE, 0);
if (nRC != SOCKET_ERROR)
{
/* other side closed socket. */
if (nRC == 0)
goto recv_end;
WriteFile(hFile, lpszBuffer, nRC, &nBytesWritten, NULL);
nBytesReceived += nRC;
}
TRACE("%ld bytes of %ld (%ld%%)\r", nBytesReceived, nBytes,
nBytesReceived * 100 / nBytes);
}
TRACE("Data transfer complete\n");
if (NULL != lpszBuffer)
HeapFree(GetProcessHeap(), 0, lpszBuffer);
recv_end:
return (nRC != SOCKET_ERROR);
}
/***********************************************************************
* FTP_CloseSessionHandle (internal)
*
* Deallocate session handle
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_CloseSessionHandle(LPWININETFTPSESSIONA lpwfs)
{
if (INVALID_SOCKET != lpwfs->sndSocket)
close(lpwfs->sndSocket);
if (INVALID_SOCKET != lpwfs->lstnSocket)
close(lpwfs->lstnSocket);
if (lpwfs->lpszPassword)
HeapFree(GetProcessHeap(), 0, lpwfs->lpszPassword);
if (lpwfs->lpszUserName)
HeapFree(GetProcessHeap(), 0, lpwfs->lpszUserName);
HeapFree(GetProcessHeap(), 0, lpwfs);
return TRUE;
}
/***********************************************************************
* FTP_CloseSessionHandle (internal)
*
* Deallocate session handle
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_CloseFindNextHandle(LPWININETFINDNEXTA lpwfn)
{
INT i;
TRACE("\n");
for (i = 0; i < lpwfn->size; i++)
{
if (NULL != lpwfn->lpafp[i].lpszName)
HeapFree(GetProcessHeap(), 0, lpwfn->lpafp[i].lpszName);
}
HeapFree(GetProcessHeap(), 0, lpwfn->lpafp);
HeapFree(GetProcessHeap(), 0, lpwfn);
return TRUE;
}
/***********************************************************************
* FTP_ReceiveFileList (internal)
*
* Read file list from server
*
* RETURNS
* Handle to file list on success
* NULL on failure
*
*/
HINTERNET FTP_ReceiveFileList(LPWININETFTPSESSIONA lpwfs, INT nSocket,
LPWIN32_FIND_DATAA lpFindFileData, DWORD dwContext)
{
DWORD dwSize = 0;
LPFILEPROPERTIESA lpafp = NULL;
LPWININETFINDNEXTA lpwfn = NULL;
TRACE("\n");
if (FTP_ParseDirectory(lpwfs, nSocket, &lpafp, &dwSize))
{
FTP_ConvertFileProp(lpafp, lpFindFileData);
lpwfn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WININETFINDNEXTA));
if (NULL != lpwfn)
{
lpwfn->hdr.htype = WH_HFINDNEXT;
lpwfn->hdr.lpwhparent = (LPWININETHANDLEHEADER)lpwfs;
lpwfn->hdr.dwContext = dwContext;
lpwfn->index = 1; /* Next index is 1 since we return index 0 */
lpwfn->size = dwSize;
lpwfn->lpafp = lpafp;
}
}
TRACE("Matched %ld files\n", dwSize);
return (HINTERNET)lpwfn;
}
/***********************************************************************
* FTP_ConvertFileProp (internal)
*
* Converts FILEPROPERTIESA struct to WIN32_FIND_DATAA
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_ConvertFileProp(LPFILEPROPERTIESA lpafp, LPWIN32_FIND_DATAA lpFindFileData)
{
BOOL bSuccess = FALSE;
ZeroMemory(lpFindFileData, sizeof(WIN32_FIND_DATAA));
if (lpafp)
{
DWORD access = mktime(&lpafp->tmLastModified);
/* Not all fields are filled in */
lpFindFileData->ftLastAccessTime.dwHighDateTime = HIWORD(access);
lpFindFileData->ftLastAccessTime.dwLowDateTime = LOWORD(access);
lpFindFileData->nFileSizeHigh = HIWORD(lpafp->nSize);
lpFindFileData->nFileSizeLow = LOWORD(lpafp->nSize);
if (lpafp->bIsDirectory)
lpFindFileData->dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
if (lpafp->lpszName)
strncpy(lpFindFileData->cFileName, lpafp->lpszName, MAX_PATH);
bSuccess = TRUE;
}
return bSuccess;
}
/***********************************************************************
* FTP_ParseDirectory (internal)
*
* Parse string of directory information
*
* RETURNS
* TRUE on success
* FALSE on failure
*
* FIXME: - This function needs serious clea-up
* - We should consider both UNIX and NT list formats
*/
#define MAX_MONTH_LEN 10
#define MIN_LEN_DIR_ENTRY 15
BOOL FTP_ParseDirectory(LPWININETFTPSESSIONA lpwfs, INT nSocket, LPFILEPROPERTIESA *lpafp, LPDWORD dwfp)
{
/*
* <Permissions> <NoLinks> <owner> <group> <size> <date> <time or year> <filename>
*
* For instance:
* drwx--s--- 2 pcarrier ens 512 Sep 28 1995 pcarrier
*/
CHAR* pszMinutes;
CHAR* pszHour;
time_t aTime;
struct tm* apTM;
CHAR pszMonth[MAX_MONTH_LEN];
CHAR* pszMatch;
BOOL bSuccess = TRUE;
DWORD nBufLen = MAX_REPLY_LEN;
LPFILEPROPERTIESA curFileProp = NULL;
CHAR* pszLine = NULL;
CHAR* pszToken = NULL;
INT nTokenToSkip = 3;
INT nCount = 0;
INT nSeconds = 0;
INT nMinutes = 0;
INT nHour = 0;
INT nDay = 0;
INT nMonth = 0;
INT nYear = 0;
INT sizeFilePropArray = 20;
INT indexFilePropArray = 0;
TRACE("\n");
/* Allocate intial file properties array */
*lpafp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FILEPROPERTIESA)*(sizeFilePropArray));
if (NULL == lpafp)
{
bSuccess = FALSE;
goto lend;
}
while ((pszLine = FTP_GetNextLine(nSocket, INTERNET_GetResponseBuffer(), &nBufLen)) != NULL)
{
if (sizeFilePropArray <= indexFilePropArray)
{
LPFILEPROPERTIESA tmpafp;
sizeFilePropArray *= 2;
tmpafp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *lpafp,
sizeof(FILEPROPERTIESA)*sizeFilePropArray);
if (NULL == tmpafp)
{
bSuccess = FALSE;
goto lend;
}
*lpafp = tmpafp;
}
curFileProp = &((*lpafp)[indexFilePropArray]);
/* First Parse the permissions. */
pszToken = strtok(pszLine, " \t" );
/* HACK! If this is not a file listing skip the line */
if (!pszToken || 10 != strlen(pszToken) || nBufLen <= MIN_LEN_DIR_ENTRY)
{
nBufLen = MAX_REPLY_LEN;
continue;
}
FTP_ParsePermission(pszToken, curFileProp);
nTokenToSkip = 3;
nCount = 0;
do
{
pszToken = strtok( NULL, " \t" );
nCount++;
} while( nCount <= nTokenToSkip );
/* Store the size of the file in the param list. */
TRACE("nSize-> %s\n", pszToken);
if (pszToken != NULL)
curFileProp->nSize = atol(pszToken);
/* Parse last modified time. */
nSeconds = 0;
nMinutes = 0;
nHour = 0;
nDay = 0;
nMonth = 0;
nYear = 0;
pszToken = strtok( NULL, " \t" );
strncpy(pszMonth, pszToken, MAX_MONTH_LEN);
CharUpperA(pszMonth);
pszMatch = strstr(szMonths, pszMonth);
if( pszMatch != NULL )
nMonth = (pszMatch - szMonths) / 3;
pszToken = strtok(NULL, " \t");
TRACE("nDay -> %s\n", pszToken);
if (pszToken != NULL)
nDay = atoi(pszToken);
pszToken = strtok(NULL, " \t");
pszMinutes = strchr(pszToken, ':');
if( pszMinutes != NULL )
{
pszMinutes++;
nMinutes = atoi(pszMinutes);
pszHour = pszMinutes - 3;
if (pszHour != NULL)
nHour = atoi(pszHour);
time(&aTime);
apTM = localtime( &aTime );
nYear = apTM->tm_year;
}
else
{
nYear = atoi(pszToken);
nYear -= 1900;
nHour = 12;
}
curFileProp->tmLastModified.tm_sec = nSeconds;
curFileProp->tmLastModified.tm_min = nMinutes;
curFileProp->tmLastModified.tm_hour = nHour;
curFileProp->tmLastModified.tm_mday = nDay;
curFileProp->tmLastModified.tm_mon = nMonth;
curFileProp->tmLastModified.tm_year = nYear;
pszToken = strtok(NULL, " \t");
if(pszToken != NULL)
{
curFileProp->lpszName = strdup(pszToken);
TRACE(": %s\n", curFileProp->lpszName);
}
nBufLen = MAX_REPLY_LEN;
indexFilePropArray++;
}
if (bSuccess && indexFilePropArray)
{
if (indexFilePropArray < sizeFilePropArray - 1)
{
LPFILEPROPERTIESA tmpafp;
tmpafp = HeapReAlloc(GetProcessHeap(), 0, *lpafp,
sizeof(FILEPROPERTIESA)*indexFilePropArray);
if (NULL == tmpafp)
*lpafp = tmpafp;
}
*dwfp = indexFilePropArray;
}
else
{
HeapFree(GetProcessHeap(), 0, *lpafp);
INTERNET_SetLastError(ERROR_NO_MORE_FILES);
bSuccess = FALSE;
}
lend:
return bSuccess;
}
/***********************************************************************
* FTP_ParsePermission (internal)
*
* Parse permission string of directory information
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL FTP_ParsePermission(LPCSTR lpszPermission, LPFILEPROPERTIESA lpfp)
{
BOOL bSuccess = TRUE;
unsigned short nPermission = 0;
INT nPos = 1;
INT nLast = 9;
TRACE("\n");
if ((*lpszPermission != 'd') && (*lpszPermission != '-') && (*lpszPermission != 'l'))
{
bSuccess = FALSE;
return bSuccess;
}
lpfp->bIsDirectory = (*lpszPermission == 'd');
do
{
switch (nPos)
{
case 1:
nPermission |= (*(lpszPermission+1) == 'r' ? 1 : 0) << 8;
break;
case 2:
nPermission |= (*(lpszPermission+2) == 'w' ? 1 : 0) << 7;
break;
case 3:
nPermission |= (*(lpszPermission+3) == 'x' ? 1 : 0) << 6;
break;
case 4:
nPermission |= (*(lpszPermission+4) == 'r' ? 1 : 0) << 5;
break;
case 5:
nPermission |= (*(lpszPermission+5) == 'w' ? 1 : 0) << 4;
break;
case 6:
nPermission |= (*(lpszPermission+6) == 'x' ? 1 : 0) << 3;
break;
case 7:
nPermission |= (*(lpszPermission+7) == 'r' ? 1 : 0) << 2;
break;
case 8:
nPermission |= (*(lpszPermission+8) == 'w' ? 1 : 0) << 1;
break;
case 9:
nPermission |= (*(lpszPermission+9) == 'x' ? 1 : 0);
break;
}
nPos++;
}while (nPos <= nLast);
lpfp->permissions = nPermission;
return bSuccess;
}
/***********************************************************************
* FTP_GetNextLine (internal)
*
* Parse next line in directory string listing
*
* RETURNS
* Pointer to begining of next line
* NULL on failure
*
*/
LPSTR FTP_GetNextLine(INT nSocket, LPSTR lpszBuffer, LPDWORD dwBuffer)
{
struct timeval tv;
fd_set infd;
BOOL bSuccess = FALSE;
INT nRecv = 0;
TRACE("\n");
while (nRecv < *dwBuffer)
{
FD_ZERO(&infd);
FD_SET(nSocket, &infd);
tv.tv_sec=RESPONSE_TIMEOUT;
tv.tv_usec=0;
if (select(nSocket+1,&infd,NULL,NULL,&tv))
{
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;
}
}
lend:
if (bSuccess)
{
lpszBuffer[nRecv] = '\0';
*dwBuffer = nRecv - 1;
TRACE(":%d %s\n", nRecv, lpszBuffer);
return lpszBuffer;
}
else
{
return NULL;
}
}
/***********************************************************************
* FTP_SetResponseError (internal)
*
* Set the appropriate error code for a given response from the server
*
* RETURNS
*
*/
DWORD FTP_SetResponseError(DWORD dwResponse)
{
DWORD dwCode = 0;
switch(dwResponse)
{
case 421: /* Service not available - Server may be shutting down. */
dwCode = ERROR_INTERNET_TIMEOUT;
break;
case 425: /* Cannot open data connection. */
dwCode = ERROR_INTERNET_CANNOT_CONNECT;
break;
case 426: /* Connection closed, transer aborted. */
dwCode = ERROR_INTERNET_CONNECTION_ABORTED;
break;
case 500: /* Syntax error. Command unrecognized. */
case 501: /* Syntax error. Error in parameters or arguments. */
dwCode = ERROR_INTERNET_INCORRECT_FORMAT;
break;
case 530: /* Not logged in. Login incorrect. */
dwCode = ERROR_INTERNET_LOGIN_FAILURE;
break;
case 550: /* File action not taken. File not found or no access. */
dwCode = ERROR_INTERNET_ITEM_NOT_FOUND;
break;
case 450: /* File action not taken. File may be busy. */
case 451: /* Action aborted. Server error. */
case 452: /* Action not taken. Insufficient storage space on server. */
case 502: /* Command not implemented. */
case 503: /* Bad sequence of command. */
case 504: /* Command not implemented for that parameter. */
case 532: /* Need account for storing files */
case 551: /* Requested action aborted. Page type unknown */
case 552: /* Action aborted. Exceeded storage allocation */
case 553: /* Action not taken. File name not allowed. */
default:
dwCode = ERROR_INTERNET_INTERNAL_ERROR;
break;
}
INTERNET_SetLastError(dwCode);
return dwCode;
}
/*
* Wininet
*
* Copyright 1999 Corel Corporation
*
* Ulrich Czekalla
*
*/
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include "windows.h"
#include "wininet.h"
#include "debugtools.h"
#include "winerror.h"
#include "winsock.h"
#include "internet.h"
DEFAULT_DEBUG_CHANNEL(wininet);
#define MAX_IDLE_WORKER 1000*60*1
#define MAX_WORKER_THREADS 10
#define GET_HWININET_FROM_LPWININETFINDNEXT(lpwh) \
(LPWININETAPPINFOA)(((LPWININETFTPSESSIONA)(lpwh->hdr.lpwhparent))->hdr.lpwhparent)
typedef struct
{
DWORD dwError;
CHAR response[MAX_REPLY_LEN];
} WITHREADERROR, *LPWITHREADERROR;
INTERNET_SCHEME GetInternetScheme(LPSTR lpszScheme);
BOOLAPI INTERNET_FindNextFileA(HINTERNET hFind, LPVOID lpvFindData);
VOID INTERNET_ExecuteWork();
DWORD g_dwTlsErrIndex = TLS_OUT_OF_INDEXES;
DWORD dwNumThreads;
DWORD dwNumIdleThreads;
HANDLE hEventArray[2];
#define hQuitEvent hEventArray[0]
#define hWorkEvent hEventArray[1]
CRITICAL_SECTION csQueue;
LPWORKREQUEST lpHeadWorkQueue;
LPWORKREQUEST lpWorkQueueTail;
/***********************************************************************
* WININET_LibMain [Internal] Initializes the internal 'WININET.DLL'.
*
* PARAMS
* hinstDLL [I] handle to the 'dlls' instance
* fdwReason [I]
* lpvReserved [I] reserverd, must be NULL
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOL WINAPI
WININET_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("%x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
g_dwTlsErrIndex = TlsAlloc();
if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES)
return FALSE;
hQuitEvent = CreateEventA(0, TRUE, FALSE, NULL);
hWorkEvent = CreateEventA(0, FALSE, FALSE, NULL);
InitializeCriticalSection(&csQueue);
dwNumThreads = 0;
dwNumIdleThreads = 0;
case DLL_THREAD_ATTACH:
{
LPWITHREADERROR lpwite = HeapAlloc(GetProcessHeap(), 0, sizeof(WITHREADERROR));
if (NULL == lpwite)
return FALSE;
TlsSetValue(g_dwTlsErrIndex, (LPVOID)lpwite);
}
break;
case DLL_THREAD_DETACH:
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
HeapFree(GetProcessHeap(), 0, TlsGetValue(g_dwTlsErrIndex));
break;
case DLL_PROCESS_DETACH:
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;
}
/***********************************************************************
* InternetOpenA (WININET.113)
*
* Per-application initialization of wininet
*
* RETURNS
* HINTERNET on success
* NULL on failure
*
*/
INTERNETAPI HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent,
DWORD dwAccessType, LPCSTR lpszProxy,
LPCSTR lpszProxyBypass, DWORD dwFlags)
{
LPWININETAPPINFOA lpwai = NULL;
TRACE("\n");
/* Clear any error information */
INTERNET_SetLastError(0);
lpwai = HeapAlloc(GetProcessHeap(), 0, sizeof(WININETAPPINFOA));
if (NULL == lpwai)
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
else
{
memset(lpwai, 0, sizeof(WININETAPPINFOA));
lpwai->hdr.htype = WH_HINIT;
lpwai->hdr.lpwhparent = NULL;
lpwai->hdr.dwFlags = dwFlags;
if (NULL != lpszAgent)
lpwai->lpszAgent = strdup(lpszAgent);
if (NULL != lpszProxy)
lpwai->lpszProxy = strdup(lpszProxy);
if (NULL != lpszProxyBypass)
lpwai->lpszProxyBypass = strdup(lpszProxyBypass);
lpwai->dwAccessType = dwAccessType;
}
return (HINTERNET)lpwai;
}
/***********************************************************************
* InternetGetLastResponseInfoA (WININET.108)
*
* Return last wininet error description on the calling thread
*
* RETURNS
* TRUE on success of writting to buffer
* FALSE on failure
*
*/
BOOLAPI InternetGetLastResponseInfoA(LPDWORD lpdwError,
LPSTR lpszBuffer, LPDWORD lpdwBufferLength)
{
LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex);
TRACE("\n");
*lpdwError = lpwite->dwError;
if (lpwite->dwError)
{
strncpy(lpszBuffer, lpwite->response, *lpdwBufferLength);
*lpdwBufferLength = strlen(lpszBuffer);
}
else
*lpdwBufferLength = 0;
return TRUE;
}
/***********************************************************************
* InternetConnectA (WININET.93)
*
* Open a ftp, gopher or http session
*
* RETURNS
* HINTERNET a session handle on success
* NULL on failure
*
*/
INTERNETAPI HINTERNET WINAPI InternetConnectA(HINTERNET hInternet,
LPCSTR lpszServerName, INTERNET_PORT nServerPort,
LPCSTR lpszUserName, LPCSTR lpszPassword,
DWORD dwService, DWORD dwFlags, DWORD dwContext)
{
HINTERNET rc = (HINTERNET) NULL;
TRACE("\n");
/* Clear any error information */
INTERNET_SetLastError(0);
switch (dwService)
{
case INTERNET_SERVICE_FTP:
rc = FTP_Connect(hInternet, lpszServerName, nServerPort,
lpszUserName, lpszPassword, dwFlags, dwContext);
break;
case INTERNET_SERVICE_HTTP:
break;
case INTERNET_SERVICE_GOPHER:
default:
break;
}
return rc;
}
/***********************************************************************
* InternetFindNextFileA (WININET.102)
*
* Continues a file search from a previous call to FindFirstFile
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI InternetFindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
{
LPWININETAPPINFOA hIC = NULL;
LPWININETFINDNEXTA lpwh = (LPWININETFINDNEXTA) hFind;
TRACE("\n");
if (NULL == lpwh || lpwh->hdr.htype != WH_HFINDNEXT)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
hIC = GET_HWININET_FROM_LPWININETFINDNEXT(lpwh);
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
WORKREQUEST workRequest;
workRequest.asyncall = INTERNETFINDNEXTA;
workRequest.HFTPSESSION = (DWORD)hFind;
workRequest.LPFINDFILEDATA = (DWORD)lpvFindData;
return INTERNET_AsyncCall(&workRequest);
}
else
{
return INTERNET_FindNextFileA(hFind, lpvFindData);
}
}
/***********************************************************************
* INTERNET_FindNextFileA (Internal)
*
* Continues a file search from a previous call to FindFirstFile
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI INTERNET_FindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
{
BOOL bSuccess = TRUE;
LPWININETAPPINFOA hIC = NULL;
LPWIN32_FIND_DATAA lpFindFileData;
LPWININETFINDNEXTA lpwh = (LPWININETFINDNEXTA) hFind;
TRACE("\n");
if (NULL == lpwh || lpwh->hdr.htype != WH_HFINDNEXT)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
/* 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;
}
TRACE("index(%d) size(%ld)\n", lpwh->index, lpwh->size);
lpFindFileData = (LPWIN32_FIND_DATAA) lpvFindData;
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++;
TRACE("\nName: %s\nSize: %ld\n", lpFindFileData->cFileName, lpFindFileData->nFileSizeLow);
lend:
hIC = GET_HWININET_FROM_LPWININETFINDNEXT(lpwh);
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
{
INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)bSuccess;
iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError();
hIC->lpfnStatusCB(hFind, lpwh->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT));
}
return bSuccess;
}
/***********************************************************************
* InternetCloseHandle (WININET.89)
*
* Continues a file search from a previous call to FindFirstFile
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI InternetCloseHandle(HINTERNET hInternet)
{
BOOL retval = FALSE;
LPWININETHANDLEHEADER lpwh = (LPWININETHANDLEHEADER) hInternet;
TRACE("\n");
if (NULL == lpwh)
return FALSE;
/* Clear any error information */
INTERNET_SetLastError(0);
switch (lpwh->htype)
{
case WH_HINIT:
case WH_HHTTPSESSION:
case WH_HHTTPREQ:
break;
case WH_HFTPSESSION:
retval = FTP_CloseSessionHandle((LPWININETFTPSESSIONA) lpwh);
break;
case WH_HFINDNEXT:
retval = FTP_CloseFindNextHandle((LPWININETFINDNEXTA) lpwh);
break;
default:
break;
}
return retval;
}
/***********************************************************************
* InternetCrackUrlA (WININET.95)
*
* Break up URL into its components
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
LPURL_COMPONENTSA lpUrlComponents)
{
/*
* RFC 1808
* <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
*
*/
char* szScheme = NULL;
char* szUser = NULL;
char* szPass = NULL;
char* szHost = NULL;
char* szUrlPath = NULL;
char* szParam = NULL;
char* szNetLoc = NULL;
int nPort = 80;
int nSchemeLen = 0;
int nUserLen = 0;
int nPassLen = 0;
int nHostLen = 0;
int nUrlLen = 0;
/* Find out if the URI is absolute... */
BOOL bIsAbsolute = FALSE;
char cAlphanum;
char* ap = (char*)lpszUrl;
char* cp = NULL;
TRACE("\n");
while( (cAlphanum = *ap) != '\0' )
{
if( ((cAlphanum >= 'a') && (cAlphanum <= 'z')) ||
((cAlphanum >= 'A') && (cAlphanum <= 'Z')) ||
((cAlphanum >= '0') && (cAlphanum <= '9')) )
{
ap++;
continue;
}
if( (cAlphanum == ':') && (ap - lpszUrl >= 2) )
{
bIsAbsolute = TRUE;
cp = ap;
break;
}
break;
}
/* Absolute URI...
FIXME!!!! This should work on relative urls too!*/
if( bIsAbsolute )
{
/* Get scheme first... */
nSchemeLen = cp - lpszUrl;
szScheme = strdup( lpszUrl );
szScheme[ nSchemeLen ] = '\0';
/* Eat ':' in protocol... */
cp++;
/* Parse <params>... */
szParam = strpbrk( lpszUrl, ";" );
if( szParam != NULL )
{
char* sParam;
/* Eat ';' in Params... */
szParam++;
sParam = strdup( szParam );
*szParam = '\0';
}
/* Skip over slashes...*/
if( *cp == '/' )
{
cp++;
if( *cp == '/' )
{
cp++;
if( *cp == '/' )
cp++;
}
}
/* Parse the <net-loc>...*/
if( GetInternetScheme( szScheme ) == INTERNET_SCHEME_FILE )
{
szUrlPath = strdup( cp );
nUrlLen = strlen( szUrlPath );
if( nUrlLen >= 2 && szUrlPath[ 1 ] == '|' )
szUrlPath[ 1 ] = ':';
}
else
{
size_t nNetLocLen;
szUrlPath = strpbrk(cp, "/");
if( szUrlPath != NULL )
nUrlLen = strlen( szUrlPath );
/* Find the end of our net-loc... */
nNetLocLen = strcspn( cp, "/" );
szNetLoc = strdup( cp );
szNetLoc[ nNetLocLen ] = '\0';
if( szNetLoc != NULL )
{
char* lpszPort;
int nPortLen;
/* [<user>[<:password>]@]<host>[:<port>] */
/* First find the user and password if they exist...*/
szHost = strchr( szNetLoc, '@' );
if( szHost == NULL )
{
/* username and password not specified... */
szHost = szNetLoc;
nHostLen = nNetLocLen;
}
else
{
int nUserPassLen = nNetLocLen - nHostLen - 1;
char* szUserPass = strdup( szNetLoc );
/* Get username and/or password... */
/* Eat '@' in domain... */
++szHost;
nHostLen = strlen( szHost );
szUserPass[ nUserPassLen ] = '\0';
if( szUserPass != NULL )
{
szPass = strpbrk( szUserPass, ":" );
if( szPass != NULL )
{
/* Eat ':' in UserPass... */
++szPass;
nPassLen = strlen( szPass );
nUserLen = nUserPassLen - nPassLen - 1;
szUser = strdup( szUserPass );
szUser[ nUserLen ] = '\0';
}
else
{
/* password not specified... */
szUser = strdup( szUserPass );
nUserLen = strlen( szUser );
}
}
}
/* <host><:port>...*/
/* Then get the port if it exists... */
lpszPort = strpbrk( szHost, ":" );
nPortLen = 0;
if( lpszPort != NULL )
{
char* szPort = lpszPort + 1;
if( szPort != NULL )
{
nPortLen = strlen( szPort );
nPort = atoi( szPort );
}
*lpszPort = '\0';
nHostLen = strlen(szHost);
}
}
}
}
/* Relative URI... */
else
return FALSE;
return TRUE;
}
/***********************************************************************
* InternetAttemptConnect (WININET.81)
*
* Attempt to make a connection to the internet
*
* RETURNS
* ERROR_SUCCESS on success
* Error value on failure
*
*/
INTERNETAPI DWORD WINAPI InternetAttemptConnect(DWORD dwReserved)
{
FIXME("Stub\n");
return ERROR_SUCCESS;
}
/***********************************************************************
* InternetCanonicalizeUrlA (WININET.85)
*
* Escape unsafe characters and spaces
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI InternetCanonicalizeUrlA(LPCSTR lpszUrl, LPSTR lpszBuffer,
LPDWORD lpdwBufferLength, DWORD dwFlags)
{
BOOL bSuccess = FALSE;
FIXME("Stub!\n");
if (lpszUrl)
{
strncpy(lpszBuffer, lpszUrl, *lpdwBufferLength);
*lpdwBufferLength = strlen(lpszBuffer);
bSuccess = TRUE;
}
return bSuccess;
}
/***********************************************************************
* InternetSetStatusCallback (WININET.133)
*
* 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
*
*/
INTERNETAPI INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallback(
HINTERNET hInternet ,INTERNET_STATUS_CALLBACK lpfnIntCB)
{
INTERNET_STATUS_CALLBACK retVal;
LPWININETAPPINFOA lpwai = (LPWININETAPPINFOA)hInternet;
TRACE("0x%08lx\n", (ULONG)hInternet);
if (lpwai->hdr.htype != WH_HINIT)
return INTERNET_INVALID_STATUS_CALLBACK;
retVal = lpwai->lpfnStatusCB;
lpwai->lpfnStatusCB = lpfnIntCB;
return retVal;
}
/***********************************************************************
* InternetWriteFile (WININET.138)
*
* Write data to an open internet file
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer ,
DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
{
BOOL retval = FALSE;
int nSocket = INVALID_SOCKET;
LPWININETHANDLEHEADER lpwh = (LPWININETHANDLEHEADER) hFile;
TRACE("\n");
if (NULL == lpwh)
return FALSE;
switch (lpwh->htype)
{
case WH_HHTTPREQ:
nSocket = ((LPWININETHTTPREQA)hFile)->nSocketFD;
break;
case WH_HFILE:
nSocket = ((LPWININETFILE)hFile)->nDataSocket;
break;
default:
break;
}
if (INVALID_SOCKET != nSocket)
{
*lpdwNumOfBytesWritten = INTERNET_WriteDataToStream(nSocket, lpBuffer, dwNumOfBytesToWrite);
if (*lpdwNumOfBytesWritten < 0)
*lpdwNumOfBytesWritten = 0;
else
retval = TRUE;
}
return retval;
}
/***********************************************************************
* InternetReadFile (WININET.121)
*
* Read data from an open internet file
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOLAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
DWORD dwNumOfBytesToRead, LPDWORD dwNumOfBytesRead)
{
BOOL retval = FALSE;
int nSocket = INVALID_SOCKET;
LPWININETHANDLEHEADER lpwh = (LPWININETHANDLEHEADER) hFile;
TRACE("\n");
if (NULL == lpwh)
return FALSE;
switch (lpwh->htype)
{
case WH_HHTTPREQ:
nSocket = ((LPWININETHTTPREQA)hFile)->nSocketFD;
break;
case WH_HFILE:
nSocket = ((LPWININETFILE)hFile)->nDataSocket;
break;
default:
break;
}
if (INVALID_SOCKET != nSocket)
{
*dwNumOfBytesRead = INTERNET_ReadDataFromStream(nSocket, lpBuffer, dwNumOfBytesToRead);
if (*dwNumOfBytesRead < 0)
*dwNumOfBytesRead = 0;
else
retval = TRUE;
}
return retval;
}
/***********************************************************************
* GetInternetScheme (internal)
*
* Get scheme of url
*
* RETURNS
* scheme on success
* INTERNET_SCHEME_UNKNOWN on failure
*
*/
INTERNET_SCHEME GetInternetScheme(LPSTR lpszScheme)
{
if(lpszScheme==NULL)
return INTERNET_SCHEME_UNKNOWN;
if( (strcmp("ftp", lpszScheme) == 0) ||
(strcmp("FTP", lpszScheme) == 0) )
return INTERNET_SCHEME_FTP;
else if( (strcmp("gopher", lpszScheme) == 0) ||
(strcmp("GOPHER", lpszScheme) == 0) )
return INTERNET_SCHEME_GOPHER;
else if( (strcmp("http", lpszScheme) == 0) ||
(strcmp("HTTP", lpszScheme) == 0) )
return INTERNET_SCHEME_HTTP;
else if( (strcmp("https", lpszScheme) == 0) ||
(strcmp("HTTPS", lpszScheme) == 0) )
return INTERNET_SCHEME_HTTPS;
else if( (strcmp("file", lpszScheme) == 0) ||
(strcmp("FILE", lpszScheme) == 0) )
return INTERNET_SCHEME_FILE;
else if( (strcmp("news", lpszScheme) == 0) ||
(strcmp("NEWS", lpszScheme) == 0) )
return INTERNET_SCHEME_NEWS;
else if( (strcmp("mailto", lpszScheme) == 0) ||
(strcmp("MAILTO", lpszScheme) == 0) )
return INTERNET_SCHEME_MAILTO;
else
return INTERNET_SCHEME_UNKNOWN;
}
/***********************************************************************
* INTERNET_WriteDataToStream (internal)
*
* Send data to server
*
* RETURNS
*
* number of characters sent on success
* -1 on error
*/
int INTERNET_WriteDataToStream(int nDataSocket, LPCVOID Buffer, DWORD BytesToWrite)
{
if (INVALID_SOCKET == nDataSocket)
return SOCKET_ERROR;
return send(nDataSocket, Buffer, BytesToWrite, 0);
}
/***********************************************************************
* INTERNET_ReadDataFromStream (internal)
*
* Read data from http server
*
* RETURNS
*
* number of characters sent on success
* -1 on error
*/
int INTERNET_ReadDataFromStream(int nDataSocket, LPVOID Buffer, DWORD BytesToRead)
{
if (INVALID_SOCKET == nDataSocket)
return SOCKET_ERROR;
return recv(nDataSocket, Buffer, BytesToRead, 0);
}
/***********************************************************************
* INTERNET_SetLastError (internal)
*
* Set last thread specific error
*
* RETURNS
*
*/
void INTERNET_SetLastError(DWORD dwError)
{
LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex);
SetLastError(dwError);
lpwite->dwError = dwError;
}
/***********************************************************************
* INTERNET_GetLastError (internal)
*
* Get last thread specific error
*
* RETURNS
*
*/
DWORD INTERNET_GetLastError()
{
LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex);
return lpwite->dwError;
}
/***********************************************************************
* INTERNET_WorkerThreadFunc (internal)
*
* Worker thread execution function
*
* RETURNS
*
*/
DWORD INTERNET_WorkerThreadFunc(LPVOID *lpvParam)
{
DWORD dwWaitRes;
while (1)
{
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
*
*/
BOOL INTERNET_InsertWorkRequest(LPWORKREQUEST lpWorkRequest)
{
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;
}
return bSuccess;
}
/***********************************************************************
* INTERNET_GetWokkRequest (internal)
*
* Retrieves work request from queue
*
* RETURNS
*
*/
BOOL INTERNET_GetWorkRequest(LPWORKREQUEST lpWorkRequest)
{
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;
}
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);
if (InterlockedIncrement(&dwNumThreads) > MAX_WORKER_THREADS ||
!(hThread = CreateThread(NULL, 0,
(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
*
*/
VOID INTERNET_ExecuteWork()
{
WORKREQUEST workRequest;
TRACE("\n");
if (INTERNET_GetWorkRequest(&workRequest))
{
switch (workRequest.asyncall)
{
case FTPPUTFILEA:
FTP_FtpPutFileA((HINTERNET)workRequest.HFTPSESSION, (LPCSTR)workRequest.LPSZLOCALFILE,
(LPCSTR)workRequest.LPSZNEWREMOTEFILE, workRequest.DWFLAGS, workRequest.DWCONTEXT);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZLOCALFILE);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZNEWREMOTEFILE);
break;
case FTPSETCURRENTDIRECTORYA:
FTP_FtpSetCurrentDirectoryA((HINTERNET)workRequest.HFTPSESSION,
(LPCSTR)workRequest.LPSZDIRECTORY);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDIRECTORY);
break;
case FTPCREATEDIRECTORYA:
FTP_FtpCreateDirectoryA((HINTERNET)workRequest.HFTPSESSION,
(LPCSTR)workRequest.LPSZDIRECTORY);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDIRECTORY);
break;
case FTPFINDFIRSTFILEA:
FTP_FtpFindFirstFileA((HINTERNET)workRequest.HFTPSESSION,
(LPCSTR)workRequest.LPSZSEARCHFILE,
(LPWIN32_FIND_DATAA)workRequest.LPFINDFILEDATA, workRequest.DWFLAGS,
workRequest.DWCONTEXT);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZSEARCHFILE);
break;
case FTPGETCURRENTDIRECTORYA:
FTP_FtpGetCurrentDirectoryA((HINTERNET)workRequest.HFTPSESSION,
(LPSTR)workRequest.LPSZDIRECTORY, (LPDWORD)workRequest.LPDWDIRECTORY);
break;
case FTPOPENFILEA:
FTP_FtpOpenFileA((HINTERNET)workRequest.HFTPSESSION,
(LPCSTR)workRequest.LPSZFILENAME,
workRequest.FDWACCESS,
workRequest.DWFLAGS,
workRequest.DWCONTEXT);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZFILENAME);
break;
case FTPGETFILEA:
FTP_FtpGetFileA((HINTERNET)workRequest.HFTPSESSION,
(LPCSTR)workRequest.LPSZREMOTEFILE,
(LPCSTR)workRequest.LPSZNEWFILE,
(BOOL)workRequest.FFAILIFEXISTS,
workRequest.DWLOCALFLAGSATTRIBUTE,
workRequest.DWFLAGS,
workRequest.DWCONTEXT);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZREMOTEFILE);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZNEWFILE);
break;
case FTPDELETEFILEA:
FTP_FtpDeleteFileA((HINTERNET)workRequest.HFTPSESSION,
(LPCSTR)workRequest.LPSZFILENAME);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZFILENAME);
break;
case FTPREMOVEDIRECTORYA:
FTP_FtpRemoveDirectoryA((HINTERNET)workRequest.HFTPSESSION,
(LPCSTR)workRequest.LPSZDIRECTORY);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDIRECTORY);
break;
case FTPRENAMEFILEA:
FTP_FtpRenameFileA((HINTERNET)workRequest.HFTPSESSION,
(LPCSTR)workRequest.LPSZSRCFILE,
(LPCSTR)workRequest.LPSZDESTFILE);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZSRCFILE);
HeapFree(GetProcessHeap(), 0, (LPVOID)workRequest.LPSZDESTFILE);
break;
case INTERNETFINDNEXTA:
INTERNET_FindNextFileA((HINTERNET)workRequest.HFTPSESSION,
(LPWIN32_FIND_DATAA)workRequest.LPFINDFILEDATA);
break;
}
}
}
/***********************************************************************
* INTERNET_GetResponseBuffer
*
* RETURNS
*
*/
LPSTR INTERNET_GetResponseBuffer()
{
LPWITHREADERROR lpwite = (LPWITHREADERROR)TlsGetValue(g_dwTlsErrIndex);
return lpwite->response;
}
#ifndef _WINE_INTERNET_H_
#define _WINE_INTERNET_H_
typedef enum
{
WH_HINIT,
WH_HFTPSESSION,
WH_HGOPHERSESSION,
WH_HHTTPSESSION,
WH_HHTTPREQ,
WH_HFILE,
WH_HFINDNEXT,
} WH_TYPE;
typedef struct _WININETHANDLEHEADER
{
WH_TYPE htype;
DWORD dwFlags;
DWORD dwContext;
DWORD dwError;
struct _WININETHANDLEHEADER *lpwhparent;
} WININETHANDLEHEADER, *LPWININETHANDLEHEADER;
typedef struct
{
WININETHANDLEHEADER hdr;
LPSTR lpszAgent;
LPSTR lpszProxy;
LPSTR lpszProxyBypass;
DWORD dwAccessType;
INTERNET_STATUS_CALLBACK lpfnStatusCB;
} WININETAPPINFOA, *LPWININETAPPINFOA;
typedef struct
{
WININETHANDLEHEADER hdr;
LPSTR lpszServerName;
LPSTR lpszUserName;
INTERNET_PORT nServerPort;
struct sockaddr_in socketAddress;
struct hostent *phostent;
} WININETHTTPSESSIONA, *LPWININETHTTPSESSIONA;
typedef struct
{
WININETHANDLEHEADER hdr;
LPSTR lpszPath;
LPSTR lpszReferrer;
LPSTR lpszAcceptTypes;
LPSTR lpszVerb;
LPSTR lpszHostName;
LPSTR lpszRedirect;
int nSocketFD;
int statusCode;
int contentLength;
time_t nSystemTime;
} WININETHTTPREQA, *LPWININETHTTPREQA;
typedef struct
{
WININETHANDLEHEADER hdr;
int sndSocket;
int lstnSocket;
struct sockaddr_in socketAddress;
struct sockaddr_in lstnSocketAddress;
struct hostent *phostent;
LPSTR lpszPassword;
LPSTR lpszUserName;
} WININETFTPSESSIONA, *LPWININETFTPSESSIONA;
typedef struct
{
WININETHANDLEHEADER hdr;
int nDataSocket;
} WININETFILE, *LPWININETFILE;
typedef struct
{
BOOL bIsDirectory;
LPSTR lpszName;
DWORD nSize;
struct tm tmLastModified;
unsigned short permissions;
} FILEPROPERTIESA, *LPFILEPROPERTIESA;
typedef struct
{
WININETHANDLEHEADER hdr;
int index;
DWORD size;
LPFILEPROPERTIESA lpafp;
} WININETFINDNEXTA, *LPWININETFINDNEXTA;
typedef enum
{
FTPPUTFILEA,
FTPSETCURRENTDIRECTORYA,
FTPCREATEDIRECTORYA,
FTPFINDFIRSTFILEA,
FTPGETCURRENTDIRECTORYA,
FTPOPENFILEA,
FTPGETFILEA,
FTPDELETEFILEA,
FTPREMOVEDIRECTORYA,
FTPRENAMEFILEA,
INTERNETFINDNEXTA,
} ASYNC_FUNC;
typedef struct WORKREQ
{
ASYNC_FUNC asyncall;
DWORD param1;
#define HFTPSESSION param1
DWORD param2;
#define LPSZLOCALFILE param2
#define LPSZREMOTEFILE param2
#define LPSZFILENAME param2
#define LPSZSRCFILE param2
#define LPSZDIRECTORY param2
#define LPSZSEARCHFILE param2
DWORD param3;
#define LPSZNEWREMOTEFILE param3
#define LPSZNEWFILE param3
#define LPFINDFILEDATA param3
#define LPDWDIRECTORY param3
#define FDWACCESS param3
#define LPSZDESTFILE param3
DWORD param4;
#define DWFLAGS param4
DWORD param5;
#define DWCONTEXT param5
DWORD param6;
#define FFAILIFEXISTS param4
DWORD param7;
#define DWLOCALFLAGSATTRIBUTE param7
struct WORKREQ *next;
struct WORKREQ *prev;
} WORKREQUEST, *LPWORKREQUEST;
time_t ConvertTimeString(LPCSTR asctime);
HINTERNET FTP_Connect(HINTERNET hInterent, LPCSTR lpszServerName,
INTERNET_PORT nServerPort, LPCSTR lpszUserName,
LPCSTR lpszPassword, DWORD dwFlags, DWORD dwContext);
BOOL GetAddress(LPCSTR lpszServerName, INTERNET_PORT nServerPort,
struct hostent **phe, struct sockaddr_in *psa);
int INTERNET_WriteDataToStream(int nDataSocket, LPCVOID Buffer, DWORD BytesToWrite);
int INTERNET_ReadDataFromStream(int nDataSocket, LPVOID Buffer, DWORD BytesToRead);
void INTERNET_SetLastError(DWORD dwError);
DWORD INTERNET_GetLastError();
BOOL INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest);
LPSTR INTERNET_GetResponseBuffer();
BOOL FTP_CloseSessionHandle(LPWININETFTPSESSIONA lpwfs);
BOOL FTP_CloseFindNextHandle(LPWININETFINDNEXTA lpwfn);
BOOLAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
LPCSTR lpszNewRemoteFile, DWORD dwFlags, DWORD dwContext);
BOOLAPI FTP_FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory);
BOOLAPI FTP_FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory);
INTERNETAPI HINTERNET WINAPI FTP_FtpFindFirstFileA(HINTERNET hConnect,
LPCSTR lpszSearchFile, LPWIN32_FIND_DATAA lpFindFileData, DWORD dwFlags, DWORD dwContext);
BOOLAPI FTP_FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDirectory,
LPDWORD lpdwCurrentDirectory);
BOOL FTP_ConvertFileProp(LPFILEPROPERTIESA lpafp, LPWIN32_FIND_DATAA lpFindFileData);
BOOL FTP_FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDest);
BOOL FTP_FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory);
BOOL FTP_FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName);
HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession, LPCSTR lpszFileName,
DWORD fdwAccess, DWORD dwFlags, DWORD dwContext);
BOOLAPI FTP_FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszNewFile,
BOOL fFailIfExists, DWORD dwLocalFlagsAttribute, DWORD dwInternetFlags,
DWORD dwContext);
#define MAX_REPLY_LEN 0x5B4
#endif /* _WINE_INTERNET_H_ */
/*
* Wininet - Utility functions
*
* Copyright 1999 Corel Corporation
*
* Ulrich Czekalla
*
*/
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "windows.h"
#include "wininet.h"
#include "winerror.h"
#include "winsock.h"
#include "debugtools.h"
#include "internet.h"
DEFAULT_DEBUG_CHANNEL(wininet);
#define TIME_STRING_LEN 30
time_t ConvertTimeString(LPCSTR asctime)
{
char tmpChar[TIME_STRING_LEN];
char *tmpChar2;
struct tm SystemTime;
int timelen = strlen(asctime);
if(!asctime || !timelen)
return 0;
strncpy(tmpChar, asctime, TIME_STRING_LEN);
/* Assert that the string is the expected length */
if (tmpChar[TIME_STRING_LEN] != '\0')
{
tmpChar[TIME_STRING_LEN] = '\0';
FIXME("\n");
}
/* Convert a time such as 'Mon, 15 Nov 1999 16:09:35 GMT' into a SYSTEMTIME structure
* We assume the time is in this format
* and divide it into easy to swallow chunks
*/
tmpChar[3]='\0';
tmpChar[7]='\0';
tmpChar[11]='\0';
tmpChar[16]='\0';
tmpChar[19]='\0';
tmpChar[22]='\0';
tmpChar[25]='\0';
SystemTime.tm_year = atoi(tmpChar+12) - 1900;
SystemTime.tm_mday = atoi(tmpChar+5);
SystemTime.tm_hour = atoi(tmpChar+17);
SystemTime.tm_min = atoi(tmpChar+20);
SystemTime.tm_sec = atoi(tmpChar+23);
/* and month */
tmpChar2 = tmpChar + 8;
switch(tmpChar2[2])
{
case 'n':
if(tmpChar2[1]=='a')
SystemTime.tm_mon = 0;
else
SystemTime.tm_mon = 5;
break;
case 'b':
SystemTime.tm_mon = 1;
break;
case 'r':
if(tmpChar2[1]=='a')
SystemTime.tm_mon = 2;
else
SystemTime.tm_mon = 3;
break;
case 'y':
SystemTime.tm_mon = 4;
break;
case 'l':
SystemTime.tm_mon = 6;
break;
case 'g':
SystemTime.tm_mon = 7;
break;
case 'p':
SystemTime.tm_mon = 8;
break;
case 't':
SystemTime.tm_mon = 9;
break;
case 'v':
SystemTime.tm_mon = 10;
break;
case 'c':
SystemTime.tm_mon = 11;
break;
default:
FIXME("\n");
}
return mktime(&SystemTime);
}
BOOL GetAddress(LPCSTR lpszServerName, INTERNET_PORT nServerPort,
struct hostent **phe, struct sockaddr_in *psa)
{
*phe = gethostbyname(lpszServerName);
if (NULL == *phe)
{
TRACE("Failed to get hostname %s\n", lpszServerName);
return FALSE;
}
memset(psa,0,sizeof(struct sockaddr_in));
memcpy((char *)&psa->sin_addr, (*phe)->h_addr, (*phe)->h_length);
psa->sin_family = (*phe)->h_addrtype;
psa->sin_port = htons((u_short)nServerPort);
return TRUE;
}
name wininet
type win32
init WININET_LibMain
@ stub InternetInitializeAutoProxyDll
@ stub ShowCertificate
@ stub CommitUrlCacheEntryA
@ stub CommitUrlCacheEntryW
@ stub CreateUrlCacheContainerA
@ stub CreateUrlCacheContainerW
@ stub CreateUrlCacheEntryA
@ stub CreateUrlCacheEntryW
@ stub CreateUrlCacheGroup
@ stub DeleteIE3Cache
@ stub DeleteUrlCacheContainerA
@ stub DeleteUrlCacheContainerW
@ stub DeleteUrlCacheEntry
@ stub DeleteUrlCacheGroup
@ stub DllInstall
@ stub FindCloseUrlCache
@ stub FindFirstUrlCacheContainerA
@ stub FindFirstUrlCacheContainerW
@ stub FindFirstUrlCacheEntryA
@ stub FindFirstUrlCacheEntryExA
@ stub FindFirstUrlCacheEntryExW
@ stub FindFirstUrlCacheEntryW
@ stub FindNextUrlCacheContainerA
@ stub FindNextUrlCacheContainerW
@ stub FindNextUrlCacheEntryA
@ stub FindNextUrlCacheEntryExA
@ stub FindNextUrlCacheEntryExW
@ stub FindNextUrlCacheEntryW
@ stub FreeUrlCacheSpaceA
@ stub FreeUrlCacheSpaceW
@ stdcall FtpCreateDirectoryA(ptr str) FtpCreateDirectoryA
@ stub FtpCreateDirectoryW
@ stdcall FtpDeleteFileA(ptr str) FtpDeleteFileA
@ stub FtpDeleteFileW
@ stdcall FtpFindFirstFileA(ptr str str long long) FtpFindFirstFileA
@ stub FtpFindFirstFileW
@ stdcall FtpGetCurrentDirectoryA(ptr str ptr) FtpGetCurrentDirectoryA
@ stub FtpGetCurrentDirectoryW
@ stdcall FtpGetFileA(ptr str str long long long long) FtpGetFileA
@ stub FtpGetFileW
@ stdcall FtpOpenFileA(ptr str long long long) FtpOpenFileA
@ stub FtpOpenFileW
@ stdcall FtpPutFileA(ptr str str long long) FtpPutFileA
@ stub FtpPutFileW
@ stdcall FtpRemoveDirectoryA(ptr str) FtpRemoveDirectoryA
@ stub FtpRemoveDirectoryW
@ stdcall FtpRenameFileA(ptr str str) FtpRenameFileA
@ stub FtpRenameFileW
@ stdcall FtpSetCurrentDirectoryA(ptr str) FtpSetCurrentDirectoryA
@ stub FtpSetCurrentDirectoryW
@ stub GetUrlCacheConfigInfoA
@ stub GetUrlCacheConfigInfoW
@ stub GetUrlCacheEntryInfoA
@ stub GetUrlCacheEntryInfoExA
@ stub GetUrlCacheEntryInfoExW
@ stub GetUrlCacheEntryInfoW
@ stub GetUrlCacheHeaderData
@ stub GopherCreateLocatorA
@ stub GopherCreateLocatorW
@ stub GopherFindFirstFileA
@ stub GopherFindFirstFileW
@ stub GopherGetAttributeA
@ stub GopherGetAttributeW
@ stub GopherGetLocatorTypeA
@ stub GopherGetLocatorTypeW
@ stub GopherOpenFileA
@ stub GopherOpenFileW
@ stub HttpAddRequestHeadersA
@ stub HttpAddRequestHeadersW
@ stub HttpEndRequestA
@ stub HttpEndRequestW
@ stub HttpOpenRequestA
@ stub HttpOpenRequestW
@ stub HttpQueryInfoA
@ stub HttpQueryInfoW
@ stub HttpSendRequestA
@ stub HttpSendRequestExA
@ stub HttpSendRequestExW
@ stub HttpSendRequestW
@ stub IncrementUrlCacheHeaderData
@ stdcall InternetAttemptConnect(long) InternetAttemptConnect
@ stub InternetAutodial
@ stub InternetAutodialCallback
@ stub InternetAutodialHangup
@ stdcall InternetCanonicalizeUrlA(str str ptr long) InternetCanonicalizeUrlA
@ stub InternetCanonicalizeUrlW
@ stub InternetCheckConnectionA
@ stub InternetCheckConnectionW
@ stdcall InternetCloseHandle(long) InternetCloseHandle
@ stub InternetCombineUrlA
@ stub InternetCombineUrlW
@ stub InternetConfirmZoneCrossing
@ stdcall InternetConnectA(ptr str long str str long long long) InternetConnectA
@ stub InternetConnectW
@ stdcall InternetCrackUrlA(str long long ptr) InternetCrackUrlA
@ stub InternetCrackUrlW
@ stub InternetCreateUrlA
@ stub InternetCreateUrlW
@ stub InternetDebugGetLocalTime
@ stub InternetDial
@ stub InternetErrorDlg
@ stdcall InternetFindNextFileA(ptr ptr) InternetFindNextFileA
@ stub InternetFindNextFileW
@ stub InternetGetCertByURL
@ stub InternetGetConnectedState
@ stub InternetGetCookieA
@ stub InternetGetCookieW
@ stdcall InternetGetLastResponseInfoA(ptr str ptr) InternetGetLastResponseInfoA
@ stub InternetGetLastResponseInfoW
@ stub InternetGoOnline
@ stub InternetHangUp
@ stub InternetLockRequestFile
@ stdcall InternetOpenA(str long str str long) InternetOpenA
@ stub InternetOpenServerPushParse
@ stub InternetOpenUrlA
@ stub InternetOpenUrlW
@ stub InternetOpenW
@ stub InternetQueryDataAvailable
@ stub InternetQueryOptionA
@ stub InternetQueryOptionW
@ stdcall InternetReadFile(ptr ptr long ptr) InternetReadFile
@ stub InternetReadFileExA
@ stub InternetReadFileExW
@ stub InternetServerPushParse
@ stub InternetSetCookieA
@ stub InternetSetCookieW
@ stub InternetSetDialState
@ stub InternetSetFilePointer
@ stub InternetSetOptionA
@ stub InternetSetOptionExA
@ stub InternetSetOptionExW
@ stub InternetSetOptionW
@ stdcall InternetSetStatusCallback(ptr ptr) InternetSetStatusCallback
@ stub InternetShowSecurityInfoByURL
@ stub InternetTimeFromSystemTime
@ stub InternetTimeToSystemTime
@ stub InternetUnlockRequestFile
@ stdcall InternetWriteFile(ptr ptr long ptr) InternetWriteFile
@ stub InternetWriteFileExA
@ stub InternetWriteFileExW
@ stub IsHostInProxyBypassList
@ stub LoadUrlCacheContent
@ stub ParseX509EncodedCertificateForListBoxEntry
@ stub ReadUrlCacheEntryStream
@ stub RetrieveUrlCacheEntryFileA
@ stub RetrieveUrlCacheEntryFileW
@ stub RetrieveUrlCacheEntryStreamA
@ stub RetrieveUrlCacheEntryStreamW
@ stub RunOnceUrlCache
@ stub SetUrlCacheConfigInfoA
@ stub SetUrlCacheConfigInfoW
@ stub SetUrlCacheEntryGroup
@ stub SetUrlCacheEntryInfoA
@ stub SetUrlCacheEntryInfoW
@ stub SetUrlCacheHeaderData
@ stub ShowClientAuthCerts
@ stub ShowSecurityInfo
@ stub ShowX509EncodedCertificate
@ stub UnlockUrlCacheEntryFile
@ stub UnlockUrlCacheEntryStream
@ stub UpdateUrlCacheContentPath
...@@ -164,13 +164,14 @@ char dbch_win16drv[] = "\003win16drv"; ...@@ -164,13 +164,14 @@ char dbch_win16drv[] = "\003win16drv";
char dbch_win32[] = "\003win32"; char dbch_win32[] = "\003win32";
char dbch_winedbg[] = "\003winedbg"; char dbch_winedbg[] = "\003winedbg";
char dbch_wing[] = "\003wing"; char dbch_wing[] = "\003wing";
char dbch_wininet[] = "\003wininet";
char dbch_winsock[] = "\003winsock"; char dbch_winsock[] = "\003winsock";
char dbch_winspool[] = "\003winspool"; char dbch_winspool[] = "\003winspool";
char dbch_wnet[] = "\003wnet"; char dbch_wnet[] = "\003wnet";
char dbch_x11[] = "\003x11"; char dbch_x11[] = "\003x11";
char dbch_x11drv[] = "\003x11drv"; char dbch_x11drv[] = "\003x11drv";
#define DEBUG_CHANNEL_COUNT 163 #define DEBUG_CHANNEL_COUNT 164
static char * const debug_channels[DEBUG_CHANNEL_COUNT] = { static char * const debug_channels[DEBUG_CHANNEL_COUNT] = {
dbch_accel, dbch_accel,
...@@ -331,6 +332,7 @@ static char * const debug_channels[DEBUG_CHANNEL_COUNT] = { ...@@ -331,6 +332,7 @@ static char * const debug_channels[DEBUG_CHANNEL_COUNT] = {
dbch_win32, dbch_win32,
dbch_winedbg, dbch_winedbg,
dbch_wing, dbch_wing,
dbch_wininet,
dbch_winsock, dbch_winsock,
dbch_winspool, dbch_winspool,
dbch_wnet, dbch_wnet,
......
/*
* urlmon.h
*/
#ifndef __WINE_URLMON_H
#define __WINE_URLMON_H
HRESULT CreateURLMoniker(IMoniker *pmkContext, LPWSTR szURL, IMoniker **ppmk);
#endif /* __WINE_URLMON_H */
#ifndef _WINE_WININET_H_
#define _WINE_WININET_H_
#if defined(__cplusplus)
extern "C" {
#endif
#define INTERNETAPI
#define BOOLAPI INTERNETAPI BOOL WINAPI
typedef LPVOID HINTERNET;
typedef HINTERNET * LPHINTERNET;
typedef WORD INTERNET_PORT;
typedef INTERNET_PORT * LPINTERNET_PORT;
#define INTERNET_INVALID_PORT_NUMBER 0
#define INTERNET_DEFAULT_FTP_PORT 21
#define INTERNET_DEFAULT_GOPHER_PORT 70
#define INTERNET_DEFAULT_HTTP_PORT 80
#define INTERNET_DEFAULT_HTTPS_PORT 443
#define INTERNET_DEFAULT_SOCKS_PORT 1080
#define INTERNET_MAX_HOST_NAME_LENGTH 256
#define INTERNET_MAX_USER_NAME_LENGTH 128
#define INTERNET_MAX_PASSWORD_LENGTH 128
#define INTERNET_MAX_PORT_NUMBER_LENGTH 5
#define INTERNET_MAX_PORT_NUMBER_VALUE 65535
#define INTERNET_MAX_PATH_LENGTH 2048
#define INTERNET_MAX_SCHEME_LENGTH 32
#define INTERNET_MAX_URL_LENGTH (INTERNET_MAX_SCHEME_LENGTH + sizeof("://")+ INTERNET_MAX_PATH_LENGTH)
#define INTERNET_KEEP_ALIVE_UNKNOWN ((DWORD)-1)
#define INTERNET_KEEP_ALIVE_ENABLED 1
#define INTERNET_KEEP_ALIVE_DISABLED 0
#define INTERNET_REQFLAG_FROM_CACHE 0x00000001
#define INTERNET_REQFLAG_ASYNC 0x00000002
#define INTERNET_REQFLAG_VIA_PROXY 0x00000004
#define INTERNET_REQFLAG_NO_HEADERS 0x00000008
#define INTERNET_REQFLAG_PASSIVE 0x00000010
#define INTERNET_REQFLAG_CACHE_WRITE_DISABLED 0x00000040
#define INTERNET_FLAG_RELOAD 0x80000000
#define INTERNET_FLAG_RAW_DATA 0x40000000
#define INTERNET_FLAG_EXISTING_CONNECT 0x20000000
#define INTERNET_FLAG_ASYNC 0x10000000
#define INTERNET_FLAG_PASSIVE 0x08000000
#define INTERNET_FLAG_NO_CACHE_WRITE 0x04000000
#define INTERNET_FLAG_DONT_CACHE INTERNET_FLAG_NO_CACHE_WRITE
#define INTERNET_FLAG_MAKE_PERSISTENT 0x02000000
#define INTERNET_FLAG_FROM_CACHE 0x01000000
#define INTERNET_FLAG_OFFLINE INTERNET_FLAG_FROM_CACHE
#define INTERNET_FLAG_SECURE 0x00800000
#define INTERNET_FLAG_KEEP_CONNECTION 0x00400000
#define INTERNET_FLAG_NO_AUTO_REDIRECT 0x00200000
#define INTERNET_FLAG_READ_PREFETCH 0x00100000
#define INTERNET_FLAG_NO_COOKIES 0x00080000
#define INTERNET_FLAG_NO_AUTH 0x00040000
#define INTERNET_FLAG_CACHE_IF_NET_FAIL 0x00010000
#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP 0x00008000
#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS 0x00004000
#define INTERNET_FLAG_IGNORE_CERT_DATE_INVALID 0x00002000
#define INTERNET_FLAG_IGNORE_CERT_CN_INVALID 0x00001000
#define INTERNET_FLAG_RESYNCHRONIZE 0x00000800
#define INTERNET_FLAG_HYPERLINK 0x00000400
#define INTERNET_FLAG_NO_UI 0x00000200
#define INTERNET_FLAG_PRAGMA_NOCACHE 0x00000100
#define INTERNET_FLAG_CACHE_ASYNC 0x00000080
#define INTERNET_FLAG_FORMS_SUBMIT 0x00000040
#define INTERNET_FLAG_NEED_FILE 0x00000010
#define INTERNET_FLAG_MUST_CACHE_REQUEST INTERNET_FLAG_NEED_FILE
#define INTERNET_FLAG_TRANSFER_ASCII FTP_TRANSFER_TYPE_ASCII
#define INTERNET_FLAG_TRANSFER_BINARY FTP_TRANSFER_TYPE_BINARY
#define SECURITY_INTERNET_MASK (INTERNET_FLAG_IGNORE_CERT_CN_INVALID|\
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID|\
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS|\
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP)
#define INTERNET_FLAGS_MASK (INTERNET_FLAG_RELOAD \
| INTERNET_FLAG_RAW_DATA \
| INTERNET_FLAG_EXISTING_CONNECT \
| INTERNET_FLAG_ASYNC \
| INTERNET_FLAG_PASSIVE \
| INTERNET_FLAG_NO_CACHE_WRITE \
| INTERNET_FLAG_MAKE_PERSISTENT \
| INTERNET_FLAG_FROM_CACHE \
| INTERNET_FLAG_SECURE \
| INTERNET_FLAG_KEEP_CONNECTION \
| INTERNET_FLAG_NO_AUTO_REDIRECT \
| INTERNET_FLAG_READ_PREFETCH \
| INTERNET_FLAG_NO_COOKIES \
| INTERNET_FLAG_NO_AUTH \
| INTERNET_FLAG_CACHE_IF_NET_FAIL \
| SECURITY_INTERNET_MASK \
| INTERNET_FLAG_RESYNCHRONIZE \
| INTERNET_FLAG_HYPERLINK \
| INTERNET_FLAG_NO_UI \
| INTERNET_FLAG_PRAGMA_NOCACHE \
| INTERNET_FLAG_CACHE_ASYNC \
| INTERNET_FLAG_FORMS_SUBMIT \
| INTERNET_FLAG_NEED_FILE \
| INTERNET_FLAG_TRANSFER_BINARY \
| INTERNET_FLAG_TRANSFER_ASCII \
)
#define INTERNET_ERROR_MASK_INSERT_CDROM 0x1
#define INTERNET_OPTIONS_MASK (~INTERNET_FLAGS_MASK)
#define WININET_API_FLAG_ASYNC 0x00000001
#define WININET_API_FLAG_SYNC 0x00000004
#define WININET_API_FLAG_USE_CONTEXT 0x00000008
#define INTERNET_NO_CALLBACK 0
typedef enum {
INTERNET_SCHEME_PARTIAL = -2,
INTERNET_SCHEME_UNKNOWN = -1,
INTERNET_SCHEME_DEFAULT = 0,
INTERNET_SCHEME_FTP,
INTERNET_SCHEME_GOPHER,
INTERNET_SCHEME_HTTP,
INTERNET_SCHEME_HTTPS,
INTERNET_SCHEME_FILE,
INTERNET_SCHEME_NEWS,
INTERNET_SCHEME_MAILTO,
INTERNET_SCHEME_SOCKS,
INTERNET_SCHEME_FIRST = INTERNET_SCHEME_FTP,
INTERNET_SCHEME_LAST = INTERNET_SCHEME_SOCKS
} INTERNET_SCHEME,* LPINTERNET_SCHEME;
typedef struct {
DWORD dwResult;
DWORD dwError;
} INTERNET_ASYNC_RESULT,* LPINTERNET_ASYNC_RESULT;
typedef struct {
DWORD dwAccessType;
LPCSTR lpszProxy;
LPCSTR lpszProxyBypass;
} INTERNET_PROXY_INFOA,* LPINTERNET_PROXY_INFOA;
typedef struct {
DWORD dwAccessType;
LPCWSTR lpszProxy;
LPCWSTR lpszProxyBypass;
} INTERNET_PROXY_INFOW,* LPINTERNET_PROXY_INFOW;
DECL_WINELIB_TYPE_AW(INTERNET_PROXY_INFO)
DECL_WINELIB_TYPE_AW(LPINTERNET_PROXY_INFOLPCHOOSEFONT)
typedef struct {
DWORD dwMajorVersion;
DWORD dwMinorVersion;
} INTERNET_VERSION_INFO,* LPINTERNET_VERSION_INFO;
typedef struct {
DWORD dwMajorVersion;
DWORD dwMinorVersion;
} HTTP_VERSION_INFO,* LPHTTP_VERSION_INFO;
typedef struct {
DWORD dwConnectedState;
DWORD dwFlags;
} INTERNET_CONNECTED_INFO,* LPINTERNET_CONNECTED_INFO;
#define ISO_FORCE_DISCONNECTED 0x00000001
typedef struct {
DWORD dwStructSize;
LPSTR lpszScheme;
DWORD dwSchemeLength;
INTERNET_SCHEME nScheme;
LPSTR lpszHostName;
DWORD dwHostNameLength;
INTERNET_PORT nPort;
LPSTR lpszUserName;
DWORD dwUserNameLength;
LPSTR lpszPassword;
DWORD dwPasswordLength;
LPSTR lpszUrlPath;
DWORD dwUrlPathLength;
LPSTR lpszExtraInfo;
DWORD dwExtraInfoLength;
} URL_COMPONENTSA,* LPURL_COMPONENTSA;
typedef struct {
DWORD dwStructSize;
LPWSTR lpszScheme;
DWORD dwSchemeLength;
INTERNET_SCHEME nScheme;
LPWSTR lpszHostName;
DWORD dwHostNameLength;
INTERNET_PORT nPort;
LPWSTR lpszUserName;
DWORD dwUserNameLength;
LPWSTR lpszPassword;
DWORD dwPasswordLength;
LPWSTR lpszUrlPath;
DWORD dwUrlPathLength;
LPWSTR lpszExtraInfo;
DWORD dwExtraInfoLength;
} URL_COMPONENTSW,* LPURL_COMPONENTSW;
DECL_WINELIB_TYPE_AW(URL_COMPONENTS)
DECL_WINELIB_TYPE_AW(LPURL_COMPONENTS)
typedef struct {
FILETIME ftExpiry;
FILETIME ftStart;
LPSTR lpszSubjectInfo;
LPSTR lpszIssuerInfo;
LPSTR lpszProtocolName;
LPSTR lpszSignatureAlgName;
LPSTR lpszEncryptionAlgName;
DWORD dwKeySize;
} INTERNET_CERTIFICATE_INFOA,* LPINTERNET_CERTIFICATE_INFOA;
typedef struct {
FILETIME ftExpiry;
FILETIME ftStart;
LPWSTR lpszSubjectInfo;
LPWSTR lpszIssuerInfo;
LPWSTR lpszProtocolName;
LPWSTR lpszSignatureAlgName;
LPWSTR lpszEncryptionAlgName;
DWORD dwKeySize;
} INTERNET_CERTIFICATE_INFOW,* LPINTERNET_CERTIFICATE_INFOW;
DECL_WINELIB_TYPE_AW(INTERNET_CERTIFICATE_INFO)
DECL_WINELIB_TYPE_AW(LPINTERNET_CERTIFICATE_INFO)
typedef struct _INTERNET_BUFFERSA {
DWORD dwStructSize;
struct _INTERNET_BUFFERSA * Next;
LPCSTR lpcszHeader;
DWORD dwHeadersLength;
DWORD dwHeadersTotal;
LPVOID lpvBuffer;
DWORD dwBufferLength;
DWORD dwBufferTotal;
DWORD dwOffsetLow;
DWORD dwOffsetHigh;
} INTERNET_BUFFERSA,* LPINTERNET_BUFFERSA;
typedef struct _INTERNET_BUFFERSW {
DWORD dwStructSize;
struct _INTERNET_BUFFERSW * Next;
LPCWSTR lpcszHeader;
DWORD dwHeadersLength;
DWORD dwHeadersTotal;
LPVOID lpvBuffer;
DWORD dwBufferLength;
DWORD dwBufferTotal;
DWORD dwOffsetLow;
DWORD dwOffsetHigh;
} INTERNET_BUFFERSW,* LPINTERNET_BUFFERSW;
DECL_WINELIB_TYPE_AW(INTERNET_BUFFERS)
DECL_WINELIB_TYPE_AW(LPINTERNET_BUFFERS)
BOOLAPI InternetTimeFromSystemTimeA(CONST SYSTEMTIME *,DWORD ,LPSTR ,DWORD);
BOOLAPI InternetTimeFromSystemTimeW(CONST SYSTEMTIME *,DWORD ,LPWSTR ,DWORD);
#define InternetTimeFromSystemTime WINELIB_NAME_AW(InternetTimeFromSystemTime)
#define INTERNET_RFC1123_BUFSIZE 30
BOOLAPI InternetTimeToSystemTimeA(LPCSTR ,SYSTEMTIME *,DWORD);
BOOLAPI InternetTimeToSystemTimeW(LPCWSTR ,SYSTEMTIME *,DWORD);
#define InternetTimeToSystemTime WINELIB_NAME_AW(InternetTimeToSystemTime)
BOOLAPI InternetCrackUrlA(LPCSTR ,DWORD ,DWORD ,LPURL_COMPONENTSA);
BOOLAPI InternetCrackUrlW(LPCWSTR ,DWORD ,DWORD ,LPURL_COMPONENTSW);
#define InternetCrackUrl WINELIB_NAME_AW(InternetCrackUrl)
BOOLAPI InternetCreateUrlA(LPURL_COMPONENTSA ,DWORD ,LPSTR ,LPDWORD);
BOOLAPI InternetCreateUrlW(LPURL_COMPONENTSW ,DWORD ,LPWSTR ,LPDWORD);
#define InternetCreateUrl WINELIB_NAME_AW(InternetCreateUrl)
BOOLAPI InternetCanonicalizeUrlA(LPCSTR ,LPSTR ,LPDWORD ,DWORD);
BOOLAPI InternetCanonicalizeUrlW(LPCWSTR ,LPWSTR ,LPDWORD ,DWORD);
#define InternetCanonicalizeUrl WINELIB_NAME_AW(InternetCanonicalizeUrl)
BOOLAPI InternetCombineUrlA(LPCSTR ,LPCSTR ,LPSTR ,LPDWORD ,DWORD);
BOOLAPI InternetCombineUrlW(LPCWSTR ,LPCWSTR ,LPWSTR ,LPDWORD ,DWORD);
#define InternetCombineUrl WINELIB_NAME_AW(InternetCombineUrl)
#define ICU_ESCAPE 0x80000000
#define ICU_USERNAME 0x40000000
#define ICU_NO_ENCODE 0x20000000
#define ICU_DECODE 0x10000000
#define ICU_NO_META 0x08000000
#define ICU_ENCODE_SPACES_ONLY 0x04000000
#define ICU_BROWSER_MODE 0x02000000
INTERNETAPI HINTERNET WINAPI InternetOpenA(LPCSTR ,DWORD ,LPCSTR lpszProxy ,LPCSTR lpszProxyBypass ,DWORD);
INTERNETAPI HINTERNET WINAPI InternetOpenW(LPCWSTR ,DWORD ,LPCWSTR lpszProxy ,LPCWSTR lpszProxyBypass ,DWORD);
#define InternetOpen WINELIB_NAME_AW(InternetOpen);
#define INTERNET_OPEN_TYPE_PRECONFIG 0
#define INTERNET_OPEN_TYPE_DIRECT 1
#define INTERNET_OPEN_TYPE_PROXY 3
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4
#define PRE_CONFIG_INTERNET_ACCESS INTERNET_OPEN_TYPE_PRECONFIG
#define LOCAL_INTERNET_ACCESS INTERNET_OPEN_TYPE_DIRECT
#define CERN_PROXY_INTERNET_ACCESS INTERNET_OPEN_TYPE_PROXY
BOOLAPI InternetCloseHandle(HINTERNET);
INTERNETAPI HINTERNET WINAPI InternetConnectA(HINTERNET ,LPCSTR ,INTERNET_PORT ,
LPCSTR lpszUserName ,LPCSTR lpszPassword ,DWORD ,DWORD ,DWORD );
INTERNETAPI HINTERNET WINAPI InternetConnectW(HINTERNET ,LPCWSTR ,INTERNET_PORT ,
LPCWSTR lpszUserName ,LPCWSTR lpszPassword ,DWORD ,DWORD ,DWORD );
#define InternetConnect WINELIB_NAME_AW(InternetConnect);
#define INTERNET_SERVICE_URL 0
#define INTERNET_SERVICE_FTP 1
#define INTERNET_SERVICE_GOPHER 2
#define INTERNET_SERVICE_HTTP 3
#define InternetConnectUrl(hInternet,lpszUrl,dwFlags,dwContext) \
InternetConnect(hInternet,\
lpszUrl,\
INTERNET_INVALID_PORT_NUMBER,\
NULL,\
NULL,\
INTERNET_SERVICE_URL,\
dwFlags,\
dwContext \
)
INTERNETAPI HINTERNET WINAPI InternetOpenUrlA(HINTERNET ,LPCSTR ,LPCSTR lpszHeaders ,DWORD ,DWORD ,DWORD);
INTERNETAPI HINTERNET WINAPI InternetOpenUrlW(HINTERNET ,LPCWSTR ,LPCWSTR lpszHeaders ,DWORD ,DWORD ,DWORD);
#define InternetOpenUrl WINELIB_NAME_AW(InternetOpenUrl);
BOOLAPI InternetReadFile( HINTERNET ,LPVOID ,DWORD ,LPDWORD );
INTERNETAPI BOOL WINAPI InternetReadFileExA( HINTERNET ,LPINTERNET_BUFFERSA ,DWORD ,DWORD );
INTERNETAPI BOOL WINAPI InternetReadFileExW( HINTERNET ,LPINTERNET_BUFFERSW ,DWORD ,DWORD );
#define InternetReadFileEx WINELIB_NAME_AW(InternetReadFileEx);
#define IRF_ASYNC WININET_API_FLAG_ASYNC
#define IRF_SYNC WININET_API_FLAG_SYNC
#define IRF_USE_CONTEXT WININET_API_FLAG_USE_CONTEXT
#define IRF_NO_WAIT 0x00000008
INTERNETAPI DWORD WINAPI InternetSetFilePointer(HINTERNET ,LONG ,PVOID ,DWORD ,DWORD);
BOOLAPI InternetWriteFile(HINTERNET ,LPCVOID ,DWORD ,LPDWORD);
BOOLAPI InternetQueryDataAvailable(HINTERNET ,LPDWORD lpdwNumberOfBytesAvailable ,DWORD ,DWORD);
BOOLAPI InternetFindNextFileA(HINTERNET ,LPVOID);
BOOLAPI InternetFindNextFileW(HINTERNET ,LPVOID);
#define InternetFindNextFile WINELIB_NAME_AW*(InternetFindNextFile);
BOOLAPI InternetQueryOptionA(HINTERNET hInternet ,DWORD ,LPVOID lpBuffer ,LPDWORD);
BOOLAPI InternetQueryOptionW(HINTERNET hInternet ,DWORD ,LPVOID lpBuffer ,LPDWORD);
#define InternetQueryOption WINELIB_NAME_AW(InternetQueryOption);
BOOLAPI InternetSetOptionA(HINTERNET hInternet ,DWORD ,LPVOID ,DWORD);
BOOLAPI InternetSetOptionW(HINTERNET hInternet ,DWORD ,LPVOID ,DWORD);
#define InternetSetOption WINELIB_NAME_AW(InternetSetOption);
BOOLAPI InternetSetOptionExA(HINTERNET hInternet ,DWORD ,LPVOID ,DWORD ,DWORD);
BOOLAPI InternetSetOptionExW(HINTERNET hInternet ,DWORD ,LPVOID ,DWORD ,DWORD);
#define InternetSetOptionEx WINELIB_NAME_AW(InternetSetOptionEx);
BOOLAPI InternetLockRequestFile(HINTERNET ,HANDLE *);
BOOLAPI InternetUnlockRequestFile(HANDLE);
#define ISO_GLOBAL 0x00000001
#define ISO_REGISTRY 0x00000002
#define ISO_VALID_FLAGS (ISO_GLOBAL | ISO_REGISTRY)
#define INTERNET_OPTION_CALLBACK 1
#define INTERNET_OPTION_CONNECT_TIMEOUT 2
#define INTERNET_OPTION_CONNECT_RETRIES 3
#define INTERNET_OPTION_CONNECT_BACKOFF 4
#define INTERNET_OPTION_SEND_TIMEOUT 5
#define INTERNET_OPTION_CONTROL_SEND_TIMEOUT INTERNET_OPTION_SEND_TIMEOUT
#define INTERNET_OPTION_RECEIVE_TIMEOUT 6
#define INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT INTERNET_OPTION_RECEIVE_TIMEOUT
#define INTERNET_OPTION_DATA_SEND_TIMEOUT 7
#define INTERNET_OPTION_DATA_RECEIVE_TIMEOUT 8
#define INTERNET_OPTION_HANDLE_TYPE 9
#define INTERNET_OPTION_LISTEN_TIMEOUT 11
#define INTERNET_OPTION_READ_BUFFER_SIZE 12
#define INTERNET_OPTION_WRITE_BUFFER_SIZE 13
#define INTERNET_OPTION_ASYNC_ID 15
#define INTERNET_OPTION_ASYNC_PRIORITY 16
#define INTERNET_OPTION_PARENT_HANDLE 21
#define INTERNET_OPTION_KEEP_CONNECTION 22
#define INTERNET_OPTION_REQUEST_FLAGS 23
#define INTERNET_OPTION_EXTENDED_ERROR 24
#define INTERNET_OPTION_OFFLINE_MODE 26
#define INTERNET_OPTION_CACHE_STREAM_HANDLE 27
#define INTERNET_OPTION_USERNAME 28
#define INTERNET_OPTION_PASSWORD 29
#define INTERNET_OPTION_ASYNC 30
#define INTERNET_OPTION_SECURITY_FLAGS 31
#define INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT 32
#define INTERNET_OPTION_DATAFILE_NAME 33
#define INTERNET_OPTION_URL 34
#define INTERNET_OPTION_SECURITY_CERTIFICATE 35
#define INTERNET_OPTION_SECURITY_KEY_BITNESS 36
#define INTERNET_OPTION_REFRESH 37
#define INTERNET_OPTION_PROXY 38
#define INTERNET_OPTION_SETTINGS_CHANGED 39
#define INTERNET_OPTION_VERSION 40
#define INTERNET_OPTION_USER_AGENT 41
#define INTERNET_OPTION_END_BROWSER_SESSION 42
#define INTERNET_OPTION_PROXY_USERNAME 43
#define INTERNET_OPTION_PROXY_PASSWORD 44
#define INTERNET_OPTION_CONTEXT_VALUE 45
#define INTERNET_OPTION_CONNECT_LIMIT 46
#define INTERNET_OPTION_SECURITY_SELECT_CLIENT_CERT 47
#define INTERNET_OPTION_POLICY 48
#define INTERNET_OPTION_DISCONNECTED_TIMEOUT 49
#define INTERNET_OPTION_CONNECTED_STATE 50
#define INTERNET_OPTION_IDLE_STATE 51
#define INTERNET_OPTION_OFFLINE_SEMANTICS 52
#define INTERNET_OPTION_SECONDARY_CACHE_KEY 53
#define INTERNET_OPTION_CALLBACK_FILTER 54
#define INTERNET_OPTION_CONNECT_TIME 55
#define INTERNET_OPTION_SEND_THROUGHPUT 56
#define INTERNET_OPTION_RECEIVE_THROUGHPUT 57
#define INTERNET_OPTION_REQUEST_PRIORITY 58
#define INTERNET_OPTION_HTTP_VERSION 59
#define INTERNET_OPTION_RESET_URLCACHE_SESSION 60
#define INTERNET_OPTION_ERROR_MASK 62
#define INTERNET_FIRST_OPTION INTERNET_OPTION_CALLBACK
#define INTERNET_LAST_OPTION INTERNET_OPTION_ERROR_MASK
#define INTERNET_PRIORITY_FOREGROUND 1000
#define INTERNET_HANDLE_TYPE_INTERNET 1
#define INTERNET_HANDLE_TYPE_CONNECT_FTP 2
#define INTERNET_HANDLE_TYPE_CONNECT_GOPHER 3
#define INTERNET_HANDLE_TYPE_CONNECT_HTTP 4
#define INTERNET_HANDLE_TYPE_FTP_FIND 5
#define INTERNET_HANDLE_TYPE_FTP_FIND_HTML 6
#define INTERNET_HANDLE_TYPE_FTP_FILE 7
#define INTERNET_HANDLE_TYPE_FTP_FILE_HTML 8
#define INTERNET_HANDLE_TYPE_GOPHER_FIND 9
#define INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML 10
#define INTERNET_HANDLE_TYPE_GOPHER_FILE 11
#define INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML 12
#define INTERNET_HANDLE_TYPE_HTTP_REQUEST 13
#define SECURITY_FLAG_SECURE 0x00000001
#define SECURITY_FLAG_STRENGTH_WEAK 0x10000000
#define SECURITY_FLAG_STRENGTH_MEDIUM 0x40000000
#define SECURITY_FLAG_STRENGTH_STRONG 0x20000000
#define SECURITY_FLAG_UNKNOWNBIT 0x80000000
#define SECURITY_FLAG_NORMALBITNESS SECURITY_FLAG_STRENGTH_WEAK
#define SECURITY_FLAG_SSL 0x00000002
#define SECURITY_FLAG_SSL3 0x00000004
#define SECURITY_FLAG_PCT 0x00000008
#define SECURITY_FLAG_PCT4 0x00000010
#define SECURITY_FLAG_IETFSSL4 0x00000020
#define SECURITY_FLAG_40BIT SECURITY_FLAG_STRENGTH_WEAK
#define SECURITY_FLAG_128BIT SECURITY_FLAG_STRENGTH_STRONG
#define SECURITY_FLAG_56BIT SECURITY_FLAG_STRENGTH_MEDIUM
#define SECURITY_FLAG_IGNORE_REVOCATION 0x00000080
#define SECURITY_FLAG_IGNORE_UNKNOWN_CA 0x00000100
#define SECURITY_FLAG_IGNORE_WRONG_USAGE 0x00000200
#define SECURITY_FLAG_IGNORE_CERT_CN_INVALID INTERNET_FLAG_IGNORE_CERT_CN_INVALID
#define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID INTERNET_FLAG_IGNORE_CERT_DATE_INVALID
#define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
#define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP
#define SECURITY_SET_MASK (SECURITY_FLAG_IGNORE_REVOCATION |\
SECURITY_FLAG_IGNORE_UNKNOWN_CA |\
SECURITY_FLAG_IGNORE_CERT_CN_INVALID |\
SECURITY_FLAG_IGNORE_CERT_DATE_INVALID |\
SECURITY_FLAG_IGNORE_WRONG_USAGE)
BOOLAPI InternetGetLastResponseInfoA(LPDWORD ,LPSTR lpszBuffer ,LPDWORD);
BOOLAPI InternetGetLastResponseInfoW(LPDWORD ,LPWSTR lpszBuffer ,LPDWORD);
#define InternetGetLastResponseInfo WINELIB_NAME_AW(InternetGetLastResponseInfo);
typedef VOID (CALLBACK * INTERNET_STATUS_CALLBACK)(HINTERNET ,DWORD ,DWORD ,
LPVOID lpvStatusInformation ,DWORD);
typedef INTERNET_STATUS_CALLBACK * LPINTERNET_STATUS_CALLBACK;
INTERNETAPI INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallback(HINTERNET ,INTERNET_STATUS_CALLBACK);
#define INTERNET_STATUS_RESOLVING_NAME 10
#define INTERNET_STATUS_NAME_RESOLVED 11
#define INTERNET_STATUS_CONNECTING_TO_SERVER 20
#define INTERNET_STATUS_CONNECTED_TO_SERVER 21
#define INTERNET_STATUS_SENDING_REQUEST 30
#define INTERNET_STATUS_REQUEST_SENT 31
#define INTERNET_STATUS_RECEIVING_RESPONSE 40
#define INTERNET_STATUS_RESPONSE_RECEIVED 41
#define INTERNET_STATUS_CTL_RESPONSE_RECEIVED 42
#define INTERNET_STATUS_PREFETCH 43
#define INTERNET_STATUS_CLOSING_CONNECTION 50
#define INTERNET_STATUS_CONNECTION_CLOSED 51
#define INTERNET_STATUS_HANDLE_CREATED 60
#define INTERNET_STATUS_HANDLE_CLOSING 70
#define INTERNET_STATUS_REQUEST_COMPLETE 100
#define INTERNET_STATUS_REDIRECT 110
#define INTERNET_STATUS_INTERMEDIATE_RESPONSE 120
#define INTERNET_STATUS_STATE_CHANGE 200
#define INTERNET_STATE_CONNECTED 0x00000001
#define INTERNET_STATE_DISCONNECTED 0x00000002
#define INTERNET_STATE_DISCONNECTED_BY_USER 0x00000010
#define INTERNET_STATE_IDLE 0x00000100
#define INTERNET_STATE_BUSY 0x00000200
#define INTERNET_INVALID_STATUS_CALLBACK ((INTERNET_STATUS_CALLBACK)(-1L))
#define FTP_TRANSFER_TYPE_UNKNOWN 0x00000000
#define FTP_TRANSFER_TYPE_ASCII 0x00000001
#define FTP_TRANSFER_TYPE_BINARY 0x00000002
#define FTP_TRANSFER_TYPE_MASK (FTP_TRANSFER_TYPE_ASCII | FTP_TRANSFER_TYPE_BINARY)
INTERNETAPI HINTERNET WINAPI FtpFindFirstFileA(HINTERNET ,LPCSTR lpszSearchFile ,
LPWIN32_FIND_DATAA lpFindFileData ,DWORD ,DWORD);
INTERNETAPI HINTERNET WINAPI FtpFindFirstFileW(HINTERNET ,LPCWSTR lpszSearchFile ,
LPWIN32_FIND_DATAW lpFindFileData ,DWORD ,DWORD);
#define FtpFindFirstFile WINELIB_NAME_AW(FtpFindFirstFile);
BOOLAPI FtpGetFileA(HINTERNET ,LPCSTR ,LPCSTR ,BOOL ,DWORD ,DWORD ,DWORD);
BOOLAPI FtpGetFileW(HINTERNET ,LPCWSTR ,LPCWSTR ,BOOL ,DWORD ,DWORD ,DWORD);
#define FtpGetFile WINELIB_NAME_AW(FtpGetFileW);
BOOLAPI FtpPutFileA(HINTERNET ,LPCSTR ,LPCSTR ,DWORD ,DWORD);
BOOLAPI FtpPutFileW(HINTERNET ,LPCWSTR ,LPCWSTR ,DWORD ,DWORD);
#define FtpPutFile WINELIB_NAME_AW(FtpPutFile);
BOOLAPI FtpDeleteFileA(HINTERNET ,LPCSTR);
BOOLAPI FtpDeleteFileW(HINTERNET ,LPCWSTR);
#define FtpDeleteFile WINELIB_NAME_AW(FtpDeleteFile);
BOOLAPI FtpRenameFileA(HINTERNET ,LPCSTR ,LPCSTR);
BOOLAPI FtpRenameFileW(HINTERNET ,LPCWSTR ,LPCWSTR);
#define FtpRenameFile WINELIB_NAME_AW(FtpRenameFile);
INTERNETAPI HINTERNET WINAPI FtpOpenFileA(HINTERNET ,LPCSTR ,DWORD ,DWORD ,DWORD);
INTERNETAPI HINTERNET WINAPI FtpOpenFileW(HINTERNET ,LPCWSTR ,DWORD ,DWORD ,DWORD);
#define FtpOpenFile WINELIB_NAME_AW(FtpOpenFile);
BOOLAPI FtpCreateDirectoryA(HINTERNET ,LPCSTR);
BOOLAPI FtpCreateDirectoryW(HINTERNET ,LPCWSTR);
#define FtpCreateDirectory WINELIB_NAME_AW(FtpCreateDirectory);
BOOLAPI FtpRemoveDirectoryA(HINTERNET ,LPCSTR);
BOOLAPI FtpRemoveDirectoryW(HINTERNET ,LPCWSTR);
#define FtpRemoveDirectory WINELIB_NAME_AW(FtpRemoveDirectory);
BOOLAPI FtpSetCurrentDirectoryA(HINTERNET ,LPCSTR);
BOOLAPI FtpSetCurrentDirectoryW(HINTERNET ,LPCWSTR);
#define FtpSetCurrentDirectory WINELIB_NAME_AW(FtpSetCurrentDirectory);
BOOLAPI FtpGetCurrentDirectoryA(HINTERNET ,LPSTR ,LPDWORD);
BOOLAPI FtpGetCurrentDirectoryW(HINTERNET ,LPWSTR ,LPDWORD);
#define FtpGetCurrentDirectory WINELIB_NAME_AW(FtpGetCurrentDirectory);
#define MAX_GOPHER_DISPLAY_TEXT 128
#define MAX_GOPHER_SELECTOR_TEXT 256
#define MAX_GOPHER_HOST_NAME INTERNET_MAX_HOST_NAME_LENGTH
#define MAX_GOPHER_LOCATOR_LENGTH (1 \
+ MAX_GOPHER_DISPLAY_TEXT \
+ 1 \
+ MAX_GOPHER_SELECTOR_TEXT \
+ 1 \
+ MAX_GOPHER_HOST_NAME \
+ 1 \
+ INTERNET_MAX_PORT_NUMBER_LENGTH \
+ 1 \
+ 1 \
+ 2 \
)
typedef struct {
CHAR DisplayString[MAX_GOPHER_DISPLAY_TEXT + 1];
DWORD GopherType;
DWORD SizeLow;
DWORD SizeHigh;
FILETIME LastModificationTime;
CHAR Locator[MAX_GOPHER_LOCATOR_LENGTH + 1];
} GOPHER_FIND_DATAA,* LPGOPHER_FIND_DATAA;
typedef struct {
WCHAR DisplayString[MAX_GOPHER_DISPLAY_TEXT + 1];
DWORD GopherType;
DWORD SizeLow;
DWORD SizeHigh;
FILETIME LastModificationTime;
WCHAR Locator[MAX_GOPHER_LOCATOR_LENGTH + 1];
} GOPHER_FIND_DATAW,* LPGOPHER_FIND_DATAW;
DECL_WINELIB_TYPE_AW(GOPHER_FIND_DATA);
DECL_WINELIB_TYPE_AW(LPGOPHER_FIND_DATA);
#define GOPHER_TYPE_TEXT_FILE 0x00000001
#define GOPHER_TYPE_DIRECTORY 0x00000002
#define GOPHER_TYPE_CSO 0x00000004
#define GOPHER_TYPE_ERROR 0x00000008
#define GOPHER_TYPE_MAC_BINHEX 0x00000010
#define GOPHER_TYPE_DOS_ARCHIVE 0x00000020
#define GOPHER_TYPE_UNIX_UUENCODED 0x00000040
#define GOPHER_TYPE_INDEX_SERVER 0x00000080
#define GOPHER_TYPE_TELNET 0x00000100
#define GOPHER_TYPE_BINARY 0x00000200
#define GOPHER_TYPE_REDUNDANT 0x00000400
#define GOPHER_TYPE_TN3270 0x00000800
#define GOPHER_TYPE_GIF 0x00001000
#define GOPHER_TYPE_IMAGE 0x00002000
#define GOPHER_TYPE_BITMAP 0x00004000
#define GOPHER_TYPE_MOVIE 0x00008000
#define GOPHER_TYPE_SOUND 0x00010000
#define GOPHER_TYPE_HTML 0x00020000
#define GOPHER_TYPE_PDF 0x00040000
#define GOPHER_TYPE_CALENDAR 0x00080000
#define GOPHER_TYPE_INLINE 0x00100000
#define GOPHER_TYPE_UNKNOWN 0x20000000
#define GOPHER_TYPE_ASK 0x40000000
#define GOPHER_TYPE_GOPHER_PLUS 0x80000000
#define IS_GOPHER_FILE(type) (BOOL)(((type) & GOPHER_TYPE_FILE_MASK) ? TRUE : FALSE)
#define IS_GOPHER_DIRECTORY(type) (BOOL)(((type) & GOPHER_TYPE_DIRECTORY) ? TRUE : FALSE)
#define IS_GOPHER_PHONE_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_CSO) ? TRUE : FALSE)
#define IS_GOPHER_ERROR(type) (BOOL)(((type) & GOPHER_TYPE_ERROR) ? TRUE : FALSE)
#define IS_GOPHER_INDEX_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_INDEX_SERVER) ? TRUE : FALSE)
#define IS_GOPHER_TELNET_SESSION(type) (BOOL)(((type) & GOPHER_TYPE_TELNET) ? TRUE : FALSE)
#define IS_GOPHER_BACKUP_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_REDUNDANT) ? TRUE : FALSE)
#define IS_GOPHER_TN3270_SESSION(type) (BOOL)(((type) & GOPHER_TYPE_TN3270) ? TRUE : FALSE)
#define IS_GOPHER_ASK(type) (BOOL)(((type) & GOPHER_TYPE_ASK) ? TRUE : FALSE)
#define IS_GOPHER_PLUS(type) (BOOL)(((type) & GOPHER_TYPE_GOPHER_PLUS) ? TRUE : FALSE)
#define IS_GOPHER_TYPE_KNOWN(type) (BOOL)(((type) & GOPHER_TYPE_UNKNOWN) ? FALSE : TRUE)
#define GOPHER_TYPE_FILE_MASK (GOPHER_TYPE_TEXT_FILE \
| GOPHER_TYPE_MAC_BINHEX \
| GOPHER_TYPE_DOS_ARCHIVE \
| GOPHER_TYPE_UNIX_UUENCODED \
| GOPHER_TYPE_BINARY \
| GOPHER_TYPE_GIF \
| GOPHER_TYPE_IMAGE \
| GOPHER_TYPE_BITMAP \
| GOPHER_TYPE_MOVIE \
| GOPHER_TYPE_SOUND \
| GOPHER_TYPE_HTML \
| GOPHER_TYPE_PDF \
| GOPHER_TYPE_CALENDAR \
| GOPHER_TYPE_INLINE \
)
typedef struct {
LPCSTR Comment;
LPCSTR EmailAddress;
} GOPHER_ADMIN_ATTRIBUTE_TYPEA,* LPGOPHER_ADMIN_ATTRIBUTE_TYPEA;
typedef struct {
LPCWSTR Comment;
LPCWSTR EmailAddress;
} GOPHER_ADMIN_ATTRIBUTE_TYPEW,* LPGOPHER_ADMIN_ATTRIBUTE_TYPEW;
DECL_WINELIB_TYPE_AW(GOPHER_ADMIN_ATTRIBUTE_TYPE)
DECL_WINELIB_TYPE_AW(LPGOPHER_ADMIN_ATTRIBUTE_TYPE)
typedef struct {
FILETIME DateAndTime;
} GOPHER_MOD_DATE_ATTRIBUTE_TYPE,* LPGOPHER_MOD_DATE_ATTRIBUTE_TYPE;
typedef struct {
DWORD Ttl;
} GOPHER_TTL_ATTRIBUTE_TYPE,* LPGOPHER_TTL_ATTRIBUTE_TYPE;
typedef struct {
INT Score;
} GOPHER_SCORE_ATTRIBUTE_TYPE,* LPGOPHER_SCORE_ATTRIBUTE_TYPE;
typedef struct {
INT LowerBound;
INT UpperBound;
} GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE,* LPGOPHER_SCORE_RANGE_ATTRIBUTE_TYPE;
typedef struct {
LPCSTR Site;
} GOPHER_SITE_ATTRIBUTE_TYPEA,* LPGOPHER_SITE_ATTRIBUTE_TYPEA;
typedef struct {
LPCWSTR Site;
} GOPHER_SITE_ATTRIBUTE_TYPEW,* LPGOPHER_SITE_ATTRIBUTE_TYPEW;
DECL_WINELIB_TYPE_AW(GOPHER_SITE_ATTRIBUTE_TYPE)
DECL_WINELIB_TYPE_AW(LPGOPHER_SITE_ATTRIBUTE_TYPE)
typedef struct {
LPCSTR Organization;
} GOPHER_ORGANIZATION_ATTRIBUTE_TYPEA,* LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPEA;
typedef struct {
LPCWSTR Organization;
} GOPHER_ORGANIZATION_ATTRIBUTE_TYPEW,* LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPEW;
DECL_WINELIB_TYPE_AW(GOPHER_ORGANIZATION_ATTRIBUTE_TYPE)
DECL_WINELIB_TYPE_AW(LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPE)
typedef struct {
LPCSTR Location;
} GOPHER_LOCATION_ATTRIBUTE_TYPEA,* LPGOPHER_LOCATION_ATTRIBUTE_TYPEA;
typedef struct {
LPCWSTR Location;
} GOPHER_LOCATION_ATTRIBUTE_TYPEW,* LPGOPHER_LOCATION_ATTRIBUTE_TYPEW;
DECL_WINELIB_TYPE_AW(GOPHER_LOCATION_ATTRIBUTE_TYPE)
DECL_WINELIB_TYPE_AW(LPGOPHER_LOCATION_ATTRIBUTE_TYPE)
typedef struct {
INT DegreesNorth;
INT MinutesNorth;
INT SecondsNorth;
INT DegreesEast;
INT MinutesEast;
INT SecondsEast;
} GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE,* LPGOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE;
typedef struct {
INT Zone;
} GOPHER_TIMEZONE_ATTRIBUTE_TYPE,* LPGOPHER_TIMEZONE_ATTRIBUTE_TYPE;
typedef struct {
LPCSTR Provider;
} GOPHER_PROVIDER_ATTRIBUTE_TYPEA,* LPGOPHER_PROVIDER_ATTRIBUTE_TYPEA;
typedef struct {
LPCWSTR Provider;
} GOPHER_PROVIDER_ATTRIBUTE_TYPEW,* LPGOPHER_PROVIDER_ATTRIBUTE_TYPEW;
DECL_WINELIB_TYPE_AW(GOPHER_PROVIDER_ATTRIBUTE_TYPE)
DECL_WINELIB_TYPE_AW(LPGOPHER_PROVIDER_ATTRIBUTE_TYPE)
typedef struct {
LPCSTR Version;
} GOPHER_VERSION_ATTRIBUTE_TYPEA,* LPGOPHER_VERSION_ATTRIBUTE_TYPEA;
typedef struct {
LPCWSTR Version;
} GOPHER_VERSION_ATTRIBUTE_TYPEW,* LPGOPHER_VERSION_ATTRIBUTE_TYPEW;
DECL_WINELIB_TYPE_AW(GOPHER_VERSION_ATTRIBUTE_TYPE)
DECL_WINELIB_TYPE_AW(LPGOPHER_VERSION_ATTRIBUTE_TYPE)
typedef struct {
LPCSTR ShortAbstract;
LPCSTR AbstractFile;
} GOPHER_ABSTRACT_ATTRIBUTE_TYPEA,* LPGOPHER_ABSTRACT_ATTRIBUTE_TYPEA;
typedef struct {
LPCWSTR ShortAbstract;
LPCWSTR AbstractFile;
} GOPHER_ABSTRACT_ATTRIBUTE_TYPEW,* LPGOPHER_ABSTRACT_ATTRIBUTE_TYPEW;
DECL_WINELIB_TYPE_AW(GOPHER_ABSTRACT_ATTRIBUTE_TYPE)
DECL_WINELIB_TYPE_AW(LPGOPHER_ABSTRACT_ATTRIBUTE_TYPE)
typedef struct {
LPCSTR ContentType;
LPCSTR Language;
DWORD Size;
} GOPHER_VIEW_ATTRIBUTE_TYPEA,* LPGOPHER_VIEW_ATTRIBUTE_TYPEA;
typedef struct {
LPCWSTR ContentType;
LPCWSTR Language;
DWORD Size;
} GOPHER_VIEW_ATTRIBUTE_TYPEW,* LPGOPHER_VIEW_ATTRIBUTE_TYPEW;
DECL_WINELIB_TYPE_AW(GOPHER_VIEW_ATTRIBUTE_TYPE)
DECL_WINELIB_TYPE_AW(LPGOPHER_VIEW_ATTRIBUTE_TYPE)
typedef struct {
BOOL TreeWalk;
} GOPHER_VERONICA_ATTRIBUTE_TYPE,* LPGOPHER_VERONICA_ATTRIBUTE_TYPE;
typedef struct {
LPCSTR QuestionType;
LPCSTR QuestionText;
} GOPHER_ASK_ATTRIBUTE_TYPEA,* LPGOPHER_ASK_ATTRIBUTE_TYPEA;
typedef struct {
LPCWSTR QuestionType;
LPCWSTR QuestionText;
} GOPHER_ASK_ATTRIBUTE_TYPEW,* LPGOPHER_ASK_ATTRIBUTE_TYPEW;
DECL_WINELIB_TYPE_AW(GOPHER_ASK_ATTRIBUTE_TYPE)
DECL_WINELIB_TYPE_AW(LPGOPHER_ASK_ATTRIBUTE_TYPE)
typedef struct {
LPCSTR Text;
} GOPHER_UNKNOWN_ATTRIBUTE_TYPEA,* LPGOPHER_UNKNOWN_ATTRIBUTE_TYPEA;
typedef struct {
LPCWSTR Text;
} GOPHER_UNKNOWN_ATTRIBUTE_TYPEW,* LPGOPHER_UNKNOWN_ATTRIBUTE_TYPEW;
DECL_WINELIB_TYPE_AW(GOPHER_UNKNOWN_ATTRIBUTE_TYPE)
DECL_WINELIB_TYPE_AW(LPGOPHER_UNKNOWN_ATTRIBUTE_TYPE)
/*
typedef struct {
DWORD CategoryId;
DWORD AttributeId;
union {
GOPHER_ADMIN_ATTRIBUTE_TYPE Admin;
GOPHER_MOD_DATE_ATTRIBUTE_TYPE ModDate;
GOPHER_TTL_ATTRIBUTE_TYPE Ttl;
GOPHER_SCORE_ATTRIBUTE_TYPE Score;
GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE ScoreRange;
GOPHER_SITE_ATTRIBUTE_TYPE Site;
GOPHER_ORGANIZATION_ATTRIBUTE_TYPE Organization;
GOPHER_LOCATION_ATTRIBUTE_TYPE Location;
GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE GeographicalLocation;
GOPHER_TIMEZONE_ATTRIBUTE_TYPE TimeZone;
GOPHER_PROVIDER_ATTRIBUTE_TYPE Provider;
GOPHER_VERSION_ATTRIBUTE_TYPE Version;
GOPHER_ABSTRACT_ATTRIBUTE_TYPE Abstract;
GOPHER_VIEW_ATTRIBUTE_TYPE View;
GOPHER_VERONICA_ATTRIBUTE_TYPE Veronica;
GOPHER_ASK_ATTRIBUTE_TYPE Ask;
GOPHER_UNKNOWN_ATTRIBUTE_TYPE Unknown;
} AttributeType;
} GOPHER_ATTRIBUTE_TYPE,* LPGOPHER_ATTRIBUTE_TYPE;
*/
#define MAX_GOPHER_CATEGORY_NAME 128
#define MAX_GOPHER_ATTRIBUTE_NAME 128
#define MIN_GOPHER_ATTRIBUTE_LENGTH 256
#define GOPHER_INFO_CATEGORY TEXT("+INFO")
#define GOPHER_ADMIN_CATEGORY TEXT("+ADMIN")
#define GOPHER_VIEWS_CATEGORY TEXT("+VIEWS")
#define GOPHER_ABSTRACT_CATEGORY TEXT("+ABSTRACT")
#define GOPHER_VERONICA_CATEGORY TEXT("+VERONICA")
#define GOPHER_ADMIN_ATTRIBUTE TEXT("Admin")
#define GOPHER_MOD_DATE_ATTRIBUTE TEXT("Mod-Date")
#define GOPHER_TTL_ATTRIBUTE TEXT("TTL")
#define GOPHER_SCORE_ATTRIBUTE TEXT("Score")
#define GOPHER_RANGE_ATTRIBUTE TEXT("Score-range")
#define GOPHER_SITE_ATTRIBUTE TEXT("Site")
#define GOPHER_ORG_ATTRIBUTE TEXT("Org")
#define GOPHER_LOCATION_ATTRIBUTE TEXT("Loc")
#define GOPHER_GEOG_ATTRIBUTE TEXT("Geog")
#define GOPHER_TIMEZONE_ATTRIBUTE TEXT("TZ")
#define GOPHER_PROVIDER_ATTRIBUTE TEXT("Provider")
#define GOPHER_VERSION_ATTRIBUTE TEXT("Version")
#define GOPHER_ABSTRACT_ATTRIBUTE TEXT("Abstract")
#define GOPHER_VIEW_ATTRIBUTE TEXT("View")
#define GOPHER_TREEWALK_ATTRIBUTE TEXT("treewalk")
#define GOPHER_ATTRIBUTE_ID_BASE 0xabcccc00
#define GOPHER_CATEGORY_ID_ALL (GOPHER_ATTRIBUTE_ID_BASE + 1)
#define GOPHER_CATEGORY_ID_INFO (GOPHER_ATTRIBUTE_ID_BASE + 2)
#define GOPHER_CATEGORY_ID_ADMIN (GOPHER_ATTRIBUTE_ID_BASE + 3)
#define GOPHER_CATEGORY_ID_VIEWS (GOPHER_ATTRIBUTE_ID_BASE + 4)
#define GOPHER_CATEGORY_ID_ABSTRACT (GOPHER_ATTRIBUTE_ID_BASE + 5)
#define GOPHER_CATEGORY_ID_VERONICA (GOPHER_ATTRIBUTE_ID_BASE + 6)
#define GOPHER_CATEGORY_ID_ASK (GOPHER_ATTRIBUTE_ID_BASE + 7)
#define GOPHER_CATEGORY_ID_UNKNOWN (GOPHER_ATTRIBUTE_ID_BASE + 8)
#define GOPHER_ATTRIBUTE_ID_ALL (GOPHER_ATTRIBUTE_ID_BASE + 9)
#define GOPHER_ATTRIBUTE_ID_ADMIN (GOPHER_ATTRIBUTE_ID_BASE + 10)
#define GOPHER_ATTRIBUTE_ID_MOD_DATE (GOPHER_ATTRIBUTE_ID_BASE + 11)
#define GOPHER_ATTRIBUTE_ID_TTL (GOPHER_ATTRIBUTE_ID_BASE + 12)
#define GOPHER_ATTRIBUTE_ID_SCORE (GOPHER_ATTRIBUTE_ID_BASE + 13)
#define GOPHER_ATTRIBUTE_ID_RANGE (GOPHER_ATTRIBUTE_ID_BASE + 14)
#define GOPHER_ATTRIBUTE_ID_SITE (GOPHER_ATTRIBUTE_ID_BASE + 15)
#define GOPHER_ATTRIBUTE_ID_ORG (GOPHER_ATTRIBUTE_ID_BASE + 16)
#define GOPHER_ATTRIBUTE_ID_LOCATION (GOPHER_ATTRIBUTE_ID_BASE + 17)
#define GOPHER_ATTRIBUTE_ID_GEOG (GOPHER_ATTRIBUTE_ID_BASE + 18)
#define GOPHER_ATTRIBUTE_ID_TIMEZONE (GOPHER_ATTRIBUTE_ID_BASE + 19)
#define GOPHER_ATTRIBUTE_ID_PROVIDER (GOPHER_ATTRIBUTE_ID_BASE + 20)
#define GOPHER_ATTRIBUTE_ID_VERSION (GOPHER_ATTRIBUTE_ID_BASE + 21)
#define GOPHER_ATTRIBUTE_ID_ABSTRACT (GOPHER_ATTRIBUTE_ID_BASE + 22)
#define GOPHER_ATTRIBUTE_ID_VIEW (GOPHER_ATTRIBUTE_ID_BASE + 23)
#define GOPHER_ATTRIBUTE_ID_TREEWALK (GOPHER_ATTRIBUTE_ID_BASE + 24)
#define GOPHER_ATTRIBUTE_ID_UNKNOWN (GOPHER_ATTRIBUTE_ID_BASE + 25)
BOOLAPI GopherCreateLocatorA(LPCSTR ,INTERNET_PORT ,LPCSTR lpszDisplayString ,
LPCSTR lpszSelectorString ,DWORD ,LPSTR lpszLocator ,LPDWORD);
BOOLAPI GopherCreateLocatorW(LPCWSTR ,INTERNET_PORT ,LPCWSTR lpszDisplayString ,
LPCWSTR lpszSelectorString ,DWORD ,LPWSTR lpszLocator ,LPDWORD);
#define GopherCreateLocator WINELIB_NAME_AW(GopherCreateLocator)
BOOLAPI GopherGetLocatorTypeA(LPCSTR ,LPDWORD);
BOOLAPI GopherGetLocatorTypeW(LPCWSTR ,LPDWORD);
#define GopherGetLocatorType WINELIB_NAME_AW(GopherGetLocatorType)
INTERNETAPI HINTERNET WINAPI GopherFindFirstFileA(HINTERNET ,LPCSTR lpszLocator ,
LPCSTR lpszSearchString ,LPGOPHER_FIND_DATAA lpFindData ,DWORD ,DWORD);
INTERNETAPI HINTERNET WINAPI GopherFindFirstFileW(HINTERNET ,LPCWSTR lpszLocator ,
LPCWSTR lpszSearchString ,LPGOPHER_FIND_DATAW lpFindData ,DWORD ,DWORD);
#define GopherFindFirstFile WINELIB_NAME_AW(GopherFindFirstFile)
INTERNETAPI HINTERNET WINAPI GopherOpenFileA(HINTERNET ,LPCSTR ,LPCSTR lpszView ,DWORD ,DWORD);
INTERNETAPI HINTERNET WINAPI GopherOpenFileW(HINTERNET ,LPCWSTR ,LPCWSTR lpszView ,DWORD ,DWORD);
#define GopherOpenFile WINELIB_NAME_AW(GopherOpenFile)
/*
typedef BOOL (CALLBACK * GOPHER_ATTRIBUTE_ENUMERATOR)(LPGOPHER_ATTRIBUTE_TYPE ,DWORD);
BOOLAPI GopherGetAttributeA(HINTERNET ,LPCSTR ,LPCSTR lpszAttributeName ,LPBYTE ,
DWORD ,LPDWORD ,GOPHER_ATTRIBUTE_ENUMERATOR lpfnEnumerator ,DWORD);
BOOLAPI GopherGetAttributeW(HINTERNET ,LPCWSTR ,LPCWSTR lpszAttributeName ,LPBYTE ,
DWORD ,LPDWORD ,GOPHER_ATTRIBUTE_ENUMERATOR lpfnEnumerator ,DWORD);
#define GopherGetAttribute WINELIB_NAME_AW(GopherGetAttribute)
*/
#define HTTP_MAJOR_VERSION 1
#define HTTP_MINOR_VERSION 0
#define HTTP_VERSION TEXT("HTTP/1.0")
#define HTTP_QUERY_MIME_VERSION 0
#define HTTP_QUERY_CONTENT_TYPE 1
#define HTTP_QUERY_CONTENT_TRANSFER_ENCODING 2
#define HTTP_QUERY_CONTENT_ID 3
#define HTTP_QUERY_CONTENT_DESCRIPTION 4
#define HTTP_QUERY_CONTENT_LENGTH 5
#define HTTP_QUERY_CONTENT_LANGUAGE 6
#define HTTP_QUERY_ALLOW 7
#define HTTP_QUERY_PUBLIC 8
#define HTTP_QUERY_DATE 9
#define HTTP_QUERY_EXPIRES 10
#define HTTP_QUERY_LAST_MODIFIED 11
#define HTTP_QUERY_MESSAGE_ID 12
#define HTTP_QUERY_URI 13
#define HTTP_QUERY_DERIVED_FROM 14
#define HTTP_QUERY_COST 15
#define HTTP_QUERY_LINK 16
#define HTTP_QUERY_PRAGMA 17
#define HTTP_QUERY_VERSION 18
#define HTTP_QUERY_STATUS_CODE 19
#define HTTP_QUERY_STATUS_TEXT 20
#define HTTP_QUERY_RAW_HEADERS 21
#define HTTP_QUERY_RAW_HEADERS_CRLF 22
#define HTTP_QUERY_CONNECTION 23
#define HTTP_QUERY_ACCEPT 24
#define HTTP_QUERY_ACCEPT_CHARSET 25
#define HTTP_QUERY_ACCEPT_ENCODING 26
#define HTTP_QUERY_ACCEPT_LANGUAGE 27
#define HTTP_QUERY_AUTHORIZATION 28
#define HTTP_QUERY_CONTENT_ENCODING 29
#define HTTP_QUERY_FORWARDED 30
#define HTTP_QUERY_FROM 31
#define HTTP_QUERY_IF_MODIFIED_SINCE 32
#define HTTP_QUERY_LOCATION 33
#define HTTP_QUERY_ORIG_URI 34
#define HTTP_QUERY_REFERER 35
#define HTTP_QUERY_RETRY_AFTER 36
#define HTTP_QUERY_SERVER 37
#define HTTP_QUERY_TITLE 38
#define HTTP_QUERY_USER_AGENT 39
#define HTTP_QUERY_WWW_AUTHENTICATE 40
#define HTTP_QUERY_PROXY_AUTHENTICATE 41
#define HTTP_QUERY_ACCEPT_RANGES 42
#define HTTP_QUERY_SET_COOKIE 43
#define HTTP_QUERY_COOKIE 44
#define HTTP_QUERY_REQUEST_METHOD 45
#define HTTP_QUERY_REFRESH 46
#define HTTP_QUERY_CONTENT_DISPOSITION 47
#define HTTP_QUERY_AGE 48
#define HTTP_QUERY_CACHE_CONTROL 49
#define HTTP_QUERY_CONTENT_BASE 50
#define HTTP_QUERY_CONTENT_LOCATION 51
#define HTTP_QUERY_CONTENT_MD5 52
#define HTTP_QUERY_CONTENT_RANGE 53
#define HTTP_QUERY_ETAG 54
#define HTTP_QUERY_HOST 55
#define HTTP_QUERY_IF_MATCH 56
#define HTTP_QUERY_IF_NONE_MATCH 57
#define HTTP_QUERY_IF_RANGE 58
#define HTTP_QUERY_IF_UNMODIFIED_SINCE 59
#define HTTP_QUERY_MAX_FORWARDS 60
#define HTTP_QUERY_PROXY_AUTHORIZATION 61
#define HTTP_QUERY_RANGE 62
#define HTTP_QUERY_TRANSFER_ENCODING 63
#define HTTP_QUERY_UPGRADE 64
#define HTTP_QUERY_VARY 65
#define HTTP_QUERY_VIA 66
#define HTTP_QUERY_WARNING 67
#define HTTP_QUERY_MAX 67
#define HTTP_QUERY_CUSTOM 65535
#define HTTP_QUERY_FLAG_REQUEST_HEADERS 0x80000000
#define HTTP_QUERY_FLAG_SYSTEMTIME 0x40000000
#define HTTP_QUERY_FLAG_NUMBER 0x20000000
#define HTTP_QUERY_FLAG_COALESCE 0x10000000
#define HTTP_QUERY_MODIFIER_FLAGS_MASK (HTTP_QUERY_FLAG_REQUEST_HEADERS \
| HTTP_QUERY_FLAG_SYSTEMTIME \
| HTTP_QUERY_FLAG_NUMBER \
| HTTP_QUERY_FLAG_COALESCE \
)
#define HTTP_QUERY_HEADER_MASK (~HTTP_QUERY_MODIFIER_FLAGS_MASK)
#define HTTP_STATUS_CONTINUE 100
#define HTTP_STATUS_SWITCH_PROTOCOLS 101
#define HTTP_STATUS_OK 200
#define HTTP_STATUS_CREATED 201
#define HTTP_STATUS_ACCEPTED 202
#define HTTP_STATUS_PARTIAL 203
#define HTTP_STATUS_NO_CONTENT 204
#define HTTP_STATUS_RESET_CONTENT 205
#define HTTP_STATUS_PARTIAL_CONTENT 206
#define HTTP_STATUS_AMBIGUOUS 300
#define HTTP_STATUS_MOVED 301
#define HTTP_STATUS_REDIRECT 302
#define HTTP_STATUS_REDIRECT_METHOD 303
#define HTTP_STATUS_NOT_MODIFIED 304
#define HTTP_STATUS_USE_PROXY 305
#define HTTP_STATUS_REDIRECT_KEEP_VERB 307
#define HTTP_STATUS_BAD_REQUEST 400
#define HTTP_STATUS_DENIED 401
#define HTTP_STATUS_PAYMENT_REQ 402
#define HTTP_STATUS_FORBIDDEN 403
#define HTTP_STATUS_NOT_FOUND 404
#define HTTP_STATUS_BAD_METHOD 405
#define HTTP_STATUS_NONE_ACCEPTABLE 406
#define HTTP_STATUS_PROXY_AUTH_REQ 407
#define HTTP_STATUS_REQUEST_TIMEOUT 408
#define HTTP_STATUS_CONFLICT 409
#define HTTP_STATUS_GONE 410
#define HTTP_STATUS_LENGTH_REQUIRED 411
#define HTTP_STATUS_PRECOND_FAILED 412
#define HTTP_STATUS_REQUEST_TOO_LARGE 413
#define HTTP_STATUS_URI_TOO_LONG 414
#define HTTP_STATUS_UNSUPPORTED_MEDIA 415
#define HTTP_STATUS_SERVER_ERROR 500
#define HTTP_STATUS_NOT_SUPPORTED 501
#define HTTP_STATUS_BAD_GATEWAY 502
#define HTTP_STATUS_SERVICE_UNAVAIL 503
#define HTTP_STATUS_GATEWAY_TIMEOUT 504
#define HTTP_STATUS_VERSION_NOT_SUP 505
#define HTTP_STATUS_FIRST HTTP_STATUS_CONTINUE
#define HTTP_STATUS_LAST HTTP_STATUS_VERSION_NOT_SUP
INTERNETAPI HINTERNET WINAPI HttpOpenRequestA(HINTERNET ,LPCSTR ,LPCSTR ,LPCSTR ,
LPCSTR lpszReferrer ,LPCSTR * ,DWORD ,DWORD);
INTERNETAPI HINTERNET WINAPI HttpOpenRequestW(HINTERNET ,LPCWSTR ,LPCWSTR ,LPCWSTR ,
LPCWSTR lpszReferrer ,LPCWSTR * ,DWORD ,DWORD);
#define HttpOpenRequest WINELIB_NAME_AW(HttpOpenRequest)
BOOLAPI HttpAddRequestHeadersA(HINTERNET ,LPCSTR ,DWORD ,DWORD);
BOOLAPI HttpAddRequestHeadersW(HINTERNET ,LPCWSTR ,DWORD ,DWORD);
#define HttpAddRequestHeaders WINELIB_NAME_AW(HttpAddRequestHeaders)
#define HTTP_ADDREQ_INDEX_MASK 0x0000FFFF
#define HTTP_ADDREQ_FLAGS_MASK 0xFFFF0000
#define HTTP_ADDREQ_FLAG_ADD_IF_NEW 0x10000000
#define HTTP_ADDREQ_FLAG_ADD 0x20000000
#define HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA 0x40000000
#define HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON 0x01000000
#define HTTP_ADDREQ_FLAG_COALESCE HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
#define HTTP_ADDREQ_FLAG_REPLACE 0x80000000
BOOLAPI HttpSendRequestA(HINTERNET ,LPCSTR lpszHeaders ,DWORD ,LPVOID lpOptional ,DWORD);
BOOLAPI HttpSendRequestW(HINTERNET ,LPCWSTR lpszHeaders ,DWORD ,LPVOID lpOptional ,DWORD);
#define HttpSendRequest WINELIB_NAME_AW(HttpSendRequest)
INTERNETAPI BOOL WINAPI HttpSendRequestExA(HINTERNET ,LPINTERNET_BUFFERSA lpBuffersIn ,
LPINTERNET_BUFFERSA lpBuffersOut ,DWORD ,DWORD);
INTERNETAPI BOOL WINAPI HttpSendRequestExW(HINTERNET ,LPINTERNET_BUFFERSW lpBuffersIn ,
LPINTERNET_BUFFERSW lpBuffersOut ,DWORD ,DWORD);
#define HttpSendRequestEx WINELIB_NAME_AW(HttpSendRequestEx)
#define HSR_ASYNC WININET_API_FLAG_ASYNC
#define HSR_SYNC WININET_API_FLAG_SYNC
#define HSR_USE_CONTEXT WININET_API_FLAG_USE_CONTEXT
#define HSR_INITIATE 0x00000008
#define HSR_DOWNLOAD 0x00000010
#define HSR_CHUNKED 0x00000020
INTERNETAPI BOOL WINAPI HttpEndRequestA(HINTERNET ,LPINTERNET_BUFFERSA lpBuffersOut ,DWORD ,DWORD);
INTERNETAPI BOOL WINAPI HttpEndRequestW(HINTERNET ,LPINTERNET_BUFFERSW lpBuffersOut ,DWORD ,DWORD);
#define HttpEndRequest WINELIB_NAME_AW(HttpEndRequest)
BOOLAPI HttpQueryInfoA(HINTERNET ,DWORD ,LPVOID lpBuffer ,LPDWORD ,LPDWORD lpdwIndex);
BOOLAPI HttpQueryInfoW(HINTERNET ,DWORD ,LPVOID lpBuffer ,LPDWORD ,LPDWORD lpdwIndex);
#define HttpQueryInfo WINELIB_NAME_AW(HttpQueryInfo)
BOOLAPI InternetSetCookieA(LPCSTR ,LPCSTR ,LPCSTR);
BOOLAPI InternetSetCookieW(LPCSTR ,LPCWSTR ,LPCWSTR);
#define InternetSetCookie WINELIB_NAME_AW(InternetSetCookie)
BOOLAPI InternetGetCookieA(LPCSTR ,LPCSTR ,LPSTR ,LPDWORD);
BOOLAPI InternetGetCookieW(LPCSTR ,LPCWSTR ,LPWSTR ,LPDWORD);
#define InternetGetCookie WINELIB_NAME_AW(InternetGetCookie)
INTERNETAPI DWORD WINAPI InternetAttemptConnect(DWORD);
BOOLAPI InternetCheckConnectionA(LPCSTR ,DWORD ,DWORD);
BOOLAPI InternetCheckConnectionW(LPCWSTR ,DWORD ,DWORD);
#define InternetCheckConnection WINELIB_NAME_AW(InternetCheckConnection)
#define FLAG_ICC_FORCE_CONNECTION 0x00000001
#define FLAGS_ERROR_UI_FILTER_FOR_ERRORS 0x01
#define FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS 0x02
#define FLAGS_ERROR_UI_FLAGS_GENERATE_DATA 0x04
#define FLAGS_ERROR_UI_FLAGS_NO_UI 0x08
#define FLAGS_ERROR_UI_SERIALIZE_DIALOGS 0x10
DWORD InternetAuthNotifyCallback ( DWORD ,DWORD ,LPVOID );
typedef DWORD (CALLBACK * PFN_AUTH_NOTIFY) (DWORD,DWORD,LPVOID);
typedef struct
{
DWORD cbStruct;
DWORD dwOptions;
PFN_AUTH_NOTIFY pfnNotify;
DWORD dwContext;
}
INTERNET_AUTH_NOTIFY_DATA;
INTERNETAPI DWORD WINAPI InternetErrorDlg(HWND ,HINTERNET ,DWORD ,DWORD ,LPVOID *);
INTERNETAPI DWORD WINAPI InternetConfirmZoneCrossingA(HWND ,LPSTR ,LPSTR ,BOOL);
INTERNETAPI DWORD WINAPI InternetConfirmZoneCrossingW(HWND ,LPWSTR ,LPWSTR ,BOOL);
#define InternetConfirmZoneCrossing WINELIB_NAME_AW(InternetConfirmZoneCrossing)
#define INTERNET_ERROR_BASE 12000
#define ERROR_INTERNET_OUT_OF_HANDLES (INTERNET_ERROR_BASE + 1)
#define ERROR_INTERNET_TIMEOUT (INTERNET_ERROR_BASE + 2)
#define ERROR_INTERNET_EXTENDED_ERROR (INTERNET_ERROR_BASE + 3)
#define ERROR_INTERNET_INTERNAL_ERROR (INTERNET_ERROR_BASE + 4)
#define ERROR_INTERNET_INVALID_URL (INTERNET_ERROR_BASE + 5)
#define ERROR_INTERNET_UNRECOGNIZED_SCHEME (INTERNET_ERROR_BASE + 6)
#define ERROR_INTERNET_NAME_NOT_RESOLVED (INTERNET_ERROR_BASE + 7)
#define ERROR_INTERNET_PROTOCOL_NOT_FOUND (INTERNET_ERROR_BASE + 8)
#define ERROR_INTERNET_INVALID_OPTION (INTERNET_ERROR_BASE + 9)
#define ERROR_INTERNET_BAD_OPTION_LENGTH (INTERNET_ERROR_BASE + 10)
#define ERROR_INTERNET_OPTION_NOT_SETTABLE (INTERNET_ERROR_BASE + 11)
#define ERROR_INTERNET_SHUTDOWN (INTERNET_ERROR_BASE + 12)
#define ERROR_INTERNET_INCORRECT_USER_NAME (INTERNET_ERROR_BASE + 13)
#define ERROR_INTERNET_INCORRECT_PASSWORD (INTERNET_ERROR_BASE + 14)
#define ERROR_INTERNET_LOGIN_FAILURE (INTERNET_ERROR_BASE + 15)
#define ERROR_INTERNET_INVALID_OPERATION (INTERNET_ERROR_BASE + 16)
#define ERROR_INTERNET_OPERATION_CANCELLED (INTERNET_ERROR_BASE + 17)
#define ERROR_INTERNET_INCORRECT_HANDLE_TYPE (INTERNET_ERROR_BASE + 18)
#define ERROR_INTERNET_INCORRECT_HANDLE_STATE (INTERNET_ERROR_BASE + 19)
#define ERROR_INTERNET_NOT_PROXY_REQUEST (INTERNET_ERROR_BASE + 20)
#define ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND (INTERNET_ERROR_BASE + 21)
#define ERROR_INTERNET_BAD_REGISTRY_PARAMETER (INTERNET_ERROR_BASE + 22)
#define ERROR_INTERNET_NO_DIRECT_ACCESS (INTERNET_ERROR_BASE + 23)
#define ERROR_INTERNET_NO_CONTEXT (INTERNET_ERROR_BASE + 24)
#define ERROR_INTERNET_NO_CALLBACK (INTERNET_ERROR_BASE + 25)
#define ERROR_INTERNET_REQUEST_PENDING (INTERNET_ERROR_BASE + 26)
#define ERROR_INTERNET_INCORRECT_FORMAT (INTERNET_ERROR_BASE + 27)
#define ERROR_INTERNET_ITEM_NOT_FOUND (INTERNET_ERROR_BASE + 28)
#define ERROR_INTERNET_CANNOT_CONNECT (INTERNET_ERROR_BASE + 29)
#define ERROR_INTERNET_CONNECTION_ABORTED (INTERNET_ERROR_BASE + 30)
#define ERROR_INTERNET_CONNECTION_RESET (INTERNET_ERROR_BASE + 31)
#define ERROR_INTERNET_FORCE_RETRY (INTERNET_ERROR_BASE + 32)
#define ERROR_INTERNET_INVALID_PROXY_REQUEST (INTERNET_ERROR_BASE + 33)
#define ERROR_INTERNET_NEED_UI (INTERNET_ERROR_BASE + 34)
#define ERROR_INTERNET_HANDLE_EXISTS (INTERNET_ERROR_BASE + 36)
#define ERROR_INTERNET_SEC_CERT_DATE_INVALID (INTERNET_ERROR_BASE + 37)
#define ERROR_INTERNET_SEC_CERT_CN_INVALID (INTERNET_ERROR_BASE + 38)
#define ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR (INTERNET_ERROR_BASE + 39)
#define ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR (INTERNET_ERROR_BASE + 40)
#define ERROR_INTERNET_MIXED_SECURITY (INTERNET_ERROR_BASE + 41)
#define ERROR_INTERNET_CHG_POST_IS_NON_SECURE (INTERNET_ERROR_BASE + 42)
#define ERROR_INTERNET_POST_IS_NON_SECURE (INTERNET_ERROR_BASE + 43)
#define ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED (INTERNET_ERROR_BASE + 44)
#define ERROR_INTERNET_INVALID_CA (INTERNET_ERROR_BASE + 45)
#define ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP (INTERNET_ERROR_BASE + 46)
#define ERROR_INTERNET_ASYNC_THREAD_FAILED (INTERNET_ERROR_BASE + 47)
#define ERROR_INTERNET_REDIRECT_SCHEME_CHANGE (INTERNET_ERROR_BASE + 48)
#define ERROR_INTERNET_DIALOG_PENDING (INTERNET_ERROR_BASE + 49)
#define ERROR_INTERNET_RETRY_DIALOG (INTERNET_ERROR_BASE + 50)
#define ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR (INTERNET_ERROR_BASE + 52)
#define ERROR_INTERNET_INSERT_CDROM (INTERNET_ERROR_BASE + 53)
#define ERROR_FTP_TRANSFER_IN_PROGRESS (INTERNET_ERROR_BASE + 110)
#define ERROR_FTP_DROPPED (INTERNET_ERROR_BASE + 111)
#define ERROR_FTP_NO_PASSIVE_MODE (INTERNET_ERROR_BASE + 112)
#define ERROR_GOPHER_PROTOCOL_ERROR (INTERNET_ERROR_BASE + 130)
#define ERROR_GOPHER_NOT_FILE (INTERNET_ERROR_BASE + 131)
#define ERROR_GOPHER_DATA_ERROR (INTERNET_ERROR_BASE + 132)
#define ERROR_GOPHER_END_OF_DATA (INTERNET_ERROR_BASE + 133)
#define ERROR_GOPHER_INVALID_LOCATOR (INTERNET_ERROR_BASE + 134)
#define ERROR_GOPHER_INCORRECT_LOCATOR_TYPE (INTERNET_ERROR_BASE + 135)
#define ERROR_GOPHER_NOT_GOPHER_PLUS (INTERNET_ERROR_BASE + 136)
#define ERROR_GOPHER_ATTRIBUTE_NOT_FOUND (INTERNET_ERROR_BASE + 137)
#define ERROR_GOPHER_UNKNOWN_LOCATOR (INTERNET_ERROR_BASE + 138)
#define ERROR_HTTP_HEADER_NOT_FOUND (INTERNET_ERROR_BASE + 150)
#define ERROR_HTTP_DOWNLEVEL_SERVER (INTERNET_ERROR_BASE + 151)
#define ERROR_HTTP_INVALID_SERVER_RESPONSE (INTERNET_ERROR_BASE + 152)
#define ERROR_HTTP_INVALID_HEADER (INTERNET_ERROR_BASE + 153)
#define ERROR_HTTP_INVALID_QUERY_REQUEST (INTERNET_ERROR_BASE + 154)
#define ERROR_HTTP_HEADER_ALREADY_EXISTS (INTERNET_ERROR_BASE + 155)
#define ERROR_HTTP_REDIRECT_FAILED (INTERNET_ERROR_BASE + 156)
#define ERROR_HTTP_NOT_REDIRECTED (INTERNET_ERROR_BASE + 160)
#define ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION (INTERNET_ERROR_BASE + 161)
#define ERROR_HTTP_COOKIE_DECLINED (INTERNET_ERROR_BASE + 162)
#define ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION (INTERNET_ERROR_BASE + 168)
#define ERROR_INTERNET_SECURITY_CHANNEL_ERROR (INTERNET_ERROR_BASE + 157)
#define ERROR_INTERNET_UNABLE_TO_CACHE_FILE (INTERNET_ERROR_BASE + 158)
#define ERROR_INTERNET_TCPIP_NOT_INSTALLED (INTERNET_ERROR_BASE + 159)
#define ERROR_INTERNET_DISCONNECTED (INTERNET_ERROR_BASE + 163)
#define ERROR_INTERNET_SERVER_UNREACHABLE (INTERNET_ERROR_BASE + 164)
#define ERROR_INTERNET_PROXY_SERVER_UNREACHABLE (INTERNET_ERROR_BASE + 165)
#define ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT (INTERNET_ERROR_BASE + 166)
#define ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT (INTERNET_ERROR_BASE + 167)
#define ERROR_INTERNET_SEC_INVALID_CERT (INTERNET_ERROR_BASE + 169)
#define ERROR_INTERNET_SEC_CERT_REVOKED (INTERNET_ERROR_BASE + 170)
#define ERROR_INTERNET_FAILED_DUETOSECURITYCHECK (INTERNET_ERROR_BASE + 171)
#define INTERNET_ERROR_LAST ERROR_INTERNET_FAILED_DUETOSECURITYCHECK
#define NORMAL_CACHE_ENTRY 0x00000001
#define COOKIE_CACHE_ENTRY 0x00100000
#define URLHISTORY_CACHE_ENTRY 0x00200000
#define TRACK_OFFLINE_CACHE_ENTRY 0x00000010
#define TRACK_ONLINE_CACHE_ENTRY 0x00000020
#define STICKY_CACHE_ENTRY 0x00000004
#define SPARSE_CACHE_ENTRY 0x00010000
#define URLCACHE_FIND_DEFAULT_FILTER NORMAL_CACHE_ENTRY \
| COOKIE_CACHE_ENTRY \
| URLHISTORY_CACHE_ENTRY \
| TRACK_OFFLINE_CACHE_ENTRY \
| TRACK_ONLINE_CACHE_ENTRY \
| STICKY_CACHE_ENTRY
typedef struct _INTERNET_CACHE_ENTRY_INFOA {
DWORD dwStructSize;
LPSTR lpszSourceUrlName;
LPSTR lpszLocalFileName;
DWORD CacheEntryType;
DWORD dwUseCount;
DWORD dwHitRate;
DWORD dwSizeLow;
DWORD dwSizeHigh;
FILETIME LastModifiedTime;
FILETIME ExpireTime;
FILETIME LastAccessTime;
FILETIME LastSyncTime;
LPBYTE lpHeaderInfo;
DWORD dwHeaderInfoSize;
LPSTR lpszFileExtension;
union {
DWORD dwReserved;
DWORD dwExemptDelta;
} u;
} INTERNET_CACHE_ENTRY_INFOA,* LPINTERNET_CACHE_ENTRY_INFOA;
typedef struct _INTERNET_CACHE_ENTRY_INFOW {
DWORD dwStructSize;
LPWSTR lpszSourceUrlName;
LPWSTR lpszLocalFileName;
DWORD CacheEntryType;
DWORD dwUseCount;
DWORD dwHitRate;
DWORD dwSizeLow;
DWORD dwSizeHigh;
FILETIME LastModifiedTime;
FILETIME ExpireTime;
FILETIME LastAccessTime;
FILETIME LastSyncTime;
LPBYTE lpHeaderInfo;
DWORD dwHeaderInfoSize;
LPWSTR lpszFileExtension;
union {
DWORD dwReserved;
DWORD dwExemptDelta;
} u;
} INTERNET_CACHE_ENTRY_INFOW,* LPINTERNET_CACHE_ENTRY_INFOW;
DECL_WINELIB_TYPE_AW(INTERNET_CACHE_ENTRY_INFO)
DECL_WINELIB_TYPE_AW(LPINTERNET_CACHE_ENTRY_INFO)
BOOLAPI CreateUrlCacheEntryA(LPCSTR ,DWORD ,LPCSTR ,LPSTR ,DWORD);
BOOLAPI CreateUrlCacheEntryW(LPCSTR ,DWORD ,LPCSTR ,LPWSTR ,DWORD);
#define CreateUrlCacheEntry WINELIB_NAME_AW(CreateUrlCacheEntry)
BOOLAPI CommitUrlCacheEntryA(LPCSTR ,LPCSTR ,FILETIME ,FILETIME ,DWORD ,LPBYTE ,DWORD ,LPCSTR ,DWORD);
BOOLAPI CommitUrlCacheEntryW(LPCSTR ,LPCWSTR ,FILETIME ,FILETIME ,DWORD ,LPBYTE ,DWORD ,LPCWSTR ,DWORD);
#define CommitUrlCacheEntry WINELIB_NAME_AW(CommitUrlCacheEntry)
BOOLAPI RetrieveUrlCacheEntryFileA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,DWORD);
BOOLAPI RetrieveUrlCacheEntryFileW(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,DWORD);
#define RetrieveUrlCacheEntryFile WINELIB_NAME_AW(RetrieveUrlCacheEntryFile)
BOOLAPI UnlockUrlCacheEntryFile(LPCSTR ,DWORD);
INTERNETAPI HANDLE WINAPI RetrieveUrlCacheEntryStreamA(LPCSTR ,
LPINTERNET_CACHE_ENTRY_INFOA , LPDWORD ,BOOL ,DWORD);
INTERNETAPI HANDLE WINAPI RetrieveUrlCacheEntryStreamW(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,
LPDWORD ,BOOL ,DWORD);
#define RetrieveUrlCacheEntryStream WINELIB_NAME_AW(RetrieveUrlCacheEntryStream)
BOOLAPI ReadUrlCacheEntryStream( HANDLE ,DWORD ,LPVOID ,LPDWORD ,DWORD );
BOOLAPI UnlockUrlCacheEntryStream( HANDLE ,DWORD );
BOOLAPI GetUrlCacheEntryInfoA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD);
BOOLAPI GetUrlCacheEntryInfoW(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD);
#define GetUrlCacheEntryInfo WINELIB_NAME_AW(GetUrlCacheEntryInfo)
BOOLAPI GetUrlCacheEntryInfoExA(
LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,LPSTR ,LPDWORD ,LPVOID ,DWORD);
BOOLAPI GetUrlCacheEntryInfoExW(
LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,LPWSTR ,LPDWORD ,LPVOID ,DWORD);
#define GetUrlCacheEntryInfoEx WINELIB_NAME_AW(GetUrlCacheEntryInfoEx)
#define CACHE_ENTRY_ATTRIBUTE_FC 0x00000004
#define CACHE_ENTRY_HITRATE_FC 0x00000010
#define CACHE_ENTRY_MODTIME_FC 0x00000040
#define CACHE_ENTRY_EXPTIME_FC 0x00000080
#define CACHE_ENTRY_ACCTIME_FC 0x00000100
#define CACHE_ENTRY_SYNCTIME_FC 0x00000200
#define CACHE_ENTRY_HEADERINFO_FC 0x00000400
#define CACHE_ENTRY_EXEMPT_DELTA_FC 0x00000800
BOOLAPI SetUrlCacheEntryInfoA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,DWORD);
BOOLAPI SetUrlCacheEntryInfoW(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,DWORD);
#define SetUrlCacheEntryInfo WINELIB_NAME_AW(SetUrlCacheEntryInfo)
typedef LONGLONG GROUPID;
INTERNETAPI GROUPID WINAPI CreateUrlCacheGroup(DWORD ,LPVOID);
BOOLAPI DeleteUrlCacheGroup(GROUPID ,DWORD ,LPVOID);
#define INTERNET_CACHE_GROUP_ADD 0
#define INTERNET_CACHE_GROUP_REMOVE 1
BOOLAPI SetUrlCacheEntryGroup(LPCSTR ,DWORD ,GROUPID ,LPBYTE ,DWORD ,LPVOID);
INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryExA(
LPCSTR ,DWORD ,DWORD ,GROUPID ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID );
INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryExW(
LPCSTR ,DWORD ,DWORD ,GROUPID ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID );
#define FindFirstUrlCacheEntryEx WINELIB_NAME_AW(FindFirstUrlCacheEntryEx)
BOOLAPI FindNextUrlCacheEntryExA(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID);
BOOLAPI FindNextUrlCacheEntryExW(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID);
#define FindNextUrlCacheEntryEx WINELIB_NAME_AW(FindNextUrlCacheEntryEx)
INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD);
INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryW(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD);
#define FindFirstUrlCacheEntry WINELIB_NAME_AW(FindFirstUrlCacheEntry)
BOOLAPI FindNextUrlCacheEntryA(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD);
BOOLAPI FindNextUrlCacheEntryW(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD);
#define FindNextUrlCacheEntry WINELIB_NAME_AW(FindNextUrlCacheEntry)
BOOLAPI FindCloseUrlCache(HANDLE);
BOOLAPI DeleteUrlCacheEntry(LPCSTR);
INTERNETAPI DWORD WINAPI InternetDialA(HWND ,LPSTR ,DWORD ,LPDWORD ,DWORD);
INTERNETAPI DWORD WINAPI InternetDialW(HWND ,LPWSTR ,DWORD ,LPDWORD ,DWORD);
#define InternetDial WINELIB_NAME_AW(InternetDial)
#define INTERNET_DIAL_UNATTENDED 0x8000
INTERNETAPI DWORD WINAPI InternetHangUp(DWORD ,DWORD);
#define INTERENT_GOONLINE_REFRESH 0x00000001
#define INTERENT_GOONLINE_MASK 0x00000001
INTERNETAPI BOOL WINAPI InternetGoOnlineA(LPSTR ,HWND ,DWORD);
INTERNETAPI BOOL WINAPI InternetGoOnlineW(LPWSTR ,HWND ,DWORD);
#define InternetGoOnline WINELIB_NAME_AW(InternetGoOnline)
INTERNETAPI BOOL WINAPI InternetAutodial(DWORD ,DWORD);
#define INTERNET_AUTODIAL_FORCE_ONLINE 1
#define INTERNET_AUTODIAL_FORCE_UNATTENDED 2
#define INTERNET_AUTODIAL_FAILIFSECURITYCHECK 4
#define INTERNET_AUTODIAL_FLAGS_MASK (INTERNET_AUTODIAL_FORCE_ONLINE | INTERNET_AUTODIAL_FORCE_UNATTENDED | INTERNET_AUTODIAL_FAILIFSECURITYCHECK)
INTERNETAPI BOOL WINAPI InternetAutodialHangup(DWORD);
INTERNETAPI BOOL WINAPI InternetGetConnectedState(LPDWORD ,DWORD);
#define INTERNET_CONNECTION_MODEM 1
#define INTERNET_CONNECTION_LAN 2
#define INTERNET_CONNECTION_PROXY 4
#define INTERNET_CONNECTION_MODEM_BUSY 8
typedef DWORD (CALLBACK * PFN_DIAL_HANDLER) (HWND,LPCSTR,DWORD,LPDWORD);
#define INTERNET_CUSTOMDIAL_CONNECT 0
#define INTERNET_CUSTOMDIAL_UNATTENDED 1
#define INTERNET_CUSTOMDIAL_DISCONNECT 2
#define INTERNET_CUSTOMDIAL_SHOWOFFLINE 4
#define INTERNET_CUSTOMDIAL_SAFE_FOR_UNATTENDED 1
#define INTERNET_CUSTOMDIAL_WILL_SUPPLY_STATE 2
#define INTERNET_CUSTOMDIAL_CAN_HANGUP 4
INTERNETAPI BOOL WINAPI InternetSetDialStateA(LPCSTR ,DWORD ,DWORD);
INTERNETAPI BOOL WINAPI InternetSetDialStateW(LPCWSTR ,DWORD ,DWORD);
#define InternetSetDialState WINELIB_NAME_AW(InternetSetDialState)
#define INTERNET_DIALSTATE_DISCONNECTED 1
#if defined(__cplusplus)
}
#endif
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment