📄 wininet.h
字号:
//
typedef struct {
DWORD dwMajorVersion;
DWORD dwMinorVersion;
} INTERNET_VERSION_INFO, * LPINTERNET_VERSION_INFO;
//
// 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_CONNECTED_INFO - information used to set the global connected state
//
typedef struct {
//
// dwConnectedState - new connected/disconnected state.
// See INTERNET_STATE_CONNECTED, etc.
//
DWORD dwConnectedState;
//
// dwFlags - flags controlling connected->disconnected (or disconnected->
// connected) transition. See below
//
DWORD dwFlags;
} INTERNET_CONNECTED_INFO, * LPINTERNET_CONNECTED_INFO;
//
// flags for INTERNET_CONNECTED_INFO dwFlags
//
//
// ISO_FORCE_DISCONNECTED - if set when putting Wininet into disconnected mode,
// all outstanding requests will be aborted with a cancelled error
//
#define ISO_FORCE_DISCONNECTED 0x00000001
//
// URL_COMPONENTS - the constituent parts of an URL. Used in InternetCrackUrl()
// and InternetCreateUrl()
//
// For InternetCrackUrl(), if a pointer field and its corresponding length field
// are both 0 then that component is not returned. If the pointer field is NULL
// but the length field is not zero, then both the pointer and length fields are
// returned if both pointer and corresponding length fields are non-zero then
// the pointer field points to a buffer where the component is copied. The
// component may be un-escaped, depending on dwFlags
//
// For InternetCreateUrl(), the pointer fields should be NULL if the component
// is not required. If the corresponding length field is zero then the pointer
// field is the address of a zero-terminated string. If the length field is not
// zero then it is the string length of the corresponding pointer field
//
#pragma warning( disable : 4121 ) // disable alignment warning
typedef struct {
DWORD dwStructSize; // size of this structure. Used in version check
LPSTR lpszScheme; // pointer to scheme name
DWORD dwSchemeLength; // length of scheme name
INTERNET_SCHEME nScheme; // enumerated scheme type (if known)
LPSTR lpszHostName; // pointer to host name
DWORD dwHostNameLength; // length of host name
INTERNET_PORT nPort; // converted port number
LPSTR lpszUserName; // pointer to user name
DWORD dwUserNameLength; // length of user name
LPSTR lpszPassword; // pointer to password
DWORD dwPasswordLength; // length of password
LPSTR lpszUrlPath; // pointer to URL-path
DWORD dwUrlPathLength; // length of URL-path
LPSTR lpszExtraInfo; // pointer to extra information (e.g. ?foo or #foo)
DWORD dwExtraInfoLength; // length of extra information
} URL_COMPONENTSA, * LPURL_COMPONENTSA;
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_COMPONENTSW, * LPURL_COMPONENTSW;
#ifdef UNICODE
typedef URL_COMPONENTSW URL_COMPONENTS;
typedef LPURL_COMPONENTSW LPURL_COMPONENTS;
#else
typedef URL_COMPONENTSA URL_COMPONENTS;
typedef LPURL_COMPONENTSA LPURL_COMPONENTS;
#endif // UNICODE
#pragma warning( default : 4121 ) // restore alignment warning
//
// INTERNET_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.
//
LPTSTR lpszSubjectInfo;
//
// lpszIssuerInfo - the name of orgainzation, site, and server
// the cert was issues by.
//
LPTSTR lpszIssuerInfo;
//
// lpszProtocolName - the name of the protocol used to provide the secure
// connection.
//
LPTSTR lpszProtocolName;
//
// lpszSignatureAlgName - the name of the algorithm used for signing
// the certificate.
//
LPTSTR lpszSignatureAlgName;
//
// lpszEncryptionAlgName - the name of the algorithm used for
// doing encryption over the secure channel (SSL/PCT) connection.
//
LPTSTR lpszEncryptionAlgName;
//
// dwKeySize - size of the key.
//
DWORD dwKeySize;
} INTERNET_CERTIFICATE_INFO, * LPINTERNET_CERTIFICATE_INFO;
//
// INTERNET_BUFFERS - combines headers and data. May be chained for e.g. file
// upload or scatter/gather operations. For chunked read/write, lpcszHeader
// contains the chunked-ext
//
typedef struct _INTERNET_BUFFERSA {
DWORD dwStructSize; // used for API versioning. Set to sizeof(INTERNET_BUFFERS)
struct _INTERNET_BUFFERSA * Next; // chain of buffers
LPCSTR lpcszHeader; // pointer to headers (may be NULL)
DWORD dwHeadersLength; // length of headers if not NULL
DWORD dwHeadersTotal; // size of headers if not enough buffer
LPVOID lpvBuffer; // pointer to data buffer (may be NULL)
DWORD dwBufferLength; // length of data buffer if not NULL
DWORD dwBufferTotal; // total size of chunk, or content-length if not chunked
DWORD dwOffsetLow; // used for read-ranges (only used in HttpSendRequest2)
DWORD dwOffsetHigh;
} INTERNET_BUFFERSA, * LPINTERNET_BUFFERSA;
typedef struct _INTERNET_BUFFERSW {
DWORD dwStructSize; // used for API versioning. Set to sizeof(INTERNET_BUFFERS)
struct _INTERNET_BUFFERSW * Next; // chain of buffers
LPCWSTR lpcszHeader; // pointer to headers (may be NULL)
DWORD dwHeadersLength; // length of headers if not NULL
DWORD dwHeadersTotal; // size of headers if not enough buffer
LPVOID lpvBuffer; // pointer to data buffer (may be NULL)
DWORD dwBufferLength; // length of data buffer if not NULL
DWORD dwBufferTotal; // total size of chunk, or content-length if not chunked
DWORD dwOffsetLow; // used for read-ranges (only used in HttpSendRequest2)
DWORD dwOffsetHigh;
} INTERNET_BUFFERSW, * LPINTERNET_BUFFERSW;
#ifdef UNICODE
typedef INTERNET_BUFFERSW INTERNET_BUFFERS;
typedef LPINTERNET_BUFFERSW LPINTERNET_BUFFERS;
#else
typedef INTERNET_BUFFERSA INTERNET_BUFFERS;
typedef LPINTERNET_BUFFERSA LPINTERNET_BUFFERS;
#endif // UNICODE
//
// prototypes
//
BOOLAPI
InternetTimeFromSystemTimeA(
IN CONST SYSTEMTIME *pst, // input GMT time
IN DWORD dwRFC, // RFC format
OUT LPSTR lpszTime, // output string buffer
IN DWORD cbTime // output buffer size
);
BOOLAPI
InternetTimeFromSystemTimeW(
IN CONST SYSTEMTIME *pst, // input GMT time
IN DWORD dwRFC, // RFC format
OUT LPWSTR lpszTime, // output string buffer
IN DWORD cbTime // output buffer size
);
#ifdef UNICODE
#define InternetTimeFromSystemTime InternetTimeFromSystemTimeW
#else
#ifdef _WINX32_
#define InternetTimeFromSystemTime InternetTimeFromSystemTimeA
#else
BOOLAPI
InternetTimeFromSystemTime(
IN CONST SYSTEMTIME *pst, // input GMT time
IN DWORD dwRFC, // RFC format
OUT LPSTR lpszTime, // output string buffer
IN DWORD cbTime // output buffer size
);
#endif // _WINX32_
#endif // !UNICODE
//
// constants for InternetTimeFromSystemTime
//
#define INTERNET_RFC1123_FORMAT 0
#define INTERNET_RFC1123_BUFSIZE 30
BOOLAPI
InternetTimeToSystemTimeA(
IN LPCSTR lpszTime, // NULL terminated string
OUT SYSTEMTIME *pst, // output in GMT time
IN DWORD dwReserved
);
BOOLAPI
InternetTimeToSystemTimeW(
IN LPCWSTR lpszTime, // NULL terminated string
OUT SYSTEMTIME *pst, // output in GMT time
IN DWORD dwReserved
);
#ifdef UNICODE
#define InternetTimeToSystemTime InternetTimeToSystemTimeW
#else
#ifdef _WINX32_
#define InternetTimeToSystemTime InternetTimeToSystemTimeA
#else
BOOLAPI
InternetTimeToSystemTime(
IN LPCSTR lpszTime, // NULL terminated string
OUT SYSTEMTIME *pst, // output in GMT time
IN DWORD dwReserved
);
#endif // _WINX32_
#endif // !UNICODE
BOOLAPI
InternetCrackUrlA(
IN LPCSTR lpszUrl,
IN DWORD dwUrlLength,
IN DWORD dwFlags,
IN OUT LPURL_COMPONENTSA lpUrlComponents
);
BOOLAPI
InternetCrackUrlW(
IN LPCWSTR lpszUrl,
IN DWORD dwUrlLength,
IN DWORD dwFlags,
IN OUT LPURL_COMPONENTSW lpUrlComponents
);
#ifdef UNICODE
#define InternetCrackUrl InternetCrackUrlW
#else
#define InternetCrackUrl InternetCrackUrlA
#endif // !UNICODE
BOOLAPI
InternetCreateUrlA(
IN LPURL_COMPONENTSA lpUrlComponents,
IN DWORD dwFlags,
OUT LPSTR lpszUrl,
IN OUT LPDWORD lpdwUrlLength
);
BOOLAPI
InternetCreateUrlW(
IN LPURL_COMPONENTSW lpUrlComponents,
IN DWORD dwFlags,
OUT LPWSTR lpszUrl,
IN OUT LPDWORD lpdwUrlLength
);
#ifdef UNICODE
#define InternetCreateUrl InternetCreateUrlW
#else
#define InternetCreateUrl InternetCreateUrlA
#endif // !UNICODE
BOOLAPI
InternetCanonicalizeUrlA(
IN LPCSTR lpszUrl,
OUT LPSTR lpszBuffer,
IN OUT LPDWORD lpdwBufferLength,
IN DWORD dwFlags
);
BOOLAPI
InternetCanonicalizeUrlW(
IN LPCWSTR lpszUrl,
OUT LPWSTR lpszBuffer,
IN OUT LPDWORD lpdwBufferLength,
IN DWORD dwFlags
);
#ifdef UNICODE
#define InternetCanonicalizeUrl InternetCanonicalizeUrlW
#else
#define InternetCanonicalizeUrl InternetCanonicalizeUrlA
#endif // !UNICODE
BOOLAPI
InternetCombineUrlA(
IN LPCSTR lpszBaseUrl,
IN LPCSTR lpszRelativeUrl,
OUT LPSTR lpszBuffer,
IN OUT LPDWORD lpdwBufferLength,
IN DWORD dwFlags
);
BOOLAPI
InternetCombineUrlW(
IN LPCWSTR lpszBaseUrl,
IN LPCWSTR lpszRelativeUrl,
OUT LPWSTR lpszBuffer,
IN OUT LPDWORD lpdwBufferLength,
IN DWORD dwFlags
);
#ifdef UNICODE
#define InternetCombineUrl InternetCombineUrlW
#else
#define InternetCombineUrl InternetCombineUrlA
#endif // !UNICODE
//
// flags for InternetCrackUrl() and InternetCreateUrl()
//
#define ICU_ESCAPE 0x80000000 // (un)escape URL characters
#define ICU_USERNAME 0x40000000 // use internal username & password
//
// flags for InternetCanonicalizeUrl() and InternetCombineUrl()
//
#define ICU_NO_ENCODE 0x20000000 // Don't convert unsafe characters to escape sequence
#define ICU_DECODE 0x10000000 // Convert %XX escape sequences to characters
#define ICU_NO_META 0x08000000 // Don't convert .. etc. meta path sequences
#define ICU_ENCODE_SPACES_ONLY 0x04000000 // Encode spaces only
#define ICU_BROWSER_MODE 0x02000000 // Special encode/decode rules for browser
#define ICU_ENCODE_PERCENT 0x00001000 // Encode any percent (ASCII25)
// signs encountered, default is to not encode percent.
INTERNETAPI
HINTERNET
WINAPI
InternetOpenA(
IN LPCSTR lpszAgent,
IN DWORD dwAccessType,
IN LPCSTR lpszProxy OPTIONAL,
IN LPCSTR lpszProxyBypass OPTIONAL,
IN DWORD dwFlags
);
INTERNETAPI
HINTERNET
WINAPI
InternetOpenW(
IN LPCWSTR lpszAgent,
IN DWORD dwAccessType,
IN LPCWSTR lpszProxy OPTIONAL,
IN LPCWSTR lpszProxyBypass OPTIONAL,
IN DWORD dwFlags
);
#ifdef UNICODE
#define InternetOpen InternetOpenW
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -