/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
winhttp.h
Abstract:
Contains manifests, macros, types and prototypes for Windows HTTP Services
--*/
#if !defined(_WINHTTPX_)
#define _WINHTTPX_
/*
* Set up Structure Packing to be 4 bytes for all winhttp structures
*/
#if defined(_WIN64)
#include <pshpack8.h>
#else
#include <pshpack4.h>
#endif
#if defined(__cplusplus)
extern "C" {
#endif
#if !defined(_WINHTTP_INTERNAL_)
#define WINHTTPAPI DECLSPEC_IMPORT
#else
#define WINHTTPAPI
#endif
#define BOOLAPI WINHTTPAPI BOOL WINAPI
//
// types
//
typedef LPVOID HINTERNET;
typedef HINTERNET * LPHINTERNET;
typedef WORD INTERNET_PORT;
typedef INTERNET_PORT * LPINTERNET_PORT;
typedef DWORD DWORD_PTR;
//
// manifests
//
#define INTERNET_DEFAULT_PORT 0 // use the protocol-specific default
#define INTERNET_DEFAULT_HTTP_PORT 80 // " " HTTP "
#define INTERNET_DEFAULT_HTTPS_PORT 443 // " " HTTPS "
// flags for WinHttpOpen():
#define WINHTTP_FLAG_ASYNC 0x10000000 // this session is asynchronous (where supported)
// flags for WinHttpOpenRequest():
#define WINHTTP_FLAG_SECURE 0x00800000 // use SSL if applicable (HTTPS)
#define WINHTTP_FLAG_ESCAPE_PERCENT 0x00000004 // if escaping enabled, escape percent as well
#define WINHTTP_FLAG_NULL_CODEPAGE 0x00000008 // assume all symbols are ASCII, use fast convertion
#define WINHTTP_FLAG_BYPASS_PROXY_CACHE 0x00000100 // add "pragma: no-cache" request header
#define WINHTTP_FLAG_REFRESH WINHTTP_FLAG_BYPASS_PROXY_CACHE
#define WINHTTP_FLAG_ESCAPE_DISABLE 0x00000040 // disable escaping
#define WINHTTP_FLAG_ESCAPE_DISABLE_QUERY 0x00000080 // if escaping enabled escape path part, but do not escape query
#define SECURITY_FLAG_IGNORE_UNKNOWN_CA 0x00000100
#define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID 0x00002000 // expired X509 Cert.
#define SECURITY_FLAG_IGNORE_CERT_CN_INVALID 0x00001000 // bad common name in X509 Cert.
#define SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE 0x00000200
//
// WINHTTP_ASYNC_RESULT - this structure is returned to the application via
// the callback with WINHTTP_CALLBACK_STATUS_REQUEST_COMPLETE. It is not sufficient to
// just return the result of the async operation. If the API failed then the
// app cannot call GetLastError() because the thread context will be incorrect.
// Both the value returned by the async API and any resultant error code are
// made available. The app need not check dwError if dwResult indicates that
// the API succeeded (in this case dwError will be ERROR_SUCCESS)
//
typedef struct
{
DWORD_PTR dwResult; // indicates which async API has encountered an error
DWORD dwError; // the error code if the API failed
}
WINHTTP_ASYNC_RESULT, * LPWINHTTP_ASYNC_RESULT;
//
// HTTP_VERSION_INFO - query or set global HTTP version (1.0 or 1.1)
//
typedef struct
{
DWORD dwMajorVersion;
DWORD dwMinorVersion;
}
HTTP_VERSION_INFO, * LPHTTP_VERSION_INFO;
//
// INTERNET_SCHEME - URL scheme type
//
typedef int INTERNET_SCHEME, * LPINTERNET_SCHEME;
#define INTERNET_SCHEME_HTTP (1)
#define INTERNET_SCHEME_HTTPS (2)
//
// URL_COMPONENTS - the constituent parts of an URL. Used in WinHttpCrackUrl()
// and WinHttpCreateUrl()
//
// For WinHttpCrackUrl(), if a pointer field and its corresponding length field
// are both 0 then that component is not returned. If the pointer field is NULL
// but the length field is not zero, then both the pointer and length fields are
// returned if both pointer and corresponding length fields are non-zero then
// the pointer field points to a buffer where the component is copied. The
// component may be un-escaped, depending on dwFlags
//
// For WinHttpCreateUrl(), the pointer fields should be NULL if the component
// is not required. If the corresponding length field is zero then the pointer
// field is the address of a zero-terminated string. If the length field is not
// zero then it is the string length of the corresponding pointer field
//
#pragma warning( disable : 4121 ) // disable alignment warning
typedef struct
{
DWORD dwStructSize; // size of this structure. Used in version check
LPWSTR lpszScheme; // pointer to scheme name
DWORD dwSchemeLength; // length of scheme name
INTERNET_SCHEME nScheme; // enumerated scheme type (if known)
LPWSTR lpszHostName; // pointer to host name
DWORD dwHostNameLength; // length of host name
INTERNET_PORT nPort; // converted port number
LPWSTR lpszUserName; // pointer to user name
DWORD dwUserNameLength; // length of user name
LPWSTR lpszPassword; // pointer to password
DWORD dwPasswordLength; // length of password
LPWSTR lpszUrlPath; // pointer to URL-path
DWORD dwUrlPathLength; // length of URL-path
LPWSTR lpszExtraInfo; // pointer to extra information (e.g. ?foo or #foo)
DWORD dwExtraInfoLength; // length of extra information
}
URL_COMPONENTS, * LPURL_COMPONENTS;
typedef URL_COMPONENTS URL_COMPONENTSW;
typedef LPURL_COMPONENTS LPURL_COMPONENTSW;
#pragma warning( default : 4121 ) // restore alignment warning
//
// WINHTTP_PROXY_INFO - structure supplied with WINHTTP_OPTION_PROXY to get/
// set proxy information on a WinHttpOpen() handle
//
typedef struct
{
DWORD dwAccessType; // see WINHTTP_ACCESS_* types below
LPWSTR lpszProxy; // proxy server list
LPWSTR lpszProxyBypass; // proxy bypass list
}
WINHTTP_PROXY_INFO, * LPWINHTTP_PROXY_INFO;
typedef WINHTTP_PROXY_INFO WINHTTP_PROXY_INFOW;
typedef LPWINHTTP_PROXY_INFO LPWINHTTP_PROXY_INFOW;
typedef struct
{
DWORD dwFlags;
DWORD dwAutoDetectFlags;
LPCWSTR lpszAutoConfigUrl;
LPVOID lpvReserved;
DWORD dwReserved;
BOOL fAutoLogonIfChallenged;
}
WINHTTP_AUTOPROXY_OPTIONS;
#define WINHTTP_AUTOPROXY_AUTO_DETECT 0x00000001
#define WINHTTP_AUTOPROXY_CONFIG_URL 0x00000002
#define WINHTTP_AUTOPROXY_RUN_INPROCESS 0x00010000
#define WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY 0x00020000
//
// Flags for dwAutoDetectFlags
//
#define WINHTTP_AUTO_DETECT_TYPE_DHCP 0x00000001
#define WINHTTP_AUTO_DETECT_TYPE_DNS_A 0x00000002
//
// WINHTTP_CERTIFICATE_INFO lpBuffer - contains the certificate returned from
// the server
//
typedef struct
{
//
// ftExpiry - date the certificate expires.
//
FILETIME ftExpiry;
//
// ftStart - date the certificate becomes valid.
//
FILETIME ftStart;
//
// lpszSubjectInfo - the name of organization, site, and server
// the cert. was issued for.
//
LPWSTR lpszSubjectInfo;
//
// lpszIssuerInfo - the name of orgainzation, site, and server
// the cert was issues by.
//
LPWSTR lpszIssuerInfo;
//
// lpszProtocolName - the name of the protocol used to provide the secure
// connection.
//
LPWSTR lpszProtocolName;
//
// lpszSignatureAlgName - the name of the algorithm used for signing
// the certificate.
//
LPWSTR lpszSignatureAlgName;
//
// lpszEncryptionAlgName - the name of the algorithm used for
// doing encryption over the secure channel (SSL) connection.
//
LPWSTR lpszEncryptionAlgName;
//
// dwKeySize - size of the key.
//
DWORD dwKeySize;
}
WINHTTP_CERTIFICATE_INFO;
//
// prototypes
//
BOOLAPI
WinHttpTimeFromSystemTime
(
IN CONST SYSTEMTIME *pst, // input GMT time
OUT LPWSTR pwszTime // output string b
- 1
- 2
- 3
- 4
- 5
- 6
前往页