/*++
Copyright (c) 1995-1999 Microsoft Corporation
Module Name:
wininet.h
Abstract:
Contains manifests, macros, types and prototypes for Microsoft Windows
Internet Extensions
--*/
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#if !defined(_WININET_)
#include <SpecStrings.h>
#define _WININET_
/*
* Set up Structure Packing to be 4 bytes
* for all wininet structures
*/
#if defined(_WIN64)
#include <pshpack8.h>
#else
#include <pshpack4.h>
#endif
#if defined(__cplusplus)
extern "C" {
#endif
#if !defined(_WINX32_)
#define INTERNETAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
#define INTERNETAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
#define INTERNETAPIX(type, salannotation) EXTERN_C DECLSPEC_IMPORT salannotation type STDAPICALLTYPE
#define URLCACHEAPI EXTERN_C DECLSPEC_IMPORT DWORD STDAPICALLTYPE
#define URLCACHEAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
#else
#define INTERNETAPI EXTERN_C HRESULT STDAPICALLTYPE
#define INTERNETAPI_(type) EXTERN_C type STDAPICALLTYPE
#define INTERNETAPIX(type, salannotation) EXTERN_C salannotation type STDAPICALLTYPE
#define URLCACHEAPI EXTERN_C DWORD STDAPICALLTYPE
#define URLCACHEAPI_(type) EXTERN_C type STDAPICALLTYPE
#endif
#define BOOLAPI INTERNETAPIX(BOOL, _Success_(return != FALSE))
//
// internet types
//
typedef LPVOID HINTERNET;
typedef HINTERNET * LPHINTERNET;
typedef WORD INTERNET_PORT;
typedef INTERNET_PORT * LPINTERNET_PORT;
//
// Internet APIs
//
//
// manifests
//
#define INTERNET_INVALID_PORT_NUMBER 0 // use the protocol-specific default
#define INTERNET_DEFAULT_FTP_PORT 21 // default for FTP servers
#define INTERNET_DEFAULT_GOPHER_PORT 70 // " " gopher "
#define INTERNET_DEFAULT_HTTP_PORT 80 // " " HTTP "
#define INTERNET_DEFAULT_HTTPS_PORT 443 // " " HTTPS "
#define INTERNET_DEFAULT_SOCKS_PORT 1080 // default for SOCKS firewall servers.
//
// maximum field lengths (arbitrary)
//
#define INTERNET_MAX_HOST_NAME_LENGTH 256
#define INTERNET_MAX_USER_NAME_LENGTH 128
#define INTERNET_MAX_PASSWORD_LENGTH 128
#define INTERNET_MAX_PORT_NUMBER_LENGTH 5 // INTERNET_PORT is unsigned short
#define INTERNET_MAX_PORT_NUMBER_VALUE 65535 // maximum unsigned short value
#define INTERNET_MAX_PATH_LENGTH 2048
#define INTERNET_MAX_SCHEME_LENGTH 32 // longest protocol name length
#define INTERNET_MAX_URL_LENGTH (INTERNET_MAX_SCHEME_LENGTH \
+ sizeof("://") \
+ INTERNET_MAX_PATH_LENGTH)
//
// values returned by InternetQueryOption() with INTERNET_OPTION_KEEP_CONNECTION:
//
#define INTERNET_KEEP_ALIVE_UNKNOWN ((DWORD)-1)
#define INTERNET_KEEP_ALIVE_ENABLED 1
#define INTERNET_KEEP_ALIVE_DISABLED 0
//
// flags returned by InternetQueryOption() with INTERNET_OPTION_REQUEST_FLAGS
//
#define INTERNET_REQFLAG_FROM_CACHE 0x00000001 // response came from cache
#define INTERNET_REQFLAG_ASYNC 0x00000002 // request was made asynchronously
#define INTERNET_REQFLAG_VIA_PROXY 0x00000004 // request was made via a proxy
#define INTERNET_REQFLAG_NO_HEADERS 0x00000008 // orginal response contained no headers
#define INTERNET_REQFLAG_PASSIVE 0x00000010 // FTP: passive-mode connection
#define INTERNET_REQFLAG_CACHE_WRITE_DISABLED 0x00000040 // HTTPS: this request not cacheable
#define INTERNET_REQFLAG_NET_TIMEOUT 0x00000080 // w/ _FROM_CACHE: net request timed out
//
// flags for IDN enable/disable via INTERNET_OPTION_IDN
//
#define INTERNET_FLAG_IDN_DIRECT 0x00000001 // IDN enabled for direct connections
#define INTERNET_FLAG_IDN_PROXY 0x00000002 // IDN enabled for proxy
//
// flags common to open functions (not InternetOpen()):
//
#define INTERNET_FLAG_RELOAD 0x80000000 // retrieve the original item
//
// flags for InternetOpenUrl():
//
#define INTERNET_FLAG_RAW_DATA 0x40000000 // FTP/gopher find: receive the item as raw (structured) data
#define INTERNET_FLAG_EXISTING_CONNECT 0x20000000 // FTP: use existing InternetConnect handle for server if possible
//
// flags for InternetOpen():
//
#define INTERNET_FLAG_ASYNC 0x10000000 // this request is asynchronous (where supported)
//
// protocol-specific flags:
//
#define INTERNET_FLAG_PASSIVE 0x08000000 // used for FTP connections
//
// additional cache flags
//
#define INTERNET_FLAG_NO_CACHE_WRITE 0x04000000 // don't write this item to the cache
#define INTERNET_FLAG_DONT_CACHE INTERNET_FLAG_NO_CACHE_WRITE
#define INTERNET_FLAG_MAKE_PERSISTENT 0x02000000 // make this item persistent in cache
#define INTERNET_FLAG_FROM_CACHE 0x01000000 // use offline semantics
#define INTERNET_FLAG_OFFLINE INTERNET_FLAG_FROM_CACHE
//
// additional flags
//
#define INTERNET_FLAG_SECURE 0x00800000 // use PCT/SSL if applicable (HTTP)
#define INTERNET_FLAG_KEEP_CONNECTION 0x00400000 // use keep-alive semantics
#define INTERNET_FLAG_NO_AUTO_REDIRECT 0x00200000 // don't handle redirections automatically
#define INTERNET_FLAG_READ_PREFETCH 0x00100000 // do background read prefetch
#define INTERNET_FLAG_NO_COOKIES 0x00080000 // no automatic cookie handling
#define INTERNET_FLAG_NO_AUTH 0x00040000 // no automatic authentication handling
#define INTERNET_FLAG_RESTRICTED_ZONE 0x00020000 // apply restricted zone policies for cookies, auth
#define INTERNET_FLAG_CACHE_IF_NET_FAIL 0x00010000 // return cache file if net request fails
//
// Security Ignore Flags, Allow HttpOpenRequest to overide
// Secure Channel (SSL/PCT) failures of the following types.
//
#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP 0x00008000 // ex: https:// to http://
#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS 0x00004000 // ex: http:// to https://
#define INTERNET_FLAG_IGNORE_CERT_DATE_INVALID 0x00002000 // expired X509 Cert.
#define INTERNET_FLAG_IGNORE_CERT_CN_INVALID 0x00001000 // bad common name in X509 Cert.
//
// more caching flags
//
#define INTERNET_FLAG_RESYNCHRONIZE 0x00000800 // asking wininet to update an item if it is newer
#define INTERNET_FLAG_HYPERLINK 0x00000400 // asking wininet to do hyperlinking semantic which works right for scripts
#define INTERNET_FLAG_NO_UI 0x00000200 // no cookie popup
#define INTERNET_FLAG_PRAGMA_NOCACHE 0x00000100 // asking wininet to add "pragma: no-cache"
#define INTERNET_FLAG_CACHE_ASYNC 0x00000080 // ok to perform lazy cache-write
#define INTERNET_FLAG_FORMS_SUBMIT 0x00000040 // this is a forms submit
#define INTERNET_FLAG_FWD_BACK 0x00000020 // fwd-back button op
#define INTERNET_FLAG_NEED_FILE 0x00000010 // need a file for this request
#define INTERNET_FLAG_MUST_CACHE_REQUEST INTERNET_FLAG_NEED_FILE
//
// flags for FTP
//
#define INTERNET_FLAG_TRANSFER_ASCII FTP_TRANSFER_TYPE_ASCII // 0x00000001
#define INTERNET_FLAG_TRANSFER_BINARY FTP_TRANSFER_TYPE_BINARY // 0x00000002
//
// flags field masks
//
#define SECURITY_INTERNET_MASK (INTERNET_FLAG_IGNORE_CERT_CN_INVALID | \
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID | \
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS | \
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP )
#define SECURITY_IGNORE_ERROR_MASK (INTERNET_FLAG_IGNORE_CERT_CN_INVALID | \
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID | \
S