' ########################################################################################
' Microsoft Windows
' File: Http.inc
' Contents: This header corresponds to the HTTP API specification
' 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_http_PBI)
#DEFINE PBX_http_PBI
%EQUATE `HTTP_INC = 1
#INCLUDE ONCE "Core/Windows.inc"
#INCLUDE ONCE "Legacy/Platform/WinSock2.inc"
#INCLUDE ONCE "Legacy/System/WS2tcpip.inc"
#IF %WINVER >= &H0501
'//
'// HTTPAPI is available on
'//
'// a) WinXP SP2 and higher
'// b) Windows 2003 and higher
'// c) Vista and higher.
'//
'//
'// Flags for HttpInitialize() and HttpTerminate()
'//
'//
'// HTTP_INITIALIZE_SERVER - Initializes the HTTP API layer and driver for
'// server applications.
'//
'// HTTP_INITIALIZE_CONFIG - Initializes the HTTP API layer and driver for
'// applications that will modify the HTTP
'// configuration.
'//
'// Notes -
'//
'// 1. These flags can be used in combination.
'//
'// 2. HttpTerminate() must be called for each call to HttpInitialize() made
'// with each flag set when invoking HttpInitialize. For example, one
'// could make two calls to HttpInitialize() setting HTTP_INITIALIZE_SERVER
'// the first time and HTTP_INITIALIZE_CONFIG the second time. One call
'// to HttpTerminate() with both flags set suffices to clean up both
'// calls to HttpInitialize().
'//
%EQUATE `HTTP_INITIALIZE_SERVER = &H00000001
%EQUATE `HTTP_INITIALIZE_CONFIG = &H00000002
#IF %WINVER >= &H0600
'//
'// Following section defines the properties supported by the
'// server side HTTP API.
'//
' enum HTTP_SERVER_PROPERTY
%EQUATE `HttpServerAuthenticationProperty = 0 ' // Used for enabling server side authentication.
%EQUATE `HttpServerLoggingProperty = 1 ' // Used for enabling logging.
%EQUATE `HttpServerQosProperty = 2 ' // Used for setting QoS properties.
%EQUATE `HttpServerTimeoutsProperty = 3 ' // Used for configuring timeouts.
%EQUATE `HttpServerQueueLengthProperty = 4 ' // Used for limiting request queue lengths.
%EQUATE `HttpServerStateProperty = 5 ' // Used for manipulating the state.
%EQUATE `HttpServer503VerbosityProperty = 6 ' // Used for modifying the verbosity level of 503 type responses generated by server side API.
%EQUATE `HttpServerBindingProperty = 7 ' // Used for manipulating Url Group to Request Queue association.
%EQUATE `HttpServerExtendedAuthenticationProperty = 8 ' // Extended authentication property.
%EQUATE `HttpServerListenEndpointProperty = 9 ' // Listening endpoint property.
#ENDIF
#IF %WINVER >= &H0601
%EQUATE `HttpServerChannelBindProperty = 10 ' // Authentication channel binding property
%EQUATE `HttpServerProtectionLevelProperty = 11 ' // IP Protection level policy for a Url Group.
#ENDIF
#IF %WINVER >= &H0600
%EQUATE `HTTP_MAX_SERVER_QUEUE_LENGTH = &H7FFFFFFF
%EQUATE `HTTP_MIN_SERVER_QUEUE_LENGTH = 1
'//
'// Generic property flags. Each structure defining a property info typically
'// contain an element of this type.
'//
' // Size = 4 bytes
TYPE HTTP_PROPERTY_FLAGS DWORD
 Present AS BIT * 1 IN DWORD ' ULONG Present:1
END TYPE
'//
'// Enabled state.
'//
' enum HTTP_ENABLED_STATE
%EQUATE `HttpEnabledStateActive = 0
%EQUATE `HttpEnabledStateInactive = 1
' // Size = 8 bytes
TYPE HTTP_STATE_INFO DWORD
 Flags AS HTTP_PROPERTY_FLAGS
 State AS LONG ' HTTP_ENABLED_STATE enum
END TYPE
'//
'// Defines the verbosity level for a request queue which will be used
'// when sending "503 - Service Unavailable" type error responses. Note that
'// this setting only affects the error responses generated internally
'// by HTTPAPI.
'//
' enum HTTP_503_RESPONSE_VERBOSITY
%EQUATE `Http503ResponseVerbosityBasic = 0 ' Instead of sending a 503 response, the connection will be reset. This is the default behavior.
%EQUATE `Http503ResponseVerbosityLimited = 1 ' Will send a 503 w/ a generic reason phrase.
%EQUATE `Http503ResponseVerbosityFull = 2 ' Will send a 503 w/ a detailed reason phrase.
'//
'// Network QoS related.
'//
' enum HTTP_QOS_SETTING_TYPE
%EQUATE `HttpQosSettingTypeBandwidth = 0
%EQUATE `HttpQosSettingTypeConnectionLimit = 1
%EQUATE `HttpQosSettingTypeFlowRate = 2
' // Size = 8 bytes
TYPE HTTP_QOS_SETTING_INFO DWORD
 QosType AS LONG ' HTTP_QOS_SETTING_TYPE enum
 QosSetting AS DWORD
END TYPE
' // Size = 8 bytes
TYPE HTTP_CONNECTION_LIMIT_INFO DWORD
 Flags AS HTTP_PROPERTY_FLAGS
 MaxConnections AS DWORD ' ULONG
END TYPE
' // Size = 8 bytes
TYPE HTTP_BANDWIDTH_LIMIT_INFO DWORD
 Flags AS HTTP_PROPERTY_FLAGS
 MaxBandwidth AS DWORD ' ULONG
END TYPE
' // Size = 16 bytes
TYPE HTTP_FLOWRATE_INFO DWORD
 Flags AS HTTP_PROPERTY_FLAGS
 MaxBandwidth AS DWORD ' ULONG
 MaxPeakBandwidth AS DWORD ' ULONG
 BurstSize AS DWORD ' ULONG
END TYPE
'//
'// Bandwidth throttling limit can not be set lower than the following
'// number. The value is in bytes/sec.
'//
'#define HTTP_MIN_ALLOWED_BANDWIDTH_THROTTLING_RATE ((ULONG)1024)
%EQUATE `HTTP_MIN_ALLOWED_BANDWIDTH_THROTTLING_RATE = 1024
'//
'// Distinguished value for bandwidth, connection limits and logging rollover
'// size indicating "no limit".
'//
'#define HTTP_LIMIT_INFINITE ((ULONG)-1)
%EQUATE `HTTP_LIMIT_INFINITE = &HFFFFFFFF
'//
'// Timeout information.
'//
'//
'// For manipulating global timeout settings.
'// These timers run when connection does not belong to any application.
'// Value zero is not allowed for driver wide timeout settings.
'//
' enum _HTTP_SERVICE_CONFIG_TIMEOUT_KEY
%EQUATE `IdleConnectionTimeout = 0
%EQUATE `HeaderWaitTimeout = 1
'typedef USHORT HTTP_SERVICE_CONFIG_TIMEOUT_PARAM,
' *PHTTP_SERVICE_CONFIG_TIMEOUT_PARAM;
'//
'// To set a timeout value use the set structure. To query/delete use the key
'// directly. When you query a timeout value the output buffer must be exactly
'// the sizeof param.
'//
' // Size = 8 bytes
TYPE HTTP_SERVICE_CONFIG_TIMEOUT_SET DWORD
 KeyDesc AS LONG ' HTTP_SERVICE_CONFIG_TIMEOUT_KEY enum
 ParamDesc AS WORD ' HTTP_SERVICE_CONFIG_TIMEOUT_PARAM
END TYPE
'//
'// For manipulating application specific timeout settings.
'// These timers run when there's a request being processed on a connection
'// and HTTPAPI has already associated the request with an application.
'// Setting a timeout value to zero will cause HTTPAPI to revert to default.
'//
' // Size = 20 bytes
TYPE HTTP_TIMEOUT_LIMIT_INFO DWORD FILL
 Flags AS HTTP_PROPERTY_FLAGS
 ' // Timeouts configured in seconds.
 EntityBody AS WORD ' USHORT
 DrainEntityBody AS WORD ' USHORT
 RequestQueue AS WORD ' USHORT
 ' // Following two timeouts are only enforced after first request on
 ' // connection is routed to the application. These will not manipulate
 ' // the driver wide timeouts.
 IdleConnection AS WORD ' USHORT
 HeaderWait AS WORD ' USHORT
 ' // Timeouts configured in bytes/second.
 ' // This timer can be turned off by setting it to MAXULONG.
 MinSendRate AS DWORD ' ULONG
END TYPE
'//
'// Controls whether IP-based URLs should listen on the specific IP or wildcard.
'//
' // Size = 8 bytes
TYPE HTTP_LISTEN_ENDPOINT_INFO DWORD
 Flags AS HTTP_PROPERTY_FLAGS
 EnableSharing AS BYTE ' BOOLEAN
END TYPE
' // Size = 16 bytes
TYPE HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS DWORD FILL
 DomainNameLength AS WORD ' USHORT
 DomainName AS WSTRINGZ PTR
 RealmLength AS WORD ' USHORT
 Realm AS WSTRINGZ PTR
END TYPE
' // Size = 8 bytes
TYPE HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS DWORD FILL
 RealmLength AS WORD ' USHORT
 Realm AS WSTRINGZ PTR
END TYPE
'//
'// Definitions used for setting server side authentication property.
'//
%EQUATE `HTTP_AUTH_ENABLE_BASIC = &H00000001
%EQUATE `HTTP_AUTH_ENABLE_DIGEST = &H00000002
%EQUATE `HTTP_AUTH_ENABLE_NTLM = &H00000004
%EQUATE `HTTP_AUTH_ENABLE_NEGOTIATE = &H00000008
%EQUATE `HTTP_AUTH_ENABLE_KERBEROS = &H00000010
%EQUATE `HTTP_AUTH_ENABLE_ALL = %HTTP_AUTH_ENABLE_BASIC OR %HTTP_AUTH_ENABLE_DIGEST OR %HTTP_AUTH_ENABLE_NTLM OR %HTTP_AUTH_ENABLE_NEGOTIATE OR %HTTP_AUTH_ENABLE_KERBEROS
'C_ASSERT(HTTP_AUTH_ENABLE_NEGOTIATE > HTTP_AUTH_ENABLE_NTLM);
'C_ASSERT(HTTP_AUTH_ENABLE_NTLM > HTTP_AUTH_ENABLE_DIGEST);
'C_ASSERT(HTTP_AUTH_ENABLE_DIGEST > HTTP_AUTH_ENABLE_BASIC);
%EQUATE `HTTP_AUTH_EX_FLAG_ENABLE_KERBEROS_CREDENTIAL_CACHING = &H01
%EQUATE `HTTP_AUTH_EX_FLAG_CAPTURE_CREDENTIAL = &H02
' // Size = 36 bytes
TYPE HTTP_SERVER_AUTHENTICATION_INFO DWORD FILL
 Flags AS HTTP_PROPERTY_FLAGS
 AuthSchemes AS DWORD ' ULONG
 ReceiveMutualAuth AS BYTE ' BOOLEAN
 ReceiveContextHandle AS BYTE ' BOOLEAN
 DisableNTLMCredentialCaching AS BYTE ' BOOLEAN
 ExFlags AS BYTE ' UCHAR
 DigestParams AS HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS
 BasicParams AS HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS
END TYPE
#IF %WINVER >= &H0601
'//
'// Definitions for setting authentication channel binding properties
'//
' enum HTTP_SERVICE_BINDING_TYPE
%EQUATE `HttpServiceBindingTypeNone = 0
%EQUATE `HttpServiceBindingTypeW = 1
%EQUATE `HttpServiceBindingTypeA = 2
' // Size = 4 bytes
TYPE HTTP_SERVICE_BINDING_BASE DWORD
 Type AS LONG ' HTTP_SERVICE_BINDING_TYPE enum
END TYPE
' // Size = 12 bytes
TYPE HTTP_SERVICE_BINDING_A DWORD
 Base AS HTTP_SERVICE_BINDING_BASE
 Buffer AS ASCIIZ PTR
 BufferSize AS DWORD ' ULONG
END TYPE
' // Size = 12 bytes
TYPE HTTP_SERVICE_BINDING_W DWORD
 Base AS HTTP_SERVICE_BINDING_BASE
 Buffer AS WSTRINGZ PTR
 BufferSize AS DWORD ' ULONG
END TYPE
' enum HTTP_AUTHENTICATION_HARDENING_LEVELS
%EQUATE `HttpAuthenticationHardeningLegacy = 0
%EQUATE `HttpAuthenticationHardeningMedium = 1
%EQUATE `HttpAuthenticationHardeningStrict = 2
'//
'// Channel binding token verification flags.
'//
%EQUATE `HTTP_CHANNEL_BIND_PROXY = &H1
%EQUATE `HTTP_CHANNEL_BIND_PROXY_COHOSTING = &H20
'//
'// Service bind verification flags
'//
%EQUATE `HTTP_CHANNEL_BIND_NO_SERVICE_NAME_CHECK = &H2
%EQUATE `HTTP_CHANNEL_BIND_DOTLESS_SERVICE = &H4
'//
'// Flags triggering channel bind parameters retrieval
'//
%EQUATE `HTTP_CHANNEL_BIND_SECURE_CHANNEL_TOKEN = &H8
%EQUATE `HTTP_CHANNEL_BIND_CLIENT_SERVICE = &H10
'//
'// All valid flags (mask for internal checks)
'//
' // Size = 16 bytes
TYPE HTTP_CHANNEL_BIND_INFO DWORD
 Hardening AS LONG ' HTTP_AUTHENTICATION_HARDENING_LEVELS enum
 Flags AS DWORD ' ULONG
 ServiceNames AS HTTP_SERVICE_BINDING_BASE PTR ' PHTTP_SERVICE_BINDING_BASE *
 NumberOfServiceNames AS DWORD ' ULONG
END TYPE
' // Size = 16 bytes
TYPE HTTP_REQUEST_CHANNEL_BIND_STATUS DWORD
 ServiceName AS HTTP_SERVICE_BINDING_BASE PTR ' PHTTP_SERVICE_BINDING_BASE
 ChannelToken AS BYTE PTR
 ChannelTokenSize AS DWORD ' ULONG
 Flags AS DWORD ' ULONG
END TYPE
#ENDIF
'//
'// Definitions used for setting logging property.
'//
'//
'// The known log fields recognized/supported by HTTPAPI. Following fields
'// are used for W3C logging. Subset of them are also used for error
'// logging.
'//
%EQUATE `HTTP_LOG_FIELD_DATE = &H00000001
%EQUATE `HTTP_LOG_FIELD_TIME = &H00000002
%EQUATE `HTTP_LOG_FIELD_CLIENT_IP = &H00000004
%EQUATE `HTTP_LOG_FIELD_USER_NAME = &H00000008
%EQUATE `HTTP_LOG_FIELD_SITE_NAME = &H00000010
%EQUATE `HTTP_LOG_FIELD_COMPUTER_NAME = &H00000020
%EQUATE `HTTP_LOG_FIELD_SERVER_IP = &H00000040
%EQUATE `HTTP_LOG_FIELD_METHOD = &H00000080
%EQUATE `HTTP_LOG_FIELD_URI_STEM = &H00000100
%EQUATE `HTTP_LOG_FIELD_URI_QUERY = &H00000200
%EQUATE `HTTP_LOG_FIELD_STATUS = &H00000400
%EQUATE `HTTP_LOG_FIELD_WIN32_STATUS = &H00000800
%EQUATE `HTTP_LOG_FIELD_BYTES_SENT = &H00001000
%EQUATE `HTTP_LOG_FIELD_BYTES_RECV = &H00002000
%EQUATE `HTTP_LOG_FIELD_TIME_TAKEN = &H00004000
%EQUATE `HTTP_LOG_FIELD_SERVER_PORT = &H00008000
%EQUATE `HTTP_LOG_FIELD_USER_AGENT = &H00010000
%EQUATE `HTTP_LOG_FIELD_COOKIE = &H00020000
%EQUATE `HTTP_LOG_FIELD_REFERER = &H00040000
%EQUATE `HTTP_LOG_FIELD_VERSION = &H00080000
%EQUATE `HTTP_LOG_FIELD_HOST = &H00100000
%EQUATE `HTTP_LOG_FIELD_SUB_STATUS = &H00200000
'//
'// Fields that are used only for error logging.
'//
%EQUATE `HTTP_LOG_FIELD_CLIENT_PORT = &H00400000
%EQUATE `HTTP_LOG_FIELD_URI = &H00800000
%EQUATE `HTTP_LOG_FIELD_SITE_ID = &H01000000
%EQUATE `HTTP_LOG_FIELD_REASON = &H02000000
%EQUATE `HTTP_LOG_FIELD_QUEUE_NAME = &H04000000
'//
'// Defines the logging type.
'//
' enum HTTP_LOGGING_TYPE
%EQUATE `HttpLoggingTypeW3C = 0
%EQUATE `HttpLoggingTypeIIS = 1
%EQUATE `HttpLoggingTypeNCSA = 2
%EQUATE `HttpLoggingTypeRaw = 3
'//
'// Defines the rollover type for log files.
'//
' enum _HTTP_LOGGING_ROLLOVER_TYPE
%EQUATE `HttpLoggingRolloverSize = 0
%EQUATE `HttpLoggingRolloverDaily = 1
%EQUATE `HttpLoggingRolloverWeekly = 2
%EQUATE `HttpLoggingRolloverMonthly = 3
%EQUATE `HttpLoggingRolloverHourly = 4
'//
'// Log file rollover size can not be set lower than the following
'// limit. The value is in bytes.
'//
'#define HTTP_MIN_ALLOWED_LOG_FILE_ROLLOVER_SIZE ((ULONG)(1 * 1024 * 1024))
%EQUATE `HTTP_MIN_ALLOWED_LOG_FILE_ROLLOVER_SIZE = (1 * 1024 * 1024)
'//
'// Logging option flags. When used in the logging configuration alters
'// some default logging behaviour.
'//
'// HTTP_LOGGING_FLAG_LOCAL_TIME_ROLLOVER - This flag is used to change
'// the log file rollover to happen by local time based. By default
'// log file rollovers happen by GMT time.
'//
'// HTTP_LOGGING_FLAG_USE_UTF8_CONVERSION - When set the unicode fields
'// will be converted to UTF8 multibytes when writting to the log
'// files. When this flag is not present, the local code page
'// conversion happens.
'//
'// HTTP_LOGGING_FLAG_LOG_ERRORS_ONLY -
'// HTTP_LOGGING_FLAG_LOG_SUCCESS_ONLY - These two flags are used to
'// to do selective logging. If neither of them are present both
'// types of requests will be logged. Only one these flags can be
'// set at a time. They are mutually exclusive.
'//
%EQUATE `HTTP_LOGGING_FLAG_LOCAL_TIME_ROLLOVER = &H00000001
%EQUATE `HTTP_LOGGING_FLAG_USE_UTF8_CONVERSION = &H00000002
%EQUATE `HTTP_LOGGING_FLAG_LOG_ERRORS_ONLY = &H00000004
%EQUATE `HTTP_LOGGING_FLAG_LOG_SUCCESS_ONLY = &H00000008
'//
'// Configuration structure used for setting the logging property.
'//
' // Size = 48 bytes
TYPE HTTP_LOGGING_INFO DWORD FILL
 Flags AS HTTP_PROPERTY_FLAGS ' Specifies whether this property exists or not.
 LoggingFlags AS DWORD ' ULONG // Optional logging flags.
 ' // Optional informatonal software directive string for W3C type logging. Not
 ' // used for other types of logging. If nothing is provided here HTTPAPI will
 ' // log a default string. Any arbitrary string could be used here to identify
 ' // the application. Length cannot be greater than MAX_PATH. Lenght is in
 ' // bytes.
 SoftwareName AS WSTRINGZ PTR
 SoftwareNameLength AS WORD ' USHORT
 DirectoryNameLength AS WORD ' USHORT // Length must be in number of bytes.
 DirectoryName AS WSTRINGZ PTR ' PCWSTR // Log file directory must be a fully qualified path.
 Format AS LONG ' HTTP_LOGGING_TYPE // Specifies the format for the log files.
' // Bitmask value indicates which fields to be logged
' // if the log format is set to W3C. This must be the 'bitwise or'
' // of the HTTP_LOG_FIELD_... values.
' //
 Fields AS DWORD ' ULONG
 pExtFields AS DWORD ' PVOID // Reserved must be NULL.
 NumOfExtFields AS WORD ' USHORT // Reserved must be zero.
 MaxRecordSize AS WORD ' USHORT // Reserved must be zero.
 RolloverType AS LONG ' HTTP_LOGGING_ROLLOVER_TYPE // Defines the rollover type for the log files.
 ' // Indicates the maximum size (in bytes) after which
 ' // the log files should be rolled over. A value of -1
 ' // (HTTP_LIMIT_INFINITE) indicates an unlimited size.
 ' // This value is discarded if rollover type is not set to
 ' // HttpLoggingRolloverSize.
 RolloverSize AS DWORD ' ULONG
 ' // Specifies the security descriptor to be applied to
 ' // the log files and the sub-directories. If null we will
 ' // inherit the system default. This security descriptor must
 ' // be self-relative.
 pSecurityDescriptor AS SECURITY_DESCRIPTOR PTR ' PSECURITY_DESCRIPTOR
END TYPE
'//
'// Binding information.
'//
' // Size = 8 bytes
TYPE HTTP_BINDING_INFO DWORD
 Flags AS HTTP_PROPERTY_FLAGS
 RequestQueueHandle AS DWORD
END TYPE
#ENDIF
#IF %WINVER >= &H0601
' enum HTTP_PROTECTION_LEVEL_TYPE
' //
' // This option will allow edge (NAT) traversed traffic, i.e. Teredo
' // for the UrlGroup, unless there is an admin rule that overwrites the
' // application's intend.
' //
%EQUATE `HttpProtectionLevelUnrestricted = 0
' //
' // This setting will ensure that edge (NAT) traversed traffic
' // will not be allowed.
' //
%EQUATE `HttpProtectionLevelEdgeRestricted = 1
' //
' // Below type is not supported by HTTP API.
' //
%EQUATE `HttpProtectionLevelRestricted = 2
'//
'// Controls whether the associated UrlGroup Namespace should receive
'// edge traversed traffic. By default this parameter is unspecified.
'//
' // Size = 8 bytes
TYPE HTTP_PROTECTION_LEVEL_INFO DWORD
 Flags AS HTTP_PROPERTY_FLAGS
 Level AS LONG ' HTTP_PROTECTION_LEVEL_TYPE
END TYPE
#ENDIF
#IF %WINVER >= &H0600
'//
'// Definitions for request queue manipulation.
'//
'// These flags are used with HttpCreateRequestQueue() API.
'//
'// HTTP_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING - To open an existing request
'// queue. The request queue name must be supplied.
'//
'// HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER - Creates the request queue and
'// marks that the caller process is not willing to do send/receive (HTTP I/O)on
'// the handle directly.
'//
%EQUATE `HTTP_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING = &H00000001
%EQUATE `HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER = &H00000002
#ENDIF ' // WINVER >= 0x0600
'//
'// Flags for HttpReceiveHttpRequest().
'//
'// HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY - Specifies that the caller would like
'// any available entity body to be copied along with the protocol headers.
'//
%EQUATE `HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY = &H00000001
%EQUATE `HTTP_RECEIVE_REQUEST_FLAG_FLUSH_BODY = &H00000002
#IF %WINVER >= &H0600
'//
'// Flags for HttpReceiveRequestEntityBody().
'//
'// HTTP_RECEIVE_REQUEST_ENTITY_BODY_FLAG_FILL_BUFFER - Specifies that the
'// caller would like the buffer to get filled up with entity bodies unless
'// there are no more entity bodies to be copied.
'//
%EQUATE `HTTP_RECEIVE_REQUEST_ENTITY_BODY_FLAG_FILL_BUFFER = &H00000001
#ENDIF ' // WINVER >= 0x0600
'//
'// Flags for HttpSendHttpResponse() and HttpSendResponseEntityBody().
'//
'// HTTP_SEND_RESPONSE_FLAG_DISCONNECT - Specifies that the network connection
'// should be disconnected immediately after sending the response, overriding
'// the HTTP protocol's persistent connection features, such as
'// "Connection: keep-alive".
'//
'// HTTP_SEND_RESPONSE_FLAG_MORE_DATA - Specifies that additional entity body
'// data will be sent by the caller.
'//
'// HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA - Specifies that a caller wants the
'// response to complete as soon as possible at the cost by buffering partial
'// or the entire response.
'//
'// HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING - Specifies that a caller wants to
'// enable the TCP nagling algorithm for this particular send.
'//
'// HTTP_SEND_RESPONSE_FLAG_PROCESS_RANGES - Specifies that for a range request
'// a full response content is passed and a caller wants HTTP API to process
'// ranges properly.
'//
%EQUATE `HTTP_SEND_RESPONSE_FLAG_DISCONNECT = &H00000001
%EQUATE `HTTP_SEND_RESPONSE_FLAG_MORE_DATA = &H00000002
%EQUATE `HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA = &H00000004
%EQUATE `HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING = &H00000008
%EQUATE `HTTP_SEND_RESPONSE_FLAG_PROCESS_RANGES = &H00000020
'//
'// Flags for HttpFlushResponseCache().
'//
'// HTTP_FLUSH_RESPONSE_FLAG_RECURSIVE - Flushes the specified URL and all
'// hierarchally-related sub-URLs from the response or fragment cache.
'//
%EQUATE `HTTP_FLUSH_RESPONSE_FLAG_RECURSIVE = &H00000001
'//
'// Opaque identifiers for various kernel objects.
'//
'typedef ULONGLONG HTTP_OPAQUE_ID, *PHTTP_OPAQUE_ID;
'typedef HTTP_OPAQUE_ID HTTP_REQUEST_ID, *PHTTP_REQUEST_ID;
'typedef HTTP_OPAQUE_ID HTTP_CONNECTION_ID, *PHTTP_CONNECTION_ID;
'typedef HTTP_OPAQUE_ID HTTP_RAW_CONNECTION_ID, *PHTTP_RAW_CONNECTION_ID;
'#if _WIN32_WINNT >= 0x0600
'typedef HTTP_OPAQUE_ID HTTP_URL_GROUP_ID, *PHTTP_URL_GROUP_ID;
'typedef HTTP_OPAQUE_ID HTTP_SERVER_SESSION_ID, *PHTTP_SERVER_SESSION_ID;
'#endif // _WIN32_WINNT >= 0x0600
'//
'// Macros for opaque identifier manipulations.
'//
'#define HTTP_NULL_ID (0ui64)
'#define HTTP_IS_NULL_ID(pid) (HTTP_NULL_ID == *(pid))
'#define HTTP_SET_NULL_ID(pid) (*(pid) = HTTP_NULL_ID)
%EQUATE `HTTP_NULL_ID = 0&&
'//
'// This structure defines a file byte range.
'//
'// If the Length field is HTTP_BYTE_RANGE_TO_EOF then the remainder of the
'// file (everything after StartingOffset) is sent.
'//
'#define HTTP_BYTE_RANGE_TO_EOF ((ULONGLONG)-1)
%EQUATE `HTTP_BYTE_RANGE_TO_EOF = -1&&
' // Size = 16 bytes
TYPE HTTP_BYTE_RANGE QWORD
 StartingOffset AS QUAD ' ULARGE_INTEGER
 Length AS QUAD ' ULARGE_INTEGER
END TYPE
'//
'// The type for HTTP protocol version numbers.
'//
' // Size = 4 bytes
TYPE HTTP_VERSION WORD
 MajorVersion AS WORD ' USHORT
 MinorVersion AS WORD ' USHORT
END TYPE
'//
'// Some useful macros for HTTP protocol version manipulation.
'//
'#define HTTP_VERSION_UNKNOWN { 0, 0 }
'#define HTTP_VERSION_0_9 { 0, 9 }
'#define HTTP_VERSION_1_0 { 1, 0 }
'#define HTTP_VERSION_1_1 { 1, 1 }
'#define HTTP_SET_VERSION(version, major, minor) \
'do { \
' (version).MajorVersion = (major); \
' (version).MinorVersion = (minor); \
'} while (0, 0)
'#define HTTP_EQUAL_VERSION(version, major, minor) \
' ((version).MajorVersion == (major) && \
' (version).MinorVersion == (minor))
'#define HTTP_GREATER_VERSION(version, major, minor) \
' ((version).MajorVersion > (major) || \
' ((version).MajorVersion == (major) && \
' (version).MinorVersion > (minor)))
'#define HTTP_LESS_VERSION(version, major, minor) \
' ((version).MajorVersion < (major) || \
' ((version).MajorVersion == (major) && \
' (version).MinorVersion < (minor)))
'#define HTTP_NOT_EQUAL_VERSION(version, major, minor) \
' (!HTTP_EQUAL_VERSION(version, major, minor))
'#define HTTP_GREATER_EQUAL_VERSION(version, major, minor) \
' (!HTTP_LESS_VERSION(version, major, minor))
'#define HTTP_LESS_EQUAL_VERSION(version, major, minor) \
' (!HTTP_GREATER_VERSION(version, major, minor))
'//
'// The enum type for HTTP verbs.
'//
' HTTP_VERB enum
%EQUATE `HttpVerbUnparsed = 0
%EQUATE `HttpVerbUnknown = 1
%EQUATE `HttpVerbInvalid = 2
%EQUATE `HttpVerbOPTIONS = 3
%EQUATE `HttpVerbGET = 4
%EQUATE `HttpVerbHEAD = 5
%EQUATE `HttpVerbPOST = 6
%EQUATE `HttpVerbPUT = 7
%EQUATE `HttpVerbDELETE = 8
%EQUATE `HttpVerbTRACE = 9
%EQUATE `HttpVerbCONNECT = 10
%EQUATE `HttpVerbTRACK = 11 ' // used by Microsoft Cluster Server for a non-logged trace
%EQUATE `HttpVerbMOVE = 12
%EQUATE `HttpVerbCOPY = 13
%EQUATE `HttpVerbPROPFIND = 14
%EQUATE `HttpVerbPROPPATCH = 15
%EQUATE `HttpVerbMKCOL = 16
%EQUATE `HttpVerbLOCK = 17
%EQUATE `HttpVerbUNLOCK = 18
%EQUATE `HttpVerbSEARCH = 19
%EQUATE `HttpVerbMaximum = 20
'//
'// Symbols for all HTTP/1.1 headers and other tokens. Notice request +
'// response values overlap. Make sure you know which type of header array
'// you are indexing.
'//
'// These values are used as offsets into arrays and as token values in
'// HTTP_KNOWN_HEADER arrays in HTTP_REQUEST_HEADERS and HTTP_RESPONSE_HEADERS.
'//
'// See RFC 2616, HTTP/1.1, for further explanation of most of these headers.
'//
' HTTP_HEADER_ID enum
%EQUATE `HttpHeaderCacheControl = 0 ' // general-header [section 4.5]
%EQUATE `HttpHeaderConnection = 1 ' // general-header [section 4.5]
%EQUATE `HttpHeaderDate = 2 ' // general-header [section 4.5]
%EQUATE `HttpHeaderKeepAlive = 3 ' // general-header [not in rfc]
%EQUATE `HttpHeaderPragma = 4 ' // general-header [section 4.5]
%EQUATE `HttpHeaderTrailer = 5 ' // general-header [section 4.5]
%EQUATE `HttpHeaderTransferEncoding = 6 ' // general-header [section 4.5]
%EQUATE `HttpHeaderUpgrade = 7 ' // general-header [section 4.5]
%EQUATE `HttpHeaderVia = 8 ' // general-header [section 4.5]
%EQUATE `HttpHeaderWarning = 9 ' // general-header [section 4.5]
%EQUATE `HttpHeaderAllow = 10 ' // entity-header [section 7.1]
%EQUATE `HttpHeaderContentLength = 11 ' // entity-header [section 7.1]
%EQUATE `HttpHeaderContentType = 12 ' // entity-header [section 7.1]
%EQUATE `HttpHeaderContentEncoding = 13 ' // entity-header [section 7.1]
%EQUATE `HttpHeaderContentLanguage = 14 ' // entity-header [section 7.1]
%EQUATE `HttpHeaderContentLocation = 15 ' // entity-header [section 7.1]
%EQUATE `HttpHeaderContentMd5 = 16 ' // entity-header [section 7.1]
%EQUATE `HttpHeaderContentRange = 17 ' // entity-header [section 7.1]
%EQUATE `HttpHeaderExpires = 18 ' // entity-header [section 7.1]
%EQUATE `HttpHeaderLastModified = 19 ' // entity-header [section 7.1]
' // Request Headers
%EQUATE `HttpHeaderAccept = 20 ' // request-header [section 5.3]
%EQUATE `HttpHeaderAcceptCharset = 21 ' // request-header [section 5.3]
%EQUATE `HttpHeaderAcceptEncoding = 22 ' // request-header [section 5.3]
%EQUATE `HttpHeaderAcceptLanguage = 23 ' // request-header [section 5.3]
%EQUATE `HttpHeaderAuthorization = 24 ' // request-header [section 5.3]
%EQUATE `HttpHeaderCookie = 25 ' // request-header [not in rfc]
%EQUATE `HttpHeaderExpect = 26 ' // request-header [section 5.3]
%EQUATE `HttpHeaderFrom = 27 ' // request-header [section 5.3]
%EQUATE `HttpHeaderHost = 28 ' // request-header [section 5.3]
%EQUATE `HttpHeaderIfMatch = 29 ' // request-header [section 5.3]
%EQUATE `HttpHeaderIfModifiedSince = 30 ' // request-header [section 5.3]
%EQUATE `HttpHeaderIfNoneMatch = 31 ' // request-header [section 5.3]
%EQUATE `HttpHeaderIfRange = 32 ' // request-header [section 5.3]
%EQUATE `HttpHeaderIfUnmodifiedSince = 33 ' // request-header [section 5.3]
%EQUATE `HttpHeaderMaxForwards = 34 ' // request-header [section 5.3]
%EQUATE `HttpHeaderProxyAuthorization = 35 ' // request-header [section 5.3]
%EQUATE `HttpHeaderReferer = 36 ' // request-header [section 5.3]
%EQUATE `HttpHeaderRange = 37 ' // request-header [section 5.3]
%EQUATE `HttpHeaderTe = 38 ' // request-header [section 5.3]
%EQUATE `HttpHeaderTranslate = 39 ' // request-header [webDAV not in rfc 2518]
%EQUATE `HttpHeaderUserAgent = 40 ' // request-header [section 5.3]
%EQUATE `HttpHeaderRequestMaximum = 41
' // Response Headers
%EQUATE `HttpHeaderAcceptRanges = 20 ' // response-header [section 6.2]
%EQUATE `HttpHeaderAge = 21 ' // response-header [section 6.2]
%EQUATE `HttpHeaderEtag = 22 ' // response-header [section 6.2]
%EQUATE `HttpHeaderLocation = 23 ' // response-header [section 6.2]
%EQUATE `HttpHeaderProxyAuthenticate = 24 ' // response-header [section 6.2]
%EQUATE `HttpHeaderRetryAfter = 25 ' // response-header [section 6.2]
%EQUATE `HttpHeaderServer = 26 ' // response-header [section 6.2]
%EQUATE `HttpHeaderSetCookie = 27 ' // response-header [not in rfc]
%EQUATE `HttpHeaderVary = 28 ' // response-header [section 6.2]
%EQUATE `HttpHeaderWwwAuthenticate = 29 ' // response-header [section 6.2]
%EQUATE `HttpHeaderResponseMaximum = 30
%EQUATE `HttpHeaderMaximum = 41
'//
'// Structure defining format of a known HTTP header.
'// Name is from HTTP_HEADER_ID.
'//
' // Size = 8 bytes
TYPE HTTP_KNOWN_HEADER DWORD FILL
 RawValueLength AS WORD ' USHORT // in bytes not including the NUL
 pRawValue AS ASCIIZ PTR
END TYPE
'//
'// Structure defining format of an unknown header.
'//
' // Size = 12 bytes
TYPE HTTP_UNKNOWN_HEADER DWORD FILL
 NameLength AS WORD ' USHORT // in bytes not including the NUL
 RawValueLength AS WORD ' USHORT // in bytes not including the NUL
 pName AS ASCIIZ PTR ' PCSTR // The header name (minus the ':' character)
 pRawValue AS ASCIIZ PTR ' PCSTR // The header value
END TYPE
#IF %WINVER >= &H0600
'//
'// Log fields data structure is used for logging a request. This structure must
'// be provided along with an HttpSendHttpResponse or HttpSendResponseEntityBody
'// call that concludes the send.
'//
'// Base structure is for future versioning.
' enum _HTTP_LOG_DATA_TYPE
%EQUATE `HttpLogDataTypeFields = 0
'// should we DECLSPEC_ALIGN(4 or 8) == DECLSPEC_POINTERALIGN?
' // Size = 4 bytes
TYPE HTTP_LOG_DATA DWORD
 Type AS LONG ' HTTP_LOG_DATA_TYPE
END TYPE
'// Current log fields data structure for of type HttpLogDataTypeFields.
' // Size = 92 bytes
TYPE HTTP_LOG_FIELDS_DATA
 Base AS HTTP_LOG_DATA
 UserNameLength AS WORD ' USHORT
 UriStemLength AS WORD ' USHORT
 ClientIpLength AS WORD ' USHORT
 ServerNameLength AS WORD ' USHORT
 ServiceNameLength AS WORD ' USHORT
 ServerIpLength AS WORD ' USHORT
 MethodLength AS WORD ' USHORT
 UriQueryLength AS WORD ' USHORT
 HostLength AS WORD ' USHORT
 UserAgentLength AS WORD ' USHORT
 CookieLength AS WORD ' USHORT
 ReferrerLength AS WORD ' USHORT
 UserName AS WSTRINGZ PTR
 UriStem AS WSTRINGZ PTR
 ClientIp AS WSTRINGZ PTR
 ServerName AS WSTRINGZ PTR
 ServiceName AS WSTRINGZ PTR
 ServerIp AS WSTRINGZ PTR
 Method AS WSTRINGZ PTR
 UriQuery AS WSTRINGZ PTR
 Host AS WSTRINGZ PTR
 UserAgent AS WSTRINGZ PTR
 Cookie AS WSTRINGZ PTR
 Referrer AS WSTRINGZ PTR
 ServerPort AS WORD ' USHORT
 ProtocolStatus AS WORD ' USHORT
 Win32Status AS DWORD ' ULONG
 MethodNum AS LONG ' HTTP_VERB
 SubStatus AS WORD ' USHORT
 alignment__ AS WORD ' // To keep DWORD alignment
END TYPE
#ENDIF ' // WINVER >= 0x0600
'//
'// This enum defines a data source for a particular chunk of data.
'//
' HTTP_DATA_CHUNK_TYPE enum
%EQUATE `HttpDataChunkFromMemory = 0
%EQUATE `HttpDataChunkFromFileHandle = 1
%EQUATE `HttpDataChunkFromFragmentCache = 2
%EQUATE `HttpDataChunkFromFragmentCacheEx = 3
%EQUATE `HttpDataChunkMaximum = 4
'//
'// This structure describes an individual data chunk.
'//
' // Size = 8 bytes
TYPE HTTP_DATA_CHUNK_FromMemory DWORD
 pBuffer AS DWORD
 BufferLength AS DWORD ' ULONG
END TYPE
' // Size = 24 bytes
TYPE HTTP_DATA_CHUNK_FromFileHandle QWORD
 ByteRange AS HTTP_BYTE_RANGE
 FileHandle AS DWORD
END TYPE
' // Size = 8 bytes
TYPE HTTP_DATA_CHUNK_FromFragmentCache DWORD FILL
 FragmentNameLength AS WORD ' USHORT // in bytes not including the NUL
 pFragmentName AS WSTRINGZ PTR ' PCWSTR // NULL-terminated string
END TYPE
' // size = 24 bytes
UNION HTTP_DATA_CHUNK_UNION
 HTTP_DATA_CHUNK_FromMemory ' // From-memory data chunk.
 HTTP_DATA_CHUNK_FromFileHandle ' // From-file handle data chunk.
 HTTP_DATA_CHUNK_FromFragmentCache ' // From-fragment cache data chunk.
END UNION
' // Size = 32 bytes
TYPE HTTP_DATA_CHUNK QWORD FILL
 DataChunkType AS LONG ' HTTP_DATA_CHUNK_TYPE enum // The type of this data chunk.
 HTTP_DATA_CHUNK_UNION
END TYPE
'//
'// HTTP API doesn't support 16 bit applications.
'// Neither WIN32 nor _WIN64 was defined.
'//
'C_ASSERT(TYPE_ALIGNMENT(HTTP_DATA_CHUNK) == sizeof(ULONGLONG));
'//
'// Structure defining format of request headers.
'//
' // Size = 344 bytes
TYPE HTTP_REQUEST_HEADERS DWORD FILL
 UnknownHeaderCount AS WORD ' USHORT / Number of entries in the array.
 pUnknownHeaders AS HTTP_UNKNOWN_HEADER PTR ' PHTTP_UNKNOWN_HEADER // Array of unknown HTTP headers
 TrailerCount AS WORD ' USHORT // Reserved, must be 0
 pTrailers AS HTTP_UNKNOWN_HEADER PTR ' PHTTP_UNKNOWN_HEADER // Reserved, must be NULL
 KnownHeaders(%HttpHeaderRequestMaximum - 1) AS HTTP_KNOWN_HEADER ' // Known headers.
END TYPE
'//
'// Structure defining format of response headers.
'//
' // Size = 256 bytes
TYPE HTTP_RESPONSE_HEADERS DWORD FILL
 UnknownHeaderCount AS WORD ' USHORT // Number of entries in the array
 pUnknownHeaders AS HTTP_UNKNOWN_HEADER PTR ' PHTTP_UNKNOWN_HEADER // Array of unknown HTTP headers
 TrailerCount AS WORD ' USHORT // Reserved, must be 0
 pTrailers AS HTTP_UNKNOWN_HEADER PTR ' PHTTP_UNKNOWN_HEADER // Reserved, must be NULL
 KnownHeaders(%HttpHeaderResponseMaximum - 1) AS HTTP_KNOWN_HEADER ' // Known headers.
END TYPE
'//
'// Structure defining format of transport address. Use pLocalAddress->sa_family
'// to determine whether this is an IPv4 address (AF_INET) or IPv6 (AF_INET6).
'//
'// pRemoteAddress->sa_family will be the same as pLocalAddress->sa_family.
'//
'// SOCKADDRs are always in network order, not host order.
'//
' // Size = 8 bytes
TYPE HTTP_TRANSPORT_ADDRESS DWORD
 pRemoteAddress AS SOCKADDR PTR
 pLocalAddress AS SOCKADDR PTR
END TYPE
'//
'// Structure defining format of cooked URL.
'//
' // Size = 24 bytes
TYPE HTTP_COOKED_URL DWORD FILL
 ' // Pointers overlap and point into pFullUrl. NULL if not present.
 FullUrlLength AS WORD ' USHORT // in bytes not including the NUL
 HostLength AS WORD ' USHORT // in bytes (no NUL)
 AbsPathLength AS WORD ' USHORT // in bytes (no NUL)
 QueryStringLength AS WORD ' USHORT // in bytes (no NUL)
 pFullUrl AS WSTRINGZ PTR ' PCWSTR // points to "http://hostname:port/abs/.../path?query"
 pHost AS WSTRINGZ PTR ' PCWSTR // points to the first char in the hostname
 pAbsPath AS WSTRINGZ PTR ' PCWSTR // Points to the 3rd '/' char
 pQueryString AS WSTRINGZ PTR ' PCWSTR // // Points to the 1st '?' char or NULL
END TYPE
'//
'// An opaque context for URLs
'//
'typedef ULONGLONG HTTP_URL_CONTEXT;
#IF %WINVER >= &H0600
'//
'// Optional flags for URL manipulation functions.
'//
'// HTTP_URL_FLAG_REMOVE_ALL : When this flag is used
'// when removing a Url from a url group, regardless of
'// the passed URL, all of the Urls from the url group
'// will be removed.
'//
%EQUATE `HTTP_URL_FLAG_REMOVE_ALL = 00000001
'//
'// Request Authentication related.
'//
' enum _HTTP_AUTH_STATUS
%EQUATE `HttpAuthStatusSuccess = 0
%EQUATE `HttpAuthStatusNotAuthenticated = 1
%EQUATE `HttpAuthStatusFailure = 2
' enum _HTTP_REQUEST_AUTH_TYPE
%EQUATE `HttpRequestAuthTypeNone = 0
%EQUATE `HttpRequestAuthTypeBasic = 1
%EQUATE `HttpRequestAuthTypeDigest = 2
%EQUATE `HttpRequestAuthTypeNTLM = 3
%EQUATE `HttpRequestAuthTypeNegotiate = 4
%EQUATE `HttpRequestAuthTypeKerberos = 5
#ENDIF ' // WINVER >= 0x0600
'//
'// SSL Client certificate information.
'//
' // Size = 20 bytes
TYPE HTTP_SSL_CLIENT_CERT_INFO DWORD
 CertFlags AS DWORD ' ULONG
 CertEncodedSize AS DWORD ' ULONG
 pCertEncoded AS BYTE PTR
 Token AS DWORD
 CertDeniedByMapper AS BYTE ' BOOLEAN
END TYPE
#IF %WINVER >= &H0601
'//
'// Flag to retrieve secure channel binding with HttpReceiveClientCertificate
'//
%EQUATE `HTTP_RECEIVE_SECURE_CHANNEL_TOKEN = &H1
#ENDIF
'//
'// Data computed during SSL handshake.
'//
' // Size = 28 bytes
TYPE HTTP_SSL_INFO DWORD FILL
 ServerCertKeySize AS WORD ' USHORT
 ConnectionKeySize AS WORD ' USHORT
 ServerCertIssuerSize AS DWORD ' ULONG
 ServerCertSubjectSize AS DWORD ' ULONG
 pServerCertIssuer AS ASCIIZ PTR
 pServerCertSubject AS ASCIIZ PTR
 pClientCertInfo AS HTTP_SSL_CLIENT_CERT_INFO PTR
 SslClientCertNegotiated AS DWORD ' ULONG
END TYPE
#IF %WINVER >= &H0600
'//
'// Generic request information type.
'//
' enum HTTP_REQUEST_INFO_TYPE
%EQUATE `HttpRequestInfoTypeAuth = 0
#IF %WINVER >= &H0601
%EQUATE `HttpRequestInfoTypeChannelBind = 1
#ENDIF
' // Size = 12 bytes
TYPE HTTP_REQUEST_INFO DWORD
 InfoType AS LONG ' HTTP_REQUEST_INFO_TYPE
 InfoLength AS DWORD ' ULONG
 pInfo AS DWORD
END TYPE
'#ifndef __SECSTATUS_DEFINED__
'typedef LONG SECURITY_STATUS;
'#define __SECSTATUS_DEFINED__
'#endif // __SECSTATUS_DEFINED__
'//
'// Authentication request info structure
'//
%EQUATE `HTTP_REQUEST_AUTH_FLAG_TOKEN_FOR_CACHED_CRED = &H00000001
' // Size = 52 bytes
TYPE HTTP_REQUEST_AUTH_INFO DWORD FILL
 AuthStatus AS LONG ' HTTP_REQUEST_AUTH_TYPE enum
 SecStatus AS LONG ' SECURITY_STATUS
 Flags AS DWORD ' ULONG
 AuthType AS LONG ' HTTP_REQUEST_AUTH_TYPE
 AccessToken AS DWORD
 ContextAttributes AS DWORD ' ULONG
 ' // Optional serialized context.
 PackedContextLength AS DWORD ' ULONG
 PackedContextType AS DWORD ' ULONG
 PackedContext AS DWORD
 ' // Optional mutual authentication data and its length in bytes.
 MutualAuthDataLength AS DWORD ' ULONG
 pMutualAuthData AS BYTE PTR
 ' // For SSPI based schemes the package name is returned. Length does
 ' // not include the terminating null and it is in bytes.
 PackageNameLength AS WORD ' USHORT
 pPackageName AS WSTRINGZ PTR
END TYPE
#ENDIF ' // WINVER >= 0x0600
'//
'// The structure of an HTTP request for downlevel OS
'//
' // Size = 464 bytes
TYPE HTTP_REQUEST_V1 QWORD FILL
 Flags AS DWORD ' ULONG // Request flags
 ConnectionId AS QUAD ' HTTP_CONNECTION_ID // An opaque connection identifier
 RequestId AS QUAD ' HTTP_REQUEST_ID // An opaque request identifier
 UrlContext AS QUAD ' HTTP_URL_CONTEXT // The context associated with the URL prefix
 Version AS HTTP_VERSION ' HTTP_VERSION // The HTTP version number
 Verb AS LONG ' HTTP_VERB // The request verb
 UnknownVerbLength AS WORD ' USHORT // The length of the verb string if the Verb field is HttpVerbUnknown // in bytes not including the NUL
 RawUrlLength AS WORD ' USHORT // The length of the raw (uncooked) URL // in bytes not including the NUL
 pUnknownVerb AS ASCIIZ PTR ' PCSTR // Pointer to the verb string if the Verb field is HttpVerbUnknown
 pRawUrl AS ASCIIZ PTR ' PCSTR // Pointer to the raw (uncooked) URL
 CookedUrl AS HTTP_COOKED_URL ' HTTP_COOKED_URL // The canonicalized Unicode URL
 Address AS HTTP_TRANSPORT_ADDRESS ' HTTP_TRANSPORT_ADDRESS // Local and remote transport addresses for the connection
 Headers AS HTTP_REQUEST_HEADERS ' HTTP_REQUEST_HEADERS // The request headers
 BytesReceived AS QUAD ' ULONGLONG // The total number of bytes received from network for this request
 EntityChunkCount AS WORD ' USHORT // Number of HTTP_DATA_CHUNKs
 pEntityChunks AS HTTP_DATA_CHUNK PTR ' PHTTP_DATA_CHUNK // Array of EntityChunkCount HTTP_DATA_CHUNKs
 RawConnectionId AS QUAD ' HTTP_RAW_CONNECTION_ID // SSL connection information.
 pSslInfo AS HTTP_SSL_INFO PTR ' PHTTP_SSL_INFO
 alignment1__ AS DWORD ' To keep 8 byte alignment
END TYPE
#IF %WINVER >= &H0600
'// Vista
'//
'// Version 2.0 members are defined here
'// N.B. One must define V2 elements in two places :(
'// This is due to the fact that C++ doesn't allow anonymous
'// structure declarations and one must use structure
'// inheritance instead.
'//
' // Size = 472 bytes
TYPE HTTP_REQUEST_V2 ' Must be 8 byte aligned
 HTTP_REQUEST_V1
 RequestInfoCount AS WORD ' USHORT // Additional Request Information
 alignment2__ AS WORD ' // To keep 8 byte alignment
 pRequestInfo AS HTTP_REQUEST_INFO PTR ' PHTTP_REQUEST_INFO // Additional Request Information
END TYPE
#ENDIF ' // WINVER >= 0x0600
#IF %WINVER = &H0600
MACRO HTTP_REQUEST = HTTP_REQUEST_V2
#ELSE
MACRO HTTP_REQUEST = HTTP_REQUEST_V1
#ENDIF ' // WINVER >= 0x0600
'//
'// Values for HTTP_REQUEST::Flags. Zero or more of these may be ORed together.
'//
'// HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS - there is more entity body
'// to be read for this request. Otherwise, there is no entity body or
'// all of the entity body was copied into pEntityChunks.
'// HTTP_REQUEST_FLAG_IP_ROUTED - This flag indicates that the request has been
'// routed based on host plus ip or ip binding.This is a hint for the application
'// to include the local ip while flushing kernel cache entries build for this
'// request if any.
'//
%EQUATE `HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS = &H00000001
%EQUATE `HTTP_REQUEST_FLAG_IP_ROUTED = &H00000002
'//
'// This structure describes an HTTP response.
'//
' // Size = 280 bytes
TYPE HTTP_RESPONSE_V1 DWORD FILL
 Flags AS DWORD ' ULONG // Response flags
 Version AS HTTP_VERSION ' HTTP_VERSION // The raw HTTP protocol version number
 StatusCode AS WORD ' USHORT // The HTTP status code (e.g., 200)
 ReasonLength AS WORD ' USHORT // // in bytes not including the '\0'
 pReason AS ASCIIZ PTR ' PCSTR // The HTTP reason (e.g., "OK")
 Headers AS HTTP_RESPONSE_HEADERS ' HTTP_RESPONSE_HEADERS // The response headers
 EntityChunkCount AS WORD ' USHORT // Number of HTTP_DATA_CHUNKs
 pEntityChunks AS HTTP_DATA_CHUNK PTR ' PHTTP_DATA_CHUNK // Array of EntityChunkCount HTTP_DATA_CHUNKs
END TYPE
#IF %WINVER >= &H0600
'//
'// Values for HTTP_RESPONSE::Flags.
'//
'// HTTP_RESPONSE_FLAG_MULTIPLE_ENCODINGS_AVAILABLE - Set this flag if encodings
'// other than identity form are available for this resource.This flag is ignored
'// if application has not asked for response to be cached. It's used as a hint
'// to the Http Server API for content negotiation used when serving from the
'// the kernel response cache.
'//
%EQUATE `HTTP_RESPONSE_FLAG_MULTIPLE_ENCODINGS_AVAILABLE = &H00000001
'// Vista
' enum HTTP_RESPONSE_INFO_TYPE
%EQUATE `HttpResponseInfoTypeMultipleKnownHeaders = 0
%EQUATE `HttpResponseInfoTypeAuthenticationProperty = 1
%EQUATE `HttpResponseInfoTypeQoSProperty = 2
#IF %WINVER >= &H0601
%EQUATE `HttpResponseInfoTypeChannelBind = 3
#ENDIF
' // Size = 12 bytes
TYPE HTTP_RESPONSE_INFO DWORD
 Type AS LONG ' HTTP_RESPONSE_INFO_TYPE enum
 Length AS DWORD ' ULONG
 pInfo AS DWORD
END TYPE
%EQUATE `HTTP_RESPONSE_INFO_FLAGS_PRESERVE_ORDER = &H00000001
'// This structure allows the provision of providing multiple known headers.
' // Size = 16 bytes
TYPE HTTP_MULTIPLE_KNOWN_HEADERS DWORD FILL
 HeaderId AS LONG ' HTTP_HEADER_ID enum // Known header id
 Flags AS DWORD ' ULONG // Flags
 KnownHeaderCount AS WORD ' USHORT // Number of headers of the same category
 KnownHeaders AS HTTP_KNOWN_HEADER PTR ' PHTTP_KNOWN_HEADER // Array of known header structures
END TYPE
'//
'// Version 2.0 members are defined here
'// N.B. One must define V2 elements in two places :(
'// This is due to the fact that C++ doesn't allow anonymous
'// structure declarations and one must use structure
'// inheritance instead.
'//
' // Size = 288 bytes
TYPE HTTP_RESPONSE_V2 DWORD FILL
 HTTP_RESPONSE_V1
 ResponseInfoCount AS WORD ' USHORT
 pResponseInfo AS HTTP_RESPONSE_INFO PTR ' PHTTP_RESPONSE_INFO
END TYPE
#ENDIF ' // WINVER >= 0x0600
#IF %WINVER >= &H0600
 MACRO HTTP_RESPONSE = HTTP_RESPONSE_V2
#ELSE
 MACRO HTTP_RESPONSE = HTTP_RESPONSE_V1
#ENDIF
'//
'// Api Version. This is used to ensure compatibility between applications and
'// httpapi.dll and http.sys.
'//
'// This must not be confused with the HTTP Protocol version.
'//
' // Size = 4 bytes
TYPE HTTPAPI_VERSION WORD
 HttpApiMajorVersion AS WORD ' USHORT
 HttpApiMinorVersion AS WORD ' USHORT
END TYPE
'#if _WIN32_WINNT >= 0x0600
'// Vista
'#define HTTPAPI_VERSION_2 { 2, 0 }
'#endif // _WIN32_WINNT >= 0x0600
'#define HTTPAPI_VERSION_1 { 1, 0 }
'#define HTTPAPI_EQUAL_VERSION(version, major, minor) \
' ((version).HttpApiMajorVersion == (major) && \
' (version).HttpApiMinorVersion == (minor))
'#define HTTPAPI_GREATER_VERSION(version, major, minor) \
' ((version).HttpApiMajorVersion > (major) || \
' ((version).HttpApiMajorVersion == (major) && \
' (version).HttpApiMinorVersion > (minor)))
'#define HTTPAPI_LESS_VERSION(version, major, minor) \
' ((version).HttpApiMajorVersion < (major) || \
' ((version).HttpApiMajorVersion == (major) && \
' (version).HttpApiMinorVersion < (minor)))
'#define HTTPAPI_VERSION_GREATER_OR_EQUAL( version, major, minor) \
' (!HTTPAPI_LESS_VERSION(version, major, minor))
'//
'// Cache control.
'//
'//
'// This enum defines the available cache policies.
'//
' HTTP_CACHE_POLICY_TYPE enum
%EQUATE `HttpCachePolicyNocache = 0
%EQUATE `HttpCachePolicyUserInvalidates = 1
%EQUATE `HttpCachePolicyTimeToLive = 2
%EQUATE `HttpCachePolicyMaximum = 3
'//
'// Only cache unauthorized GETs + HEADs.
'//
' // Size = 8 bytes
TYPE HTTP_CACHE_POLICY DWORD
 Policy AS LONG ' HTTP_CACHE_POLICY_TYPE
 SecondsToLive AS DWORD ' ULONG
END TYPE
'//
'// Enum that is used with HttpSetServiceConfiguration(),
'// HttpQueryServiceConfiguration(), and HttpDeleteServiceConfiguration() APIs.
'//
' HTTP_SERVICE_CONFIG_ID enum
%EQUATE `HttpServiceConfigIPListenList = 0 ' // Set, Query & Delete.
%EQUATE `HttpServiceConfigSSLCertInfo = 1 ' // Set, Query & Delete.
%EQUATE `HttpServiceConfigUrlAclInfo = 2 ' // Set, Query & Delete.
%EQUATE `HttpServiceConfigTimeout = 3 ' // Set, Query & Delete.
%EQUATE `HttpServiceConfigCache = 4 ' // Set, Query & Delete.
%EQUATE `HttpServiceConfigMax = 5
'//
'// Generic Query enum that can be used with HttpQueryServiceConfiguration()
'//
' HTTP_SERVICE_CONFIG_QUERY_TYPE enum
%EQUATE `HttpServiceConfigQueryExact = 0
%EQUATE `HttpServiceConfigQueryNext = 1
%EQUATE `HttpServiceConfigQueryMax = 2
'//
'// This data structure is used to define a key of the SSL certificate hash
'// store.
'//
' // Size = 4 bytes
TYPE HTTP_SERVICE_CONFIG_SSL_KEY DWORD
 pIpPort AS SOCKADDR PTR
END TYPE
'//
'// This defines a record for the SSL config store.
'//
' // Size = 52 bytes
TYPE HTTP_SERVICE_CONFIG_SSL_PARAM DWORD
 SslHashLength AS DWORD ' ULONG // Length of the SSL hash (in bytes)
 pSslHash AS DWORD ' PVOID // Pointer to the SSL hash
 AppId AS GUID ' GUID // A unique identifier that can be used to identify the app that has set this parameter
 pSslCertStoreName AS WSTRINGZ PTR ' PWSTR // Store name to read the server certificate from; defaults to "MY".
 ' // DefaultCertCheckMode is a bit flag with the following semantics
 ' // 0x1 - Client certificate will not be verified for revocation
 ' // 0x2 - Only cached certificate revocation will be used.
 ' // 0x4 - Enable use of the DefaultRevocationFreshnessTime setting
 ' // 0x10000 - No usage check.
 DefaultCertCheckMode AS DWORD
 DefaultRevocationFreshnessTime AS DWORD ' DWORD // How often to check for an updated Certificate revocation list (CRL)
 DefaultRevocationUrlRetrievalTimeout AS DWORD ' DWORD // Timeout on attempt to retrieve certificate revocation list from the remote URL
 pDefaultSslCtlIdentifier AS WSTRINGZ PTR ' PWSTR // Restrict the certificate issuers that you want to trust
 pDefaultSslCtlStoreName AS WSTRINGZ PTR ' PWSTR // Store name under LOCAL_MACHINE where Ctl identified by pDefaultSslCtlIdentifier is stored
 DefaultFlags AS DWORD ' DWORD // Default Flags
END TYPE
%EQUATE `HTTP_SERVICE_CONFIG_SSL_FLAG_USE_DS_MAPPER = &H00000001
%EQUATE `HTTP_SERVICE_CONFIG_SSL_FLAG_NEGOTIATE_CLIENT_CERT = &H00000002
#IF %WINVER < &H0600
%EQUATE `HTTP_SERVICE_CONFIG_SSL_FLAG_NO_RAW_FILTER = &H00000004
#ENDIF ' // WINVER < 0x0600
'//
'// This data structure is used by HttpSetServiceConfiguration() for the
'// config ID HttpServiceConfigSSLCertInfo. It's used to add a new record
'// to the SSL store.
'//
' // Size = 56 bytes
TYPE HTTP_SERVICE_CONFIG_SSL_SET DWORD
 KeyDesc AS HTTP_SERVICE_CONFIG_SSL_KEY
 ParamDesc AS HTTP_SERVICE_CONFIG_SSL_PARAM
END TYPE
'//
'// This data structure is used by HttpQueryServiceConfiguration() for the
'// config ID HttpServiceConfigSSLCertInfo. It's used to query a particular
'// record from the SSL store.
'//
'// If QueryType is HttpServiceConfigQueryExact, then one particular record of
'// the type HTTP_SERVICE_CONFIG_SSL_SET is returned. If the QueryType is
'// HttpServiceConfigQueryNext, then the next instance of
'// HTTP_SERVICE_CONFIG_SSL_SET is returned. In such cases, the dwToken field
'// represents the cursor. For the first item, dwToken has to be 0.
'// For subsequent items, dwToken has to be incremented by 1,
'// until ERROR_NO_MORE_ITEMS is returned.
'//
' // Size = 12 bytes
TYPE HTTP_SERVICE_CONFIG_SSL_QUERY DWORD
 QueryDesc AS LONG ' HTTP_SERVICE_CONFIG_QUERY_TYPE enum
 KeyDesc AS HTTP_SERVICE_CONFIG_SSL_KEY
 dwToken AS DWORD
END TYPE
'//
'// Set/Delete IP Listen-Only List record
'//
'// Used as a parameter to both HttpSetServiceConfiguration() and
'// HttpDeleteServiceConfiguration() functions.
'//
' // Size = 8 bytes
TYPE HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM DWORD FILL
 AddrLength AS WORD ' USHORT
 pAddress AS SOCKADDR PTR
END TYPE
'//
'// Query IP Listen-Only List record.
'//
'// Parameter to HttpQueryServiceConfiguration() for the config ID
'// HttpServiceConfigIPListenList. On successful return, AddrList
'// contains an array of AddrCount elements. Caller must provide a
'// large enough buffer to hold all elements in one call.
'//
'// Caller may determine the type of each returned element by examining
'// AddrList[i].ss_family. If it's AF_INET, use ((PSOCKADDR_IN) &AddrList[i]);
'// otherwise, for AF_INET6, use ((PSOCKADDR_IN6) &AddrList[i])
'// to select the appropriate address type.
'//
' // Size = 136 bytes
TYPE HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY QWORD FILL
 AddrCount AS DWORD ' ULONG
 AddrList(0) AS SOCKADDR_STORAGE ' variable-length array
END TYPE
'//
'// URL ACL
'//
'//
' // Size = 4 bytes
TYPE HTTP_SERVICE_CONFIG_URLACL_KEY DWORD
 pUrlPrefix AS WSTRINGZ PTR
END TYPE
'//
'// This defines a record for the SSL config store.
'//
' // Size = 4 bytes
TYPE HTTP_SERVICE_CONFIG_URLACL_PARAM DWORD
 pStringSecurityDescriptor AS WSTRINGZ PTR
END TYPE
'//
'// This data structure is used by HttpSetServiceConfiguration for the config ID
'// HttpServiceConfigUrlAclInfo. It is used to add a new record to the URL ACL
'// store.
'//
' // Size = 8 bytes
TYPE HTTP_SERVICE_CONFIG_URLACL_SET DWORD
 KeyDesc AS HTTP_SERVICE_CONFIG_URLACL_KEY
 ParamDesc AS HTTP_SERVICE_CONFIG_URLACL_PARAM
END TYPE
'//
'// This data structure is used by HttpQueryServiceConfiguration() for the
'// config ID HttpServiceConfigUrlAclInfo. It's used to query a particular
'// record from the URL ACL store.
'//
'// If QueryType is HttpServiceConfigQueryExact, then one particular record of
'// the type HTTP_SERVICE_CONFIG_URLACL_SET is returned. If the QueryType is
'// HttpServiceConfigQueryNext, then the next instance of
'// HTTP_SERVICE_CONFIG_URLACL_SET is returned. In such cases, the dwToken field
'// represents the cursor. For the first item, dwToken has to be 0.
'// For subsequent items, dwToken has to be incremented by 1,
'// until ERROR_NO_MORE_ITEMS is returned.
'//
' // Size = 12 bytes
TYPE HTTP_SERVICE_CONFIG_URLACL_QUERY DWORD
 QueryDesc AS LONG ' HTTP_SERVICE_CONFIG_QUERY_TYPE enum
 KeyDesc AS HTTP_SERVICE_CONFIG_URLACL_KEY
 dwToken AS DWORD
END TYPE
'//
'// Cache Paramemers
'//
'//
'// For manipulating global cache parameters.
'// The parameters that can be changed or queued are per-uri cache size
'// and cached range chunk size.
'//
' enum HTTP_SERVICE_CONFIG_CACHE_KEY
%EQUATE `MaxCacheResponseSize = 0
%EQUATE `CacheRangeChunkSize = 1
'typedef ULONG HTTP_SERVICE_CONFIG_CACHE_PARAM,
' *PHTTP_SERVICE_CONFIG_CACHE_PARAM;
'//
'// To set a cache parameter value use the set structure. To query use the key
'// directly. When you query a parameter value the output buffer must be exactly
'// the sizeof param.
'//
' // Size = 8 bytes
TYPE HTTP_SERVICE_CONFIG_CACHE_SET DWORD
 KeyDesc AS LONG ' HTTP_SERVICE_CONFIG_CACHE_KEY
 ParamDesc AS DWORD ' HTTP_SERVICE_CONFIG_CACHE_PARAM
END TYPE
'//
'// Define our API linkage.
'//
'#if !defined(HTTPAPI_LINKAGE)
'#define HTTPAPI_LINKAGE DECLSPEC_IMPORT
'#endif // !HTTPAPI_LINKAGE
'//
'// Initialize/Terminate APIs.
'//
'// NOTE: MUST be called once before all other APIs
DECLARE FUNCTION HttpInitialize LIB "httpapi.dll" ALIAS "HttpInitialize" ( BYVAL Version AS HTTPAPI_VERSION , BYVAL Flags AS QUAD , BYREF pReserved AS QUAD ) AS QUAD ' ULONG
'// NOTE: MUST be called after final API call returns.
DECLARE FUNCTION HttpTerminate LIB "httpapi.dll" ALIAS "HttpTerminate" ( BYVAL Flags AS QUAD , BYREF pReserved AS QUAD ) AS QUAD ' ULONG
'// HTTP Request Queue manipulation APIs.
'//
'// This API is maintained for backward competibility for the first
'// version of the HTTPAPI and should not be used. Instead the new
'// HttpCreateRequestQueue() API must be used.
'//
'// Use CloseHandle() to release the handles returned by
'// HttpCreateHttpHandle() API.
DECLARE FUNCTION HttpCreateHttpHandle LIB "httpapi.dll" ALIAS "HttpCreateHttpHandle" ( BYREF pReqQueueHandle AS QUAD , BYVAL Options AS QUAD ) AS QUAD ' ULONG
#IF %WINVER >= &H0600
'// Extended Request Queue manipulation APIs.
'//
'// Use HttpCloseRequestQueue() API to close the handles
'// created by the HttpCreateRequestQueue API.
DECLARE FUNCTION HttpCreateRequestQueue LIB "httpapi.dll" ALIAS "HttpCreateRequestQueue" ( BYVAL Version AS HTTPAPI_VERSION , BYREF pName AS WSTRINGZ , BYREF pSecurityAttributes AS SECURITY_ATTRIBUTES , BYVAL Flags AS QUAD , BYREF pReqQueueHandle AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpCloseRequestQueue LIB "httpapi.dll" ALIAS "HttpCloseRequestQueue" ( BYVAL ReqQueueHandle AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpSetRequestQueueProperty LIB "httpapi.dll" ALIAS "HttpSetRequestQueueProperty" ( BYVAL Handle AS QUAD , BYVAL Property AS LONG , BYVAL pPropertyInformation AS QUAD , BYVAL PropertyInformationLength AS QUAD , BYVAL Reserved AS QUAD , BYVAL pReserved AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpQueryRequestQueueProperty LIB "httpapi.dll" ALIAS "HttpQueryRequestQueueProperty" ( BYVAL Handle AS QUAD , BYVAL Property AS LONG , BYREF pPropertyInformation AS ANY , BYVAL PropertyInformationLength AS QUAD , BYVAL Reserved AS QUAD , BYREF pReturnLength AS QUAD , BYVAL pReserved AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpShutdownRequestQueue LIB "httpapi.dll" ALIAS "HttpShutdownRequestQueue" ( BYVAL ReqQueueHandle AS QUAD ) AS QUAD ' ULONG
#ENDIF ' // WINVER >= 0x0600
'//
'// SSL APIs.
'//
DECLARE FUNCTION HttpReceiveClientCertificate LIB "httpapi.dll" ALIAS "HttpReceiveClientCertificate" ( BYVAL ReqQueueHandle AS QUAD , BYVAL ConnectionId AS QUAD , BYVAL Flags AS QUAD , BYREF pSslClientCertInfo AS HTTP_SSL_CLIENT_CERT_INFO , BYVAL SslClientCertInfoSize AS QUAD , BYREF pBytesReceived AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
#IF %WINVER >= &H0600
'//
'// Server Session APIs.
'//
DECLARE FUNCTION HttpCreateServerSession LIB "httpapi.dll" ALIAS "HttpCreateServerSession" ( BYVAL Version AS HTTPAPI_VERSION , BYREF pServerSessionId AS QUAD , BYVAL Reserved AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpCloseServerSession LIB "httpapi.dll" ALIAS "HttpCloseServerSession" ( BYVAL ServerSessionId AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpQueryServerSessionProperty LIB "httpapi.dll" ALIAS "HttpQueryServerSessionProperty" ( BYVAL ServerSessionId AS QUAD , BYVAL Property AS LONG , BYREF pPropertyInformation AS ANY , BYVAL PropertyInformationLength AS QUAD , BYREF pReturnLength AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpSetServerSessionProperty LIB "httpapi.dll" ALIAS "HttpSetServerSessionProperty" ( BYVAL ServerSessionId AS QUAD , BYVAL Property AS LONG , BYVAL pPropertyInformation AS QUAD , BYVAL PropertyInformationLength AS QUAD ) AS QUAD ' ULONG
#ENDIF ' // WINVER >= 0x0600
'//
'// URL Configuration APIs.
'//
DECLARE FUNCTION HttpAddUrl LIB "httpapi.dll" ALIAS "HttpAddUrl" ( BYVAL ReqQueueHandle AS QUAD , BYREF pUrlPrefix AS WSTRINGZ , BYVAL pReserved AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpRemoveUrl LIB "httpapi.dll" ALIAS "HttpRemoveUrl" ( BYVAL ReqQueueHandle AS QUAD , BYREF pUrlPrefix AS WSTRINGZ ) AS QUAD ' ULONG
#IF %WINVER >= &H0600
'//
'// Url Group APIs.
'//
DECLARE FUNCTION HttpCreateUrlGroup LIB "httpapi.dll" ALIAS "HttpCreateUrlGroup" ( BYVAL ServerSessionId AS QUAD , BYREF pUrlGroupId AS QUAD , BYVAL Reserved AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpCloseUrlGroup LIB "httpapi.dll" ALIAS "HttpCloseUrlGroup" ( BYVAL UrlGroupId AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpAddUrlToUrlGroup LIB "httpapi.dll" ALIAS "HttpAddUrlToUrlGroup" ( BYVAL UrlGroupId AS QUAD , BYREF pFullyQualifiedUrl AS WSTRINGZ , BYVAL UrlContext AS QUAD , BYVAL Reserved AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpRemoveUrlFromUrlGroup LIB "httpapi.dll" ALIAS "HttpRemoveUrlFromUrlGroup" ( BYVAL UrlGroupId AS QUAD , BYREF pFullyQualifiedUrl AS WSTRINGZ , BYVAL Flags AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpSetUrlGroupProperty LIB "httpapi.dll" ALIAS "HttpSetUrlGroupProperty" ( BYVAL UrlGroupId AS QUAD , BYVAL Property AS LONG , BYVAL pPropertyInformation AS QUAD , BYVAL PropertyInformationLength AS QUAD ) AS QUAD ' ULONG
DECLARE FUNCTION HttpQueryUrlGroupProperty LIB "httpapi.dll" ALIAS "HttpQueryUrlGroupProperty" ( BYVAL UrlGroupId AS QUAD , BYVAL Property AS LONG , BYREF pPropertyInformation AS ANY , BYVAL PropertyInformationLength AS QUAD , BYREF pReturnLength AS QUAD ) AS QUAD ' ULONG
#ENDIF ' // WINVER >= 0x0600
'//
'// HTTP Server I/O APIs.
'//
DECLARE FUNCTION HttpReceiveHttpRequest LIB "httpapi.dll" ALIAS "HttpReceiveHttpRequest" ( BYVAL ReqQueueHandle AS QUAD , BYVAL RequestId AS QUAD , BYVAL Flags AS QUAD , BYREF pRequestBuffer AS HTTP_REQUEST , BYVAL RequestBufferLength AS QUAD , BYREF pBytesReceived AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
DECLARE FUNCTION HttpReceiveRequestEntityBody LIB "httpapi.dll" ALIAS "HttpReceiveRequestEntityBody" ( BYVAL ReqQueueHandle AS QUAD , BYVAL RequestId AS QUAD , BYVAL Flags AS QUAD , BYREF pBuffer AS ANY , BYVAL BufferLength AS QUAD , BYREF pBytesReceived AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
#IF %WINVER = &H0600
DECLARE FUNCTION HttpSendHttpResponse LIB "httpapi.dll" ALIAS "HttpSendHttpResponse" ( BYVAL ReqQueueHandle AS QUAD , BYVAL RequestId AS QUAD , BYVAL Flags AS QUAD , BYREF pHttpResponse AS HTTP_RESPONSE , BYREF pCachePolicy AS HTTP_CACHE_POLICY , BYREF pBytesSent AS QUAD , BYVAL pReserved1 AS QUAD , BYVAL Reserved2 AS QUAD , BYREF pOverlapped AS OVERLAPPED , BYREF pLogData AS HTTP_LOG_DATA ) AS QUAD ' ULONG
#ELSE
DECLARE FUNCTION HttpSendHttpResponse LIB "httpapi.dll" ALIAS "HttpSendHttpResponse" ( BYVAL ReqQueueHandle AS QUAD , BYVAL RequestId AS QUAD , BYVAL Flags AS QUAD , BYREF pHttpResponse AS HTTP_RESPONSE , BYVAL pReserved1 AS QUAD , BYREF pBytesSent AS QUAD , BYVAL pReserved2 AS QUAD , BYVAL Reserved3 AS QUAD , BYREF pOverlapped AS OVERLAPPED , BYVAL pReserved4 AS QUAD ) AS QUAD ' ULONG
#ENDIF
#IF %WINVER = &H0600
DECLARE FUNCTION HttpSendResponseEntityBody LIB "httpapi.dll" ALIAS "HttpSendResponseEntityBody" ( BYVAL ReqQueueHandle AS QUAD , BYVAL RequestId AS QUAD , BYVAL Flags AS QUAD , BYVAL EntityChunkCount AS WORD , BYREF pEntityChunks AS HTTP_DATA_CHUNK , BYREF pBytesSent AS QUAD , BYREF pReserved1 AS ANY , BYVAL Reserved2 AS QUAD , BYREF pOverlapped AS OVERLAPPED , BYREF pLogData AS HTTP_LOG_DATA ) AS QUAD ' ULONG
#ELSE
DECLARE FUNCTION HttpSendResponseEntityBody LIB "httpapi.dll" ALIAS "HttpSendResponseEntityBody" ( BYVAL ReqQueueHandle AS QUAD , BYVAL RequestId AS QUAD , BYVAL Flags AS QUAD , BYVAL EntityChunkCount AS WORD , BYREF pEntityChunks AS HTTP_DATA_CHUNK , BYREF pBytesSent AS QUAD , BYREF pReserved1 AS ANY , BYVAL Reserved2 AS QUAD , BYREF pOverlapped AS OVERLAPPED , BYVAL pReserved3 AS QUAD ) AS QUAD ' ULONG
#ENDIF
DECLARE FUNCTION HttpWaitForDisconnect LIB "httpapi.dll" ALIAS "HttpWaitForDisconnect" ( BYVAL ReqQueueHandle AS QUAD , BYVAL ConnectionId AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
#IF %WINVER >= &H0600
DECLARE FUNCTION HttpWaitForDisconnectEx LIB "httpapi.dll" ALIAS "HttpWaitForDisconnectEx" ( BYVAL ReqQueueHandle AS QUAD , BYVAL ConnectionId AS QUAD , BYVAL Reserved AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
DECLARE FUNCTION HttpCancelHttpRequest LIB "httpapi.dll" ALIAS "HttpCancelHttpRequest" ( BYVAL ReqQueueHandle AS QUAD , BYVAL RequestId AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
DECLARE FUNCTION HttpWaitForDemandStart LIB "httpapi.dll" ALIAS "HttpWaitForDemandStart" ( BYVAL ReqQueueHandle AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
#ENDIF ' // WINVER >= 0x0600
'//
'// Cache manipulation APIs.
'//
DECLARE FUNCTION HttpFlushResponseCache LIB "httpapi.dll" ALIAS "HttpFlushResponseCache" ( BYVAL ReqQueueHandle AS QUAD , BYREF pUrlPrefix AS WSTRINGZ , BYVAL Flags AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
DECLARE FUNCTION HttpAddFragmentToCache LIB "httpapi.dll" ALIAS "HttpAddFragmentToCache" ( BYVAL ReqQueueHandle AS QUAD , BYREF pUrlPrefix AS WSTRINGZ , BYREF pDataChunk AS HTTP_DATA_CHUNK , BYREF pCachePolicy AS HTTP_CACHE_POLICY , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
DECLARE FUNCTION HttpReadFragmentFromCache LIB "httpapi.dll" ALIAS "HttpReadFragmentFromCache" ( BYVAL ReqQueueHandle AS QUAD , BYREF pUrlPrefix AS WSTRINGZ , BYREF pByteRange AS HTTP_BYTE_RANGE , BYREF pBuffer AS ANY , BYVAL BufferLength AS QUAD , BYREF pBytesRead AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
'//
'// Server configuration APIs
'//
DECLARE FUNCTION HttpSetServiceConfiguration LIB "httpapi.dll" ALIAS "HttpSetServiceConfiguration" ( BYVAL ServiceHandle AS QUAD , BYVAL ConfigId AS LONG , BYVAL pConfigInformation AS QUAD , BYVAL ConfigInformationLength AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
DECLARE FUNCTION HttpDeleteServiceConfiguration LIB "httpapi.dll" ALIAS "HttpDeleteServiceConfiguration" ( BYVAL ServiceHandle AS QUAD , BYVAL ConfigId AS LONG , BYVAL pConfigInformation AS QUAD , BYVAL ConfigInformationLength AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
DECLARE FUNCTION HttpQueryServiceConfiguration LIB "httpapi.dll" ALIAS "HttpQueryServiceConfiguration" ( BYVAL ServiceHandle AS QUAD , BYVAL ConfigId AS LONG , BYVAL pInputConfigInformation AS QUAD , BYVAL InputConfigInformationLength AS QUAD , BYREF pOutputConfigInformation AS ANY , BYVAL OutputConfigInformationLength AS QUAD , BYREF pReturnLength AS QUAD , BYREF pOverlapped AS OVERLAPPED ) AS QUAD ' ULONG
#ENDIF ' // WINVER >= 0x0501
#ENDIF
