/// <summary>Uses the default port for the service specified by dwService.</summary>
publicconstushortINTERNET_INVALID_PORT_NUMBER=0;
/// <summary>
/// Prototype for an application-defined status callback function.
/// </summary>
/// <param name="hInternet">The handle for which the callback function is called.</param>
/// <param name="dwContext">A pointer to a variable that specifies the application-defined context value associated with hInternet.</param>
/// <param name="dwInternetStatus">A status code that indicates why the callback function is called.</param>
/// <param name="lpvStatusInformation">A pointer to additional status information. When the INTERNET_STATUS_STATE_CHANGE flag is set, lpvStatusInformation points to a DWORD that contains one or more of the <see cref="InternetState"/> flags.</param>
/// <param name="dwStatusInformationLength">The size, in bytes, of the data pointed to by lpvStatusInformation.</param>
/// <summary>Flags used by <see cref="INTERNET_DIAGNOSTIC_SOCKET_INFO"/>.</summary>
[Flags]
publicenumIDSI_Flags
{
/// <summary>Set if the connection is from the "keep-alive" pool.</summary>
IDSI_FLAG_KEEP_ALIVE=0x00000001,
/// <summary>Set if the HTTP Request is using a secure socket.</summary>
IDSI_FLAG_SECURE=0x00000002,
/// <summary>Set if a proxy is being used to reach the server.</summary>
IDSI_FLAG_PROXY=0x00000004,
/// <summary>Set if a proxy is being used to create a tunnel.</summary>
IDSI_FLAG_TUNNEL=0x00000008
}
/// <summary>Option to be queried or set within <see cref="INTERNET_PER_CONN_OPTION"/> structure.</summary>
publicenumINTERNET_PER_CONN_OPTION_ID
{
/// <summary>Sets or retrieves the connection type.</summary>
INTERNET_PER_CONN_FLAGS=1,
/// <summary>Sets or retrieves a string containing the proxy servers.</summary>
INTERNET_PER_CONN_PROXY_SERVER=2,
/// <summary>Sets or retrieves a string containing the URLs that do not use the proxy server.</summary>
INTERNET_PER_CONN_PROXY_BYPASS=3,
/// <summary>Sets or retrieves a string containing the URL to the automatic configuration script.</summary>
INTERNET_PER_CONN_AUTOCONFIG_URL=4,
/// <summary>Sets or retrieves the automatic discovery settings.</summary>
INTERNET_PER_CONN_AUTODISCOVERY_FLAGS=5,
/// <summary>Chained autoconfig URL. Used when the primary autoconfig URL points to an INS file that sets a second autoconfig URL for proxy information.</summary>
INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL=6,
/// <summary>The number of minutes until automatic refresh of autoconfig URL by autodiscovery.</summary>
INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS=7,
/// <summary>Read only option. Returns the time the last known good autoconfig URL was found using autodiscovery.</summary>
INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME=8,
/// <summary>Read only option. Returns the last known good URL found using autodiscovery.</summary>
INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL=9,
/// <summary>Sets or retrieves the connection type.</summary>
INTERNET_PER_CONN_FLAGS_UI=10
}
/// <summary>Options for the <see cref="InternetOpen(string, InternetOpenType, string, string, InternetApiFlags)"/> function.</summary>
[Flags]
publicenumInternetApiFlags:uint
{
/// <summary>Indicates that a Platform for Privacy Protection (P3P) header is to be associated with a cookie.</summary>
INTERNET_COOKIE_EVALUATE_P3P=0x80,
/// <summary>Indicates that a third-party cookie is being set or retrieved.</summary>
INTERNET_COOKIE_THIRD_PARTY=0x10,
/// <summary>
/// Makes only asynchronous requests on handles descended from the handle returned from this function. Only the InternetOpen function uses this flag.
/// </summary>
INTERNET_FLAG_ASYNC=0x10000000,
/// <summary>Allows a lazy cache write.</summary>
INTERNET_FLAG_CACHE_ASYNC=0x00000080,
/// <summary>
/// Returns the resource from the cache if the network request for the resource fails due to an ERROR_INTERNET_CONNECTION_RESET or
/// ERROR_INTERNET_CANNOT_CONNECT error. This flag is used by HttpOpenRequest.
/// </summary>
INTERNET_FLAG_CACHE_IF_NET_FAIL=0x00010000,
/// <summary>Does not add the returned entity to the cache. This is identical to the preferred value, INTERNET_FLAG_NO_CACHE_WRITE.</summary>
INTERNET_FLAG_DONT_CACHE=0x04000000,
/// <summary>
/// Attempts to use an existing InternetConnect object if one exists with the same attributes required to make the request. This is useful only with
/// FTP operations, since FTP is the only protocol that typically performs multiple operations during the same session. WinINet caches a single
/// connection handle for each HINTERNET handle generated by InternetOpen. The InternetOpenUrl and InternetConnect functions use this flag for Http
/// and Ftp connections.
/// </summary>
INTERNET_FLAG_EXISTING_CONNECT=0x20000000,
/// <summary>Indicates that this is a Forms submission.</summary>
INTERNET_FLAG_FORMS_SUBMIT=0x00000040,
/// <summary>
/// Does not make network requests. All entities are returned from the cache. If the requested item is not in the cache, a suitable error, such as
/// ERROR_FILE_NOT_FOUND, is returned. Only the InternetOpen function uses this flag.
/// </summary>
INTERNET_FLAG_FROM_CACHE=0x01000000,
/// <summary>
/// Indicates that the function should use the copy of the resource that is currently in the Internet cache. The expiration date and other
/// information about the resource is not checked. If the requested item is not found in the Internet cache, the system attempts to locate the
/// resource on the network. This value was introduced in Microsoft Internet Explorer 5 and is associated with the Forward and Back button operations
/// of Internet Explorer.
/// </summary>
INTERNET_FLAG_FWD_BACK=0x00000020,
/// <summary>
/// Forces a reload if there is no Expires time and no LastModified time returned from the server when determining whether to reload the item from
/// the network. This flag can be used by FtpFindFirstFile, FtpGetFile, FtpOpenFile, FtpPutFile, HttpOpenRequest, and InternetOpenUrl.
/// <para>Windows XP and Windows Server 2003 R2 and earlier: Also used by GopherFindFirstFile and GopherOpenFile.</para>
/// </summary>
INTERNET_FLAG_HYPERLINK=0x00000400,
/// <summary>
/// Disables checking of SSL/PCT-based certificates that are returned from the server against the host name given in the request. WinINet uses a
/// simple check against certificates by comparing for matching host names and simple wildcarding rules. This flag can be used by HttpOpenRequest and
/// InternetOpenUrl (for HTTP requests).
/// </summary>
INTERNET_FLAG_IGNORE_CERT_CN_INVALID=0x00001000,
/// <summary>
/// Disables checking of SSL/PCT-based certificates for proper validity dates. This flag can be used by HttpOpenRequest and InternetOpenUrl (for HTTP requests).
/// Uses keep-alive semantics, if available, for the connection. This flag is used by HttpOpenRequest and InternetOpenUrl (for HTTP requests). This
/// flag is required for Microsoft Network (MSN), NTLM, and other types of authentication.
/// </summary>
INTERNET_FLAG_KEEP_CONNECTION=0x00400000,
/// <summary>No longer supported.</summary>
INTERNET_FLAG_MAKE_PERSISTENT=0x02000000,
/// <summary>
/// Identical to the preferred value, INTERNET_FLAG_NEED_FILE. Causes a temporary file to be created if the file cannot be cached. This flag can be
/// used by FtpFindFirstFile, FtpGetFile, FtpOpenFile, FtpPutFile, HttpOpenRequest, and InternetOpenUrl.
/// <para>Windows XP and Windows Server 2003 R2 and earlier: Also used by GopherFindFirstFile and GopherOpenFile.</para>
/// </summary>
INTERNET_FLAG_MUST_CACHE_REQUEST=0x00000010,
/// <summary>
/// Causes a temporary file to be created if the file cannot be cached. This flag can be used by FtpFindFirstFile, FtpGetFile, FtpOpenFile,
/// FtpPutFile, HttpOpenRequest, and InternetOpenUrl.
/// <para>Windows XP and Windows Server 2003 R2 and earlier: Also used by GopherFindFirstFile and GopherOpenFile.</para>
/// </summary>
INTERNET_FLAG_NEED_FILE=0x00000010,
/// <summary>Does not attempt authentication automatically. This flag can be used by HttpOpenRequest and InternetOpenUrl (for HTTP requests).</summary>
INTERNET_FLAG_NO_AUTH=0x00040000,
/// <summary>Does not automatically handle redirection in HttpSendRequest. This flag can also be used by InternetOpenUrl for HTTP requests.</summary>
INTERNET_FLAG_NO_AUTO_REDIRECT=0x00200000,
/// <summary>
/// Does not add the returned entity to the cache. This flag is used by , HttpOpenRequest, and InternetOpenUrl.
/// <para>Windows XP and Windows Server 2003 R2 and earlier: Also used by GopherFindFirstFile and GopherOpenFile.</para>
/// </summary>
INTERNET_FLAG_NO_CACHE_WRITE=0x04000000,
/// <summary>
/// Does not automatically add cookie headers to requests, and does not automatically add returned cookies to the cookie database. This flag can be
/// used by HttpOpenRequest and InternetOpenUrl (for HTTP requests).
/// </summary>
INTERNET_FLAG_NO_COOKIES=0x00080000,
/// <summary>Disables the cookie dialog box. This flag can be used by HttpOpenRequest and InternetOpenUrl (HTTP requests only).</summary>
INTERNET_FLAG_NO_UI=0x00000200,
/// <summary>
/// Identical to INTERNET_FLAG_FROM_CACHE. Does not make network requests. All entities are returned from the cache. If the requested item is not in
/// the cache, a suitable error, such as ERROR_FILE_NOT_FOUND, is returned. Only the InternetOpen function uses this flag.
/// </summary>
INTERNET_FLAG_OFFLINE=0x01000000,
/// <summary>
/// Uses passive FTP semantics. Only InternetConnect and InternetOpenUrl use this flag. InternetConnect uses this flag for FTP requests, and
/// InternetOpenUrl uses this flag for FTP files and directories.
/// </summary>
INTERNET_FLAG_PASSIVE=0x08000000,
/// <summary>
/// Forces the request to be resolved by the origin server, even if a cached copy exists on the proxy. The InternetOpenUrl function (on HTTP and
/// HTTPS requests only) and HttpOpenRequest function use this flag.
/// </summary>
INTERNET_FLAG_PRAGMA_NOCACHE=0x00000100,
/// <summary>
/// Returns the data as a WIN32_FIND_DATA structure when retrieving FTP directory information. If this flag is not specified or if the call is made
/// through a CERN proxy, InternetOpenUrl returns the HTML version of the directory. Only the InternetOpenUrl function uses this flag.
/// <para>Windows XP and Windows Server 2003 R2 and earlier: Also returns a GOPHER_FIND_DATA structure when retrieving Gopher directory information.</para>
/// </summary>
INTERNET_FLAG_RAW_DATA=0x40000000,
/// <summary>This flag is currently disabled.</summary>
INTERNET_FLAG_READ_PREFETCH=0x00100000,
/// <summary>
/// Forces a download of the requested file, object, or directory listing from the origin server, not from the cache. The FtpFindFirstFile,
/// FtpGetFile, FtpOpenFile, FtpPutFile, HttpOpenRequest, and InternetOpenUrl functions use this flag.
/// <para>Windows XP and Windows Server 2003 R2 and earlier: Also used by GopherFindFirstFile and GopherOpenFile.</para>
/// </summary>
INTERNET_FLAG_RELOAD=0x80000000,
/// <summary>Indicates that the cookie being set is associated with an untrusted site.</summary>
INTERNET_FLAG_RESTRICTED_ZONE=0x00020000,
/// <summary>
/// Reloads HTTP resources if the resource has been modified since the last time it was downloaded. All FTP resources are reloaded. This flag can be
/// used by FtpFindFirstFile, FtpGetFile, FtpOpenFile, FtpPutFile, HttpOpenRequest, and InternetOpenUrl.
/// <para>Windows XP and Windows Server 2003 R2 and earlier: Also used by GopherFindFirstFile and GopherOpenFile, and Gopher resources are reloaded.</para>
/// </summary>
INTERNET_FLAG_RESYNCHRONIZE=0x00000800,
/// <summary>
/// Uses secure transaction semantics. This translates to using Secure Sockets Layer/Private Communications Technology (SSL/PCT) and is only
/// meaningful in HTTP requests. This flag is used by HttpOpenRequest and InternetOpenUrl, but this is redundant if https:// appears in the URL.The
/// InternetConnect function uses this flag for HTTP connections; all the request handles created under this connection will inherit this flag.
/// </summary>
INTERNET_FLAG_SECURE=0x00800000,
/// <summary>Transfers file as ASCII (FTP only). This flag can be used by FtpOpenFile, FtpGetFile, and FtpPutFile.</summary>
INTERNET_FLAG_TRANSFER_ASCII=0x00000001,
/// <summary>Transfers file as binary (FTP only). This flag can be used by FtpOpenFile, FtpGetFile, and FtpPutFile.</summary>
INTERNET_FLAG_TRANSFER_BINARY=0x00000002,
/// <summary>
/// Indicates that no callbacks should be made for that API. This is used for the dxContext parameter of the functions that allow asynchronous operations.
/// </summary>
INTERNET_NO_CALLBACK=0x00000000,
/// <summary>
/// Sets an HTTP request object such that it will not logon to origin servers, but will perform automatic logon to HTTP proxy servers. This option
/// differs from the Request flag INTERNET_FLAG_NO_AUTH, which prevents authentication to both proxy servers and origin servers. Setting this mode
/// will suppress the use of any credential material (either previously provided username/password or client SSL certificate) when communicating with
/// an origin server. However, if the request must transit via an authenticating proxy, WinINet will still perform automatic authentication to the
/// HTTP proxy per the Intranet Zone settings for the user. The default Intranet Zone setting is to permit automatic logon using the user<65>s default
/// credentials. To ensure suppression of all identifying information, the caller should combine INTERNET_OPTION_SUPPRESS_SERVER_AUTH with the
/// INTERNET_FLAG_NO_COOKIES request flag. This option may only be set on request objects before they have been sent. Attempts to set this option
/// after the request has been sent will return ERROR_INTERNET_INCORRECT_HANDLE_STATE. No buffer is required for this option. This is used by
/// InternetSetOption on handles returned by HttpOpenRequest only. Version: Requires Internet Explorer 8.0 or later.
/// <summary>Type of access required for the <see cref="InternetOpen(string, InternetOpenType, string, string, InternetApiFlags)"/> function.</summary>
publicenumInternetOpenType
{
/// <summary>Resolves all host names locally.</summary>
INTERNET_OPEN_TYPE_DIRECT=1,
/// <summary>Retrieves the proxy or direct configuration from the registry.</summary>
INTERNET_OPEN_TYPE_PRECONFIG=0,
/// <summary>
/// Retrieves the proxy or direct configuration from the registry and prevents the use of a startup Microsoft JScript or Internet Setup (INS) file.
/// </summary>
INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY=4,
/// <summary>
/// Passes requests to the proxy unless a proxy bypass list is supplied and the name to be resolved bypasses the proxy. In this case, the function
/// uses INTERNET_OPEN_TYPE_DIRECT.
/// </summary>
INTERNET_OPEN_TYPE_PROXY=3
}
[Flags]
publicenumInternetOptionErrorMask
{
/// <summary>Indicates that the client application can handle the ERROR_INTERNET_INSERT_CDROM error code.</summary>
INTERNET_ERROR_MASK_INSERT_CDROM=0x1,
/// <summary>
/// Indicates that all certificate errors are to be reported using the same error return, namely ERROR_INTERNET_SEC_CERT_ERRORS. If this flag is set,
/// call InternetErrorDlg upon receiving the ERROR_INTERNET_SEC_CERT_ERRORS error, so that the user can respond to a familiar dialog describing the
/// problem. Caution Failing to inform the user of this error exposes the user to potential spoofing attacks.
/// </summary>
INTERNET_ERROR_MASK_COMBINED_SEC_CERT=0x2,
/// <summary>Indicates that the client application can handle the ERROR_INTERNET_LOGIN_FAILURE_DISPLAY_ENTITY_BODY error code.</summary>
/// <summary>Sets or retrieves an unsigned long integer value that contains the connected state. This is used by InternetQueryOption and InternetSetOption.</summary>
[CorrespondingType(typeof(uint))]
INTERNET_OPTION_CONNECTED_STATE=50,
/// <summary>
/// Sets or retrieves a DWORD_PTR that contains the address of the context value associated with this HINTERNET handle. This option can be used on
/// any HINTERNET handle. This is used by InternetQueryOption and InternetSetOption. Previously, this set the context value to the address stored in
/// the lpBuffer pointer. This has been corrected so that the value stored in the buffer is used and the INTERNET_OPTION_CONTEXT_VALUE flag is
/// assigned a new value. The old value, 10, has been preserved so that applications written for the old behavior are still supported.
/// </summary>
[CorrespondingType(typeof(IntPtr))]
INTERNET_OPTION_CONTEXT_VALUE=45,
/// <summary>Identical to INTERNET_OPTION_RECEIVE_TIMEOUT. This is used by InternetQueryOption and InternetSetOption.</summary>
[CorrespondingType(typeof(uint))]
INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT=6,
/// <summary>Identical to INTERNET_OPTION_SEND_TIMEOUT. This is used by InternetQueryOption and InternetSetOption.</summary>
[CorrespondingType(typeof(uint))]
INTERNET_OPTION_CONTROL_SEND_TIMEOUT=5,
/// <summary>
/// Retrieves a string value that contains the name of the file backing a downloaded entity. This flag is valid after InternetOpenUrl, FtpOpenFile,
/// GopherOpenFile, or HttpOpenRequest has completed. This option can only be queried by InternetQueryOption.
/// Sets or retrieves an unsigned long integer value that contains the priority of requests that compete for a connection on an HTTP handle. This is
/// used by InternetQueryOption and InternetSetOption.
/// </summary>
[CorrespondingType(typeof(uint))]
INTERNET_OPTION_REQUEST_PRIORITY=58,
/// <summary>
/// Starts a new cache session for the process. No buffer is required. This is used by InternetSetOption. This option is reserved for internal use only.
/// Sets or retrieves a string value that contains the secondary cache key. This is used by InternetQueryOption and InternetSetOption. This option is
/// reserved for internal use only.
/// </summary>
[CorrespondingType(typeof(string))]
INTERNET_OPTION_SECONDARY_CACHE_KEY=53,
/// <summary>
/// Retrieves the certificate for an SSL/PCT (Secure Sockets Layer/Private Communications Technology) server into a formatted string. This is used by InternetQueryOption.
/// <summary>Retrieves the certificate for an SSL/PCT server into the INTERNET_CERTIFICATE_INFO structure. This is used by InternetQueryOption.</summary>
/// Sets or retrieves an unsigned long integer value that contains the size, in bytes, of the write buffer. This option can be used on HINTERNET
/// handles returned by FtpOpenFile and InternetConnect (FTP session only). It is used by InternetQueryOption and InternetSetOption.
/// </summary>
[CorrespondingType(typeof(uint))]
INTERNET_OPTION_WRITE_BUFFER_SIZE=13,
/// <summary>
/// By default, the host or authority portion of the Unicode URL is encoded according to the IDN specification. Setting this option on the request,
/// or connection handle, when IDN is disabled, specifies a code page encoding scheme for the host portion of the URL. The lpBuffer parameter in the
/// call to InternetSetOption contains the desired DBCS code page. If no code page is specified in lpBuffer, WinINet uses the default system code
/// page (CP_ACP). Note: This option is ignored if IDN is not disabled. For more information about how to disable IDN, see the INTERNET_OPTION_IDN option.
/// <para><c>Windows XP with SP2 and Windows Server 2003 with SP1:</c> This flag is not supported.</para>
/// <para><c>Version:</c> Requires Internet Explorer 7.0.</para>
/// By default, the path portion of the URL is UTF8 encoded. The WinINet API performs escape character (%) encoding on the high-bit characters.
/// Setting this option on the request, or connection handle, disables the UTF8 encoding and sets a specific code page. The lpBuffer parameter in the
/// call to InternetSetOption contains the desired DBCS codepage for the path. If no code page is specified in lpBuffer, WinINet uses the default CP_UTF8.
/// <para><c>Windows XP with SP2 and Windows Server 2003 with SP1:</c> This flag is not supported.</para>
/// <para><c>Version:</c> Requires Internet Explorer 7.0.</para>
/// Sets or retrieves an unsigned long integer value that contains the time-out value, in milliseconds, to use for Internet connection requests.
/// Setting this option to infinite (0xFFFFFFFF) will disable this timer. If a connection request takes longer than this time-out value, the request
/// is canceled. When attempting to connect to multiple IP addresses for a single host (a multihome host), the timeout limit is cumulative for all of
/// the IP addresses. This option can be used on any HINTERNET handle, including a NULL handle. It is used by InternetQueryOption and InternetSetOption.
/// </summary>
[CorrespondingType(typeof(uint))]
INTERNET_OPTION_CONNECT_TIMEOUT=2,
/// <summary>
/// Sets or retrieves an unsigned long integer value that contains the time-out value, in milliseconds, to receive a response to a request for the
/// data channel of an FTP transaction. If the response takes longer than this time-out value, the request is canceled. This option can be used on
/// any HINTERNET handle, including a NULL handle. It is used by InternetQueryOption and InternetSetOption. This flag has no impact on HTTP functionality.
/// </summary>
[CorrespondingType(typeof(uint))]
INTERNET_OPTION_DATA_RECEIVE_TIMEOUT=8,
/// <summary>
/// Sets or retrieves an unsigned long integer value, in milliseconds, that contains the time-out value to send a request for the data channel of an
/// FTP transaction. If the send takes longer than this time-out value, the send is canceled. This option can be used on any HINTERNET handle,
/// including a NULL handle. It is used by InternetQueryOption and InternetSetOption. This flag has no impact on HTTP functionality.
/// </summary>
[CorrespondingType(typeof(uint))]
INTERNET_OPTION_DATA_SEND_TIMEOUT=7,
/// <summary>
/// Retrieves an INTERNET_DIAGNOSTIC_SOCKET_INFO structure that contains data about a specified HTTP Request. This flag is used by
/// InternetQueryOption. <c>Windows 7:</c> This option is no longer supported.
/// <summary>Identical to the value SECURITY_FLAG_STRENGTH_WEAK. This is only returned in a call to InternetQueryOption.</summary>
SECURITY_FLAG_NORMALBITNESS=0x10000000,
/// <summary>Not implemented.</summary>
SECURITY_FLAG_PCT=0x00000008,
/// <summary>Not implemented.</summary>
SECURITY_FLAG_PCT4=0x00000010,
/// <summary>Uses secure transfers. This is only returned in a call to InternetQueryOption.</summary>
SECURITY_FLAG_SECURE=0x00000001,
/// <summary>Not implemented.</summary>
SECURITY_FLAG_SSL=0x00000002,
/// <summary>Not implemented.</summary>
SECURITY_FLAG_SSL3=0x00000004,
/// <summary>Uses medium (56-bit) encryption. This is only returned in a call to InternetQueryOption.</summary>
SECURITY_FLAG_STRENGTH_MEDIUM=0x40000000,
/// <summary>Uses strong (128-bit) encryption. This is only returned in a call to InternetQueryOption.</summary>
SECURITY_FLAG_STRENGTH_STRONG=0x20000000,
/// <summary>Uses weak (40-bit) encryption. This is only returned in a call to InternetQueryOption.</summary>
SECURITY_FLAG_STRENGTH_WEAK=0x10000000,
}
publicenumInternetOptionSupressBehavior
{
/// <summary>
/// Disables all suppressions, re-enabling default and configured behavior. This option is the equivalent of setting
/// INTERNET_SUPPRESS_COOKIE_POLICY_RESET and INTERNET_SUPPRESS_COOKIE_PERSIST_RESET individually. <c>Version:</c> Requires Internet Explorer 6.0 or later.
/// </summary>
INTERNET_SUPPRESS_RESET_ALL=0,
/// <summary>Ignores any configured cookie policies and allows cookies to be set. <c>Version:</c> Requires Internet Explorer 6.0 or later.</summary>
INTERNET_SUPPRESS_COOKIE_POLICY=1,
/// <summary>
/// Disables the INTERNET_SUPPRESS_COOKIE_POLICY suppression, permitting the evaluation of cookies according to the configured cookie policy.
/// <c>Version:</c> Requires Internet Explorer 6.0 or later.
/// </summary>
INTERNET_SUPPRESS_COOKIE_POLICY_RESET=2,
/// <summary>
/// Suppresses the persistence of cookies, even if the server has specified them as persistent. <c>Version:</c> Requires Internet Explorer 8.0 or later.
/// </summary>
INTERNET_SUPPRESS_COOKIE_PERSIST=3,
/// <summary>
/// Disables the INTERNET_SUPPRESS_COOKIE_PERSIST suppression, re-enabling the persistence of cookies. Any previously suppressed cookies will not
/// become persistent. <c>Version:</c> Requires Internet Explorer 8.0 or later.
/// </summary>
INTERNET_SUPPRESS_COOKIE_PERSIST_RESET=4
}
/// <summary>Type of service to access in <see cref="InternetConnect"/>.</summary>
publicenumInternetService
{
/// <summary>FTP service.</summary>
INTERNET_SERVICE_FTP=1,
/// <summary>Gopher service. <note type="note">Windows XP and Windows Server 2003 R2 and earlier only.</note></summary>
INTERNET_SERVICE_GOPHER=2,
/// <summary>HTTP service.</summary>
INTERNET_SERVICE_HTTP=3
}
/// <summary>Values passed using the <see cref="INTERNET_STATUS_CALLBACK"/> delegate.</summary>
[Flags]
publicenumInternetState
{
/// <summary>Connected state. Mutually exclusive with disconnected state.</summary>
INTERNET_STATE_CONNECTED=1,
/// <summary>Disconnected state. No network connection could be established.</summary>
INTERNET_STATE_DISCONNECTED=2,
/// <summary>Disconnected by user request.</summary>
INTERNET_STATE_DISCONNECTED_BY_USER=0x10,
/// <summary>No network requests are being made by Windows Internet.</summary>
INTERNET_STATE_IDLE=0x100,
/// <summary>Network requests are being made by Windows Internet.</summary>
INTERNET_STATE_BUSY=0x200,
}
/// <summary>Values passed using the <see cref="INTERNET_STATUS_CALLBACK"/> delegate.</summary>
publicenumInternetStatus
{
/// <summary>Closing the connection to the server. The lpvStatusInformation parameter is NULL.</summary>
INTERNET_STATUS_CLOSING_CONNECTION=50,
/// <summary>Successfully connected to the socket address (SOCKADDR) pointed to by lpvStatusInformation.</summary>
INTERNET_STATUS_CONNECTED_TO_SERVER=21,
/// <summary>Connecting to the socket address (SOCKADDR) pointed to by lpvStatusInformation.</summary>
INTERNET_STATUS_CONNECTING_TO_SERVER=20,
/// <summary>Successfully closed the connection to the server. The lpvStatusInformation parameter is NULL.</summary>
INTERNET_STATUS_CONNECTION_CLOSED=51,
/// <summary>Retrieving content from the cache. Contains data about past cookie events for the URL such as if cookies were accepted, rejected, downgraded, or leashed. The lpvStatusInformation parameter is a pointer to an InternetCookieHistory structure.</summary>
INTERNET_STATUS_COOKIE_HISTORY=327,
/// <summary>Indicates the number of cookies that were accepted, rejected, downgraded (changed from persistent to session cookies), or leashed (will be sent out only in 1st party context). The lpvStatusInformation parameter is a DWORD with the number of cookies received.</summary>
INTERNET_STATUS_COOKIE_RECEIVED=321,
/// <summary>Indicates the number of cookies that were either sent or suppressed, when a request is sent. The lpvStatusInformation parameter is a DWORD with the number of cookies sent or suppressed.</summary>
INTERNET_STATUS_COOKIE_SENT=320,
/// <summary>Not implemented.</summary>
INTERNET_STATUS_CTL_RESPONSE_RECEIVED=42,
/// <summary>Notifies the client application that a proxy has been detected.</summary>
INTERNET_STATUS_DETECTING_PROXY=80,
/// <summary>This handle value has been terminated. pvStatusInformation contains the address of the handle being closed. The lpvStatusInformation parameter contains the address of the handle being closed.</summary>
INTERNET_STATUS_HANDLE_CLOSING=70,
/// <summary>Used by InternetConnect to indicate it has created the new handle. This lets the application call InternetCloseHandle from another thread, if the connect is taking too long. The lpvStatusInformation parameter contains the address of an HINTERNET handle.</summary>
INTERNET_STATUS_HANDLE_CREATED=60,
/// <summary>Received an intermediate (100 level) status code message from the server.</summary>
INTERNET_STATUS_INTERMEDIATE_RESPONSE=120,
/// <summary>Successfully found the IP address of the name contained in lpvStatusInformation. The lpvStatusInformation parameter points to a PCTSTR containing the host name.</summary>
INTERNET_STATUS_NAME_RESOLVED=11,
/// <summary>The response has a P3P header in it.</summary>
INTERNET_STATUS_P3P_HEADER=325,
/// <summary>Not implemented.</summary>
INTERNET_STATUS_P3P_POLICYREF=326,
/// <summary>Not implemented.</summary>
INTERNET_STATUS_PREFETCH=43,
/// <summary>Not implemented.</summary>
INTERNET_STATUS_PRIVACY_IMPACTED=324,
/// <summary>Waiting for the server to respond to a request. The lpvStatusInformation parameter is NULL.</summary>
INTERNET_STATUS_RECEIVING_RESPONSE=40,
/// <summary>An HTTP request is about to automatically redirect the request. The lpvStatusInformation parameter points to the new URL. At this point, the application can read any data returned by the server with the redirect response and can query the response headers. It can also cancel the operation by closing the handle. This callback is not made if the original request specified INTERNET_FLAG_NO_AUTO_REDIRECT.</summary>
INTERNET_STATUS_REDIRECT=110,
/// <summary>An asynchronous operation has been completed. The lpvStatusInformation parameter contains the address of an INTERNET_ASYNC_RESULT structure.</summary>
INTERNET_STATUS_REQUEST_COMPLETE=100,
/// <summary>Successfully sent the information request to the server. The lpvStatusInformation parameter points to a DWORD value that contains the number of bytes sent.</summary>
INTERNET_STATUS_REQUEST_SENT=31,
/// <summary>Looking up the IP address of the name contained in lpvStatusInformation. The lpvStatusInformation parameter points to a PCTSTR containing the host name.</summary>
INTERNET_STATUS_RESOLVING_NAME=10,
/// <summary>Successfully received a response from the server.</summary>
INTERNET_STATUS_RESPONSE_RECEIVED=41,
/// <summary>Sending the information request to the server. The lpvStatusInformation parameter is NULL.</summary>
INTERNET_STATUS_SENDING_REQUEST=30,
/// <summary>Moved between a secure (HTTPS) and a nonsecure (HTTP) site. The user must be informed of this change; otherwise, the user is at risk of disclosing sensitive information involuntarily. When this flag is set, the lpvStatusInformation parameter points to a status DWORD that contains additional flags.</summary>
INTERNET_STATUS_STATE_CHANGE=200,
/// <summary>The request requires user input to be completed.</summary>
INTERNET_STATUS_USER_INPUT_REQUIRED=140,
}
/// <summary>Closes a single Internet handle.</summary>
/// <param name="hInternet">Handle to be closed.</param>
/// <returns>Returns TRUE if the handle is successfully closed, or FALSE otherwise. To get extended error information, call GetLastError.</returns>
/// <summary>Opens an File Transfer Protocol (FTP) or HTTP session for a given site.</summary>
/// <param name="hInternet">Handle returned by a previous call to InternetOpen.</param>
/// <param name="lpszServerName">
/// A string that specifies the host name of an Internet server. Alternately, the string can contain the IP number of the site, in ASCII dotted-decimal
/// format (for example, 11.0.1.45).
/// </param>
/// <param name="nServerPort">
/// Transmission Control Protocol/Internet Protocol (TCP/IP) port on the server. These flags set only the port that is used. The service is set by the
/// value of dwService.
/// </param>
/// <param name="lpszUsername">
/// A string that specifies the name of the user to log on. If this parameter is NULL, the function uses an appropriate default. For the FTP protocol,
/// the default is "anonymous".
/// </param>
/// <param name="lpszPassword">
/// A string that contains the password to use to log on. If both lpszPassword and lpszUsername are NULL, the function uses the default "anonymous"
/// password. In the case of FTP, the default password is the user's email name. If lpszPassword is NULL, but lpszUsername is not NULL, the function uses
/// a blank password.
/// </param>
/// <param name="dwService">Type of service to access.</param>
/// <param name="dwFlags">
/// Options specific to the service used. If dwService is INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE causes the application to use passive FTP semantics.
/// </param>
/// <param name="dwContext">
/// Pointer to a variable that contains an application-defined value that is used to identify the application context for the returned handle in callbacks.
/// </param>
/// <returns>
/// Returns a valid handle to the session if the connection is successful, or NULL otherwise. To retrieve extended error information, call GetLastError.
/// An application can also use InternetGetLastResponseInfo to determine why access to the service was denied.
/// <summary>Initializes an application's use of the WinINet functions</summary>
/// <param name="lpszAgent">
/// A string that specifies the name of the application or entity calling the WinINet functions. This name is used as the user agent in the HTTP protocol.
/// </param>
/// <param name="dwAccessType">Type of access required.</param>
/// <param name="lpszProxyName">
/// A string that specifies the name of the proxy server(s) to use when proxy access is specified by setting dwAccessType to INTERNET_OPEN_TYPE_PROXY. Do
/// not use an empty string, because InternetOpen will use it as the proxy name. The WinINet functions recognize only CERN type proxies (HTTP only) and
/// the TIS FTP gateway (FTP only). If Microsoft Internet Explorer is installed, these functions also support SOCKS proxies. FTP requests can be made
/// through a CERN type proxy either by changing them to an HTTP request or by using InternetOpenUrl. If dwAccessType is not set to
/// INTERNET_OPEN_TYPE_PROXY, this parameter is ignored and should be NULL. For more information about listing proxy servers, see the Listing Proxy
/// Servers section of Enabling Internet Functionality.
/// </param>
/// <param name="lpszProxyBypass">
/// A string that specifies an optional list of host names or IP addresses, or both, that should not be routed through the proxy when dwAccessType is set
/// to INTERNET_OPEN_TYPE_PROXY. The list can contain wildcards. Do not use an empty string, because InternetOpen will use it as the proxy bypass list.
/// If this parameter specifies the "<local>" macro, the function bypasses the proxy for any host name that does not contain a period.
/// <para>
/// By default, WinINet will bypass the proxy for requests that use the host names "localhost", "loopback", "127.0.0.1", or "[::1]". This behavior exists
/// because a remote proxy server typically will not resolve these addresses properly.
/// </para>
/// <para>Internet Explorer 9: You can remove the local computer from the proxy bypass list using the "<-loopback>" macro.</para>
/// <para>If dwAccessType is not set to INTERNET_OPEN_TYPE_PROXY, this parameter is ignored and should be NULL.</para>
/// </param>
/// <param name="dwFlags">Options.</param>
/// <returns>
/// Returns a valid handle that the application passes to subsequent WinINet functions. If InternetOpen fails, it returns NULL. To retrieve a specific
/// <summary>Queries an Internet option on the specified handle.</summary>
/// <param name="hInternet">Handle on which to query information.</param>
/// <param name="dwOption">Internet option to be queried. This can be one of the Option Flags values.</param>
/// <param name="optionsList">
/// Pointer to a buffer that receives the option setting. Strings returned by InternetQueryOption are globally allocated, so the calling application must
/// free them when it is finished using them.
/// </param>
/// <param name="bufferLength">
/// Pointer to a variable that contains the size of lpBuffer, in bytes. When InternetQueryOption returns, lpdwBufferLength specifies the size of the data
/// placed into lpBuffer. If GetLastError returns ERROR_INSUFFICIENT_BUFFER, this parameter points to the number of bytes required to hold the requested information.
/// </param>
/// <returns>Returns TRUE if successful, or FALSE otherwise. To get a specific error message, call GetLastError.</returns>
/// <summary>Queries an Internet option on the specified handle.</summary>
/// <param name="hInternet">Handle on which to query information.</param>
/// <param name="option">Internet option to be queried. This can be one of the Option Flags values.</param>
/// <returns>A <see cref="SafeCoTaskMemHandle"/> instance with sufficient memory needed to hold the response. This should be cast to the type required.</returns>
/// <param name="hInternet">Handle on which to set information.</param>
/// <param name="dwOption">Internet option to be set. This can be one of the Option Flags values.</param>
/// <param name="lpBuffer">Pointer to a buffer that contains the option setting.</param>
/// <param name="lpdwBufferLength">
/// Size of the lpBuffer buffer. If lpBuffer contains a string, the size is in TCHARs. If lpBuffer contains anything other than a string, the size is in bytes.
/// </param>
/// <returns>Returns TRUE if successful, or FALSE otherwise. To get a specific error message, call GetLastError.</returns>
if(CorrespondingTypeAttribute.GetCorrespondingTypes(option).FirstOrDefault()!=null)thrownewArgumentException($"{option} cannot be used to set options that do not require a value.");
/// <summary>The InternetSetStatusCallback function sets up a callback function that WinINet functions can call as progress is made during an operation.</summary>
/// <param name="hInternet">The handle for which the callback is set.</param>
/// <param name="lpfnInternetCallback">A pointer to the callback function to call when progress is made, or NULL to remove the existing callback function. For more information about the callback function, see InternetStatusCallback.</param>
/// <returns>Returns the previously defined status callback function if successful, NULL if there was no previously defined status callback function, or INTERNET_INVALID_STATUS_CALLBACK if the callback function is not valid.</returns>
/// <summary>Contains the global HTTP version.</summary>
/// <remarks>
/// On Windows 7, Windows Server 2008 R2, and later, the value in the HTTP_VERSION_INFO structure is overridden by Internet Explorer settings.
/// EnableHttp1_1 is a registry value under HKLM\Software\Microsoft\InternetExplorer\AdvacnedOptions\HTTP\GENABLE controlled by Internet Options set in
/// Internet Explorer for the system. The EnableHttp1_1 value defaults to 1. The HTTP_VERSION_INFO structure is ignored for any HTTP version less than
/// 1.1 if EnableHttp1_1 is set to 1.
/// </remarks>
[StructLayout(LayoutKind.Sequential)]
publicstructHTTP_VERSION_INFO
{
/// <summary>The major version number. Must be 1.</summary>
publicuintdwMajorVersion;
/// <summary>The minor version number. Can be either 1 or zero.</summary>
publicuintdwMinorVersion;
}
/// <summary>Contains the LastModified and Expire times for a resource stored in the Internet cache.</summary>
[StructLayout(LayoutKind.Sequential)]
publicstructINTERNET_CACHE_TIMESTAMPS
{
/// <summary>FILETIME structure that contains the Expires time.</summary>
publicFILETIMEftExpires;
/// <summary>FILETIME structure that contains the LastModified time.</summary>
publicFILETIMEftLastModified;
}
/// <summary>Contains certificate information returned from the server. This structure is used by the InternetQueryOption function.</summary>
/// <remarks>
/// Despite what the header indicates, the implementation of INTERNET_CERTIFICATE_INFO is not Unicode-aware. All of the string members are filled as ANSI
/// strings regardless of whether Unicode is enabled. Consequently, when reading these values, the caller must cast them to LPSTR if Unicode is enabled.
/// <summary>FILETIME structure that contains the date the certificate expires.</summary>
publicFILETIMEftExpiry;
/// <summary>FILETIME structure that contains the date the certificate becomes valid.</summary>
publicFILETIMEftStart;
/// <summary>
/// Pointer to a buffer that contains the name of the organization, site, and server for which the certificate was issued. The application must call
/// LocalFree to release the resources allocated for this parameter.
/// </summary>
publicStrPtrAnsilpszSubjectInfo;
/// <summary>
/// Pointer to a buffer that contains the name of the organization, site, and server that issued the certificate. The application must call LocalFree
/// to release the resources allocated for this parameter.
/// </summary>
publicStrPtrAnsilpszIssuerInfo;
/// <summary>
/// Pointer to a buffer that contains the name of the protocol used to provide the secure connection. The application must call LocalFree to release
/// the resources allocated for this parameter.
/// </summary>
publicStrPtrAnsilpszProtocolName;
/// <summary>
/// Pointer to a buffer that contains the name of the algorithm used for signing the certificate. The application must call LocalFree to release the
/// resources allocated for this parameter.
/// </summary>
publicStrPtrAnsilpszSignatureAlgName;
/// <summary>
/// Pointer to a buffer that contains the name of the algorithm used for doing encryption over the secure channel (SSL/PCT) connection. The
/// application must call LocalFree to release the resources allocated for this parameter.
/// </summary>
publicStrPtrAnsilpszEncryptionAlgName;
/// <summary>Size, in TCHARs, of the key.</summary>
publicuintdwKeySize;
}
/// <summary>
/// The INTERNET_DIAGNOSTIC_SOCKET_INFO structure is returned by the InternetQueryOption function when the INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO flag is
/// passed to it together with a handle to an HTTP Request. The INTERNET_DIAGNOSTIC_SOCKET_INFO structure contains information about the socket
/// <summary>Size of the structure, in bytes.</summary>
publicuintdwSize;
/// <summary>
/// Pointer to a string that contains the name of the RAS connection or NULL, which indicates the default or LAN connection, to set or query options on.
/// </summary>
publicStrPtrAutopszConnection;
/// <summary>Number of options to query or set.</summary>
publicuintdwOptionCount;
/// <summary>Options that failed, if an error occurs.</summary>
publicuintdwOptionError;
/// <summary>Pointer to an array of INTERNET_PER_CONN_OPTION structures containing the options to query or set.</summary>
publicIntPtrpOptions;
}
/// <summary>Union that contains the value for the option. It can be any one of the following types depending on the value of dwOption.</summary>
[StructLayout(LayoutKind.Explicit)]
publicstructINTERNET_PER_CONN_OPTION_Value
{
/// <summary>Unsigned long integer value.</summary>
[FieldOffset(0)]
publicuintdwValue;
/// <summary>Pointer to a string value.</summary>
[FieldOffset(0)]
publicStrPtrAutopszValue;
/// <summary>A FILETIME structure.</summary>
[FieldOffset(0)]
publicFILETIMEftValue;
}
/// <summary>
/// Contains information that is supplied with the INTERNET_OPTION_PROXY value to get or set proxy information on a handle obtained from a call to the
/// <summary>Pointer to a string that contains the proxy server list.</summary>
publicStrPtrAutolpszProxy;
/// <summary>Pointer to a string that contains the proxy bypass list.</summary>
publicStrPtrAutolpszProxyBypass;
}
/// <summary>
/// Contains the HTTP version number of the server. This structure is used when passing the INTERNET_OPTION_VERSION flag to the InternetQueryOption function.