' ########################################################################################
' Microsoft Windows
' File: WinInet.inc
' Contents: Microsoft Windows Internet Extensions
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_WinInet_PBI)
#DEFINE PBX_WinInet_PBI
%EQUATE `WININET_INC = 1
'#if !defined(_WININET_)
'#include <SpecStrings.h>
'#define _WININET_
#INCLUDE ONCE "Core/Windows.inc"
'/*
' * Set up Structure Packing to be 4 bytes
' * for all wininet structures
' */
'#if defined(_WIN64)
'#include <pshpack8.h>
'#else
'#include <pshpack4.h>
'#endif
'#define BOOLAPI INTERNETAPI_(BOOL)
'//
'// internet types
'//
'typedef LPVOID HINTERNET;
'typedef HINTERNET * LPHINTERNET;
'typedef WORD INTERNET_PORT;
'typedef INTERNET_PORT * LPINTERNET_PORT;
'//
'// Internet APIs
'//
'//
'// manifests
'//
%EQUATE `INTERNET_INVALID_PORT_NUMBER = 0 ' use the protocol-specific default
%EQUATE `INTERNET_DEFAULT_FTP_PORT = 21 ' default for FTP servers
%EQUATE `INTERNET_DEFAULT_GOPHER_PORT = 70 ' " " gopher "
%EQUATE `INTERNET_DEFAULT_HTTP_PORT = 80 ' " " HTTP "
%EQUATE `INTERNET_DEFAULT_HTTPS_PORT = 443 ' " " HTTPS "
%EQUATE `INTERNET_DEFAULT_SOCKS_PORT = 1080 ' default for SOCKS firewall servers.
'//
'// maximum field lengths (arbitrary)
'//
%EQUATE `INTERNET_MAX_HOST_NAME_LENGTH = 256
%EQUATE `INTERNET_MAX_USER_NAME_LENGTH = 128
%EQUATE `INTERNET_MAX_PASSWORD_LENGTH = 128
%EQUATE `INTERNET_MAX_PORT_NUMBER_LENGTH = 5 ' %INTERNET_PORT is unsigned short
%EQUATE `INTERNET_MAX_PORT_NUMBER_VALUE = 65535 ' maximum unsigned short value
%EQUATE `INTERNET_MAX_PATH_LENGTH = 2048
%EQUATE `INTERNET_MAX_SCHEME_LENGTH = 32 ' longest protocol name length
%EQUATE `INTERNET_MAX_URL_LENGTH = (%INTERNET_MAX_SCHEME_LENGTH + 4 ' sizeof("://") + null
 + %INTERNET_MAX_PATH_LENGTH)
'//
'// values returned by InternetQueryOption() with INTERNET_OPTION_KEEP_CONNECTION:
'//
%EQUATE `INTERNET_KEEP_ALIVE_UNKNOWN = &HFFFFFFFF ' ((DWORD)-1)
%EQUATE `INTERNET_KEEP_ALIVE_ENABLED = 1
%EQUATE `INTERNET_KEEP_ALIVE_DISABLED = 0
'//
'// flags returned by InternetQueryOption() with INTERNET_OPTION_REQUEST_FLAGS
'//
%EQUATE `INTERNET_REQFLAG_FROM_CACHE = &H00000001 ' response came from cache
%EQUATE `INTERNET_REQFLAG_ASYNC = &H00000002 ' request was made asynchronously
%EQUATE `INTERNET_REQFLAG_VIA_PROXY = &H00000004 ' request was made via a proxy
%EQUATE `INTERNET_REQFLAG_NO_HEADERS = &H00000008 ' orginal response contained no headers
%EQUATE `INTERNET_REQFLAG_PASSIVE = &H00000010 ' FTP: passive-mode connection
%EQUATE `INTERNET_REQFLAG_CACHE_WRITE_DISABLED = &H00000040 ' HTTPS: this request not cacheable
%EQUATE `INTERNET_REQFLAG_NET_TIMEOUT = &H00000080 ' w/ _FROM_CACHE: net request timed out
'//
'// flags for IDN enable/disable via INTERNET_OPTION_IDN
'//
%EQUATE `INTERNET_FLAG_IDN_DIRECT = &H00000001 ' // IDN enabled for direct connections
%EQUATE `INTERNET_FLAG_IDN_PROXY = &H00000002 ' // IDN enabled for proxy
'//
'// flags common to open functions (not InternetOpen()):
'//
%EQUATE `INTERNET_FLAG_RELOAD = &H80000000 ' retrieve the original item
'//
'// flags for InternetOpenUrl():
'//
%EQUATE `INTERNET_FLAG_RAW_DATA = &H40000000 ' FTP/gopher find: receive the item as raw (structured) data
%EQUATE `INTERNET_FLAG_EXISTING_CONNECT = &H20000000 ' FTP: use existing InternetConnect handle for server if possible
'//
'// flags for InternetOpen():
'//
%EQUATE `INTERNET_FLAG_ASYNC = &H10000000 ' this request is asynchronous (where supported)
'//
'// protocol-specific flags:
'//
%EQUATE `INTERNET_FLAG_PASSIVE = &H08000000 ' used for FTP connections
'//
'// additional cache flags
'//
%EQUATE `INTERNET_FLAG_NO_CACHE_WRITE = &H04000000 ' don't write this item to the cache
%EQUATE `INTERNET_FLAG_DONT_CACHE = %INTERNET_FLAG_NO_CACHE_WRITE
%EQUATE `INTERNET_FLAG_MAKE_PERSISTENT = &H02000000 ' make this item persistent in cache
%EQUATE `INTERNET_FLAG_FROM_CACHE = &H01000000 ' use offline semantics
%EQUATE `INTERNET_FLAG_OFFLINE = %INTERNET_FLAG_FROM_CACHE
'//
'// additional flags
'//
%EQUATE `INTERNET_FLAG_SECURE = &H00800000 ' use PCT/SSL if applicable (HTTP)
%EQUATE `INTERNET_FLAG_KEEP_CONNECTION = &H00400000 ' use keep-alive semantics
%EQUATE `INTERNET_FLAG_NO_AUTO_REDIRECT = &H00200000 ' don't handle redirections automatically
%EQUATE `INTERNET_FLAG_READ_PREFETCH = &H00100000 ' do background read prefetch
%EQUATE `INTERNET_FLAG_NO_COOKIES = &H00080000 ' no automatic cookie handling
%EQUATE `INTERNET_FLAG_NO_AUTH = &H00040000 ' no automatic authentication handling
%EQUATE `INTERNET_FLAG_RESTRICTED_ZONE = &H00020000 ' apply restricted zone policies for cookies, auth
%EQUATE `INTERNET_FLAG_CACHE_IF_NET_FAIL = &H00010000 ' return cache file if net request fails
'//
'// Security Ignore Flags, Allow HttpOpenRequest to overide
'// Secure Channel (SSL/PCT) failures of the following types.
'//
%EQUATE `INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP = &H00008000 ' ex: https:// to http://
%EQUATE `INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS = &H00004000 ' ex: http:// to https://
%EQUATE `INTERNET_FLAG_IGNORE_CERT_DATE_INVALID = &H00002000 ' expired X509 Cert.
%EQUATE `INTERNET_FLAG_IGNORE_CERT_CN_INVALID = &H00001000 ' bad common name in X509 Cert.
'//
'// more caching flags
'//
%EQUATE `INTERNET_FLAG_RESYNCHRONIZE = &H00000800 ' asking wininet to update an item if it is newer
%EQUATE `INTERNET_FLAG_HYPERLINK = &H00000400 ' asking wininet to do hyperlinking semantic which works right for scripts
%EQUATE `INTERNET_FLAG_NO_UI = &H00000200 ' no cookie popup
%EQUATE `INTERNET_FLAG_PRAGMA_NOCACHE = &H00000100 ' asking wininet to add "pragma: no-cache"
%EQUATE `INTERNET_FLAG_CACHE_ASYNC = &H00000080 ' ok to perform lazy cache-write
%EQUATE `INTERNET_FLAG_FORMS_SUBMIT = &H00000040 ' this is a forms submit
%EQUATE `INTERNET_FLAG_FWD_BACK = &H00000020 ' fwd-back button op
%EQUATE `INTERNET_FLAG_NEED_FILE = &H00000010 ' need a file for this request
%EQUATE `INTERNET_FLAG_MUST_CACHE_REQUEST = %INTERNET_FLAG_NEED_FILE
'//
'// flags for FTP
'//
%EQUATE `INTERNET_FLAG_TRANSFER_ASCII = &H00000001 ' %FTP_TRANSFER_TYPE_ASCII
%EQUATE `INTERNET_FLAG_TRANSFER_BINARY = &H00000002 ' %FTP_TRANSFER_TYPE_BINARY
'//
'// flags field masks
'//
%EQUATE `SECURITY_INTERNET_MASK = %INTERNET_FLAG_IGNORE_CERT_CN_INVALID OR %INTERNET_FLAG_IGNORE_CERT_DATE_INVALID OR %INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS OR %INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP
'%SECURITY_IGNORE_ERROR_MASK = %INTERNET_FLAG_IGNORE_CERT_CN_INVALID OR ' %INTERNET_FLAG_IGNORE_CERT_DATE_INVALID OR ' %SECURITY_FLAG_IGNORE_UNKNOWN_CA OR ' %SECURITY_FLAG_IGNORE_REVOCATION
%EQUATE `SECURITY_IGNORE_ERROR_MASK = %INTERNET_FLAG_IGNORE_CERT_CN_INVALID OR %INTERNET_FLAG_IGNORE_CERT_DATE_INVALID OR &H00000100 OR &H00000080
%EQUATE `INTERNET_FLAGS_MASK = %INTERNET_FLAG_RELOAD OR %INTERNET_FLAG_RAW_DATA OR %INTERNET_FLAG_EXISTING_CONNECT OR %INTERNET_FLAG_ASYNC OR %INTERNET_FLAG_PASSIVE OR %INTERNET_FLAG_NO_CACHE_WRITE OR %INTERNET_FLAG_MAKE_PERSISTENT OR %INTERNET_FLAG_FROM_CACHE OR %INTERNET_FLAG_SECURE OR %INTERNET_FLAG_KEEP_CONNECTION OR %INTERNET_FLAG_NO_AUTO_REDIRECT OR %INTERNET_FLAG_READ_PREFETCH OR %INTERNET_FLAG_NO_COOKIES OR %INTERNET_FLAG_NO_AUTH OR %INTERNET_FLAG_CACHE_IF_NET_FAIL OR %SECURITY_INTERNET_MASK OR %INTERNET_FLAG_RESYNCHRONIZE OR %INTERNET_FLAG_HYPERLINK OR %INTERNET_FLAG_NO_UI OR %INTERNET_FLAG_PRAGMA_NOCACHE OR %INTERNET_FLAG_CACHE_ASYNC OR %INTERNET_FLAG_FORMS_SUBMIT OR %INTERNET_FLAG_NEED_FILE OR %INTERNET_FLAG_RESTRICTED_ZONE OR %INTERNET_FLAG_TRANSFER_BINARY OR %INTERNET_FLAG_TRANSFER_ASCII OR %INTERNET_FLAG_FWD_BACK OR &H00000008 ' INTERNET_FLAG_BGUPDATE
%EQUATE `INTERNET_ERROR_MASK_INSERT_CDROM = &H1
%EQUATE `INTERNET_ERROR_MASK_COMBINED_SEC_CERT = &H2
%EQUATE `INTERNET_ERROR_MASK_NEED_MSN_SSPI_PKG = &H4
%EQUATE `INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY = &H8
%EQUATE `INTERNET_OPTIONS_MASK = NOT %INTERNET_FLAGS_MASK
'//
'// common per-API flags (new APIs)
'//
%EQUATE `WININET_API_FLAG_ASYNC = &H00000001 ' force async operation
%EQUATE `WININET_API_FLAG_SYNC = &H00000004 ' force sync operation
%EQUATE `WININET_API_FLAG_USE_CONTEXT = &H00000008 ' use value supplied in dwContext (even if 0)
'//
'// INTERNET_NO_CALLBACK - if this value is presented as the dwContext parameter
'// then no call-backs will be made for that API
'//
%EQUATE `INTERNET_NO_CALLBACK = 0
'//
'// structures/types
'//
'//
'// INTERNET_SCHEME - enumerated URL scheme type
'//
%EQUATE `INTERNET_SCHEME_PARTIAL = -2
%EQUATE `INTERNET_SCHEME_UNKNOWN = -1
%EQUATE `INTERNET_SCHEME_DEFAULT = 0
%EQUATE `INTERNET_SCHEME_FTP = 1
%EQUATE `INTERNET_SCHEME_GOPHER = 2
%EQUATE `INTERNET_SCHEME_HTTP = 3
%EQUATE `INTERNET_SCHEME_HTTPS = 4
%EQUATE `INTERNET_SCHEME_FILE = 5
%EQUATE `INTERNET_SCHEME_NEWS = 6
%EQUATE `INTERNET_SCHEME_MAILTO = 7
%EQUATE `INTERNET_SCHEME_SOCKS = 8
%EQUATE `INTERNET_SCHEME_JAVASCRIPT = 9
%EQUATE `INTERNET_SCHEME_VBSCRIPT = 10
%EQUATE `INTERNET_SCHEME_RES = 11
%EQUATE `INTERNET_SCHEME_FIRST = %INTERNET_SCHEME_FTP
%EQUATE `INTERNET_SCHEME_LAST = %INTERNET_SCHEME_RES
'//
'// INTERNET_ASYNC_RESULT - this structure is returned to the application via
'// the callback with INTERNET_STATUS_REQUEST_COMPLETE. It is not sufficient to
'// just return the result of the async operation. If the API failed then the
'// app cannot call GetLastError() because the thread context will be incorrect.
'// Both the value returned by the async API and any resultant error code are
'// made available. The app need not check dwError if dwResult indicates that
'// the API succeeded (in this case dwError will be ERROR_SUCCESS)
'//
' // Size = 8 bytes
TYPE INTERNET_ASYNC_RESULT DWORD
 dwResult AS DWORD ' DWORD_PTR // the HINTERNET, DWORD, or BOOL return code from an async API
 dwError AS DWORD ' DWORD // the error code if the API failed
END TYPE
'//
'// INTERNET_DIAGNOSTIC_SOCKET_INFO - info about the socket in use
'//
' // Size = 16 bytes
TYPE INTERNET_DIAGNOSTIC_SOCKET_INFO DWORD
 Socket AS DWORD ' DWORD_PTR
 SourcePort AS DWORD
 DestPort AS DWORD
 Flags AS DWORD
END TYPE
'//
'// INTERNET_DIAGNOSTIC_SOCKET_INFO.Flags definitions
'//
%EQUATE `IDSI_FLAG_KEEP_ALIVE = &H00000001 ' // set if from keep-alive pool
%EQUATE `IDSI_FLAG_SECURE = &H00000002 ' // set if secure connection
%EQUATE `IDSI_FLAG_PROXY = &H00000004 ' // set if using proxy
%EQUATE `IDSI_FLAG_TUNNEL = &H00000008 ' // set if tunnelling through proxy
'//
'// INTERNET_PROXY_INFO - structure supplied with INTERNET_OPTION_PROXY to get/
'// set proxy information on a InternetOpen() handle
'//
' // Size = 12 bytes
TYPE INTERNET_PROXY_INFO DWORD
 dwAccessType AS DWORD ' DWORD // dwAccessType - INTERNET_OPEN_TYPE_DIRECT,
 ' INTERNET_OPEN_TYPE_PROXY,
 ' or INTERNET_OPEN_TYPE_PRECONFIG (set only)
 lpszProxy AS ASCIIZ PTR ' LPCTSTR // lpszProxy - proxy server list
 lpszProxyBypass AS ASCIIZ PTR ' LPCTSTR // lpszProxyBypass - proxy bypass list
END TYPE
'//
'// INTERNET_PER_CONN_OPTION_LIST - set per-connection options such as proxy
'// and autoconfig info
'//
'// Set and queried using Internet[Set|Query]Option with
'// INTERNET_OPTION_PER_CONNECTION_OPTION
'//
' // Size = 8 bytes
UNION INTERNET_PER_CONN_OPTIONA_VALUE DWORD
 dwValue AS DWORD ' DWORD // dword value for the option
 pszValue AS ASCIIZ PTR ' LPSTR // pointer to string value for the option
 ftValue AS FILETIME ' FILETIME // file-time value for the option
END UNION
' // Size = 12 bytes
TYPE INTERNET_PER_CONN_OPTIONA DWORD
 dwOption AS DWORD ' DWORD // option to be queried or set
 Value AS INTERNET_PER_CONN_OPTIONA_VALUE
END TYPE
' // Size = 8 bytes
UNION INTERNET_PER_CONN_OPTIONW_VALUE DWORD
 dwValue AS DWORD ' DWORD // dword value for the option
 pszValue AS WSTRINGZ PTR ' LPWSTR // pointer to string value for the option
 ftValue AS FILETIME ' FILETIME // file-time value for the option
END UNION
' // Size = 12 bytes
TYPE INTERNET_PER_CONN_OPTIONW DWORD
 dwOption AS DWORD ' DWORD // option to be queried or set
 Value AS INTERNET_PER_CONN_OPTIONW_VALUE
END TYPE
#IF %DEF(%UNICODE)
 MACRO INTERNET_PER_CONN_OPTION = INTERNET_PER_CONN_OPTIONW
#ELSE
 MACRO INTERNET_PER_CONN_OPTION = INTERNET_PER_CONN_OPTIONA
#ENDIF
' // Size = 20 bytes
TYPE INTERNET_PER_CONN_OPTION_LISTA DWORD
 dwSize AS DWORD ' DWORD // size of the INTERNET_PER_CONN_OPTION_LIST struct
 pszConnection AS ASCIIZ PTR ' LPSTR // connection name to set/query options
 dwOptionCount AS DWORD ' DWORD // number of options to set/query
 dwOptionError AS DWORD ' DWORD // on error, which option failed
 pOptions AS INTERNET_PER_CONN_OPTION PTR ' LPINTERNET_PER_CONN_OPTIONW // array of options to set/query
END TYPE
' // Size = 20 bytes
TYPE INTERNET_PER_CONN_OPTION_LISTW DWORD
 dwSize AS DWORD ' DWORD // size of the INTERNET_PER_CONN_OPTION_LIST struct
 pszConnection AS WSTRINGZ PTR ' LPWSTR // connection name to set/query options
 dwOptionCount AS DWORD ' DWORD // number of options to set/query
 dwOptionError AS DWORD ' DWORD // on error, which option failed
 pOptions AS INTERNET_PER_CONN_OPTIONW PTR ' LPINTERNET_PER_CONN_OPTIONW // array of options to set/query
END TYPE
#IF %DEF(%UNICODE)
 MACRO INTERNET_PER_CONN_OPTION_LIST = INTERNET_PER_CONN_OPTION_LISTW
#ELSE
 MACRO INTERNET_PER_CONN_OPTION_LIST = INTERNET_PER_CONN_OPTION_LISTA
#ENDIF
'//
'// Options used in INTERNET_PER_CONN_OPTON struct
'//
%EQUATE `INTERNET_PER_CONN_FLAGS = 1
%EQUATE `INTERNET_PER_CONN_PROXY_SERVER = 2
%EQUATE `INTERNET_PER_CONN_PROXY_BYPASS = 3
%EQUATE `INTERNET_PER_CONN_AUTOCONFIG_URL = 4
%EQUATE `INTERNET_PER_CONN_AUTODISCOVERY_FLAGS = 5
%EQUATE `INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL = 6
%EQUATE `INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS = 7
%EQUATE `INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME = 8
%EQUATE `INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL = 9
%EQUATE `INTERNET_PER_CONN_FLAGS_UI = 10
'//
'// PER_CONN_FLAGS
'//
%EQUATE `PROXY_TYPE_DIRECT = &H00000001 ' direct to net
%EQUATE `PROXY_TYPE_PROXY = &H00000002 ' via named proxy
%EQUATE `PROXY_TYPE_AUTO_PROXY_URL = &H00000004 ' autoproxy URL
%EQUATE `PROXY_TYPE_AUTO_DETECT = &H00000008 ' use autoproxy detection
'//
'// PER_CONN_AUTODISCOVERY_FLAGS
'//
%EQUATE `AUTO_PROXY_FLAG_USER_SET = &H00000001 ' user changed this setting
%EQUATE `AUTO_PROXY_FLAG_ALWAYS_DETECT = &H00000002 ' force detection even when its not needed
%EQUATE `AUTO_PROXY_FLAG_DETECTION_RUN = &H00000004 ' detection has been run
%EQUATE `AUTO_PROXY_FLAG_MIGRATED = &H00000008 ' migration has just been done
%EQUATE `AUTO_PROXY_FLAG_DONT_CACHE_PROXY_RESULT = &H00000010 ' don't cache result of host=proxy name
%EQUATE `AUTO_PROXY_FLAG_CACHE_INIT_RUN = &H00000020 ' don't initalize and run unless URL expired
%EQUATE `AUTO_PROXY_FLAG_DETECTION_SUSPECT = &H00000040 ' if we're on a LAN & Modem, with only one IP, bad?!?
'//
'// INTERNET_VERSION_INFO - version information returned via
'// InternetQueryOption(..., INTERNET_OPTION_VERSION, ...)
'//
' // Size = 8 bytes
TYPE INTERNET_VERSION_INFO DWORD
 dwMajorVersion AS DWORD
 dwMinorVersion AS DWORD
END TYPE
'//
'// HTTP_VERSION_INFO - query or set global HTTP version (1.0 or 1.1)
'//
' // Size = 8 bytes
TYPE HTTP_VERSION_INFO DWORD
 dwMajorVersion AS DWORD
 dwMinorVersion AS DWORD
END TYPE
'//
'// INTERNET_CONNECTED_INFO - information used to set the global connected state
'//
' // Size = 8 bytes
TYPE INTERNET_CONNECTED_INFO DWORD
 dwConnectedState AS DWORD
 dwFlags AS DWORD
END TYPE
'//
'// flags for INTERNET_CONNECTED_INFO dwFlags
'//
'//
'// ISO_FORCE_DISCONNECTED - if set when putting Wininet into disconnected mode,
'// all outstanding requests will be aborted with a cancelled error
'//
%EQUATE `ISO_FORCE_DISCONNECTED = &H00000001
'//
'// URL_COMPONENTS - the constituent parts of an URL. Used in InternetCrackUrl()
'// and InternetCreateUrl()
'//
'// For InternetCrackUrl(), if a pointer field and its corresponding length field
'// are both 0 then that component is not returned. If the pointer field is NULL
'// but the length field is not zero, then both the pointer and length fields are
'// returned if both pointer and corresponding length fields are non-zero then
'// the pointer field points to a buffer where the component is copied. The
'// component may be un-escaped, depending on dwFlags
'//
'// For InternetCreateUrl(), the pointer fields should be NULL if the component
'// is not required. If the corresponding length field is zero then the pointer
'// field is the address of a zero-terminated string. If the length field is not
'// zero then it is the string length of the corresponding pointer field
'//
'#pragma warning( disable : 4121 ) // disable alignment warning
' // Size = 60 bytes
TYPE URL_COMPONENTSA DWORD
 dwStructSize AS DWORD ' DWORD // size of this structure. Used in version check
 lpszScheme AS ASCIIZ PTR ' LPSTR // pointer to scheme name
 dwSchemeLength AS DWORD ' DWORD // length of scheme name
 nScheme AS LONG ' INTERNET_SCHEME // enumerated scheme type (if known)
 lpszHostName AS ASCIIZ PTR ' LPSTR // pointer to host name
 dwHostNameLength AS DWORD ' DWORD // length of host name
 nPort AS WORD ' INTERNET_PORT // converted port number
 lpszUserName AS ASCIIZ PTR ' LPSTR // pointer to user name
 dwUserNameLength AS DWORD ' DWORD // length of user name
 lpszPassword AS ASCIIZ PTR ' LPSTR // pointer to password
 dwPasswordLength AS DWORD ' DWORD // length of password
 lpszUrlPath AS ASCIIZ PTR ' LPSTR // pointer to URL-path
 dwUrlPathLength AS DWORD ' DWORD // length of URL-path
 lpszExtraInfo AS ASCIIZ PTR ' LPSTR // pointer to extra information (e.g. ?foo or #foo)
 dwExtraInfoLength AS DWORD ' DWORD // length of extra information
END TYPE
' NOTE: The unicode version of this structure is also defined in winhhtp.inc
#IF NOT %DEF(%URL_COMPONENTSW_DEFINED)
%EQUATE `URL_COMPONENTSW_DEFINED = 1
' // Size = 60 bytes
TYPE URL_COMPONENTSW DWORD
 dwStructSize AS DWORD ' DWORD // size of this structure. Used in version check
 lpszScheme AS WSTRINGZ PTR ' LPWSTR // pointer to scheme name
 dwSchemeLength AS DWORD ' DWORD // length of scheme name
 nScheme AS LONG ' INTERNET_SCHEME // enumerated scheme type (if known)
 lpszHostName AS WSTRINGZ PTR ' LPWSTR // pointer to host name
 dwHostNameLength AS DWORD ' DWORD // length of host name
 nPort AS WORD ' INTERNET_PORT // converted port number
 lpszUserName AS WSTRINGZ PTR ' LPWSTR // pointer to user name
 dwUserNameLength AS DWORD ' DWORD // length of user name
 lpszPassword AS WSTRINGZ PTR ' LPWSTR // pointer to password
 dwPasswordLength AS DWORD ' DWORD // length of password
 lpszUrlPath AS WSTRINGZ PTR ' LPWSTR // pointer to URL-path
 dwUrlPathLength AS DWORD ' DWORD // length of URL-path
 lpszExtraInfo AS WSTRINGZ PTR ' LPWSTR // pointer to extra information (e.g. ?foo or #foo) (UnicodeZ string)
 dwExtraInfoLength AS DWORD ' DWORD // length of extra information
END TYPE
#ENDIF
#IF %DEF(%UNICODE)
 MACRO URL_COMPONENTS = URL_COMPONENTSW
#ELSE
 MACRO URL_COMPONENTS = URL_COMPONENTSA
#ENDIF
'#pragma warning( default : 4121 ) // restore alignment warning
'//
'// INTERNET_CERTIFICATE_INFO lpBuffer - contains the certificate returned from
'// the server
'//
' // Size = 40 bytes
TYPE INTERNET_CERTIFICATE_INFO DWORD
 ftExpiry AS FILETIME ' FILETIME
 ftStart AS FILETIME ' FILETIME
 lpszSubjectInfo AS ASCIIZ PTR
 lpszIssuerInfo AS ASCIIZ PTR
 lpszProtocolName AS ASCIIZ PTR
 lpszSignatureAlgName AS ASCIIZ PTR
 lpszEncryptionAlgName AS ASCIIZ PTR
 dwKeySize AS DWORD
END TYPE
'//
'// INTERNET_BUFFERS - combines headers and data. May be chained for e.g. file
'// upload or scatter/gather operations. For chunked read/write, lpcszHeader
'// contains the chunked-ext
'//
' // Size = 40 bytes
TYPE INTERNET_BUFFERSA DWORD
 dwStructSize AS DWORD ' DWORD // used for API versioning. Set to sizeof(INTERNET_BUFFERS)
 pNext AS INTERNET_BUFFERSA PTR ' struct _INTERNET_BUFFERSA // chain of buffers
 lpcszHeader AS ASCIIZ PTR ' LPCSTR // pointer to headers (may be NULL)
 dwHeadersLength AS DWORD ' DWORD // length of headers if not NULL
 dwHeadersTotal AS DWORD ' DWORD // size of headers if not enough buffer
 lpvBuffer AS BYTE PTR ' LPVOID // pointer to data buffer (may be NULL)
 dwBufferLength AS DWORD ' DWORD // length of data buffer if not NULL
 dwBufferTotal AS DWORD ' DWORD // total size of chunk, or content-length if not chunked
 dwOffsetLow AS DWORD ' DWORD // used for read-ranges (only used in HttpSendRequest2)
 dwOffsetHigh AS DWORD
END TYPE
' // Size = 40 bytes
TYPE INTERNET_BUFFERSW DWORD
 dwStructSize AS DWORD ' DWORD // used for API versioning. Set to sizeof(INTERNET_BUFFERS)
 pNext AS INTERNET_BUFFERSW PTR ' struct _INTERNET_BUFFERSW // chain of buffers
 lpcszHeader AS WSTRINGZ PTR ' LPCWSTR // pointer to headers (may be NULL)
 dwHeadersLength AS DWORD ' DWORD // length of headers if not NULL
 dwHeadersTotal AS DWORD ' DWORD // size of headers if not enough buffer
 lpvBuffer AS BYTE PTR ' LPVOID // pointer to data buffer (may be NULL)
 dwBufferLength AS DWORD ' DWORD // length of data buffer if not NULL
 dwBufferTotal AS DWORD ' DWORD // total size of chunk, or content-length if not chunked
 dwOffsetLow AS DWORD ' DWORD // used for read-ranges (only used in HttpSendRequest2)
 dwOffsetHigh AS DWORD
END TYPE
#IF %DEF(%UNICODE)
 MACRO INTERNET_BUFFERS = INTERNET_BUFFERSW
#ELSE
 MACRO INTERNET_BUFFERS = INTERNET_BUFFERSA
#ENDIF
'//
'// prototypes
'//
DECLARE FUNCTION InternetTimeFromSystemTimeA LIB "wininet.dll" ALIAS "InternetTimeFromSystemTimeA" ( BYREF pst AS SYSTEMTIME , BYVAL dwRFC AS QUAD , BYREF lpszTime AS ASCIIZ , BYVAL cbTime AS QUAD ) AS LONG
DECLARE FUNCTION InternetTimeFromSystemTimeW LIB "wininet.dll" ALIAS "InternetTimeFromSystemTimeW" ( BYREF pst AS SYSTEMTIME
 , BYVAL dwRFC AS DWORD
 , BYREF lpszTime AS WSTRINGZ
 , BYVAL cbTime AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetTimeFromSystemTime = InternetTimeFromSystemTimeW
#ELSE
 MACRO InternetTimeFromSystemTime = InternetTimeFromSystemTimeA
#ENDIF
'//
'// constants for InternetTimeFromSystemTime
'//
%EQUATE `INTERNET_RFC1123_FORMAT = 0
%EQUATE `INTERNET_RFC1123_BUFSIZE = 30
DECLARE FUNCTION InternetTimeToSystemTimeA LIB "wininet.dll" ALIAS "InternetTimeToSystemTimeA" ( BYREF lpszTime AS ASCIIZ , BYREF pst AS SYSTEMTIME , BYVAL dwReserved AS QUAD ) AS LONG
DECLARE FUNCTION InternetTimeToSystemTimeW LIB "wininet.dll" ALIAS "InternetTimeToSystemTimeW" ( BYREF lpszTime AS WSTRINGZ
 , BYREF pst AS SYSTEMTIME
 , BYVAL dwReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetTimeToSystemTime = InternetTimeToSystemTimeW
#ELSE
 MACRO InternetTimeToSystemTime = InternetTimeToSystemTimeA
#ENDIF
DECLARE FUNCTION InternetCrackUrlA LIB "wininet.dll" ALIAS "InternetCrackUrlA" ( BYREF lpszUrl AS ASCIIZ , BYVAL dwUrlLength AS QUAD , BYVAL dwFlags AS QUAD , BYREF lpUrlComponents AS URL_COMPONENTSA ) AS LONG
DECLARE FUNCTION InternetCrackUrlW LIB "wininet.dll" ALIAS "InternetCrackUrlW" ( BYREF lpszUrl AS WSTRINGZ
 , BYVAL dwUrlLength AS DWORD
 , BYVAL dwFlags AS DWORD
 , BYREF lpUrlComponents AS URL_COMPONENTSW
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetCrackUrl = InternetCrackUrlW
#ELSE
 MACRO InternetCrackUrl = InternetCrackUrlA
#ENDIF
DECLARE FUNCTION InternetCreateUrlA LIB "wininet.dll" ALIAS "InternetCreateUrlA" ( BYREF lpUrlComponents AS URL_COMPONENTSA , BYVAL dwFlags AS QUAD , BYREF lpszUrl AS ASCIIZ , BYREF lpdwUrlLength AS QUAD ) AS LONG
DECLARE FUNCTION InternetCreateUrlW LIB "wininet.dll" ALIAS "InternetCreateUrlW" ( BYREF lpUrlComponents AS URL_COMPONENTSW
 , BYVAL dwFlags AS DWORD
 , BYREF lpszUrl AS WSTRINGZ
 , BYREF lpdwUrlLength AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetCreateUrl = InternetCreateUrlW
#ELSE
 MACRO InternetCreateUrl = InternetCreateUrlA
#ENDIF
DECLARE FUNCTION InternetCanonicalizeUrlA LIB "wininet.dll" ALIAS "InternetCanonicalizeUrlA" ( BYREF lpszUrl AS ASCIIZ , BYREF lpszBuffer AS ASCIIZ , BYREF lpdwBufferLength AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION InternetCanonicalizeUrlW LIB "wininet.dll" ALIAS "InternetCanonicalizeUrlW" ( BYREF lpszUrl AS WSTRINGZ
 , BYREF lpszBuffer AS WSTRINGZ
 , BYREF lpdwBufferLength AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetCanonicalizeUrl = InternetCanonicalizeUrlW
#ELSE
 MACRO InternetCanonicalizeUrl = InternetCanonicalizeUrlA
#ENDIF
DECLARE FUNCTION InternetCombineUrlA LIB "wininet.dll" ALIAS "InternetCombineUrlA" ( BYREF lpszBaseUrl AS ASCIIZ , BYREF lpszRelativeUrl AS ASCIIZ , BYREF lpszBuffer AS ASCIIZ , BYREF lpdwBufferLength AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION InternetCombineUrlW LIB "wininet.dll" ALIAS "InternetCombineUrlW" ( BYREF lpszBaseUrl AS WSTRINGZ
 , BYREF lpszRelativeUrl AS WSTRINGZ
 , BYREF lpszBuffer AS WSTRINGZ
 , BYREF lpdwBufferLength AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetCombineUrl = InternetCombineUrlW
#ELSE
 MACRO InternetCombineUrl = InternetCombineUrlA
#ENDIF
'//
'// flags for InternetCrackUrl() and InternetCreateUrl()
'//
%EQUATE `ICU_ESCAPE = &H80000000 ' (un)escape URL characters
%EQUATE `ICU_USERNAME = &H40000000 ' use internal username & password
'//
'// flags for InternetCanonicalizeUrl() and InternetCombineUrl()
'//
%EQUATE `ICU_NO_ENCODE = &H20000000 ' Don't convert unsafe characters to escape sequence
%EQUATE `ICU_DECODE = &H10000000 ' Convert %XX escape sequences to characters
%EQUATE `ICU_NO_META = &H08000000 ' Don't convert .. etc. meta path sequences
%EQUATE `ICU_ENCODE_SPACES_ONLY = &H04000000 ' Encode spaces only
%EQUATE `ICU_BROWSER_MODE = &H02000000 ' Special encode/decode rules for browser
%EQUATE `ICU_ENCODE_PERCENT = &H00001000 ' Encode any percent (ASCII &H25) signs
 ' (default is to not encode percent).
DECLARE FUNCTION InternetOpenA LIB "wininet.dll" ALIAS "InternetOpenA" ( BYREF lpszAgent AS ASCIIZ , BYVAL dwAccessType AS QUAD , BYREF lpszProxy AS ASCIIZ , BYREF lpszProxyBypass AS ASCIIZ , BYVAL dwFlags AS QUAD ) AS QUAD ' HINTERNET
DECLARE FUNCTION InternetOpenW LIB "wininet.dll" ALIAS "InternetOpenW" ( BYREF lpszAgent AS WSTRINGZ , BYVAL dwAccessType AS QUAD , BYREF lpszProxy AS WSTRINGZ , BYREF lpszProxyBypass AS WSTRINGZ , BYVAL dwFlags AS QUAD ) AS QUAD ' HINTERNET
#IF %DEF(%UNICODE)
 MACRO InternetOpen = InternetOpenW
#ELSE
 MACRO InternetOpen = InternetOpenA
#ENDIF
'//
'// access types for InternetOpen()
'//
%EQUATE `INTERNET_OPEN_TYPE_PRECONFIG = 0 ' use registry configuration
%EQUATE `INTERNET_OPEN_TYPE_DIRECT = 1 ' direct to net
%EQUATE `INTERNET_OPEN_TYPE_PROXY = 3 ' via named proxy
%EQUATE `INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4 ' prevent using java/script/INS
'//
'// old names for access types
'//
%EQUATE `PRE_CONFIG_INTERNET_ACCESS = %INTERNET_OPEN_TYPE_PRECONFIG
%EQUATE `LOCAL_INTERNET_ACCESS = %INTERNET_OPEN_TYPE_DIRECT
%EQUATE `CERN_PROXY_INTERNET_ACCESS = %INTERNET_OPEN_TYPE_PROXY
DECLARE FUNCTION InternetCloseHandle LIB "wininet.dll" ALIAS "InternetCloseHandle" ( BYVAL hInternet AS QUAD ) AS LONG
DECLARE FUNCTION InternetConnectA LIB "wininet.dll" ALIAS "InternetConnectA" ( BYVAL hInternet AS QUAD
 , BYREF lpszServerName AS ASCIIZ
 , BYVAL nServerPort AS WORD
 , BYREF lpszUserName AS ASCIIZ
 , BYREF lpszPassword AS ASCIIZ
 , BYVAL dwService AS DWORD
 , BYVAL dwFlags AS DWORD
 , OPTIONAL BYVAL dwContext AS DWORD
 ) AS DWORD ' HINTERNET
DECLARE FUNCTION InternetConnectW LIB "wininet.dll" ALIAS "InternetConnectW" ( BYVAL hInternet AS QUAD , BYREF lpszServerName AS WSTRINGZ , BYVAL nServerPort AS WORD , BYREF lpszUserName AS WSTRINGZ , BYREF lpszPassword AS WSTRINGZ , BYVAL dwService AS QUAD , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
#IF %DEF(%UNICODE)
 MACRO InternetConnect = InternetConnectW
#ELSE
 MACRO InternetConnect = InternetConnectA
#ENDIF
'//
'// service types for InternetConnect()
'//
%EQUATE `INTERNET_SERVICE_URL = 0 ' not listed in current wininet.h
%EQUATE `INTERNET_SERVICE_FTP = 1
%EQUATE `INTERNET_SERVICE_GOPHER = 2
%EQUATE `INTERNET_SERVICE_HTTP = 3
DECLARE FUNCTION InternetOpenUrlA LIB "wininet.dll" ALIAS "InternetOpenUrlA" ( BYVAL hInternet AS QUAD , BYREF lpszUrl AS ASCIIZ , BYREF lpszHeaders AS ASCIIZ , BYVAL dwHeadersLength AS QUAD , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
DECLARE FUNCTION InternetOpenUrlW LIB "wininet.dll" ALIAS "InternetOpenUrlW" ( BYVAL hInternet AS QUAD , BYREF lpszUrl AS WSTRINGZ , BYREF lpszHeaders AS WSTRINGZ , BYVAL dwHeadersLength AS QUAD , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
#IF %DEF(%UNICODE)
 MACRO InternetOpenUrl = InternetOpenUrlW
#ELSE
 MACRO InternetOpenUrl = InternetOpenUrlA
#ENDIF
DECLARE FUNCTION InternetReadFile LIB "wininet.dll" ALIAS "InternetReadFile" ( BYVAL hFile AS QUAD , BYVAL lpBuffer AS BYTE PTR , BYVAL dwNumberOfBytesToRead AS QUAD , BYREF lpdwNumberOfBytesRead AS QUAD ) AS LONG
DECLARE FUNCTION InternetReadFileExA LIB "wininet.dll" ALIAS "InternetReadFileExA" ( BYVAL hFile AS QUAD
 , BYREF lpBuffersOut AS INTERNET_BUFFERSA
 , BYVAL dwFlags AS DWORD
 , OPTIONAL BYVAL dwContext AS DWORD
 ) AS LONG
DECLARE FUNCTION InternetReadFileExW LIB "wininet.dll" ALIAS "InternetReadFileExW" ( BYVAL hFile AS DWORD
 , BYREF lpBuffersOut AS INTERNET_BUFFERSW
 , BYVAL dwFlags AS DWORD
 , OPTIONAL BYVAL dwContext AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetReadFileEx = InternetReadFileExW
#ELSE
 MACRO InternetReadFileEx = InternetReadFileExA
#ENDIF
'//
'// flags for InternetReadFileEx()
'//
%EQUATE `IRF_ASYNC = %WININET_API_FLAG_ASYNC
%EQUATE `IRF_SYNC = %WININET_API_FLAG_SYNC
%EQUATE `IRF_USE_CONTEXT = %WININET_API_FLAG_USE_CONTEXT
%EQUATE `IRF_NO_WAIT = &H00000008
DECLARE FUNCTION InternetSetFilePointer LIB "wininet.dll" ALIAS "InternetSetFilePointer" ( BYVAL hFile AS QUAD , BYVAL lDistanceToMove AS LONG , BYREF lpDistanceToMoveHigh AS LONG , BYVAL dwMoveMethod AS QUAD , BYVAL dwContext AS QUAD ) AS QUAD
DECLARE FUNCTION InternetWriteFile LIB "wininet.dll" ALIAS "InternetWriteFile" ( BYVAL hFile AS QUAD
 , BYVAL lpBuffer AS DWORD
 , BYVAL dwNumberOfBytesToWrite AS DWORD
 , BYREF lpdwNumberOfBytesWritten AS DWORD
 ) AS LONG
DECLARE FUNCTION InternetQueryDataAvailable LIB "wininet.dll" ALIAS "InternetQueryDataAvailable" ( BYVAL hFile AS DWORD
 , BYREF lpdwNumberOfBytesAvailable AS DWORD
 , BYVAL dwFlags AS DWORD
 , OPTIONAL BYVAL dwContext AS DWORD
 ) AS LONG
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION InternetFindNextFileA LIB "WinINet.dll" ALIAS "InternetFindNextFileA" ( BYVAL hFind AS QUAD, ' in
 BYVAL lpvFindData AS BYTE PTR ' out
 ) AS LONG
#ELSE
DECLARE FUNCTION InternetFindNextFileA LIB "wininet.dll" ALIAS "InternetFindNextFileA" ( BYVAL hFind AS QUAD , BYREF lpvFindData AS ANY ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION InternetFindNextFileW LIB "WinINet.dll" ALIAS "InternetFindNextFileW" ( BYVAL hFind AS QUAD, ' in
 BYVAL lpvFindData AS BYTE PTR ' out
 ) AS LONG
#ELSE
DECLARE FUNCTION InternetFindNextFileW LIB "wininet.dll" ALIAS "InternetFindNextFileW" ( BYVAL hFind AS QUAD , BYREF lpvFindData AS ANY ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO InternetFindNextFile = InternetFindNextFileW
#ELSE
 MACRO InternetFindNextFile = InternetFindNextFileA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION InternetQueryOptionA LIB "WinINet.dll" ALIAS "InternetQueryOptionA" ( BYVAL hInternet AS QUAD, ' in
 BYVAL dwOption AS DWORD, ' in
 BYVAL lpBuffer AS BYTE PTR, ' out
 lpdwBufferLength AS DWORD ' in, out
 ) AS LONG
#ELSE
DECLARE FUNCTION InternetQueryOptionA LIB "wininet.dll" ALIAS "InternetQueryOptionA" ( BYVAL hInternet AS QUAD , BYVAL dwOption AS QUAD , BYREF lpBuffer AS ANY , BYREF lpdwBufferLength AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION InternetQueryOptionW LIB "WinINet.dll" ALIAS "InternetQueryOptionW" ( BYVAL hInternet AS QUAD, ' in
 BYVAL dwOption AS DWORD, ' in
 BYVAL lpBuffer AS BYTE PTR, ' out
 lpdwBufferLength AS DWORD ' in, out
 ) AS LONG
#ELSE
DECLARE FUNCTION InternetQueryOptionW LIB "wininet.dll" ALIAS "InternetQueryOptionW" ( BYVAL hInternet AS QUAD , BYVAL dwOption AS QUAD , BYREF lpBuffer AS ANY , BYREF lpdwBufferLength AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO InternetQueryOption = InternetQueryOptionW
#ELSE
 MACRO InternetQueryOption = InternetQueryOptionA
#ENDIF
DECLARE FUNCTION InternetSetOptionA LIB "wininet.dll" ALIAS "InternetSetOptionA" ( BYVAL hInternet AS QUAD , BYVAL dwOption AS QUAD , BYVAL lpBuffer AS QUAD , BYVAL dwBufferLength AS QUAD ) AS LONG
DECLARE FUNCTION InternetSetOptionW LIB "wininet.dll" ALIAS "InternetSetOptionW" ( BYVAL hInternet AS QUAD
 , BYVAL dwOption AS DWORD
 , BYVAL lpBuffer AS DWORD
 , BYVAL dwBufferLength AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetSetOption = InternetSetOptionW
#ELSE
 MACRO InternetSetOption = InternetSetOptionA
#ENDIF
DECLARE FUNCTION InternetSetOptionExA LIB "wininet.dll" ALIAS "InternetSetOptionExA" ( BYVAL hInternet AS QUAD , BYVAL dwOption AS QUAD , BYVAL lpBuffer AS QUAD , BYVAL dwBufferLength AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION InternetSetOptionExW LIB "wininet.dll" ALIAS "InternetSetOptionExW" ( BYVAL hInternet AS QUAD
 , BYVAL dwOption AS DWORD
 , BYVAL lpBuffer AS DWORD
 , BYVAL dwBufferLength AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetSetOptionEx = InternetSetOptionExW
#ELSE
 MACRO InternetSetOptionEx = InternetSetOptionExA
#ENDIF
DECLARE FUNCTION InternetLockRequestFile LIB "wininet.dll" ALIAS "InternetLockRequestFile" ( BYVAL hInternet AS LONG , BYREF lphLockRequestInfo AS QUAD ) AS LONG
DECLARE FUNCTION InternetUnlockRequestFile LIB "wininet.dll" ALIAS "InternetUnlockRequestFile" ( BYVAL hLockRequestInfo AS QUAD
 ) AS LONG
'//
'// flags for InternetSetOptionEx()
'//
%EQUATE `ISO_GLOBAL = &H00000001 ' modify option globally
%EQUATE `ISO_REGISTRY = &H00000002 ' write option to registry (where applicable)
%EQUATE `ISO_VALID_FLAGS = %ISO_GLOBAL OR %ISO_REGISTRY
'//
'// options manifests for Internet{Query|Set}Option
'//
%EQUATE `INTERNET_OPTION_CALLBACK = 1
%EQUATE `INTERNET_OPTION_CONNECT_TIMEOUT = 2
%EQUATE `INTERNET_OPTION_CONNECT_RETRIES = 3
%EQUATE `INTERNET_OPTION_CONNECT_BACKOFF = 4
%EQUATE `INTERNET_OPTION_SEND_TIMEOUT = 5
%EQUATE `INTERNET_OPTION_CONTROL_SEND_TIMEOUT = %INTERNET_OPTION_SEND_TIMEOUT
%EQUATE `INTERNET_OPTION_RECEIVE_TIMEOUT = 6
%EQUATE `INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT = %INTERNET_OPTION_RECEIVE_TIMEOUT
%EQUATE `INTERNET_OPTION_DATA_SEND_TIMEOUT = 7
%EQUATE `INTERNET_OPTION_DATA_RECEIVE_TIMEOUT = 8
%EQUATE `INTERNET_OPTION_HANDLE_TYPE = 9
%EQUATE `INTERNET_OPTION_LISTEN_TIMEOUT = 11
%EQUATE `INTERNET_OPTION_READ_BUFFER_SIZE = 12
%EQUATE `INTERNET_OPTION_WRITE_BUFFER_SIZE = 13
%EQUATE `INTERNET_OPTION_ASYNC_ID = 15
%EQUATE `INTERNET_OPTION_ASYNC_PRIORITY = 16
%EQUATE `INTERNET_OPTION_PARENT_HANDLE = 21
%EQUATE `INTERNET_OPTION_KEEP_CONNECTION = 22
%EQUATE `INTERNET_OPTION_REQUEST_FLAGS = 23
%EQUATE `INTERNET_OPTION_EXTENDED_ERROR = 24
%EQUATE `INTERNET_OPTION_OFFLINE_MODE = 26
%EQUATE `INTERNET_OPTION_CACHE_STREAM_HANDLE = 27
%EQUATE `INTERNET_OPTION_USERNAME = 28
%EQUATE `INTERNET_OPTION_PASSWORD = 29
%EQUATE `INTERNET_OPTION_ASYNC = 30
%EQUATE `INTERNET_OPTION_SECURITY_FLAGS = 31
%EQUATE `INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT = 32
%EQUATE `INTERNET_OPTION_DATAFILE_NAME = 33
%EQUATE `INTERNET_OPTION_URL = 34
%EQUATE `INTERNET_OPTION_SECURITY_CERTIFICATE = 35
%EQUATE `INTERNET_OPTION_SECURITY_KEY_BITNESS = 36
%EQUATE `INTERNET_OPTION_REFRESH = 37
%EQUATE `INTERNET_OPTION_PROXY = 38
%EQUATE `INTERNET_OPTION_SETTINGS_CHANGED = 39
%EQUATE `INTERNET_OPTION_VERSION = 40
%EQUATE `INTERNET_OPTION_USER_AGENT = 41
%EQUATE `INTERNET_OPTION_END_BROWSER_SESSION = 42
%EQUATE `INTERNET_OPTION_PROXY_USERNAME = 43
%EQUATE `INTERNET_OPTION_PROXY_PASSWORD = 44
%EQUATE `INTERNET_OPTION_CONTEXT_VALUE = 45
%EQUATE `INTERNET_OPTION_CONNECT_LIMIT = 46
%EQUATE `INTERNET_OPTION_SECURITY_SELECT_CLIENT_CERT = 47
%EQUATE `INTERNET_OPTION_POLICY = 48
%EQUATE `INTERNET_OPTION_DISCONNECTED_TIMEOUT = 49
%EQUATE `INTERNET_OPTION_CONNECTED_STATE = 50
%EQUATE `INTERNET_OPTION_IDLE_STATE = 51
%EQUATE `INTERNET_OPTION_OFFLINE_SEMANTICS = 52
%EQUATE `INTERNET_OPTION_SECONDARY_CACHE_KEY = 53
%EQUATE `INTERNET_OPTION_CALLBACK_FILTER = 54
%EQUATE `INTERNET_OPTION_CONNECT_TIME = 55
%EQUATE `INTERNET_OPTION_SEND_THROUGHPUT = 56
%EQUATE `INTERNET_OPTION_RECEIVE_THROUGHPUT = 57
%EQUATE `INTERNET_OPTION_REQUEST_PRIORITY = 58
%EQUATE `INTERNET_OPTION_HTTP_VERSION = 59
%EQUATE `INTERNET_OPTION_RESET_URLCACHE_SESSION = 60
%EQUATE `INTERNET_OPTION_ERROR_MASK = 62
%EQUATE `INTERNET_OPTION_FROM_CACHE_TIMEOUT = 63
%EQUATE `INTERNET_OPTION_BYPASS_EDITED_ENTRY = 64
%EQUATE `INTERNET_OPTION_HTTP_DECODING = 65
%EQUATE `INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO = 67
%EQUATE `INTERNET_OPTION_CODEPAGE = 68
%EQUATE `INTERNET_OPTION_CACHE_TIMESTAMPS = 69
%EQUATE `INTERNET_OPTION_DISABLE_AUTODIAL = 70
%EQUATE `INTERNET_OPTION_MAX_CONNS_PER_SERVER = 73
%EQUATE `INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER = 74
%EQUATE `INTERNET_OPTION_PER_CONNECTION_OPTION = 75
%EQUATE `INTERNET_OPTION_DIGEST_AUTH_UNLOAD = 76
%EQUATE `INTERNET_OPTION_IGNORE_OFFLINE = 77
%EQUATE `INTERNET_OPTION_IDENTITY = 78
%EQUATE `INTERNET_OPTION_REMOVE_IDENTITY = 79
%EQUATE `INTERNET_OPTION_ALTER_IDENTITY = 80
%EQUATE `INTERNET_OPTION_SUPPRESS_BEHAVIOR = 81
%EQUATE `INTERNET_OPTION_AUTODIAL_MODE = 82
%EQUATE `INTERNET_OPTION_AUTODIAL_CONNECTION = 83
%EQUATE `INTERNET_OPTION_CLIENT_CERT_CONTEXT = 84
%EQUATE `INTERNET_OPTION_AUTH_FLAGS = 85
%EQUATE `INTERNET_OPTION_COOKIES_3RD_PARTY = 86
%EQUATE `INTERNET_OPTION_DISABLE_PASSPORT_AUTH = 87
%EQUATE `INTERNET_OPTION_SEND_UTF8_SERVERNAME_TO_PROXY = 88
%EQUATE `INTERNET_OPTION_EXEMPT_CONNECTION_LIMIT = 89
%EQUATE `INTERNET_OPTION_ENABLE_PASSPORT_AUTH = 90
%EQUATE `INTERNET_OPTION_HIBERNATE_INACTIVE_WORKER_THREADS = 91
%EQUATE `INTERNET_OPTION_ACTIVATE_WORKER_THREADS = 92
%EQUATE `INTERNET_OPTION_RESTORE_WORKER_THREAD_DEFAULTS = 93
%EQUATE `INTERNET_OPTION_SOCKET_SEND_BUFFER_LENGTH = 94
%EQUATE `INTERNET_OPTION_PROXY_SETTINGS_CHANGED = 95
%EQUATE `INTERNET_OPTION_DATAFILE_EXT = 96
%EQUATE `INTERNET_OPTION_CODEPAGE_PATH = 100
%EQUATE `INTERNET_OPTION_CODEPAGE_EXTRA = 101
%EQUATE `INTERNET_OPTION_IDN = 102
%EQUATE `INTERNET_OPTION_MAX_CONNS_PER_PROXY = 103
%EQUATE `INTERNET_OPTION_SUPPRESS_SERVER_AUTH = 104
%EQUATE `INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT = 105
%EQUATE `INTERNET_FIRST_OPTION = %INTERNET_OPTION_CALLBACK
%EQUATE `INTERNET_LAST_OPTION = %INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT
'//
'// values for INTERNET_OPTION_PRIORITY
'//
%EQUATE `INTERNET_PRIORITY_FOREGROUND = 1000
'//
'// handle types
'//
%EQUATE `INTERNET_HANDLE_TYPE_INTERNET = 1
%EQUATE `INTERNET_HANDLE_TYPE_CONNECT_FTP = 2
%EQUATE `INTERNET_HANDLE_TYPE_CONNECT_GOPHER = 3
%EQUATE `INTERNET_HANDLE_TYPE_CONNECT_HTTP = 4
%EQUATE `INTERNET_HANDLE_TYPE_FTP_FIND = 5
%EQUATE `INTERNET_HANDLE_TYPE_FTP_FIND_HTML = 6
%EQUATE `INTERNET_HANDLE_TYPE_FTP_FILE = 7
%EQUATE `INTERNET_HANDLE_TYPE_FTP_FILE_HTML = 8
%EQUATE `INTERNET_HANDLE_TYPE_GOPHER_FIND = 9
%EQUATE `INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML = 10
%EQUATE `INTERNET_HANDLE_TYPE_GOPHER_FILE = 11
%EQUATE `INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML = 12
%EQUATE `INTERNET_HANDLE_TYPE_HTTP_REQUEST = 13
%EQUATE `INTERNET_HANDLE_TYPE_FILE_REQUEST = 14
'//
'// values for INTERNET_OPTION_AUTH_FLAGS
'//
%EQUATE `AUTH_FLAG_DISABLE_NEGOTIATE = &H00000001
%EQUATE `AUTH_FLAG_ENABLE_NEGOTIATE = &H00000002
%EQUATE `AUTH_FLAG_DISABLE_BASIC_CLEARCHANNEL = &H00000004
'//
'// values for INTERNET_OPTION_SECURITY_FLAGS
'//
'// query only
%EQUATE `SECURITY_FLAG_SECURE = &H00000001 ' can query only
%EQUATE `SECURITY_FLAG_STRENGTH_WEAK = &H10000000
%EQUATE `SECURITY_FLAG_STRENGTH_MEDIUM = &H40000000
%EQUATE `SECURITY_FLAG_STRENGTH_STRONG = &H20000000
%EQUATE `SECURITY_FLAG_UNKNOWNBIT = &H80000000
%EQUATE `SECURITY_FLAG_FORTEZZA = &H08000000
%EQUATE `SECURITY_FLAG_NORMALBITNESS = %SECURITY_FLAG_STRENGTH_WEAK
'// The following are unused
%EQUATE `SECURITY_FLAG_SSL = &H00000002
%EQUATE `SECURITY_FLAG_SSL3 = &H00000004
%EQUATE `SECURITY_FLAG_PCT = &H00000008
%EQUATE `SECURITY_FLAG_PCT4 = &H00000010
%EQUATE `SECURITY_FLAG_IETFSSL4 = &H00000020
'// The following are for backwards compatability only.
%EQUATE `SECURITY_FLAG_40BIT = %SECURITY_FLAG_STRENGTH_WEAK
%EQUATE `SECURITY_FLAG_128BIT = %SECURITY_FLAG_STRENGTH_STRONG
%EQUATE `SECURITY_FLAG_56BIT = %SECURITY_FLAG_STRENGTH_MEDIUM
'// setable flags
%EQUATE `SECURITY_FLAG_IGNORE_REVOCATION = &H00000080
%EQUATE `SECURITY_FLAG_IGNORE_UNKNOWN_CA = &H00000100
%EQUATE `SECURITY_FLAG_IGNORE_WRONG_USAGE = &H00000200
%EQUATE `SECURITY_FLAG_IGNORE_CERT_CN_INVALID = %INTERNET_FLAG_IGNORE_CERT_CN_INVALID
%EQUATE `SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = %INTERNET_FLAG_IGNORE_CERT_DATE_INVALID
%EQUATE `SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS = %INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
%EQUATE `SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP = %INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP
%EQUATE `SECURITY_SET_MASK = %SECURITY_FLAG_IGNORE_REVOCATION OR %SECURITY_FLAG_IGNORE_UNKNOWN_CA OR %SECURITY_FLAG_IGNORE_CERT_CN_INVALID OR %SECURITY_FLAG_IGNORE_CERT_DATE_INVALID OR %SECURITY_FLAG_IGNORE_WRONG_USAGE
'// valid autodial modes
%EQUATE `AUTODIAL_MODE_NEVER = 1
%EQUATE `AUTODIAL_MODE_ALWAYS = 2
%EQUATE `AUTODIAL_MODE_NO_NETWORK_PRESENT = 4
DECLARE FUNCTION InternetGetLastResponseInfoA LIB "wininet.dll" ALIAS "InternetGetLastResponseInfoA" ( BYREF lpdwError AS QUAD , BYREF lpszBuffer AS ASCIIZ , BYREF lpdwBufferLength AS QUAD ) AS LONG
DECLARE FUNCTION InternetGetLastResponseInfoW LIB "wininet.dll" ALIAS "InternetGetLastResponseInfoW" ( BYREF lpdwError AS QUAD
 , BYREF lpszBuffer AS WSTRINGZ
 , BYREF lpdwBufferLength AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetGetLastResponseInfo = InternetGetLastResponseInfoW
#ELSE
 MACRO InternetGetLastResponseInfo = InternetGetLastResponseInfoA
#ENDIF
'//
'// callback function for InternetSetStatusCallback
'//
'typedef
'(CALLBACK * INTERNET_STATUS_CALLBACK)(
' );
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION InternetSetStatusCallbackA LIB "WinINet.dll" ALIAS "InternetSetStatusCallbackA" ( BYVAL hInternet AS QUAD, ' in
 BYVAL lpfnInternetCallback AS DWORD ' in
 ) AS DWORD
#ELSE
DECLARE FUNCTION InternetSetStatusCallbackA LIB "wininet.dll" ALIAS "InternetSetStatusCallback" ( BYVAL hInternet AS QUAD , OPTIONAL BYVAL lpfnInternetCallback AS QUAD ) AS QUAD ' INTERNET_STATUS_CALLBACK
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION InternetSetStatusCallbackW LIB "WinINet.dll" ALIAS "InternetSetStatusCallbackW" ( BYVAL hInternet AS QUAD, ' in
 BYVAL lpfnInternetCallback AS DWORD ' in
 ) AS DWORD
#ELSE
DECLARE FUNCTION InternetSetStatusCallbackW LIB "wininet.dll" ALIAS "InternetSetStatusCallbackW" ( BYVAL hInternet AS QUAD , OPTIONAL BYVAL lpfnInternetCallback AS QUAD ) AS QUAD ' INTERNET_STATUS_CALLBACK
#ENDIF
#IF %DEF(%UNICODE)
 MACRO InternetSetStatusCallback = InternetSetStatusCallbackW
#ELSE
 MACRO InternetSetStatusCallback = InternetSetStatusCallbackA
#ENDIF
'//
'// status manifests for Internet status callback
'//
%EQUATE `INTERNET_STATUS_RESOLVING_NAME = 10
%EQUATE `INTERNET_STATUS_NAME_RESOLVED = 11
%EQUATE `INTERNET_STATUS_CONNECTING_TO_SERVER = 20
%EQUATE `INTERNET_STATUS_CONNECTED_TO_SERVER = 21
%EQUATE `INTERNET_STATUS_SENDING_REQUEST = 30
%EQUATE `INTERNET_STATUS_REQUEST_SENT = 31
%EQUATE `INTERNET_STATUS_RECEIVING_RESPONSE = 40
%EQUATE `INTERNET_STATUS_RESPONSE_RECEIVED = 41
%EQUATE `INTERNET_STATUS_CTL_RESPONSE_RECEIVED = 42
%EQUATE `INTERNET_STATUS_PREFETCH = 43
%EQUATE `INTERNET_STATUS_CLOSING_CONNECTION = 50
%EQUATE `INTERNET_STATUS_CONNECTION_CLOSED = 51
%EQUATE `INTERNET_STATUS_HANDLE_CREATED = 60
%EQUATE `INTERNET_STATUS_HANDLE_CLOSING = 70
%EQUATE `INTERNET_STATUS_DETECTING_PROXY = 80
%EQUATE `INTERNET_STATUS_REQUEST_COMPLETE = 100
%EQUATE `INTERNET_STATUS_REDIRECT = 110
%EQUATE `INTERNET_STATUS_INTERMEDIATE_RESPONSE = 120
%EQUATE `INTERNET_STATUS_USER_INPUT_REQUIRED = 140
%EQUATE `INTERNET_STATUS_STATE_CHANGE = 200
%EQUATE `INTERNET_STATUS_COOKIE_SENT = 320
%EQUATE `INTERNET_STATUS_COOKIE_RECEIVED = 321
%EQUATE `INTERNET_STATUS_PRIVACY_IMPACTED = 324
%EQUATE `INTERNET_STATUS_P3P_HEADER = 325
%EQUATE `INTERNET_STATUS_P3P_POLICYREF = 326
%EQUATE `INTERNET_STATUS_COOKIE_HISTORY = 327
'//
'// the following can be indicated in a state change notification:
'//
%EQUATE `INTERNET_STATE_CONNECTED = &H00000001 ' connected state (mutually exclusive with disconnected)
%EQUATE `INTERNET_STATE_DISCONNECTED = &H00000002 ' disconnected from network
%EQUATE `INTERNET_STATE_DISCONNECTED_BY_USER = &H00000010 ' disconnected by user request
%EQUATE `INTERNET_STATE_IDLE = &H00000100 ' no network requests being made (by Wininet)
%EQUATE `INTERNET_STATE_BUSY = &H00000200 ' network requests being made (by Wininet)
'//
'// the following values are used for cookie state:
'//
' InternetCookieState enum
%EQUATE `COOKIE_STATE_UNKNOWN = &H0
%EQUATE `COOKIE_STATE_ACCEPT = &H1
%EQUATE `COOKIE_STATE_PROMPT = &H2
%EQUATE `COOKIE_STATE_LEASH = &H3
%EQUATE `COOKIE_STATE_DOWNGRADE = &H4
%EQUATE `COOKIE_STATE_REJECT = &H5
%EQUATE `COOKIE_STATE_MAX = %COOKIE_STATE_REJECT
' // Size = 28 bytes
TYPE IncomingCookieState DWORD
 cSession AS LONG ' int
 cPersistent AS LONG ' int
 cAccepted AS LONG ' int
 cLeashed AS LONG ' int
 cDowngraded AS LONG ' int
 cBlocked AS LONG ' int
 pszLocation AS ASCIIZ PTR ' const char *pszLocation
END TYPE
' // Size = 12 bytes
TYPE OutgoingCookieState DWORD
 cSent AS LONG ' int
 cSuppressed AS LONG ' int
 pszLocation AS ASCIIZ PTR ' const char *pszLocation
END TYPE
' // Size = 16 bytes
TYPE InternetCookieHistory DWORD
 fAccepted AS LONG
 fLeashed AS LONG
 fDowngraded AS LONG
 fRejected AS LONG
END TYPE
' // Size = 8 bytes
TYPE CookieDecision DWORD
 dwCookieState AS DWORD
 fAllowSession AS LONG
END TYPE
'//
'// if the following value is returned by InternetSetStatusCallback, then
'// probably an invalid (non-code) address was supplied for the callback
'//
'#define INTERNET_INVALID_STATUS_CALLBACK ((INTERNET_STATUS_CALLBACK)(-1L))
%EQUATE `INTERNET_INVALID_STATUS_CALLBACK = &HFFFFFFFF
'//
'// FTP
'//
'//
'// manifests
'//
%EQUATE `FTP_TRANSFER_TYPE_UNKNOWN = &H00000000
%EQUATE `FTP_TRANSFER_TYPE_ASCII = &H00000001
%EQUATE `FTP_TRANSFER_TYPE_BINARY = &H00000002
%EQUATE `FTP_TRANSFER_TYPE_MASK = %FTP_TRANSFER_TYPE_ASCII OR %FTP_TRANSFER_TYPE_BINARY
'//
'// prototypes
'//
DECLARE FUNCTION FtpFindFirstFileA LIB "wininet.dll" ALIAS "FtpFindFirstFileA" ( BYVAL hConnect AS QUAD , BYREF lpszSearchFile AS ASCIIZ , BYREF lpFindFileData AS WIN32_FIND_DATAA , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
DECLARE FUNCTION FtpFindFirstFileW LIB "wininet.dll" ALIAS "FtpFindFirstFileW" ( BYVAL hConnect AS QUAD , BYREF lpszSearchFile AS WSTRINGZ , BYREF lpFindFileData AS WIN32_FIND_DATAW , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
#IF %DEF(%UNICODE)
 MACRO FtpFindFirstFile = FtpFindFirstFileW
#ELSE
 MACRO FtpFindFirstFile = FtpFindFirstFileA
#ENDIF
DECLARE FUNCTION FtpGetFileA LIB "wininet.dll" ALIAS "FtpGetFileA" ( BYVAL hConnect AS QUAD , BYREF lpszRemoteFile AS ASCIIZ , BYREF lpszNewFile AS ASCIIZ , BYVAL fFailIfExists AS LONG , BYVAL dwFlagsAndAttributes AS QUAD , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS LONG
DECLARE FUNCTION FtpGetFileW LIB "wininet.dll" ALIAS "FtpGetFileW" ( BYVAL hConnect AS QUAD
 , BYREF lpszRemoteFile AS WSTRINGZ
 , BYREF lpszNewFile AS WSTRINGZ
 , BYVAL fFailIfExists AS LONG
 , BYVAL dwFlagsAndAttributes AS DWORD
 , BYVAL dwFlags AS DWORD
 , OPTIONAL BYVAL dwContext AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO FtpGetFile = FtpGetFileW
#ELSE
 MACRO FtpGetFile = FtpGetFileA
#ENDIF
DECLARE FUNCTION FtpPutFileA LIB "wininet.dll" ALIAS "FtpPutFileA" ( BYVAL hConnect AS QUAD , BYREF lpszLocalFile AS ASCIIZ , BYREF lpszNewRemoteFile AS ASCIIZ , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS LONG
DECLARE FUNCTION FtpPutFileW LIB "wininet.dll" ALIAS "FtpPutFileW" ( BYVAL hConnect AS QUAD
 , BYREF lpszLocalFile AS WSTRINGZ
 , BYREF lpszNewRemoteFile AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , OPTIONAL BYVAL dwContext AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO FtpPutFile = FtpPutFileW
#ELSE
 MACRO FtpPutFile = FtpPutFileA
#ENDIF
DECLARE FUNCTION FtpGetFileEx LIB "wininet.dll" ALIAS "FtpGetFileEx" ( BYVAL hFtpSession AS QUAD , BYREF lpszRemoteFile AS ASCIIZ , BYREF lpszNewFile AS WSTRINGZ , BYVAL fFailIfExists AS LONG , BYVAL dwFlags AS QUAD , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS LONG
DECLARE FUNCTION FtpPutFileEx LIB "wininet.dll" ALIAS "FtpPutFileEx" ( BYVAL hFtpSession AS QUAD
 , BYREF lpszLocalFile AS WSTRINGZ
 , BYREF lpszNewRemoteFile AS ASCIIZ
 , BYVAL dwFlags AS DWORD
 , OPTIONAL BYVAL dwContext AS DWORD
 ) AS LONG
DECLARE FUNCTION FtpDeleteFileA LIB "wininet.dll" ALIAS "FtpDeleteFileA" ( BYVAL hConnect AS DWORD
 , BYREF lpszFileName AS ASCIIZ
 ) AS LONG
DECLARE FUNCTION FtpDeleteFileW LIB "wininet.dll" ALIAS "FtpDeleteFileW" ( BYVAL hConnect AS DWORD
 , BYREF lpszFileName AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO FtpDeleteFile = FtpDeleteFileW
#ELSE
 MACRO FtpDeleteFile = FtpDeleteFileA
#ENDIF
DECLARE FUNCTION FtpRenameFileA LIB "wininet.dll" ALIAS "FtpRenameFileA" ( BYVAL hConnect AS QUAD , BYREF lpszExisting AS ASCIIZ , BYREF lpszNew AS ASCIIZ ) AS LONG
DECLARE FUNCTION FtpRenameFileW LIB "wininet.dll" ALIAS "FtpRenameFileW" ( BYVAL hConnect AS QUAD
 , BYREF lpszExisting AS WSTRINGZ
 , BYREF lpszNew AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO FtpRenameFile = FtpRenameFileW
#ELSE
 MACRO FtpRenameFile = FtpRenameFileA
#ENDIF
DECLARE FUNCTION FtpOpenFileA LIB "wininet.dll" ALIAS "FtpOpenFileA" ( BYVAL hConnect AS QUAD , BYREF lpszFileName AS ASCIIZ , BYVAL dwAccess AS QUAD , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
DECLARE FUNCTION FtpOpenFileW LIB "wininet.dll" ALIAS "FtpOpenFileW" ( BYVAL hConnect AS QUAD , BYREF lpszFileName AS WSTRINGZ , BYVAL dwAccess AS QUAD , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
#IF %DEF(%UNICODE)
 MACRO FtpOpenFile = FtpOpenFileW
#ELSE
 MACRO FtpOpenFile = FtpOpenFileA
#ENDIF
DECLARE FUNCTION FtpCreateDirectoryA LIB "wininet.dll" ALIAS "FtpCreateDirectoryA" ( BYVAL hConnect AS QUAD , BYREF lpszDirectory AS ASCIIZ ) AS LONG
DECLARE FUNCTION FtpCreateDirectoryW LIB "wininet.dll" ALIAS "FtpCreateDirectoryW" ( BYVAL hConnect AS QUAD
 , BYREF lpszDirectory AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO FtpCreateDirectory = FtpCreateDirectoryW
#ELSE
 MACRO FtpCreateDirectory = FtpCreateDirectoryA
#ENDIF
DECLARE FUNCTION FtpRemoveDirectoryA LIB "wininet.dll" ALIAS "FtpRemoveDirectoryA" ( BYVAL hConnect AS QUAD , BYREF lpszDirectory AS ASCIIZ ) AS LONG
DECLARE FUNCTION FtpRemoveDirectoryW LIB "wininet.dll" ALIAS "FtpRemoveDirectoryW" ( BYVAL hConnect AS QUAD
 , BYREF lpszDirectory AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO FtpRemoveDirectory = FtpRemoveDirectoryW
#ELSE
 MACRO FtpRemoveDirectory = FtpRemoveDirectoryA
#ENDIF
DECLARE FUNCTION FtpSetCurrentDirectoryA LIB "wininet.dll" ALIAS "FtpSetCurrentDirectoryA" ( BYVAL hConnect AS QUAD , BYREF lpszDirectory AS ASCIIZ ) AS LONG
DECLARE FUNCTION FtpSetCurrentDirectoryW LIB "wininet.dll" ALIAS "FtpSetCurrentDirectoryW" ( BYVAL hConnect AS QUAD
 , BYREF lpszDirectory AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO FtpSetCurrentDirectory = FtpSetCurrentDirectoryW
#ELSE
 MACRO FtpSetCurrentDirectory = FtpSetCurrentDirectoryA
#ENDIF
DECLARE FUNCTION FtpGetCurrentDirectoryA LIB "wininet.dll" ALIAS "FtpGetCurrentDirectoryA" ( BYVAL hConnect AS QUAD , BYREF lpszCurrentDirectory AS ASCIIZ , BYREF lpdwCurrentDirectory AS QUAD ) AS LONG
DECLARE FUNCTION FtpGetCurrentDirectoryW LIB "wininet.dll" ALIAS "FtpGetCurrentDirectoryW" ( BYVAL hConnect AS QUAD
 , BYREF lpszCurrentDirectory AS WSTRINGZ
 , BYREF lpdwCurrentDirectory AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO FtpGetCurrentDirectory = FtpGetCurrentDirectoryW
#ELSE
 MACRO FtpGetCurrentDirectory = FtpGetCurrentDirectoryA
#ENDIF
DECLARE FUNCTION FtpCommandA LIB "wininet.dll" ALIAS "FtpCommandA" ( BYVAL hConnect AS QUAD , BYVAL fExpectResponse AS LONG , BYVAL dwFlags AS QUAD , BYREF lpszCommand AS ASCIIZ , OPTIONAL BYVAL dwContext AS QUAD , OPTIONAL BYREF phFtpCommand AS QUAD ) AS LONG
DECLARE FUNCTION FtpCommandW LIB "wininet.dll" ALIAS "FtpCommandW" ( BYVAL hConnect AS QUAD
 , BYVAL fExpectResponse AS LONG
 , BYVAL dwFlags AS DWORD
 , BYREF lpszCommand AS WSTRINGZ
 , OPTIONAL BYVAL dwContext AS DWORD
 , OPTIONAL BYREF phFtpCommand AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO FtpCommand = FtpCommandW
#ELSE
 MACRO FtpCommand = FtpCommandA
#ENDIF
DECLARE FUNCTION FtpGetFileSize LIB "wininet.dll" AlIAS "FtpGetFileSize" ( BYVAL hFile AS QUAD , OPTIONAL BYREF lpdwFileSizeHigh AS QUAD ) AS QUAD
'//
'// Gopher
'//
'//
'// manifests
'//
'//
'// string field lengths (in characters, not bytes)
'//
%EQUATE `MAX_GOPHER_DISPLAY_TEXT = 128
%EQUATE `MAX_GOPHER_SELECTOR_TEXT = 256
%EQUATE `MAX_GOPHER_HOST_NAME = %INTERNET_MAX_HOST_NAME_LENGTH
%EQUATE `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
'//
'// structures/types
'//
'//
'// GOPHER_FIND_DATA - returns the results of a GopherFindFirstFile()/
'// InternetFindNextFile() request
'//
' // Size = 808 bytes
TYPE GOPHER_FIND_DATAA DWORD
 DisplayString AS ASCIIZ * %MAX_GOPHER_DISPLAY_TEXT + 1 ' CHAR[MAX_GOPHER_DISPLAY_TEXT]
 GopherType AS DWORD
 SizeLow AS DWORD
 SizeHigh AS DWORD
 LastModificationTime AS FILETIME ' FILETIME
 Locator AS ASCIIZ * %MAX_GOPHER_LOCATOR_LENGTH + 1 ' CHAR[MAX_GOPHER_LOCATOR_LENGTH]
END TYPE
' // Size = 1588 bytes
TYPE GOPHER_FIND_DATAW DWORD
 DisplayString AS WSTRINGZ * %MAX_GOPHER_DISPLAY_TEXT + 1 ' WCHAR[MAX_GOPHER_DISPLAY_TEXT]
 GopherType AS DWORD
 SizeLow AS DWORD
 SizeHigh AS DWORD
 LastModificationTime AS FILETIME ' FILETIME
 Locator AS WSTRINGZ * %MAX_GOPHER_LOCATOR_LENGTH + 1 ' MAX_GOPHER_LOCATOR_LENGTH
END TYPE
#IF %DEF(%UNICODE)
 MACRO GOPHER_FIND_DATA = GOPHER_FIND_DATAW
#ELSE
 MACRO GOPHER_FIND_DATA = GOPHER_FIND_DATAA
#ENDIF
'//
'// manifests for GopherType
'//
%EQUATE `GOPHER_TYPE_TEXT_FILE = &H00000001
%EQUATE `GOPHER_TYPE_DIRECTORY = &H00000002
%EQUATE `GOPHER_TYPE_CSO = &H00000004
%EQUATE `GOPHER_TYPE_ERROR = &H00000008
%EQUATE `GOPHER_TYPE_MAC_BINHEX = &H00000010
%EQUATE `GOPHER_TYPE_DOS_ARCHIVE = &H00000020
%EQUATE `GOPHER_TYPE_UNIX_UUENCODED = &H00000040
%EQUATE `GOPHER_TYPE_INDEX_SERVER = &H00000080
%EQUATE `GOPHER_TYPE_TELNET = &H00000100
%EQUATE `GOPHER_TYPE_BINARY = &H00000200
%EQUATE `GOPHER_TYPE_REDUNDANT = &H00000400
%EQUATE `GOPHER_TYPE_TN3270 = &H00000800
%EQUATE `GOPHER_TYPE_GIF = &H00001000
%EQUATE `GOPHER_TYPE_IMAGE = &H00002000
%EQUATE `GOPHER_TYPE_BITMAP = &H00004000
%EQUATE `GOPHER_TYPE_MOVIE = &H00008000
%EQUATE `GOPHER_TYPE_SOUND = &H00010000
%EQUATE `GOPHER_TYPE_HTML = &H00020000
%EQUATE `GOPHER_TYPE_PDF = &H00040000
%EQUATE `GOPHER_TYPE_CALENDAR = &H00080000
%EQUATE `GOPHER_TYPE_INLINE = &H00100000
%EQUATE `GOPHER_TYPE_UNKNOWN = &H20000000
%EQUATE `GOPHER_TYPE_ASK = &H40000000
%EQUATE `GOPHER_TYPE_GOPHER_PLUS = &H80000000
'//
'// GOPHER_TYPE_FILE_MASK - use this to determine if a locator identifies a
'// (known) file type
'//
%EQUATE `GOPHER_TYPE_FILE_MASK = %GOPHER_TYPE_TEXT_FILE OR %GOPHER_TYPE_MAC_BINHEX OR %GOPHER_TYPE_DOS_ARCHIVE OR %GOPHER_TYPE_UNIX_UUENCODED OR %GOPHER_TYPE_BINARY OR %GOPHER_TYPE_GIF OR %GOPHER_TYPE_IMAGE OR %GOPHER_TYPE_BITMAP OR %GOPHER_TYPE_MOVIE OR %GOPHER_TYPE_SOUND OR %GOPHER_TYPE_HTML OR %GOPHER_TYPE_PDF OR %GOPHER_TYPE_CALENDAR OR %GOPHER_TYPE_INLINE
'//
'// gopher type macros
'//
'#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)
FUNCTION IS_GOPHER_FILE (BYVAL nType AS DWORD) AS LONG
 FUNCTION = ABS(((nType AND %GOPHER_TYPE_FILE_MASK) <> 0))
END FUNCTION
FUNCTION IS_GOPHER_DIRECTORY (BYVAL nType AS DWORD) AS LONG
 FUNCTION = ABS(((nType AND %GOPHER_TYPE_DIRECTORY) <> 0))
END FUNCTION
FUNCTION IS_GOPHER_PHONE_SERVER (BYVAL nType AS DWORD) AS LONG
 FUNCTION = ABS(((nType AND %GOPHER_TYPE_CSO) <> 0))
END FUNCTION
FUNCTION IS_GOPHER_ERROR (BYVAL nType AS DWORD) AS LONG
 FUNCTION = ABS(((nType AND %GOPHER_TYPE_ERROR) <> 0))
END FUNCTION
FUNCTION IS_GOPHER_INDEX_SERVER (BYVAL nType AS DWORD) AS LONG
 FUNCTION = ABS(((nType AND %GOPHER_TYPE_INDEX_SERVER) <> 0))
END FUNCTION
FUNCTION IS_GOPHER_TELNET_SESSION (BYVAL nType AS DWORD) AS LONG
 FUNCTION = ABS(((nType AND %GOPHER_TYPE_TELNET) <> 0))
END FUNCTION
FUNCTION IS_GOPHER_BACKUP_SERVER (BYVAL nType AS DWORD) AS LONG
 FUNCTION = ABS(((nType AND %GOPHER_TYPE_REDUNDANT) <> 0))
END FUNCTION
FUNCTION IS_GOPHER_TN3280_SESSION (BYVAL nType AS DWORD) AS LONG
 FUNCTION = ABS(((nType AND %GOPHER_TYPE_TN3270) <> 0))
END FUNCTION
FUNCTION IS_GOPHER_ASK (BYVAL nType AS DWORD) AS LONG
 FUNCTION = ABS(((nType AND %GOPHER_TYPE_ASK) <> 0))
END FUNCTION
FUNCTION IS_GOPHER_PLUS (BYVAL nType AS DWORD) AS LONG
 FUNCTION = ABS(((nType AND %GOPHER_TYPE_GOPHER_PLUS) <> 0))
END FUNCTION
FUNCTION IS_GOPHER_TYPE_KNOWN (BYVAL nType AS DWORD) AS LONG
 FUNCTION = ABS(((nType AND %GOPHER_TYPE_UNKNOWN) = 0))
END FUNCTION
'//
'// structured gopher attributes (as defined in gopher+ protocol document)
'//
' // Size = 8 bytes
TYPE GOPHER_ADMIN_ATTRIBUTE_TYPE DWORD
 Comment AS ASCIIZ PTR
 EmailAddress AS ASCIIZ PTR
END TYPE
' // Size = 8 bytes
TYPE GOPHER_MOD_DATE_ATTRIBUTE_TYPE DWORD
 DateAndTime AS FILETIME
END TYPE
' // Size = 4 bytes
TYPE GOPHER_TTL_ATTRIBUTE_TYPE DWORD
 Ttl AS DWORD
END TYPE
' // Size = 4 bytes
TYPE GOPHER_SCORE_ATTRIBUTE_TYPE DWORD
 Score AS LONG ' INT
END TYPE
' // Size = 8 bytes
TYPE GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE DWORD
 LowerBound AS LONG ' INT
 UpperBound AS LONG ' INT
END TYPE
' // Size = 4 bytes
TYPE GOPHER_SITE_ATTRIBUTE_TYPE DWORD
 Site AS ASCIIZ PTR
END TYPE
' // Size = 4 bytes
TYPE GOPHER_ORGANIZATION_ATTRIBUTE_TYPE DWORD
 Organization AS ASCIIZ PTR
END TYPE
' // Size = 4 bytes
TYPE GOPHER_LOCATION_ATTRIBUTE_TYPE DWORD
 Location AS ASCIIZ PTR
END TYPE
' // Size = 24 bytes
TYPE GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE DWORD
 DegreesNorth AS LONG ' INT
 MinutesNorth AS LONG ' INT
 SecondsNorth AS LONG ' INT
 DegreesEast AS LONG ' INT
 MinutesEast AS LONG ' INT
 SecondsEast AS LONG ' INT
END TYPE
' // Size = 4 bytes
TYPE GOPHER_TIMEZONE_ATTRIBUTE_TYPE DWORD
 Zone AS LONG ' INT
END TYPE
' // Size = 4 bytes
TYPE GOPHER_PROVIDER_ATTRIBUTE_TYPE DWORD
 Provider AS ASCIIZ PTR
END TYPE
' // Size = 4 bytes
TYPE GOPHER_VERSION_ATTRIBUTE_TYPE DWORD
 Version AS ASCIIZ PTR
END TYPE
' // Size = 8 bytes
TYPE GOPHER_ABSTRACT_ATTRIBUTE_TYPE DWORD
 ShortAbstract AS ASCIIZ PTR
 AbstractFile AS ASCIIZ PTR
END TYPE
' // Size = 12 bytes
TYPE GOPHER_VIEW_ATTRIBUTE_TYPE DWORD
 ContentType AS ASCIIZ PTR
 Language AS ASCIIZ PTR
 Size AS DWORD
END TYPE
' // Size = 4 bytes
TYPE GOPHER_VERONICA_ATTRIBUTE_TYPE DWORD
 TreeWalk AS LONG
END TYPE
' // Size = 8 bytes
TYPE GOPHER_ASK_ATTRIBUTE_TYPE DWORD
 QuestionType AS ASCIIZ PTR
 QuestionText AS ASCIIZ PTR
END TYPE
'//
'// GOPHER_UNKNOWN_ATTRIBUTE_TYPE - this is returned if we retrieve an attribute
'// that is not specified in the current gopher/gopher+ documentation. It is up
'// to the application to parse the information
'//
' // Size = 4 bytes
TYPE GOPHER_UNKNOWN_ATTRIBUTE_TYPE DWORD
 Text AS ASCIIZ PTR
END TYPE
'//
'// GOPHER_ATTRIBUTE_TYPE - returned in the user's buffer when an enumerated
'// GopherGetAttribute call is made
'//
'typedef struct {
' DWORD CategoryId; // e.g. GOPHER_CATEGORY_ID_ADMIN
' DWORD AttributeId; // e.g. GOPHER_ATTRIBUTE_ID_ADMIN
' 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;
' // Size = 24 bytes
UNION GOPHER_ATTRIBUTE_TYPE_UNION DWORD
 Admin AS GOPHER_ADMIN_ATTRIBUTE_TYPE
 ModDate AS GOPHER_MOD_DATE_ATTRIBUTE_TYPE
 Ttl AS GOPHER_TTL_ATTRIBUTE_TYPE
 Score AS GOPHER_SCORE_ATTRIBUTE_TYPE
 ScoreRange AS GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE
 Site AS GOPHER_SITE_ATTRIBUTE_TYPE
 Organization AS GOPHER_ORGANIZATION_ATTRIBUTE_TYPE
 Location AS GOPHER_LOCATION_ATTRIBUTE_TYPE
 GeographicalLocation AS GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE
 TimeZone AS GOPHER_TIMEZONE_ATTRIBUTE_TYPE
 Provider AS GOPHER_PROVIDER_ATTRIBUTE_TYPE
 Version AS GOPHER_VERSION_ATTRIBUTE_TYPE
 Abstract AS GOPHER_ABSTRACT_ATTRIBUTE_TYPE
 View AS GOPHER_VIEW_ATTRIBUTE_TYPE
 Veronica AS GOPHER_VERONICA_ATTRIBUTE_TYPE
 Ask AS GOPHER_ASK_ATTRIBUTE_TYPE
 Unknown AS GOPHER_UNKNOWN_ATTRIBUTE_TYPE
END UNION
' // Size = 32 bytes
TYPE GOPHER_ATTRIBUTE_TYPE DWORD
 CategoryId AS DWORD ' e.g. %GOPHER_CATEGORY_ID_ADMIN
 AttributeId AS DWORD ' e.g. %GOPHER_ATTRIBUTE_ID_ADMIN
 AttributeType AS GOPHER_ATTRIBUTE_TYPE_UNION
END TYPE
'#define MAX_GOPHER_CATEGORY_NAME 128 // arbitrary
'#define MAX_GOPHER_ATTRIBUTE_NAME 128 // "
'#define MIN_GOPHER_ATTRIBUTE_LENGTH 256 // "
%EQUATE `MAX_GOPHER_CATEGORY_NAME = 128 ' arbitrary
%EQUATE `MAX_GOPHER_ATTRIBUTE_NAME = 128 ' "
%EQUATE `MIN_GOPHER_ATTRIBUTE_LENGTH = 256 ' "
'//
'// known gopher attribute categories. See below for ordinals
'//
$GOPHER_INFO_CATEGORY = "+INFO"
$GOPHER_ADMIN_CATEGORY = "+ADMIN"
$GOPHER_VIEWS_CATEGORY = "+VIEWS"
$GOPHER_ABSTRACT_CATEGORY = "+ABSTRACT"
$GOPHER_VERONICA_CATEGORY = "+VERONICA"
'//
'// known gopher attributes. These are the attribute names as defined in the
'// gopher+ protocol document
'//
$GOPHER_ADMIN_ATTRIBUTE = "Admin"
$GOPHER_MOD_DATE_ATTRIBUTE = "Mod-Date"
$GOPHER_TTL_ATTRIBUTE = "TTL"
$GOPHER_SCORE_ATTRIBUTE = "Score"
$GOPHER_RANGE_ATTRIBUTE = "Score-range"
$GOPHER_SITE_ATTRIBUTE = "Site"
$GOPHER_ORG_ATTRIBUTE = "Org"
$GOPHER_LOCATION_ATTRIBUTE = "Loc"
$GOPHER_GEOG_ATTRIBUTE = "Geog"
$GOPHER_TIMEZONE_ATTRIBUTE = "TZ"
$GOPHER_PROVIDER_ATTRIBUTE = "Provider"
$GOPHER_VERSION_ATTRIBUTE = "Version"
$GOPHER_ABSTRACT_ATTRIBUTE = "Abstract"
$GOPHER_VIEW_ATTRIBUTE = "View"
$GOPHER_TREEWALK_ATTRIBUTE = "treewalk"
'//
'// identifiers for attribute strings
'//
%EQUATE `GOPHER_ATTRIBUTE_ID_BASE = &Habcccc00
%EQUATE `GOPHER_CATEGORY_ID_ALL = %GOPHER_ATTRIBUTE_ID_BASE + 1
%EQUATE `GOPHER_CATEGORY_ID_INFO = %GOPHER_ATTRIBUTE_ID_BASE + 2
%EQUATE `GOPHER_CATEGORY_ID_ADMIN = %GOPHER_ATTRIBUTE_ID_BASE + 3
%EQUATE `GOPHER_CATEGORY_ID_VIEWS = %GOPHER_ATTRIBUTE_ID_BASE + 4
%EQUATE `GOPHER_CATEGORY_ID_ABSTRACT = %GOPHER_ATTRIBUTE_ID_BASE + 5
%EQUATE `GOPHER_CATEGORY_ID_VERONICA = %GOPHER_ATTRIBUTE_ID_BASE + 6
%EQUATE `GOPHER_CATEGORY_ID_ASK = %GOPHER_ATTRIBUTE_ID_BASE + 7
%EQUATE `GOPHER_CATEGORY_ID_UNKNOWN = %GOPHER_ATTRIBUTE_ID_BASE + 8
%EQUATE `GOPHER_ATTRIBUTE_ID_ALL = %GOPHER_ATTRIBUTE_ID_BASE + 9
%EQUATE `GOPHER_ATTRIBUTE_ID_ADMIN = %GOPHER_ATTRIBUTE_ID_BASE + 10
%EQUATE `GOPHER_ATTRIBUTE_ID_MOD_DATE = %GOPHER_ATTRIBUTE_ID_BASE + 11
%EQUATE `GOPHER_ATTRIBUTE_ID_TTL = %GOPHER_ATTRIBUTE_ID_BASE + 12
%EQUATE `GOPHER_ATTRIBUTE_ID_SCORE = %GOPHER_ATTRIBUTE_ID_BASE + 13
%EQUATE `GOPHER_ATTRIBUTE_ID_RANGE = %GOPHER_ATTRIBUTE_ID_BASE + 14
%EQUATE `GOPHER_ATTRIBUTE_ID_SITE = %GOPHER_ATTRIBUTE_ID_BASE + 15
%EQUATE `GOPHER_ATTRIBUTE_ID_ORG = %GOPHER_ATTRIBUTE_ID_BASE + 16
%EQUATE `GOPHER_ATTRIBUTE_ID_LOCATION = %GOPHER_ATTRIBUTE_ID_BASE + 17
%EQUATE `GOPHER_ATTRIBUTE_ID_GEOG = %GOPHER_ATTRIBUTE_ID_BASE + 18
%EQUATE `GOPHER_ATTRIBUTE_ID_TIMEZONE = %GOPHER_ATTRIBUTE_ID_BASE + 19
%EQUATE `GOPHER_ATTRIBUTE_ID_PROVIDER = %GOPHER_ATTRIBUTE_ID_BASE + 20
%EQUATE `GOPHER_ATTRIBUTE_ID_VERSION = %GOPHER_ATTRIBUTE_ID_BASE + 21
%EQUATE `GOPHER_ATTRIBUTE_ID_ABSTRACT = %GOPHER_ATTRIBUTE_ID_BASE + 22
%EQUATE `GOPHER_ATTRIBUTE_ID_VIEW = %GOPHER_ATTRIBUTE_ID_BASE + 23
%EQUATE `GOPHER_ATTRIBUTE_ID_TREEWALK = %GOPHER_ATTRIBUTE_ID_BASE + 24
%EQUATE `GOPHER_ATTRIBUTE_ID_UNKNOWN = %GOPHER_ATTRIBUTE_ID_BASE + 25
'//
'// prototypes
'//
DECLARE FUNCTION GopherCreateLocatorA LIB "wininet.dll" ALIAS "GopherCreateLocatorA" ( BYREF lpszHost AS ASCIIZ , BYVAL nServerPort AS WORD , BYREF lpszDisplayString AS ASCIIZ , BYREF lpszSelectorString AS ASCIIZ , BYVAL dwGopherType AS QUAD , BYREF lpszLocator AS ASCIIZ , BYREF lpdwBufferLength AS QUAD ) AS LONG
DECLARE FUNCTION GopherCreateLocatorW LIB "wininet.dll" ALIAS "GopherCreateLocatorW" ( BYREF lpszHost AS WSTRINGZ
 , BYVAL nServerPort AS WORD
 , BYREF lpszDisplayString AS WSTRINGZ
 , BYREF lpszSelectorString AS WSTRINGZ
 , BYVAL dwGopherType AS DWORD
 , BYREF lpszLocator AS WSTRINGZ
 , BYREF lpdwBufferLength AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GopherCreateLocator = GopherCreateLocatorW
#ELSE
 MACRO GopherCreateLocator = GopherCreateLocatorA
#ENDIF
DECLARE FUNCTION GopherGetLocatorTypeA LIB "wininet.dll" ALIAS "GopherGetLocatorTypeA" ( BYREF lpszLocator AS ASCIIZ , BYREF lpdwGopherType AS QUAD ) AS LONG
DECLARE FUNCTION GopherGetLocatorTypeW LIB "wininet.dll" ALIAS "GopherGetLocatorTypeW" ( BYREF lpszLocator AS WSTRINGZ
 , BYREF lpdwGopherType AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GopherGetLocatorType = GopherGetLocatorTypeW
#ELSE
 MACRO GopherGetLocatorType = GopherGetLocatorTypeA
#ENDIF
DECLARE FUNCTION GopherFindFirstFileA LIB "wininet.dll" ALIAS "GopherFindFirstFileA" ( BYVAL hConnect AS QUAD , BYREF lpszLocator AS ASCIIZ , BYREF lpszSearchString AS ASCIIZ , BYREF lpFindData AS GOPHER_FIND_DATAA , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
DECLARE FUNCTION GopherFindFirstFileW LIB "wininet.dll" ALIAS "GopherFindFirstFileW" ( BYVAL hConnect AS QUAD , BYREF lpszLocator AS WSTRINGZ , BYREF lpszSearchString AS WSTRINGZ , BYREF lpFindData AS GOPHER_FIND_DATAW , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
#IF %DEF(%UNICODE)
 MACRO GopherFindFirstFile = GopherFindFirstFileW
#ELSE
 MACRO GopherFindFirstFile = GopherFindFirstFileA
#ENDIF
DECLARE FUNCTION GopherOpenFileA LIB "wininet.dll" ALIAS "GopherOpenFileA" ( BYVAL hConnect AS QUAD , BYREF lpszLocator AS ASCIIZ , BYREF lpszView AS ASCIIZ , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
DECLARE FUNCTION GopherOpenFileW LIB "wininet.dll" ALIAS "GopherOpenFileW" ( BYVAL hConnect AS QUAD , BYREF lpszLocator AS WSTRINGZ , BYREF lpszView AS WSTRINGZ , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
#IF %DEF(%UNICODE)
 MACRO GopherOpenFile = GopherOpenFileW
#ELSE
 MACRO GopherOpenFile = GopherOpenFileA
#ENDIF
'typedef BOOL (CALLBACK * GOPHER_ATTRIBUTE_ENUMERATOR)(
' );
DECLARE FUNCTION GopherGetAttributeA LIB "wininet.dll" ALIAS "GopherGetAttributeA" ( BYVAL hConnect AS QUAD , BYREF lpszLocator AS ASCIIZ , BYREF lpszAttributeName AS ASCIIZ , BYVAL lpBuffer AS QUAD , BYVAL dwBufferLength AS QUAD , BYREF lpdwCharactersReturned AS QUAD , OPTIONAL BYVAL lpfnEnumerator AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS LONG
DECLARE FUNCTION GopherGetAttributeW LIB "wininet.dll" ALIAS "GopherGetAttributeW" ( BYVAL hConnect AS QUAD
 , BYREF lpszLocator AS WSTRINGZ
 , BYREF lpszAttributeName AS WSTRINGZ
 , BYVAL lpBuffer AS DWORD
 , BYVAL dwBufferLength AS DWORD
 , BYREF lpdwCharactersReturned AS DWORD
 , OPTIONAL BYVAL lpfnEnumerator AS DWORD
 , OPTIONAL BYVAL dwContext AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GopherGetAttribute = GopherGetAttributeW
#ELSE
 MACRO GopherGetAttribute = GopherGetAttributeA
#ENDIF
'//
'// HTTP
'//
'//
'// manifests
'//
'//
'// the default major/minor HTTP version numbers
'//
%EQUATE `HTTP_MAJOR_VERSION = 1
%EQUATE `HTTP_MINOR_VERSION = 0
$HTTP_VERSIONA = "HTTP/1.0"
$$HTTP_VERSIONW = "HTTP/1.0"$$
#IF %DEF(%UNICODE)
 MACRO HTTP_VERSION = $HTTP_VERSIONA
#ELSE
 MACRO HTTP_VERSION = $$HTTP_VERSIONW
#ENDIF
'//
'// HttpQueryInfo info levels. Generally, there is one info level
'// for each potential RFC822/HTTP/MIME header that an HTTP server
'// may send as part of a request response.
'//
'// The HTTP_QUERY_RAW_HEADERS info level is provided for clients
'// that choose to perform their own header parsing.
'//
%EQUATE `HTTP_QUERY_MIME_VERSION = 0
%EQUATE `HTTP_QUERY_CONTENT_TYPE = 1
%EQUATE `HTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2
%EQUATE `HTTP_QUERY_CONTENT_ID = 3
%EQUATE `HTTP_QUERY_CONTENT_DESCRIPTION = 4
%EQUATE `HTTP_QUERY_CONTENT_LENGTH = 5
%EQUATE `HTTP_QUERY_CONTENT_LANGUAGE = 6
%EQUATE `HTTP_QUERY_ALLOW = 7
%EQUATE `HTTP_QUERY_PUBLIC = 8
%EQUATE `HTTP_QUERY_DATE = 9
%EQUATE `HTTP_QUERY_EXPIRES = 10
%EQUATE `HTTP_QUERY_LAST_MODIFIED = 11
%EQUATE `HTTP_QUERY_MESSAGE_ID = 12
%EQUATE `HTTP_QUERY_URI = 13
%EQUATE `HTTP_QUERY_DERIVED_FROM = 14
%EQUATE `HTTP_QUERY_COST = 15
%EQUATE `HTTP_QUERY_LINK = 16
%EQUATE `HTTP_QUERY_PRAGMA = 17
%EQUATE `HTTP_QUERY_VERSION = 18 ' special: part of status line
%EQUATE `HTTP_QUERY_STATUS_CODE = 19 ' special: part of status line
%EQUATE `HTTP_QUERY_STATUS_TEXT = 20 ' special: part of status line
%EQUATE `HTTP_QUERY_RAW_HEADERS = 21 ' special: all headers as ASCIIZ
%EQUATE `HTTP_QUERY_RAW_HEADERS_CRLF = 22 ' special: all headers
%EQUATE `HTTP_QUERY_CONNECTION = 23
%EQUATE `HTTP_QUERY_ACCEPT = 24
%EQUATE `HTTP_QUERY_ACCEPT_CHARSET = 25
%EQUATE `HTTP_QUERY_ACCEPT_ENCODING = 26
%EQUATE `HTTP_QUERY_ACCEPT_LANGUAGE = 27
%EQUATE `HTTP_QUERY_AUTHORIZATION = 28
%EQUATE `HTTP_QUERY_CONTENT_ENCODING = 29
%EQUATE `HTTP_QUERY_FORWARDED = 30
%EQUATE `HTTP_QUERY_FROM = 31
%EQUATE `HTTP_QUERY_IF_MODIFIED_SINCE = 32
%EQUATE `HTTP_QUERY_LOCATION = 33
%EQUATE `HTTP_QUERY_ORIG_URI = 34
%EQUATE `HTTP_QUERY_REFERER = 35
%EQUATE `HTTP_QUERY_RETRY_AFTER = 36
%EQUATE `HTTP_QUERY_SERVER = 37
%EQUATE `HTTP_QUERY_TITLE = 38
%EQUATE `HTTP_QUERY_USER_AGENT = 39
%EQUATE `HTTP_QUERY_WWW_AUTHENTICATE = 40
%EQUATE `HTTP_QUERY_PROXY_AUTHENTICATE = 41
%EQUATE `HTTP_QUERY_ACCEPT_RANGES = 42
%EQUATE `HTTP_QUERY_SET_COOKIE = 43
%EQUATE `HTTP_QUERY_COOKIE = 44
%EQUATE `HTTP_QUERY_REQUEST_METHOD = 45 ' special: GET/POST etc.
%EQUATE `HTTP_QUERY_REFRESH = 46
%EQUATE `HTTP_QUERY_CONTENT_DISPOSITION = 47
'//
'// HTTP 1.1 defined headers
'//
%EQUATE `HTTP_QUERY_AGE = 48
%EQUATE `HTTP_QUERY_CACHE_CONTROL = 49
%EQUATE `HTTP_QUERY_CONTENT_BASE = 50
%EQUATE `HTTP_QUERY_CONTENT_LOCATION = 51
%EQUATE `HTTP_QUERY_CONTENT_MD5 = 52
%EQUATE `HTTP_QUERY_CONTENT_RANGE = 53
%EQUATE `HTTP_QUERY_ETAG = 54
%EQUATE `HTTP_QUERY_HOST = 55
%EQUATE `HTTP_QUERY_IF_MATCH = 56
%EQUATE `HTTP_QUERY_IF_NONE_MATCH = 57
%EQUATE `HTTP_QUERY_IF_RANGE = 58
%EQUATE `HTTP_QUERY_IF_UNMODIFIED_SINCE = 59
%EQUATE `HTTP_QUERY_MAX_FORWARDS = 60
%EQUATE `HTTP_QUERY_PROXY_AUTHORIZATION = 61
%EQUATE `HTTP_QUERY_RANGE = 62
%EQUATE `HTTP_QUERY_TRANSFER_ENCODING = 63
%EQUATE `HTTP_QUERY_UPGRADE = 64
%EQUATE `HTTP_QUERY_VARY = 65
%EQUATE `HTTP_QUERY_VIA = 66
%EQUATE `HTTP_QUERY_WARNING = 67
%EQUATE `HTTP_QUERY_EXPECT = 68
%EQUATE `HTTP_QUERY_PROXY_CONNECTION = 69
%EQUATE `HTTP_QUERY_UNLESS_MODIFIED_SINCE = 70
%EQUATE `HTTP_QUERY_ECHO_REQUEST = 71
%EQUATE `HTTP_QUERY_ECHO_REPLY = 72
'// These are the set of headers that should be added back to a request when
'// re-doing a request after a RETRY_WITH response.
%EQUATE `HTTP_QUERY_ECHO_HEADERS = 73
%EQUATE `HTTP_QUERY_ECHO_HEADERS_CRLF = 74
%EQUATE `HTTP_QUERY_PROXY_SUPPORT = 75
%EQUATE `HTTP_QUERY_AUTHENTICATION_INFO = 76
%EQUATE `HTTP_QUERY_PASSPORT_URLS = 77
%EQUATE `HTTP_QUERY_PASSPORT_CONFIG = 78
%EQUATE `HTTP_QUERY_MAX = 78
'//
'// HTTP_QUERY_CUSTOM - if this special value is supplied as the dwInfoLevel
'// parameter of HttpQueryInfo() then the lpBuffer parameter contains the name
'// of the header we are to query
'//
%EQUATE `HTTP_QUERY_CUSTOM = 65535
'//
'// HTTP_QUERY_FLAG_REQUEST_HEADERS - if this bit is set in the dwInfoLevel
'// parameter of HttpQueryInfo() then the request headers will be queried for the
'// request information
'//
%EQUATE `HTTP_QUERY_FLAG_REQUEST_HEADERS = &H80000000
'//
'// HTTP_QUERY_FLAG_SYSTEMTIME - if this bit is set in the dwInfoLevel parameter
'// of HttpQueryInfo() AND the header being queried contains date information,
'// e.g. the "Expires:" header then lpBuffer will contain a SYSTEMTIME structure
'// containing the date and time information converted from the header string
'//
%EQUATE `HTTP_QUERY_FLAG_SYSTEMTIME = &H40000000
'//
'// HTTP_QUERY_FLAG_NUMBER - if this bit is set in the dwInfoLevel parameter of
'// HttpQueryInfo(), then the value of the header will be converted to a 32bit
'// number before being returned to the caller, if applicable
'//
%EQUATE `HTTP_QUERY_FLAG_NUMBER = &H20000000
'//
'// HTTP_QUERY_FLAG_COALESCE - combine the values from several headers of the
'// same name into the output buffer
'//
%EQUATE `HTTP_QUERY_FLAG_COALESCE = &H10000000
'//
'// HTTP_QUERY_FLAG_NUMBER64 - if this bit is set in the dwInfoLevel parameter of
'// HttpQueryInfo(), then the value of the header will be converted to a 64bit
'// number before being returned to the caller, if applicable
'//
%EQUATE `HTTP_QUERY_FLAG_NUMBER64 = &H08000000
%EQUATE `HTTP_QUERY_MODIFIER_FLAGS_MASK = %HTTP_QUERY_FLAG_REQUEST_HEADERS OR %HTTP_QUERY_FLAG_SYSTEMTIME OR %HTTP_QUERY_FLAG_NUMBER OR %HTTP_QUERY_FLAG_COALESCE OR %HTTP_QUERY_FLAG_NUMBER64
%EQUATE `HTTP_QUERY_HEADER_MASK = NOT %HTTP_QUERY_MODIFIER_FLAGS_MASK
'//
'// HTTP Response Status Codes:
'//
%EQUATE `HTTP_STATUS_CONTINUE = 100 ' OK to continue with request
%EQUATE `HTTP_STATUS_SWITCH_PROTOCOLS = 101 ' server has switched protocols in upgrade header
%EQUATE `HTTP_STATUS_OK = 200 ' request completed
%EQUATE `HTTP_STATUS_CREATED = 201 ' object created, reason = new URI
%EQUATE `HTTP_STATUS_ACCEPTED = 202 ' async completion (TBS)
%EQUATE `HTTP_STATUS_PARTIAL = 203 ' partial completion
%EQUATE `HTTP_STATUS_NO_CONTENT = 204 ' no info to return
%EQUATE `HTTP_STATUS_RESET_CONTENT = 205 ' request completed, but clear form
%EQUATE `HTTP_STATUS_PARTIAL_CONTENT = 206 ' partial GET furfilled
%EQUATE `HTTP_STATUS_AMBIGUOUS = 300 ' server couldn't decide what to return
%EQUATE `HTTP_STATUS_MOVED = 301 ' object permanently moved
%EQUATE `HTTP_STATUS_REDIRECT = 302 ' object temporarily moved
%EQUATE `HTTP_STATUS_REDIRECT_METHOD = 303 ' redirection w/ new access method
%EQUATE `HTTP_STATUS_NOT_MODIFIED = 304 ' if-modified-since was not modified
%EQUATE `HTTP_STATUS_USE_PROXY = 305 ' redirection to proxy, location header specifies proxy to use
%EQUATE `HTTP_STATUS_REDIRECT_KEEP_VERB = 307 ' HTTP/1.1: keep same verb
%EQUATE `HTTP_STATUS_BAD_REQUEST = 400 ' invalid syntax
%EQUATE `HTTP_STATUS_DENIED = 401 ' access denied
%EQUATE `HTTP_STATUS_PAYMENT_REQ = 402 ' payment required
%EQUATE `HTTP_STATUS_FORBIDDEN = 403 ' request forbidden
%EQUATE `HTTP_STATUS_NOT_FOUND = 404 ' object not found
%EQUATE `HTTP_STATUS_BAD_METHOD = 405 ' method is not allowed
%EQUATE `HTTP_STATUS_NONE_ACCEPTABLE = 406 ' no response acceptable to client found
%EQUATE `HTTP_STATUS_PROXY_AUTH_REQ = 407 ' proxy authentication required
%EQUATE `HTTP_STATUS_REQUEST_TIMEOUT = 408 ' server timed out waiting for request
%EQUATE `HTTP_STATUS_CONFLICT = 409 ' user should resubmit with more info
%EQUATE `HTTP_STATUS_GONE = 410 ' the resource is no longer available
%EQUATE `HTTP_STATUS_LENGTH_REQUIRED = 411 ' the server refused to accept request w/o a length
%EQUATE `HTTP_STATUS_PRECOND_FAILED = 412 ' precondition given in request failed
%EQUATE `HTTP_STATUS_REQUEST_TOO_LARGE = 413 ' request entity was too large
%EQUATE `HTTP_STATUS_URI_TOO_LONG = 414 ' request URI too long
%EQUATE `HTTP_STATUS_UNSUPPORTED_MEDIA = 415 ' unsupported media type
%EQUATE `HTTP_STATUS_RETRY_WITH = 449 ' retry after doing the appropriate action.
%EQUATE `HTTP_STATUS_SERVER_ERROR = 500 ' internal server error
%EQUATE `HTTP_STATUS_NOT_SUPPORTED = 501 ' required not supported
%EQUATE `HTTP_STATUS_BAD_GATEWAY = 502 ' error response received from gateway
%EQUATE `HTTP_STATUS_SERVICE_UNAVAIL = 503 ' temporarily overloaded
%EQUATE `HTTP_STATUS_GATEWAY_TIMEOUT = 504 ' timed out waiting for gateway
%EQUATE `HTTP_STATUS_VERSION_NOT_SUP = 505 ' HTTP version not supported
%EQUATE `HTTP_STATUS_FIRST = %HTTP_STATUS_CONTINUE
%EQUATE `HTTP_STATUS_LAST = %HTTP_STATUS_VERSION_NOT_SUP
'//
'// prototypes
'//
DECLARE FUNCTION HttpOpenRequestA LIB "wininet.dll" ALIAS "HttpOpenRequestA" ( BYVAL hConnect AS QUAD , BYREF lpszVerb AS ASCIIZ , BYREF lpszObjectName AS ASCIIZ , BYREF lpszVersion AS ASCIIZ , BYREF lpszReferrer AS ASCIIZ , BYREF lplpszAcceptTypes AS ANY , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
DECLARE FUNCTION HttpOpenRequestW LIB "wininet.dll" ALIAS "HttpOpenRequestW" ( BYVAL hConnect AS QUAD , BYREF lpszVerb AS WSTRINGZ , BYREF lpszObjectName AS WSTRINGZ , BYREF lpszVersion AS WSTRINGZ , BYREF lpszReferrer AS WSTRINGZ , BYREF lplpszAcceptTypes AS ANY , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS QUAD ' HINTERNET
#IF %DEF(%UNICODE)
 MACRO HttpOpenRequest = HttpOpenRequestW
#ELSE
 MACRO HttpOpenRequest = HttpOpenRequestA
#ENDIF
DECLARE FUNCTION HttpAddRequestHeadersA LIB "wininet.dll" ALIAS "HttpAddRequestHeadersA" ( BYVAL hRequest AS QUAD , BYREF lpszHeaders AS ASCIIZ , BYVAL dwHeadersLength AS QUAD , BYVAL dwModifiers AS QUAD ) AS LONG
DECLARE FUNCTION HttpAddRequestHeadersW LIB "wininet.dll" ALIAS "HttpAddRequestHeadersW" ( BYVAL hRequest AS QUAD
 , BYREF lpszHeaders AS WSTRINGZ
 , BYVAL dwHeadersLength AS DWORD
 , BYVAL dwModifiers AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO HttpAddRequestHeaders = HttpAddRequestHeadersW
#ELSE
 MACRO HttpAddRequestHeaders = HttpAddRequestHeadersA
#ENDIF
'//
'// values for dwModifiers parameter of HttpAddRequestHeaders()
'//
%EQUATE `HTTP_ADDREQ_INDEX_MASK = &H0000FFFF
%EQUATE `HTTP_ADDREQ_FLAGS_MASK = &HFFFF0000
'//
'// HTTP_ADDREQ_FLAG_ADD_IF_NEW - the header will only be added if it doesn't
'// already exist
'//
%EQUATE `HTTP_ADDREQ_FLAG_ADD_IF_NEW = &H10000000
'//
'// HTTP_ADDREQ_FLAG_ADD - if HTTP_ADDREQ_FLAG_REPLACE is set but the header is
'// not found then if this flag is set, the header is added anyway, so long as
'// there is a valid header-value
'//
%EQUATE `HTTP_ADDREQ_FLAG_ADD = &H20000000
'//
'// HTTP_ADDREQ_FLAG_COALESCE - coalesce headers with same name. e.g.
'// "Accept: text/*" and "Accept: audio/*" with this flag results in a single
'// header: "Accept: text/*, audio/*"
'//
%EQUATE `HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA = &H40000000
%EQUATE `HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON = &H01000000
%EQUATE `HTTP_ADDREQ_FLAG_COALESCE = %HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
'//
'// HTTP_ADDREQ_FLAG_REPLACE - replaces the specified header. Only one header can
'// be supplied in the buffer. If the header to be replaced is not the first
'// in a list of headers with the same name, then the relative index should be
'// supplied in the low 8 bits of the dwModifiers parameter. If the header-value
'// part is missing, then the header is removed
'//
%EQUATE `HTTP_ADDREQ_FLAG_REPLACE = &H80000000
DECLARE FUNCTION HttpSendRequestA LIB "wininet.dll" ALIAS "HttpSendRequestA" ( BYVAL hRequest AS QUAD , BYREF lpszHeaders AS ASCIIZ , BYVAL dwHeadersLength AS QUAD , BYVAL lpOptional AS QUAD , BYVAL dwOptionalLength AS QUAD ) AS LONG
DECLARE FUNCTION HttpSendRequestW LIB "wininet.dll" ALIAS "HttpSendRequestW" ( BYVAL hRequest AS QUAD
 , BYREF lpszHeaders AS WSTRINGZ
 , BYVAL dwHeadersLength AS DWORD
 , BYVAL lpOptional AS DWORD
 , BYVAL dwOptionalLength AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO HttpSendRequest = HttpSendRequestW
#ELSE
 MACRO HttpSendRequest = HttpSendRequestA
#ENDIF
DECLARE FUNCTION HttpSendRequestExA LIB "wininet.dll" ALIAS "HttpSendRequestExA" ( BYVAL hRequest AS QUAD , BYREF lpBuffersIn AS INTERNET_BUFFERSA , BYREF lpBuffersOut AS INTERNET_BUFFERSA , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS LONG
DECLARE FUNCTION HttpSendRequestExW LIB "wininet.dll" ALIAS "HttpSendRequestExW" ( BYVAL hRequest AS QUAD
 , BYREF lpBuffersIn AS INTERNET_BUFFERSW
 , BYREF lpBuffersOut AS INTERNET_BUFFERSW
 , BYVAL dwFlags AS DWORD
 , OPTIONAL BYVAL dwContext AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO HttpSendRequestEx = HttpSendRequestExW
#ELSE
 MACRO HttpSendRequestEx = HttpSendRequestExA
#ENDIF
'//
'// flags for HttpSendRequestEx(), HttpEndRequest()
'//
%EQUATE `HSR_ASYNC = %WININET_API_FLAG_ASYNC ' force async
%EQUATE `HSR_SYNC = %WININET_API_FLAG_SYNC ' force sync
%EQUATE `HSR_USE_CONTEXT = %WININET_API_FLAG_USE_CONTEXT ' use dwContext value
%EQUATE `HSR_INITIATE = &H00000008 ' iterative operation (completed by HttpEndRequest)
%EQUATE `HSR_DOWNLOAD = &H00000010 ' download to file
%EQUATE `HSR_CHUNKED = &H00000020 ' operation is send of chunked data
DECLARE FUNCTION HttpEndRequestA LIB "wininet.dll" ALIAS "HttpEndRequestA" ( BYVAL hRequest AS QUAD , BYREF lpBuffersOut AS INTERNET_BUFFERSA , BYVAL dwFlags AS QUAD , OPTIONAL BYVAL dwContext AS QUAD ) AS LONG
DECLARE FUNCTION HttpEndRequestW LIB "wininet.dll" ALIAS "HttpEndRequestW" ( BYVAL hRequest AS QUAD
 , BYREF lpBuffersOut AS INTERNET_BUFFERSW
 , BYVAL dwFlags AS DWORD
 , OPTIONAL BYVAL dwContext AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO HttpEndRequest = HttpEndRequestW
#ELSE
 MACRO HttpEndRequest = HttpEndRequestA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION HttpQueryInfoA LIB "WinINet.dll" ALIAS "HttpQueryInfoA" ( BYVAL hRequest AS QUAD, ' in
 BYVAL dwInfoLevel AS DWORD, ' in
 BYVAL lpBuffer AS BYTE PTR, ' in, out
 lpdwBufferLength AS DWORD, ' in, out
 BYVAL lpdwIndex AS DWORD PTR ' in, out
 ) AS LONG
#ELSE
DECLARE FUNCTION HttpQueryInfoA LIB "wininet.dll" ALIAS "HttpQueryInfoA" ( BYVAL hRequest AS QUAD , BYVAL dwInfoLevel AS QUAD , BYREF lpBuffer AS ANY , BYREF lpdwBufferLength AS QUAD , OPTIONAL BYREF lpdwIndex AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION HttpQueryInfoW LIB "WinINet.dll" ALIAS "HttpQueryInfoW" ( BYVAL hRequest AS QUAD, ' in
 BYVAL dwInfoLevel AS DWORD, ' in
 BYVAL lpBuffer AS BYTE PTR, ' in, out
 lpdwBufferLength AS DWORD, ' in, out
 BYVAL lpdwIndex AS DWORD PTR ' in, out
 ) AS LONG
#ELSE
DECLARE FUNCTION HttpQueryInfoW LIB "wininet.dll" ALIAS "HttpQueryInfoW" ( BYVAL hRequest AS QUAD , BYVAL dwInfoLevel AS QUAD , BYREF lpBuffer AS ANY , BYREF lpdwBufferLength AS QUAD , OPTIONAL BYREF lpdwIndex AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO HttpQueryInfo = HttpQueryInfoW
#ELSE
 MACRO HttpQueryInfo = HttpQueryInfoA
#ENDIF
'//
'// Cookie APIs
'//
%EQUATE `INTERNET_COOKIE_IS_SECURE = &H01
%EQUATE `INTERNET_COOKIE_IS_SESSION = &H02
%EQUATE `INTERNET_COOKIE_THIRD_PARTY = &H10
%EQUATE `INTERNET_COOKIE_PROMPT_REQUIRED = &H20
%EQUATE `INTERNET_COOKIE_EVALUATE_P3P = &H40
%EQUATE `INTERNET_COOKIE_APPLY_P3P = &H80
%EQUATE `INTERNET_COOKIE_P3P_ENABLED = &H100
%EQUATE `INTERNET_COOKIE_IS_RESTRICTED = &H200
%EQUATE `INTERNET_COOKIE_IE6 = &H400
%EQUATE `INTERNET_COOKIE_IS_LEGACY = &H800
%EQUATE `INTERNET_COOKIE_NON_SCRIPT = &H00001000
%EQUATE `INTERNET_COOKIE_HTTPONLY = &H00002000
DECLARE FUNCTION InternetSetCookieA LIB "wininet.dll" ALIAS "InternetSetCookieA" ( BYREF lpszUrl AS ASCIIZ , BYREF lpszCookieName AS ASCIIZ , BYREF lpszCookieData AS ASCIIZ ) AS LONG
DECLARE FUNCTION InternetSetCookieW LIB "wininet.dll" ALIAS "InternetSetCookieW" ( BYREF lpszUrl AS WSTRINGZ
 , BYREF lpszCookieName AS WSTRINGZ
 , BYREF lpszCookieData AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetSetCookie = InternetSetCookieW
#ELSE
 MACRO InternetSetCookie = InternetSetCookieA
#ENDIF
DECLARE FUNCTION InternetGetCookieA LIB "wininet.dll" ALIAS "InternetGetCookieA" ( BYREF lpszUrl AS ASCIIZ , BYREF lpszCookieName AS ASCIIZ , BYREF lpszCookieData AS ASCIIZ , BYREF lpdwSize AS QUAD ) AS LONG
DECLARE FUNCTION InternetGetCookieW LIB "wininet.dll" ALIAS "InternetGetCookieW" ( BYREF lpszUrl AS WSTRINGZ
 , BYREF lpszCookieName AS WSTRINGZ
 , BYREF lpszCookieData AS WSTRINGZ
 , BYREF lpdwSize AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetGetCookie = InternetGetCookieW
#ELSE
 MACRO InternetGetCookie = InternetGetCookieA
#ENDIF
DECLARE FUNCTION InternetSetCookieExA LIB "wininet.dll" ALIAS "InternetSetCookieExA" ( BYREF lpszUrl AS ASCIIZ , BYREF lpszCookieName AS ASCIIZ , BYREF lpszCookieData AS ASCIIZ , BYVAL dwFlags AS QUAD , BYVAL dwReserved AS QUAD ) AS QUAD
DECLARE FUNCTION InternetSetCookieExW LIB "wininet.dll" ALIAS "InternetSetCookieExW" ( BYREF lpszUrl AS WSTRINGZ
 , BYREF lpszCookieName AS WSTRINGZ
 , BYREF lpszCookieData AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , BYVAL dwReserved AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO InternetSetCookieEx = InternetSetCookieExW
#ELSE
 MACRO InternetSetCookieEx = InternetSetCookieExA
#ENDIF
DECLARE FUNCTION InternetGetCookieExA LIB "wininet.dll" ALIAS "InternetGetCookieExA" ( BYREF lpszUrl AS ASCIIZ , BYREF lpszCookieName AS ASCIIZ , BYREF lpszCookieData AS ASCIIZ , BYREF lpdwSize AS QUAD , BYVAL dwFlags AS QUAD , BYVAL lpReserved AS QUAD ) AS LONG
DECLARE FUNCTION InternetGetCookieExW LIB "wininet.dll" ALIAS "InternetGetCookieExW" ( BYREF lpszUrl AS WSTRINGZ
 , BYREF lpszCookieName AS WSTRINGZ
 , BYREF lpszCookieData AS WSTRINGZ
 , BYREF lpdwSize AS DWORD
 , BYVAL dwFlags AS DWORD
 , BYVAL lpReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetGetCookieEx = InternetGetCookieExW
#ELSE
 MACRO InternetGetCookieEx = InternetGetCookieExA
#ENDIF
'//
'// offline browsing
'//
DECLARE FUNCTION InternetAttemptConnect LIB "wininet.dll" ALIAS "InternetAttemptConnect" ( BYVAL dwReserved AS QUAD ) AS QUAD
DECLARE FUNCTION InternetCheckConnectionA LIB "wininet.dll" ALIAS "InternetCheckConnectionA" ( BYREF lpszUrl AS ASCIIZ
 , BYVAL dwFlags AS DWORD
 , BYVAL dwReserved AS DWORD
 ) AS LONG
DECLARE FUNCTION InternetCheckConnectionW LIB "wininet.dll" ALIAS "InternetCheckConnectionW" ( BYREF lpszUrl AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , BYVAL dwReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetCheckConnection = InternetCheckConnectionW
#ELSE
 MACRO InternetCheckConnection = InternetCheckConnectionA
#ENDIF
%EQUATE `FLAG_ICC_FORCE_CONNECTION = &H00000001
'//
'// Internet UI
'//
'//
'// InternetErrorDlg - Provides UI for certain Errors.
'//
%EQUATE `FLAGS_ERROR_UI_FILTER_FOR_ERRORS = &H01
%EQUATE `FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS = &H02
%EQUATE `FLAGS_ERROR_UI_FLAGS_GENERATE_DATA = &H04
%EQUATE `FLAGS_ERROR_UI_FLAGS_NO_UI = &H08
%EQUATE `FLAGS_ERROR_UI_SERIALIZE_DIALOGS = &H10
'//
'// If SERIALIZE_DIALOGS flag set, client should implement thread-safe non-blocking callback...
'//
'DWORD InternetAuthNotifyCallback
'(
' DWORD_PTR dwContext, // as passed to InternetErrorDlg
' DWORD dwReturn, // error code: success, resend, or cancel
' LPVOID lpReserved // reserved: will be set to null
');
'typedef DWORD (CALLBACK * PFN_AUTH_NOTIFY) (DWORD_PTR, DWORD, LPVOID);
'//
'// ... and last parameter of InternetErrorDlg should point to...
'//
' // Size = 16 bytes
TYPE INTERNET_AUTH_NOTIFY_DATA DWORD
 cbStruct AS DWORD ' DWORD // size of this structure
 dwOptions AS DWORD ' DWORD // reserved: must be set to 0
 pfnNotify AS DWORD ' PFN_AUTH_NOTIFY // notification callback to retry InternetErrorDlg
 dwContext AS DWORD ' DWORD_PTR // context to pass to to notification function
END TYPE
DECLARE FUNCTION ResumeSuspendedDownload LIB "wininet.dll" ALIAS "ResumeSuspendedDownload" ( BYVAL hRequest AS QUAD , BYVAL dwResultCode AS QUAD ) AS LONG
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION InternetErrorDlg LIB "WinINet.dll" ALIAS "InternetErrorDlg" ( BYVAL hWnd AS QUAD, ' in
 hRequest AS DWORD, ' in, out
 BYVAL dwError AS DWORD, ' in
 BYVAL dwFlags AS DWORD, ' in
 BYVAL lppvData AS BYTE PTR ' in, out
 ) AS DWORD
#ELSE
DECLARE FUNCTION InternetErrorDlg LIB "wininet.dll" ALIAS "InternetErrorDlg" ( BYVAL hWnd AS QUAD , BYREF hRequest AS QUAD , BYVAL dwError AS QUAD , BYVAL dwFlags AS QUAD , OPTIONAL BYREF lppvData AS ANY ) AS QUAD
#ENDIF
DECLARE FUNCTION InternetConfirmZoneCrossingA LIB "wininet.dll" ALIAS "InternetConfirmZoneCrossingA" ( BYVAL hWnd AS QUAD , BYREF szUrlPrev AS ASCIIZ , BYREF szUrlNew AS ASCIIZ , BYVAL bPost AS LONG ) AS QUAD
DECLARE FUNCTION InternetConfirmZoneCrossingW LIB "wininet.dll" ALIAS "InternetConfirmZoneCrossingW" ( BYVAL hWnd AS QUAD
 , BYREF szUrlPrev AS WSTRINGZ
 , BYREF szUrlNew AS WSTRINGZ
 , BYVAL bPost AS LONG
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO InternetConfirmZoneCrossing = InternetConfirmZoneCrossingW
#ELSE
 MACRO InternetConfirmZoneCrossing = InternetConfirmZoneCrossingA
#ENDIF
'#endif // !UNICODE
'//#if !defined(_WINERROR_)
'//
'// Internet API error returns
'//
%EQUATE `INTERNET_ERROR_BASE = 12000
%EQUATE `ERROR_INTERNET_OUT_OF_HANDLES = (%INTERNET_ERROR_BASE + 1)
%EQUATE `ERROR_INTERNET_TIMEOUT = (%INTERNET_ERROR_BASE + 2)
%EQUATE `ERROR_INTERNET_EXTENDED_ERROR = (%INTERNET_ERROR_BASE + 3)
%EQUATE `ERROR_INTERNET_INTERNAL_ERROR = (%INTERNET_ERROR_BASE + 4)
%EQUATE `ERROR_INTERNET_INVALID_URL = (%INTERNET_ERROR_BASE + 5)
%EQUATE `ERROR_INTERNET_UNRECOGNIZED_SCHEME = (%INTERNET_ERROR_BASE + 6)
%EQUATE `ERROR_INTERNET_NAME_NOT_RESOLVED = (%INTERNET_ERROR_BASE + 7)
%EQUATE `ERROR_INTERNET_PROTOCOL_NOT_FOUND = (%INTERNET_ERROR_BASE + 8)
%EQUATE `ERROR_INTERNET_INVALID_OPTION = (%INTERNET_ERROR_BASE + 9)
%EQUATE `ERROR_INTERNET_BAD_OPTION_LENGTH = (%INTERNET_ERROR_BASE + 10)
%EQUATE `ERROR_INTERNET_OPTION_NOT_SETTABLE = (%INTERNET_ERROR_BASE + 11)
%EQUATE `ERROR_INTERNET_SHUTDOWN = (%INTERNET_ERROR_BASE + 12)
%EQUATE `ERROR_INTERNET_INCORRECT_USER_NAME = (%INTERNET_ERROR_BASE + 13)
%EQUATE `ERROR_INTERNET_INCORRECT_PASSWORD = (%INTERNET_ERROR_BASE + 14)
%EQUATE `ERROR_INTERNET_LOGIN_FAILURE = (%INTERNET_ERROR_BASE + 15)
%EQUATE `ERROR_INTERNET_INVALID_OPERATION = (%INTERNET_ERROR_BASE + 16)
%EQUATE `ERROR_INTERNET_OPERATION_CANCELLED = (%INTERNET_ERROR_BASE + 17)
%EQUATE `ERROR_INTERNET_INCORRECT_HANDLE_TYPE = (%INTERNET_ERROR_BASE + 18)
%EQUATE `ERROR_INTERNET_INCORRECT_HANDLE_STATE = (%INTERNET_ERROR_BASE + 19)
%EQUATE `ERROR_INTERNET_NOT_PROXY_REQUEST = (%INTERNET_ERROR_BASE + 20)
%EQUATE `ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND = (%INTERNET_ERROR_BASE + 21)
%EQUATE `ERROR_INTERNET_BAD_REGISTRY_PARAMETER = (%INTERNET_ERROR_BASE + 22)
%EQUATE `ERROR_INTERNET_NO_DIRECT_ACCESS = (%INTERNET_ERROR_BASE + 23)
%EQUATE `ERROR_INTERNET_NO_CONTEXT = (%INTERNET_ERROR_BASE + 24)
%EQUATE `ERROR_INTERNET_NO_CALLBACK = (%INTERNET_ERROR_BASE + 25)
%EQUATE `ERROR_INTERNET_REQUEST_PENDING = (%INTERNET_ERROR_BASE + 26)
%EQUATE `ERROR_INTERNET_INCORRECT_FORMAT = (%INTERNET_ERROR_BASE + 27)
%EQUATE `ERROR_INTERNET_ITEM_NOT_FOUND = (%INTERNET_ERROR_BASE + 28)
%EQUATE `ERROR_INTERNET_CANNOT_CONNECT = (%INTERNET_ERROR_BASE + 29)
%EQUATE `ERROR_INTERNET_CONNECTION_ABORTED = (%INTERNET_ERROR_BASE + 30)
%EQUATE `ERROR_INTERNET_CONNECTION_RESET = (%INTERNET_ERROR_BASE + 31)
%EQUATE `ERROR_INTERNET_FORCE_RETRY = (%INTERNET_ERROR_BASE + 32)
%EQUATE `ERROR_INTERNET_INVALID_PROXY_REQUEST = (%INTERNET_ERROR_BASE + 33)
%EQUATE `ERROR_INTERNET_NEED_UI = (%INTERNET_ERROR_BASE + 34)
%EQUATE `ERROR_INTERNET_HANDLE_EXISTS = (%INTERNET_ERROR_BASE + 36)
%EQUATE `ERROR_INTERNET_SEC_CERT_DATE_INVALID = (%INTERNET_ERROR_BASE + 37)
%EQUATE `ERROR_INTERNET_SEC_CERT_CN_INVALID = (%INTERNET_ERROR_BASE + 38)
%EQUATE `ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR = (%INTERNET_ERROR_BASE + 39)
%EQUATE `ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR = (%INTERNET_ERROR_BASE + 40)
%EQUATE `ERROR_INTERNET_MIXED_SECURITY = (%INTERNET_ERROR_BASE + 41)
%EQUATE `ERROR_INTERNET_CHG_POST_IS_NON_SECURE = (%INTERNET_ERROR_BASE + 42)
%EQUATE `ERROR_INTERNET_POST_IS_NON_SECURE = (%INTERNET_ERROR_BASE + 43)
%EQUATE `ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED = (%INTERNET_ERROR_BASE + 44)
%EQUATE `ERROR_INTERNET_INVALID_CA = (%INTERNET_ERROR_BASE + 45)
%EQUATE `ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP = (%INTERNET_ERROR_BASE + 46)
%EQUATE `ERROR_INTERNET_ASYNC_THREAD_FAILED = (%INTERNET_ERROR_BASE + 47)
%EQUATE `ERROR_INTERNET_REDIRECT_SCHEME_CHANGE = (%INTERNET_ERROR_BASE + 48)
%EQUATE `ERROR_INTERNET_DIALOG_PENDING = (%INTERNET_ERROR_BASE + 49)
%EQUATE `ERROR_INTERNET_RETRY_DIALOG = (%INTERNET_ERROR_BASE + 50)
%EQUATE `ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR = (%INTERNET_ERROR_BASE + 52)
%EQUATE `ERROR_INTERNET_INSERT_CDROM = (%INTERNET_ERROR_BASE + 53)
%EQUATE `ERROR_INTERNET_FORTEZZA_LOGIN_NEEDED = (%INTERNET_ERROR_BASE + 54)
%EQUATE `ERROR_INTERNET_SEC_CERT_ERRORS = (%INTERNET_ERROR_BASE + 55)
%EQUATE `ERROR_INTERNET_SEC_CERT_NO_REV = (%INTERNET_ERROR_BASE + 56)
%EQUATE `ERROR_INTERNET_SEC_CERT_REV_FAILED = (%INTERNET_ERROR_BASE + 57)
'//
'// FTP API errors
'//
%EQUATE `ERROR_FTP_TRANSFER_IN_PROGRESS = (%INTERNET_ERROR_BASE + 110)
%EQUATE `ERROR_FTP_DROPPED = (%INTERNET_ERROR_BASE + 111)
%EQUATE `ERROR_FTP_NO_PASSIVE_MODE = (%INTERNET_ERROR_BASE + 112)
'//
'// gopher API errors
'//
%EQUATE `ERROR_GOPHER_PROTOCOL_ERROR = (%INTERNET_ERROR_BASE + 130)
%EQUATE `ERROR_GOPHER_NOT_FILE = (%INTERNET_ERROR_BASE + 131)
%EQUATE `ERROR_GOPHER_DATA_ERROR = (%INTERNET_ERROR_BASE + 132)
%EQUATE `ERROR_GOPHER_END_OF_DATA = (%INTERNET_ERROR_BASE + 133)
%EQUATE `ERROR_GOPHER_INVALID_LOCATOR = (%INTERNET_ERROR_BASE + 134)
%EQUATE `ERROR_GOPHER_INCORRECT_LOCATOR_TYPE = (%INTERNET_ERROR_BASE + 135)
%EQUATE `ERROR_GOPHER_NOT_GOPHER_PLUS = (%INTERNET_ERROR_BASE + 136)
%EQUATE `ERROR_GOPHER_ATTRIBUTE_NOT_FOUND = (%INTERNET_ERROR_BASE + 137)
%EQUATE `ERROR_GOPHER_UNKNOWN_LOCATOR = (%INTERNET_ERROR_BASE + 138)
'//
'// HTTP API errors
'//
%EQUATE `ERROR_HTTP_HEADER_NOT_FOUND = (%INTERNET_ERROR_BASE + 150)
%EQUATE `ERROR_HTTP_DOWNLEVEL_SERVER = (%INTERNET_ERROR_BASE + 151)
%EQUATE `ERROR_HTTP_INVALID_SERVER_RESPONSE = (%INTERNET_ERROR_BASE + 152)
%EQUATE `ERROR_HTTP_INVALID_HEADER = (%INTERNET_ERROR_BASE + 153)
%EQUATE `ERROR_HTTP_INVALID_QUERY_REQUEST = (%INTERNET_ERROR_BASE + 154)
%EQUATE `ERROR_HTTP_HEADER_ALREADY_EXISTS = (%INTERNET_ERROR_BASE + 155)
%EQUATE `ERROR_HTTP_REDIRECT_FAILED = (%INTERNET_ERROR_BASE + 156)
%EQUATE `ERROR_HTTP_NOT_REDIRECTED = (%INTERNET_ERROR_BASE + 160)
%EQUATE `ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION = (%INTERNET_ERROR_BASE + 161)
%EQUATE `ERROR_HTTP_COOKIE_DECLINED = (%INTERNET_ERROR_BASE + 162)
%EQUATE `ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION = (%INTERNET_ERROR_BASE + 168)
'//
'// additional Internet API error codes
'//
%EQUATE `ERROR_INTERNET_SECURITY_CHANNEL_ERROR = (%INTERNET_ERROR_BASE + 157)
%EQUATE `ERROR_INTERNET_UNABLE_TO_CACHE_FILE = (%INTERNET_ERROR_BASE + 158)
%EQUATE `ERROR_INTERNET_TCPIP_NOT_INSTALLED = (%INTERNET_ERROR_BASE + 159)
%EQUATE `ERROR_INTERNET_DISCONNECTED = (%INTERNET_ERROR_BASE + 163)
%EQUATE `ERROR_INTERNET_SERVER_UNREACHABLE = (%INTERNET_ERROR_BASE + 164)
%EQUATE `ERROR_INTERNET_PROXY_SERVER_UNREACHABLE = (%INTERNET_ERROR_BASE + 165)
%EQUATE `ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT = (%INTERNET_ERROR_BASE + 166)
%EQUATE `ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT = (%INTERNET_ERROR_BASE + 167)
%EQUATE `ERROR_INTERNET_SEC_INVALID_CERT = (%INTERNET_ERROR_BASE + 169)
%EQUATE `ERROR_INTERNET_SEC_CERT_REVOKED = (%INTERNET_ERROR_BASE + 170)
'// InternetAutodial specific errors
%EQUATE `ERROR_INTERNET_FAILED_DUETOSECURITYCHECK = (%INTERNET_ERROR_BASE + 171)
%EQUATE `ERROR_INTERNET_NOT_INITIALIZED = (%INTERNET_ERROR_BASE + 172)
%EQUATE `ERROR_INTERNET_NEED_MSN_SSPI_PKG = (%INTERNET_ERROR_BASE + 173)
%EQUATE `ERROR_INTERNET_LOGIN_FAILURE_DISPLAY_ENTITY_BODY = (%INTERNET_ERROR_BASE + 174)
'// Decoding/Decompression specific errors
%EQUATE `ERROR_INTERNET_DECODING_FAILED = %INTERNET_ERROR_BASE + 175
%EQUATE `INTERNET_ERROR_LAST = %ERROR_INTERNET_DECODING_FAILED
'//#endif // !defined(_WINERROR_)
'//
'// URLCACHE APIs
'//
'//
'// datatype definitions.
'//
'//
'// cache entry type flags.
'//
%EQUATE `NORMAL_CACHE_ENTRY = &H00000001
%EQUATE `STICKY_CACHE_ENTRY = &H00000004
%EQUATE `EDITED_CACHE_ENTRY = &H00000008
%EQUATE `TRACK_OFFLINE_CACHE_ENTRY = &H00000010
%EQUATE `TRACK_ONLINE_CACHE_ENTRY = &H00000020
%EQUATE `SPARSE_CACHE_ENTRY = &H00010000
%EQUATE `COOKIE_CACHE_ENTRY = &H00100000
%EQUATE `URLHISTORY_CACHE_ENTRY = &H00200000
%EQUATE `URLCACHE_FIND_DEFAULT_FILTER = %NORMAL_CACHE_ENTRY OR %COOKIE_CACHE_ENTRY OR %URLHISTORY_CACHE_ENTRY OR %TRACK_OFFLINE_CACHE_ENTRY OR %TRACK_ONLINE_CACHE_ENTRY OR %STICKY_CACHE_ENTRY
'//
'// INTERNET_CACHE_ENTRY_INFO -
'//
'#if _MSC_VER >= 1200
'#pragma warning(push)
'#endif
'#pragma warning(disable:4201)
'typedef struct _INTERNET_CACHE_ENTRY_INFOA {
' DWORD dwStructSize; // version of cache system.
' LPSTR lpszSourceUrlName; // embedded pointer to the URL name string.
' LPSTR lpszLocalFileName; // embedded pointer to the local file name.
' DWORD CacheEntryType; // cache type bit mask.
' DWORD dwUseCount; // current users count of the cache entry.
' DWORD dwHitRate; // num of times the cache entry was retrieved.
' DWORD dwSizeLow; // low DWORD of the file size.
' DWORD dwSizeHigh; // high DWORD of the file size.
' FILETIME LastModifiedTime; // last modified time of the file in GMT format.
' FILETIME ExpireTime; // expire time of the file in GMT format
' FILETIME LastAccessTime; // last accessed time in GMT format
' FILETIME LastSyncTime; // last time the URL was synchronized
' // with the source
' LPSTR lpHeaderInfo; // embedded pointer to the header info.
' DWORD dwHeaderInfoSize; // size of the above header.
' LPSTR lpszFileExtension; // File extension used to retrive the urldata as a file.
' union { // Exemption delta from last access time.
' DWORD dwReserved;
' DWORD dwExemptDelta;
' }; // Exemption delta from last access
'} INTERNET_CACHE_ENTRY_INFOA, * LPINTERNET_CACHE_ENTRY_INFOA;
' // Size = 80 bytes
TYPE INTERNET_CACHE_ENTRY_INFOA DWORD
 dwStructSize AS DWORD ' DWORD // version of cache system.
 lpszSourceUrlName AS ASCIIZ PTR ' LPSTR // embedded pointer to the URL name string.
 lpszLocalFileName AS ASCIIZ PTR ' LPSTR // embedded pointer to the local file name.
 CacheEntryType AS DWORD ' DWORD // cache type bit mask.
 dwUseCount AS DWORD ' DWORD // current users count of the cache entry.
 dwHitRate AS DWORD ' DWORD // num of times the cache entry was retrieved.
 dwSizeLow AS DWORD ' DWORD // low DWORD of the file size.
 dwSizeHigh AS DWORD ' DWORD // high DWORD of the file size.
 LastModifiedTime AS FILETIME ' FILETIME // last modified time of the file in GMT format.
 ExpireTime AS FILETIME ' FILETIME // expire time of the file in GMT format
 LastAccessTime AS FILETIME ' FILETIME // last accessed time in GMT format
 LastSyncTime AS FILETIME ' FILETIME // last time the URL was synchronized with the source
 lpHeaderInfo AS BYTE PTR ' LPBYTE // embedded pointer to the header info.
 dwHeaderInfoSize AS DWORD ' DWORD // size of the above header.
 lpszFileExtension AS ASCIIZ PTR ' LPSTR // File extension used to retrieve the urldata as a file.
 dwExemptDelta AS DWORD ' DWORD // Exemption delta from last access time.
END TYPE
'typedef struct _INTERNET_CACHE_ENTRY_INFOW {
' DWORD dwStructSize; // version of cache system.
' LPWSTR lpszSourceUrlName; // embedded pointer to the URL name string.
' LPWSTR lpszLocalFileName; // embedded pointer to the local file name.
' DWORD CacheEntryType; // cache type bit mask.
' DWORD dwUseCount; // current users count of the cache entry.
' DWORD dwHitRate; // num of times the cache entry was retrieved.
' DWORD dwSizeLow; // low DWORD of the file size.
' DWORD dwSizeHigh; // high DWORD of the file size.
' FILETIME LastModifiedTime; // last modified time of the file in GMT format.
' FILETIME ExpireTime; // expire time of the file in GMT format
' FILETIME LastAccessTime; // last accessed time in GMT format
' FILETIME LastSyncTime; // last time the URL was synchronized
' // with the source
' LPWSTR lpHeaderInfo; // embedded pointer to the header info.
' DWORD dwHeaderInfoSize; // size of the above header.
' LPWSTR lpszFileExtension; // File extension used to retrive the urldata as a file.
' union { // Exemption delta from last access time.
' DWORD dwReserved;
' DWORD dwExemptDelta;
' }; // Exemption delta from last access
'} INTERNET_CACHE_ENTRY_INFOW, * LPINTERNET_CACHE_ENTRY_INFOW;
' // Size = 80 bytes
TYPE INTERNET_CACHE_ENTRY_INFOW
 dwStructSize AS DWORD ' DWORD // version of cache system.
 lpszSourceUrlName AS WSTRINGZ PTR ' LPWSTR // embedded pointer to the URL name string.
 lpszLocalFileName AS WSTRINGZ PTR ' LPWSTR // embedded pointer to the local file name.
 CacheEntryType AS DWORD ' DWORD // cache type bit mask.
 dwUseCount AS DWORD ' DWORD // current users count of the cache entry.
 dwHitRate AS DWORD ' DWORD // num of times the cache entry was retrieved.
 dwSizeLow AS DWORD ' DWORD // low DWORD of the file size.
 dwSizeHigh AS DWORD ' DWORD // high DWORD of the file size.
 LastModifiedTime AS FILETIME ' FILETIME // last modified time of the file in GMT format.
 ExpireTime AS FILETIME ' FILETIME // expire time of the file in GMT format
 LastAccessTime AS FILETIME ' FILETIME // last accessed time in GMT format
 LastSyncTime AS FILETIME ' FILETIME // last time the URL was synchronized with the source
 lpHeaderInfo AS BYTE PTR ' LPBYTE // embedded pointer to the header info.
 dwHeaderInfoSize AS DWORD ' DWORD // size of the above header.
 lpszFileExtension AS WSTRINGZ PTR ' LPWSTR // File extension used to retrieve the urldata as a file.
 dwExemptDelta AS DWORD ' DWORD // Exemption delta from last access time.
END TYPE
#IF %DEF(%UNICODE)
 MACRO INTERNET_CACHE_ENTRY_INFO = INTERNET_CACHE_ENTRY_INFOW
#ELSE
 MACRO INTERNET_CACHE_ENTRY_INFO = INTERNET_CACHE_ENTRY_INFOA
#ENDIF
'#if _MSC_VER >= 1200
'#pragma warning(pop)
'#else
'#pragma warning(default:4201)
'#endif
' // Size = 16 bytes
TYPE INTERNET_CACHE_TIMESTAMPS DWORD
 ftExpires AS FILETIME
 ftLastModified AS FILETIME
END TYPE
'//
'// Cache Group
'//
'typedef LONGLONG GROUPID;
'//
'// Cache Group Flags
'//
%EQUATE `CACHEGROUP_ATTRIBUTE_GET_ALL = &Hffffffff
%EQUATE `CACHEGROUP_ATTRIBUTE_BASIC = &H00000001
%EQUATE `CACHEGROUP_ATTRIBUTE_FLAG = &H00000002
%EQUATE `CACHEGROUP_ATTRIBUTE_TYPE = &H00000004
%EQUATE `CACHEGROUP_ATTRIBUTE_QUOTA = &H00000008
%EQUATE `CACHEGROUP_ATTRIBUTE_GROUPNAME = &H00000010
%EQUATE `CACHEGROUP_ATTRIBUTE_STORAGE = &H00000020
%EQUATE `CACHEGROUP_FLAG_NONPURGEABLE = &H00000001
%EQUATE `CACHEGROUP_FLAG_GIDONLY = &H00000004
%EQUATE `CACHEGROUP_FLAG_FLUSHURL_ONDELETE = &H00000002
%EQUATE `CACHEGROUP_SEARCH_ALL = &H00000000
%EQUATE `CACHEGROUP_SEARCH_BYURL = &H00000001
%EQUATE `CACHEGROUP_TYPE_INVALID = &H00000001
'//
'// updatable cache group fields
'//
%EQUATE `CACHEGROUP_READWRITE_MASK = %CACHEGROUP_ATTRIBUTE_TYPE OR %CACHEGROUP_ATTRIBUTE_QUOTA OR %CACHEGROUP_ATTRIBUTE_GROUPNAME OR %CACHEGROUP_ATTRIBUTE_STORAGE
'//
'// INTERNET_CACHE_GROUP_INFO
'//
%EQUATE `GROUPNAME_MAX_LENGTH = 120
%EQUATE `GROUP_OWNER_STORAGE_SIZE = 4
' // Size = 156 bytes
TYPE INTERNET_CACHE_GROUP_INFOA
 dwGroupSize AS DWORD
 dwGroupFlags AS DWORD
 dwGroupType AS DWORD
 dwDiskUsage AS DWORD ' DWORD // in KB
 dwDiskQuota AS DWORD ' DWORD // in KB
 dwOwnerStorage(%GROUP_OWNER_STORAGE_SIZE - 1) AS DWORD ' DWORD[GROUP_OWNER_STORAGE_SIZE]
 szGroupName AS ASCIIZ * %GROUPNAME_MAX_LENGTH ' CHAR[GROUPNAME_MAX_LENGTH]
END TYPE
' // Size = 276 bytes
TYPE INTERNET_CACHE_GROUP_INFOW
 dwGroupSize AS DWORD
 dwGroupFlags AS DWORD
 dwGroupType AS DWORD
 dwDiskUsage AS DWORD ' DWORD // in KB
 dwDiskQuota AS DWORD ' DWORD // in KB
 dwOwnerStorage(%GROUP_OWNER_STORAGE_SIZE - 1) AS DWORD ' DWORD[GROUP_OWNER_STORAGE_SIZE]
 szGroupName AS WSTRINGZ * %GROUPNAME_MAX_LENGTH ' WCHAR[GROUPNAME_MAX_LENGTH]
END TYPE
#IF %DEF(%UNICODE)
 MACRO INTERNET_CACHE_GROUP_INFO = INTERNET_CACHE_GROUP_INFOW
#ELSE
 MACRO INTERNET_CACHE_GROUP_INFO = INTERNET_CACHE_GROUP_INFOA
#ENDIF
'//
'// Cache APIs
'//
DECLARE FUNCTION CreateUrlCacheEntryA LIB "wininet.dll" ALIAS "CreateUrlCacheEntryA" ( BYREF lpszUrl AS ASCIIZ , BYVAL dwExpectedFileSize AS QUAD , BYREF lpszFileExtension AS ASCIIZ , BYREF lpszFileName AS ASCIIZ , BYVAL dwReserved AS QUAD ) AS LONG
DECLARE FUNCTION CreateUrlCacheEntryW LIB "wininet.dll" ALIAS "CreateUrlCacheEntryW" ( BYREF lpszUrl AS WSTRINGZ
 , BYVAL dwExpectedFileSize AS DWORD
 , BYREF lpszFileExtension AS WSTRINGZ
 , BYREF lpszFileName AS WSTRINGZ
 , BYVAL dwReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO CreateUrlCacheEntry = CreateUrlCacheEntryW
#ELSE
 MACRO CreateUrlCacheEntry = CreateUrlCacheEntryA
#ENDIF
'#ifndef USE_FIXED_COMMIT_URL_CACHE_ENTRY
'// Temporary state of affairs until we reconcile our apis.
'// Why are we doing this? HeaderInfo _should_ be string data.
'// However, one group is passing binary data instead. For the
'// unicode api, we've decided to disallow this, but this
'// brings up an inconsistency between the u and a apis, which
'// is undesirable.
'// For Beta 1, we'll go with this behaviour, but in future releases
'// we want to make these apis consistent.
DECLARE FUNCTION CommitUrlCacheEntryA LIB "wininet.dll" ALIAS "CommitUrlCacheEntryA" ( BYREF lpszUrlName AS ASCIIZ , BYREF lpszLocalFileName AS ASCIIZ , BYVAL ExpireTime AS FILETIME , BYVAL LastModifiedTime AS FILETIME , BYVAL CacheEntryType AS QUAD , BYVAL lpHeaderInfo AS BYTE PTR , BYREF dwHeaderSize AS QUAD , BYREF lpszFileExtension AS ASCIIZ , OPTIONAL BYREF lpszOriginalUrl AS ASCIIZ ) AS LONG
DECLARE FUNCTION CommitUrlCacheEntryW LIB "wininet.dll" ALIAS "CommitUrlCacheEntryW" ( BYREF lpszUrlName AS WSTRINGZ
 , BYREF lpszLocalFileName AS WSTRINGZ
 , BYVAL ExpireTime AS FILETIME
 , BYVAL LastModifiedTime AS FILETIME
 , BYVAL CacheEntryType AS DWORD
 , BYREF lpHeaderInfo AS WSTRINGZ
 , BYREF dwHeaderSize AS DWORD
 , BYREF lpszFileExtension AS WSTRINGZ
 , OPTIONAL BYREF lpszOriginalUrl AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO CommitUrlCacheEntry = CommitUrlCacheEntryW
#ELSE
 MACRO CommitUrlCacheEntry = CommitUrlCacheEntryA
#ENDIF
DECLARE FUNCTION RetrieveUrlCacheEntryFileA LIB "wininet.dll" ALIAS "RetrieveUrlCacheEntryFileA" ( BYREF lpszUrl AS ASCIIZ , BYREF lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOA , BYREF lpcbCacheEntryInfo AS QUAD , BYVAL dwReserved AS QUAD ) AS LONG
DECLARE FUNCTION RetrieveUrlCacheEntryFileW LIB "wininet.dll" ALIAS "RetrieveUrlCacheEntryFileW" ( BYREF lpszUrl AS WSTRINGZ
 , BYREF lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOW
 , BYREF lpcbCacheEntryInfo AS DWORD
 , BYVAL dwReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO RetrieveUrlCacheEntryFile = RetrieveUrlCacheEntryFileW
#ELSE
 MACRO RetrieveUrlCacheEntryFile = RetrieveUrlCacheEntryFileA
#ENDIF
DECLARE FUNCTION UnlockUrlCacheEntryFileA LIB "wininet.dll" ALIAS "UnlockUrlCacheEntryFileA" ( BYREF lpszUrl AS ASCIIZ , BYVAL dwReserved AS QUAD ) AS LONG
DECLARE FUNCTION UnlockUrlCacheEntryFileW LIB "wininet.dll" ALIAS "UnlockUrlCacheEntryFileW" ( BYREF lpszUrl AS WSTRINGZ
 , BYVAL dwReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO UnlockUrlCacheEntryFile = UnlockUrlCacheEntryFileW
#ELSE
 MACRO UnlockUrlCacheEntryFile = UnlockUrlCacheEntryFileA
#ENDIF
DECLARE FUNCTION RetrieveUrlCacheEntryStreamA LIB "wininet.dll" ALIAS "RetrieveUrlCacheEntryStreamA" ( BYREF lpszUrlName AS ASCIIZ , BYREF lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOA , BYREF lpcbCacheEntryInfo AS QUAD , BYVAL fRandomRead AS LONG , BYVAL dwReserved AS QUAD ) AS QUAD
DECLARE FUNCTION RetrieveUrlCacheEntryStreamW LIB "wininet.dll" ALIAS "RetrieveUrlCacheEntryStreamW" ( BYREF lpszUrlName AS WSTRINGZ
 , BYREF lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOW
 , BYREF lpcbCacheEntryInfo AS DWORD
 , BYVAL fRandomRead AS LONG
 , BYVAL dwReserved AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO RetrieveUrlCacheEntryStream = RetrieveUrlCacheEntryStreamW
#ELSE
 MACRO RetrieveUrlCacheEntryStream = RetrieveUrlCacheEntryStreamA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION ReadUrlCacheEntryStream LIB "WinINet.dll" ALIAS "ReadUrlCacheEntryStream" ( BYVAL hUrlCacheStream AS QUAD, ' in
 BYVAL dwLocation AS DWORD, ' in
 BYVAL lpBuffer AS BYTE PTR, ' in, out
 lpdwLen AS DWORD, ' in, out
 BYVAL dwReserved AS DWORD ' in
 ) AS LONG
#ELSE
DECLARE FUNCTION ReadUrlCacheEntryStream LIB "wininet.dll" ALIAS "ReadUrlCacheEntryStream" ( BYVAL hUrlCacheStream AS QUAD , BYVAL dwLocation AS QUAD , BYREF lpBuffer AS ANY , BYREF lpdwLen AS QUAD , BYVAL Reserved AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION ReadUrlCacheEntryStreamEx LIB "WinINet.dll" ALIAS "ReadUrlCacheEntryStreamEx" ( BYVAL hUrlCacheStream AS QUAD, ' in
 BYVAL dwLocation AS QUAD, ' in
 BYVAL lpBuffer AS BYTE PTR, ' in, out
 lpdwLen AS DWORD ' in, out
 ) AS LONG
#ELSE
DECLARE FUNCTION ReadUrlCacheEntryStreamEx LIB "wininet.dll" ALIAS "ReadUrlCacheEntryStreamEx" ( BYVAL hUrlCacheStream AS QUAD , BYVAL qwLocation AS QUAD , BYREF lpBuffer AS ANY , BYREF lpdwLen AS QUAD ) AS LONG
#ENDIF
DECLARE FUNCTION UnlockUrlCacheEntryStream LIB "wininet.dll" ALIAS "UnlockUrlCacheEntryStream" ( BYVAL hUrlCacheStream AS QUAD , BYVAL Reserved AS QUAD ) AS LONG
DECLARE FUNCTION GetUrlCacheEntryInfoA LIB "wininet.dll" ALIAS "GetUrlCacheEntryInfoA" ( BYREF lpszUrl AS ASCIIZ
 , BYREF lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOA
 , OPTIONAL BYREF lpcbCacheEntryInfo AS DWORD
 ) AS LONG
DECLARE FUNCTION GetUrlCacheEntryInfoW LIB "wininet.dll" ALIAS "GetUrlCacheEntryInfoW" ( BYREF lpszUrl AS WSTRINGZ
 , BYREF lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOW
 , OPTIONAL BYREF lpcbCacheEntryInfo AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetUrlCacheEntryInfo = GetUrlCacheEntryInfoW
#ELSE
 MACRO GetUrlCacheEntryInfo = GetUrlCacheEntryInfoA
#ENDIF
DECLARE FUNCTION FindFirstUrlCacheGroup LIB "wininet.dll" ALIAS "FindFirstUrlCacheGroup" ( BYVAL dwFlags AS QUAD , BYVAL dwFlags AS QUAD , BYVAL LPVOIDlpSearchCondition AS QUAD , BYVAL dwSearchCondition AS QUAD , BYREF lpGroupId AS QUAD , BYVAL lpReserved AS QUAD ) AS QUAD
DECLARE FUNCTION FindNextUrlCacheGroup LIB "wininet.dll" ALIAS "FindNextUrlCacheGroup" ( BYVAL hFind AS QUAD
 , BYREF lpGroupId AS QUAD
 , BYVAL lpReserved AS DWORD
 ) AS LONG
DECLARE FUNCTION GetUrlCacheGroupAttributeA LIB "wininet.dll" ALIAS "GetUrlCacheGroupAttributeA" ( BYVAL gid AS QUAD
 , BYVAL dwFlags AS DWORD
 , BYVAL dwAttributes AS DWORD
 , BYREF lpGroupInfo AS INTERNET_CACHE_GROUP_INFOA
 , BYREF lpdwGroupInfo AS DWORD
 , BYVAL lpReserved AS DWORD
 ) AS LONG
DECLARE FUNCTION GetUrlCacheGroupAttributeW LIB "wininet.dll" ALIAS "GetUrlCacheGroupAttributeW" ( BYVAL gid AS QUAD
 , BYVAL dwFlags AS DWORD
 , BYVAL dwAttributes AS DWORD
 , BYREF lpGroupInfo AS INTERNET_CACHE_GROUP_INFOW
 , BYREF lpdwGroupInfo AS DWORD
 , BYVAL lpReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO GetUrlCacheGroupAttribute = GetUrlCacheGroupAttributeW
#ELSE
 MACRO GetUrlCacheGroupAttribute = GetUrlCacheGroupAttributeA
#ENDIF
DECLARE FUNCTION SetUrlCacheGroupAttributeA LIB "wininet.dll" ALIAS "SetUrlCacheGroupAttributeA" ( BYVAL gid AS QUAD , BYVAL dwFlags AS QUAD , BYVAL dwAttributes AS QUAD , BYREF lpGroupInfo AS INTERNET_CACHE_GROUP_INFOA , BYVAL lpReserved AS QUAD ) AS LONG
DECLARE FUNCTION SetUrlCacheGroupAttributeW LIB "wininet.dll" ALIAS "SetUrlCacheGroupAttributeW" ( BYVAL gid AS QUAD
 , BYVAL dwFlags AS DWORD
 , BYVAL dwAttributes AS DWORD
 , BYREF lpGroupInfo AS INTERNET_CACHE_GROUP_INFOW
 , BYVAL lpReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetUrlCacheGroupAttribute = SetUrlCacheGroupAttributeW
#ELSE
 MACRO SetUrlCacheGroupAttribute = SetUrlCacheGroupAttributeA
#ENDIF
DECLARE FUNCTION CreateUrlCacheGroup LIB "wininet.dll" ALIAS "CreateUrlCacheGroup" ( BYVAL dwFlags AS QUAD , BYVAL lpReserved AS QUAD ) AS QUAD ' GROUPID
DECLARE FUNCTION DeleteUrlCacheGroup LIB "wininet.dll" ALIAS "DeleteUrlCacheGroup" ( BYVAL GroupId AS QUAD , BYVAL dwFlags AS QUAD , BYVAL lpReserved AS QUAD ) AS LONG
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION GetUrlCacheEntryInfoExA LIB "WinINet.dll" ALIAS "GetUrlCacheEntryInfoExA" ( lpszUrl AS ASCIIZ, ' in
 lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOA, ' out
 lpdwCacheEntryInfoBufSize AS DWORD, ' in, out
 BYVAL lpszReserved AS DWORD, ' must pass %NULL
 BYVAL lpdwReserved AS DWORD, ' must pass %NULL
 BYVAL lpReserved AS DWORD, ' must pass %NULL
 BYVAL dwFlags AS DWORD ' must pass %NULL
 ) AS LONG
#ELSE
DECLARE FUNCTION GetUrlCacheEntryInfoExA LIB "wininet.dll" ALIAS "GetUrlCacheEntryInfoExA" ( BYREF lpszUrl AS ASCIIZ , BYREF lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOA , BYREF lpcbCacheEntryInfo AS QUAD , BYREF lpszRedirectUrl AS ASCIIZ , BYVAL lpcbRedirectUrl AS QUAD , BYVAL lpReserved AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION GetUrlCacheEntryInfoExW LIB "WinINet.dll" ALIAS "GetUrlCacheEntryInfoExW" ( lpszUrl AS WSTRINGZ, ' in
 lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOW, ' out
 lpdwCacheEntryInfoBufSize AS DWORD, ' in, out
 BYVAL lpszReserved AS DWORD, ' must pass %NULL
 BYVAL lpdwReserved AS DWORD, ' must pass %NULL
 BYVAL lpReserved AS DWORD, ' must pass %NULL
 BYVAL dwFlags AS DWORD ' must pass %NULL
 ) AS LONG
#ELSE
DECLARE FUNCTION GetUrlCacheEntryInfoExW LIB "wininet.dll" ALIAS "GetUrlCacheEntryInfoExW" ( BYREF lpszUrl AS WSTRINGZ , BYREF lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOW , BYREF lpcbCacheEntryInfo AS QUAD , BYREF lpszRedirectUrl AS WSTRINGZ , BYVAL lpcbRedirectUrl AS QUAD , BYVAL lpReserved AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
#ENDIF
#IF %DEF(%UNICODE)
 MACRO GetUrlCacheEntryInfoEx = GetUrlCacheEntryInfoExW
#ELSE
 MACRO GetUrlCacheEntryInfoEx = GetUrlCacheEntryInfoExA
#ENDIF
%EQUATE `CACHE_ENTRY_ATTRIBUTE_FC = &H00000004
%EQUATE `CACHE_ENTRY_HITRATE_FC = &H00000010
%EQUATE `CACHE_ENTRY_MODTIME_FC = &H00000040
%EQUATE `CACHE_ENTRY_EXPTIME_FC = &H00000080
%EQUATE `CACHE_ENTRY_ACCTIME_FC = &H00000100
%EQUATE `CACHE_ENTRY_SYNCTIME_FC = &H00000200
%EQUATE `CACHE_ENTRY_HEADERINFO_FC = &H00000400
%EQUATE `CACHE_ENTRY_EXEMPT_DELTA_FC = &H00000800
DECLARE FUNCTION SetUrlCacheEntryInfoA LIB "wininet.dll" ALIAS "SetUrlCacheEntryInfoA" ( BYREF lpszUrl AS ASCIIZ , BYREF lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOA , BYVAL dwFieldControl AS QUAD ) AS LONG
DECLARE FUNCTION SetUrlCacheEntryInfoW LIB "wininet.dll" ALIAS "SetUrlCacheEntryInfoW" ( BYREF lpszUrl AS WSTRINGZ
 , BYREF lpCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOW
 , BYVAL dwFieldControl AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetUrlCacheEntryInfo = SetUrlCacheEntryInfoW
#ELSE
 MACRO SetUrlCacheEntryInfo = SetUrlCacheEntryInfoA
#ENDIF
'// Flags for SetUrlCacheEntryGroup
%EQUATE `INTERNET_CACHE_GROUP_ADD = 0
%EQUATE `INTERNET_CACHE_GROUP_REMOVE = 1
DECLARE FUNCTION SetUrlCacheEntryGroupA LIB "wininet.dll" ALIAS "SetUrlCacheEntryGroupA" ( BYREF lpszUrlName AS ASCIIZ , BYVAL dwFlags AS QUAD , BYVAL GroupId AS QUAD , BYREF pbGroupAttributes AS QUAD , BYVAL cbGroupAttributes AS QUAD , BYVAL lpReserved AS QUAD ) AS LONG
DECLARE FUNCTION SetUrlCacheEntryGroupW LIB "wininet.dll" ALIAS "SetUrlCacheEntryGroupW" ( BYREF lpszUrlName AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , BYVAL GroupId AS QUAD
 , BYREF pbGroupAttributes AS DWORD
 , BYVAL cbGroupAttributes AS DWORD
 , BYVAL lpReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO SetUrlCacheEntryGroup = SetUrlCacheEntryGroupW
#ELSE
 MACRO SetUrlCacheEntryGroup = SetUrlCacheEntryGroupA
#ENDIF
DECLARE FUNCTION FindFirstUrlCacheEntryExA LIB "wininet.dll" ALIAS "FindFirstUrlCacheEntryExA" ( BYREF lpszUrlSearchPattern AS ASCIIZ , BYVAL dwFlags AS QUAD , BYVAL dwFilter AS QUAD , BYVAL GroupId AS QUAD , BYREF lpFirstCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOA , BYREF lpcbEntryInfo AS QUAD , BYVAL lpGroupAttributes AS QUAD , BYVAL lpcbGroupAttributes AS QUAD , BYVAL lpReserved AS QUAD ) AS QUAD
DECLARE FUNCTION FindFirstUrlCacheEntryExW LIB "wininet.dll" ALIAS "FindFirstUrlCacheEntryExW" ( BYREF lpszUrlSearchPattern AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , BYVAL dwFilter AS DWORD
 , BYVAL GroupId AS QUAD
 , BYREF lpFirstCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOW
 , BYREF lpcbEntryInfo AS DWORD
 , BYVAL lpGroupAttributes AS DWORD
 , BYVAL lpcbGroupAttributes AS DWORD
 , BYVAL lpReserved AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO FindFirstUrlCacheEntryEx = FindFirstUrlCacheEntryExW
#ELSE
 MACRO FindFirstUrlCacheEntryEx = FindFirstUrlCacheEntryExA
#ENDIF
DECLARE FUNCTION FindNextUrlCacheEntryExA LIB "wininet.dll" ALIAS "FindNextUrlCacheEntryExA" ( BYVAL hEnumHandle AS QUAD , BYREF lpNextCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOA , BYREF lpcbEntryInfo AS QUAD , BYVAL lpGroupAttributes AS QUAD , BYVAL lpcbGroupAttributes AS QUAD , BYVAL lpReserved AS QUAD ) AS LONG
DECLARE FUNCTION FindNextUrlCacheEntryExW LIB "wininet.dll" ALIAS "FindNextUrlCacheEntryExW" ( BYVAL hEnumHandle AS QUAD
 , BYREF lpNextCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOW
 , BYREF lpcbEntryInfo AS DWORD
 , BYVAL lpGroupAttributes AS DWORD
 , BYVAL lpcbGroupAttributes AS DWORD
 , BYVAL lpReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO FindNextUrlCacheEntryEx = FindNextUrlCacheEntryExW
#ELSE
 MACRO FindNextUrlCacheEntryEx = FindNextUrlCacheEntryExA
#ENDIF
DECLARE FUNCTION FindFirstUrlCacheEntryA LIB "wininet.dll" ALIAS "FindFirstUrlCacheEntryA" ( BYREF lpszUrlSearchPattern AS ASCIIZ , BYREF lpFirstCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOA , BYREF lpcbCacheEntryInfo AS QUAD ) AS QUAD
DECLARE FUNCTION FindFirstUrlCacheEntryW LIB "wininet.dll" ALIAS "FindFirstUrlCacheEntryW" ( BYREF lpszUrlSearchPattern AS WSTRINGZ
 , BYREF lpFirstCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOW
 , BYREF lpcbCacheEntryInfo AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO FindFirstUrlCacheEntry = FindFirstUrlCacheEntryW
#ELSE
 MACRO FindFirstUrlCacheEntry = FindFirstUrlCacheEntryA
#ENDIF
DECLARE FUNCTION FindNextUrlCacheEntryA LIB "wininet.dll" ALIAS "FindNextUrlCacheEntryA" ( BYVAL hEnumHandle AS QUAD , BYREF lpNextCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOA ) AS LONG ' _out LPINTERNET_CACHE_ENTRY_INFOA lpNextCacheEntryInfo , BYREF lpcbCacheEntryInfo AS QUAD
DECLARE FUNCTION FindNextUrlCacheEntryW LIB "wininet.dll" ALIAS "FindNextUrlCacheEntryW" ( BYVAL hEnumHandle AS QUAD
 , BYREF lpNextCacheEntryInfo AS INTERNET_CACHE_ENTRY_INFOW
 , BYREF lpcbCacheEntryInfo AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO FindNextUrlCacheEntry = FindNextUrlCacheEntryW
#ELSE
 MACRO FindNextUrlCacheEntry = FindNextUrlCacheEntryA
#ENDIF
DECLARE FUNCTION FindCloseUrlCache LIB "wininet.dll" ALIAS "FindCloseUrlCache" ( BYVAL hEnumHandle AS QUAD ) AS LONG
DECLARE FUNCTION DeleteUrlCacheEntryA LIB "wininet.dll" ALIAS "DeleteUrlCacheEntryA" ( BYREF lpszUrlName AS ASCIIZ
 ) AS LONG
DECLARE FUNCTION DeleteUrlCacheEntryW LIB "wininet.dll" ALIAS "DeleteUrlCacheEntryW" ( BYREF lpszUrlName AS WSTRINGZ
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO DeleteUrlCacheEntry = DeleteUrlCacheEntryW
#ELSE
 MACRO DeleteUrlCacheEntry = DeleteUrlCacheEntryA
#ENDIF
'//
'// Autodial APIs
'//
DECLARE FUNCTION InternetDialA LIB "wininet.dll" ALIAS "InternetDialA" ( BYVAL hwndParent AS QUAD , BYREF lpszConnectoid AS ASCIIZ , BYVAL dwFlags AS QUAD , BYREF lpdwConnection AS QUAD , BYVAL dwReserved AS QUAD ) AS QUAD
DECLARE FUNCTION InternetDialW LIB "wininet.dll" ALIAS "InternetDialW" ( BYVAL hwndParent AS QUAD
 , BYREF lpszConnectoid AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , BYREF lpdwConnection AS DWORD
 , BYVAL dwReserved AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO InternetDial = InternetDialW
#ELSE
 MACRO InternetDial = InternetDialA
#ENDIF
'// Flags for InternetDial - must not conflict with InternetAutodial flags
'// as they are valid here also.
%EQUATE `INTERNET_DIAL_FORCE_PROMPT = &H2000
%EQUATE `INTERNET_DIAL_SHOW_OFFLINE = &H4000
%EQUATE `INTERNET_DIAL_UNATTENDED = &H8000
DECLARE FUNCTION InternetHangUp LIB "wininet.dll" ALIAS "InternetHangUp" ( BYVAL dwConnection AS QUAD , BYVAL dwReserved AS QUAD ) AS QUAD
%EQUATE `INTERENT_GOONLINE_REFRESH = &H00000001
%EQUATE `INTERENT_GOONLINE_MASK = &H00000001
DECLARE FUNCTION InternetGoOnlineA LIB "wininet.dll" ALIAS "InternetGoOnlineA" ( BYREF lpszURL AS ASCIIZ , BYVAL hwndParent AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION InternetGoOnlineW LIB "wininet.dll" ALIAS "InternetGoOnlineW" ( BYREF lpszURL AS WSTRINGZ
 , BYVAL hwndParent AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetGoOnline = InternetGoOnlineW
#ELSE
 MACRO InternetGoOnline = InternetGoOnlineA
#ENDIF
DECLARE FUNCTION InternetAutodial LIB "wininet.dll" ALIAS "InternetAutodial" ( BYVAL dwFlags AS QUAD , OPTIONAL BYVAL hwndParent AS QUAD ) AS LONG
'// Flags for InternetAutodial
%EQUATE `INTERNET_AUTODIAL_FORCE_ONLINE = 1
%EQUATE `INTERNET_AUTODIAL_FORCE_UNATTENDED = 2
%EQUATE `INTERNET_AUTODIAL_FAILIFSECURITYCHECK = 4
%EQUATE `INTERNET_AUTODIAL_OVERRIDE_NET_PRESENT = 8
%EQUATE `INTERNET_AUTODIAL_FLAGS_MASK = %INTERNET_AUTODIAL_FORCE_ONLINE OR %INTERNET_AUTODIAL_FORCE_UNATTENDED OR %INTERNET_AUTODIAL_FAILIFSECURITYCHECK OR %INTERNET_AUTODIAL_OVERRIDE_NET_PRESENT
DECLARE FUNCTION InternetAutodialHangup LIB "wininet.dll" ALIAS "InternetAutodialHangup" ( BYVAL dwReserved AS QUAD ) AS LONG
DECLARE FUNCTION InternetGetConnectedState LIB "wininet.dll" ALIAS "InternetGetConnectedState" ( BYREF lpdwFlags AS QUAD
 , BYVAL dwReserved AS DWORD
 ) AS LONG
DECLARE FUNCTION InternetGetConnectedStateExA LIB "wininet.dll" ALIAS "InternetGetConnectedStateExA" ( BYREF lpdwFlags AS DWORD
 , BYREF lpszConnectionName AS ASCIIZ
 , BYVAL dwBufLen AS DWORD
 , BYVAL dwReserved AS DWORD
 ) AS LONG
DECLARE FUNCTION InternetGetConnectedStateExW LIB "wininet.dll" ALIAS "InternetGetConnectedStateExW" ( BYREF lpdwFlags AS DWORD
 , BYREF lpszConnectionName AS WSTRINGZ
 , BYVAL dwBufLen AS DWORD
 , BYVAL dwReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetGetConnectedStateEx = InternetGetConnectedStateExW
#ELSE
 MACRO InternetGetConnectedStateEx = InternetGetConnectedStateExA
#ENDIF
%EQUATE `PROXY_AUTO_DETECT_TYPE_DHCP = 1
%EQUATE `PROXY_AUTO_DETECT_TYPE_DNS_A = 2
'struct AutoProxyHelperFunctions;
'typedef struct AutoProxyHelperVtbl
'{
' BOOL ( __stdcall *IsResolvable )(
' LPSTR lpszHost);
' DWORD ( __stdcall *GetIPAddress )(
' LPSTR lpszIPAddress,
' LPDWORD lpdwIPAddressSize);
' DWORD ( __stdcall *ResolveHostName )(
' LPSTR lpszHostName,
' LPSTR lpszIPAddress,
' LPDWORD lpdwIPAddressSize);
' BOOL ( __stdcall *IsInNet )(
' LPSTR lpszIPAddress,
' LPSTR lpszDest,
' LPSTR lpszMask);
' BOOL ( __stdcall *IsResolvableEx )(
' LPSTR lpszHost
' );
' DWORD ( __stdcall *GetIPAddressEx )(
' LPSTR lpszIPAddress,
' LPDWORD lpdwIPAddressSize
' );
' DWORD ( __stdcall *ResolveHostNameEx )(
' LPSTR lpszHostName,
' LPSTR lpszIPAddress,
' LPDWORD lpdwIPAddressSize
' );
' BOOL ( __stdcall *IsInNetEx )(
' LPSTR lpszIPAddress,
' LPSTR lpszIPPrefix
' );
' DWORD ( __stdcall *SortIpList )(
' LPSTR lpszIPAddressList,
' LPSTR lpszIPSortedList,
' LPDWORD lpdwIPSortedListSize
' );
'}AutoProxyHelperVtbl;
' // Size = 36 bytes
TYPE AutoProxyHelperVtbl DWORD
 IsResolvable AS DWORD
 GetIPAddress AS DWORD
 ResolveHostName AS DWORD
 IsInNet AS DWORD
 IsResolvableEx AS DWORD
 GetIPAddressEx AS DWORD
 ResolveHostNameEx AS DWORD
 IsInNetEx AS DWORD
 SortIpList AS DWORD
END TYPE
' // Size = 12 bytes
TYPE AUTO_PROXY_SCRIPT_BUFFER DWORD
 dwStructSize AS DWORD ' DWORD // Size of struct
 lpszScriptBuffer AS ASCIIZ PTR ' LPSTR // Buffer to Pass
 dwScriptBufferSize AS DWORD ' DWORD // Size of buffer above
END TYPE
'typedef struct AutoProxyHelperFunctions
'{
' const struct AutoProxyHelperVtbl * lpVtbl;
'} AutoProxyHelperFunctions;
' // Size = 4 bytes
TYPE AutoProxyHelperFunctions DWORD
 lpVtbl AS AutoProxyHelperVtbl PTR ' const struct AutoProxyHelperVtbl * lpVtbl
END TYPE
'typedef BOOL ( CALLBACK *pfnInternetInitializeAutoProxyDll)(DWORD dwVersion,
' LPSTR lpszDownloadedTempFile,
' LPSTR lpszMime,
' AutoProxyHelperFunctions* lpAutoProxyCallbacks,
' LPAUTO_PROXY_SCRIPT_BUFFER lpAutoProxyScriptBuffer );
'typedef BOOL (CALLBACK *pfnInternetDeInitializeAutoProxyDll)(LPSTR lpszMime,
' DWORD dwReserved);
'typedef BOOL (CALLBACK *pfnInternetGetProxyInfo)(LPCSTR lpszUrl,
' DWORD dwUrlLength,
' LPSTR lpszUrlHostName,
' DWORD dwUrlHostNameLength,
' LPSTR* lplpszProxyHostName,
' LPDWORD lpdwProxyHostNameLength);
' enum WPAD_CACHE_DELETE
%EQUATE `WPAD_CACHE_DELETE_CURRENT = &H0
%EQUATE `WPAD_CACHE_DELETE_ALL = &H1
DECLARE FUNCTION DeleteWpadCacheForNetworks LIB "jsproxy.dll" ALIAS "DeleteWpadCacheForNetworks" ( BYVAL DWORD ) AS LONG
DECLARE FUNCTION InternetInitializeAutoProxyDll LIB "jsproxy.dll" ALIAS "InternetInitializeAutoProxyDll" ( BYVAL dwReserved AS QUAD
 ) AS LONG
DECLARE FUNCTION InternetDeInitializeAutoProxyDll LIB "jsproxy.dll" ALIAS "InternetDeInitializeAutoProxyDll" ( BYREF lpszMime AS ASCIIZ
 , BYVAL dwReserved AS DWORD
 ) AS LONG
DECLARE FUNCTION InternetGetProxyInfo LIB "jsproxy.dll" ALIAS "InternetGetProxyInfo" ( BYREF lpszUrl AS ASCIIZ
 , BYVAL dwUrlLength AS DWORD
 , BYREF lpszUrlHostName AS ASCIIZ
 , BYVAL dwUrlHostNameLength AS DWORD
 , BYREF lplpszProxyHostName AS ASCIIZ
 , BYREF lpdwProxyHostNameLength AS DWORD
 ) AS LONG
' Not in Vista SDK. See DetectAutoProxyUrl below.
DECLARE FUNCTION InternetAutoProxyUrl LIB "wininet.dll" ALIAS "InternetAutoProxyUrl" ( BYREF lpszAutoProxyUrl AS ASCIIZ , BYVAL dwAutoProxyUrlLength AS QUAD , BYVAL dwDetectFlags AS QUAD ) AS LONG
DECLARE FUNCTION DetectAutoProxyUrl LIB "wininet.dll" ALIAS "DetectAutoProxyUrl" ( BYREF lpszAutoProxyUrl AS ASCIIZ
 , BYVAL dwAutoProxyUrlLength AS DWORD
 , BYVAL dwDetectFlags AS DWORD
 ) AS LONG
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION CreateMD5SSOHash LIB "WinINet.dll" ALIAS "CreateMD5SSOHash" ( pszChallengeInfo AS WSTRINGZ, pwszRealm AS WSTRINGZ, pwszTarget AS WSTRINGZ, BYVAL pbHexHash AS BYTE PTR ) AS LONG
#ELSE
DECLARE FUNCTION CreateMD5SSOHash LIB "wininet.dll" ALIAS "CreateMD5SSOHash" ( BYREF pszChallengeInfo AS WSTRINGZ , BYREF pwszRealm AS WSTRINGZ , BYREF pwszTarget AS WSTRINGZ , BYREF pbHexHash AS ANY ) AS LONG
#ENDIF
'// Flags for InternetGetConnectedState and Ex
%EQUATE `INTERNET_CONNECTION_MODEM = &H01
%EQUATE `INTERNET_CONNECTION_LAN = &H02
%EQUATE `INTERNET_CONNECTION_PROXY = &H04
%EQUATE `INTERNET_CONNECTION_MODEM_BUSY = &H08 ' /* no longer used */
%EQUATE `INTERNET_RAS_INSTALLED = &H10
%EQUATE `INTERNET_CONNECTION_OFFLINE = &H20
%EQUATE `INTERNET_CONNECTION_CONFIGURED = &H40
'//
'// Custom dial handler functions
'//
'// Custom dial handler prototype
'typedef DWORD (CALLBACK * PFN_DIAL_HANDLER) (HWND, LPCSTR, DWORD, LPDWORD);
'// Flags for custom dial handler
%EQUATE `INTERNET_CUSTOMDIAL_CONNECT = 0
%EQUATE `INTERNET_CUSTOMDIAL_UNATTENDED = 1
%EQUATE `INTERNET_CUSTOMDIAL_DISCONNECT = 2
%EQUATE `INTERNET_CUSTOMDIAL_SHOWOFFLINE = 4
'// Custom dial handler supported functionality flags
%EQUATE `INTERNET_CUSTOMDIAL_SAFE_FOR_UNATTENDED = 1
%EQUATE `INTERNET_CUSTOMDIAL_WILL_SUPPLY_STATE = 2
%EQUATE `INTERNET_CUSTOMDIAL_CAN_HANGUP = 4
DECLARE FUNCTION InternetSetDialStateA LIB "wininet.dll" ALIAS "InternetSetDialStateA" ( BYREF lpszConnectoid AS ASCIIZ , BYVAL dwState AS QUAD , BYVAL dwReserved AS QUAD ) AS LONG
DECLARE FUNCTION InternetSetDialStateW LIB "wininet.dll" ALIAS "InternetSetDialStateW" ( BYREF lpszConnectoid AS WSTRINGZ
 , BYVAL dwState AS DWORD
 , BYVAL dwReserved AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetSetDialState = InternetSetDialStateW
#ELSE
 MACRO InternetSetDialState = InternetSetDialStateA
#ENDIF
'// States for InternetSetDialState
%EQUATE `INTERNET_DIALSTATE_DISCONNECTED = 1
DECLARE FUNCTION InternetSetPerSiteCookieDecisionA LIB "wininet.dll" ALIAS "InternetSetPerSiteCookieDecisionA" ( BYREF pchHostName AS ASCIIZ , BYVAL dwDecision AS QUAD ) AS LONG
DECLARE FUNCTION InternetSetPerSiteCookieDecisionW LIB "wininet.dll" ALIAS "InternetSetPerSiteCookieDecisionW" ( BYREF pchHostName AS WSTRINGZ
 , BYVAL dwDecision AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetSetPerSiteCookieDecision = InternetSetPerSiteCookieDecisionW
#ELSE
 MACRO InternetSetPerSiteCookieDecision = InternetSetPerSiteCookieDecisionA
#ENDIF
DECLARE FUNCTION InternetGetPerSiteCookieDecisionA LIB "wininet.dll" ALIAS "InternetGetPerSiteCookieDecisionA" ( BYREF pchHostName AS ASCIIZ , BYREF pResult AS QUAD ) AS LONG
DECLARE FUNCTION InternetGetPerSiteCookieDecisionW LIB "wininet.dll" ALIAS "InternetGetPerSiteCookieDecisionW" ( BYREF pchHostName AS WSTRINGZ
 , BYREF pResult AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetGetPerSiteCookieDecision = InternetGetPerSiteCookieDecisionW
#ELSE
 MACRO InternetGetPerSiteCookieDecision = InternetGetPerSiteCookieDecisionA
#ENDIF
' Not in Vista/Windows 7 SDKs
'DECLARE FUNCTION InternetClearAllSiteCookieDecisions LIB "wininet.dll" ALIAS "InternetClearAllSiteCookieDecisions" ( ' ) AS LONG
DECLARE FUNCTION InternetClearAllPerSiteCookieDecisions LIB "wininet.dll" ALIAS "InternetClearAllPerSiteCookieDecisions" ( ) AS LONG
DECLARE FUNCTION InternetEnumPerSiteCookieDecisionA LIB "wininet.dll" ALIAS "InternetEnumPerSiteCookieDecisionA" ( BYREF pszSiteName AS ASCIIZ
 , BYREF pcSiteNameSize AS DWORD
 , BYREF pdwDecision AS DWORD
 , BYVAL dwIndex AS DWORD
 ) AS LONG
DECLARE FUNCTION InternetEnumPerSiteCookieDecisionW LIB "wininet.dll" ALIAS "InternetEnumPerSiteCookieDecisionW" ( BYREF pszSiteName AS WSTRINGZ
 , BYREF pcSiteNameSize AS DWORD
 , BYREF pdwDecision AS DWORD
 , BYVAL dwIndex AS DWORD
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO InternetEnumPerSiteCookieDecision = InternetEnumPerSiteCookieDecisionW
#ELSE
 MACRO InternetEnumPerSiteCookieDecision = InternetEnumPerSiteCookieDecisionA
#ENDIF
%EQUATE `INTERNET_IDENTITY_FLAG_PRIVATE_CACHE = &H01
%EQUATE `INTERNET_IDENTITY_FLAG_SHARED_CACHE = &H02
%EQUATE `INTERNET_IDENTITY_FLAG_CLEAR_DATA = &H04
%EQUATE `INTERNET_IDENTITY_FLAG_CLEAR_COOKIES = &H08
%EQUATE `INTERNET_IDENTITY_FLAG_CLEAR_HISTORY = &H10
%EQUATE `INTERNET_IDENTITY_FLAG_CLEAR_CONTENT = &H20
%EQUATE `INTERNET_SUPPRESS_RESET_ALL = &H00
%EQUATE `INTERNET_SUPPRESS_COOKIE_POLICY = &H01
%EQUATE `INTERNET_SUPPRESS_COOKIE_POLICY_RESET = &H02
'//
'// Privacy settings values and APIs
'//
%EQUATE `PRIVACY_TEMPLATE_NO_COOKIES = 0
%EQUATE `PRIVACY_TEMPLATE_HIGH = 1
%EQUATE `PRIVACY_TEMPLATE_MEDIUM_HIGH = 2
%EQUATE `PRIVACY_TEMPLATE_MEDIUM = 3
%EQUATE `PRIVACY_TEMPLATE_MEDIUM_LOW = 4
%EQUATE `PRIVACY_TEMPLATE_LOW = 5
%EQUATE `PRIVACY_TEMPLATE_CUSTOM = 100
%EQUATE `PRIVACY_TEMPLATE_ADVANCED = 101
%EQUATE `PRIVACY_TEMPLATE_MAX = %PRIVACY_TEMPLATE_LOW
%EQUATE `PRIVACY_TYPE_FIRST_PARTY = 0
%EQUATE `PRIVACY_TYPE_THIRD_PARTY = 1
DECLARE FUNCTION PrivacySetZonePreferenceW LIB "wininet.dll" ALIAS "PrivacySetZonePreferenceW" ( BYVAL dwZone AS QUAD , BYVAL dwType AS QUAD , BYVAL dwTemplate AS QUAD , OPTIONAL BYREF pszPreference AS WSTRINGZ ) AS QUAD
MACRO PrivacySetZonePreference = PrivacySetZonePreferenceW
DECLARE FUNCTION PrivacyGetZonePreferenceW LIB "wininet.dll" ALIAS "PrivacyGetZonePreferenceW" ( BYVAL dwZone AS QUAD , BYVAL dwType AS QUAD , BYREF pdwTemplate AS QUAD , BYREF pszBuffer AS WSTRINGZ , OPTIONAL BYREF pdwBufferLength AS QUAD ) AS QUAD
MACRO PrivacyGetZonePreference = PrivacyGetZonePreferenceW
'/*
' * Return packing to whatever it was before we
' * entered this file
' */
'#include <poppack.h>
#ENDIF
