/header/Microsoft SDKs/Windows/v7.0A/Include/winhttp.h

https://github.com/nihon-tc/Rtest · C Header · 1255 lines · 753 code · 259 blank · 243 comment · 7 complexity · 42e91cf3c2cf3903b896da6bc26ab747 MD5 · raw file

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. winhttp.h
  5. Abstract:
  6. Contains manifests, macros, types and prototypes for Windows HTTP Services
  7. --*/
  8. #if !defined(_WINHTTPX_)
  9. #define _WINHTTPX_
  10. /*
  11. * Set up Structure Packing to be 4 bytes for all winhttp structures
  12. */
  13. #if defined(_WIN64)
  14. #include <pshpack8.h>
  15. #else
  16. #include <pshpack4.h>
  17. #endif
  18. #if defined(__cplusplus)
  19. extern "C" {
  20. #endif
  21. #if !defined(_WINHTTP_INTERNAL_)
  22. #define WINHTTPAPI DECLSPEC_IMPORT
  23. #else
  24. #define WINHTTPAPI
  25. #endif
  26. #define BOOLAPI WINHTTPAPI BOOL WINAPI
  27. //
  28. // types
  29. //
  30. typedef LPVOID HINTERNET;
  31. typedef HINTERNET * LPHINTERNET;
  32. typedef WORD INTERNET_PORT;
  33. typedef INTERNET_PORT * LPINTERNET_PORT;
  34. //
  35. // manifests
  36. //
  37. #define INTERNET_DEFAULT_PORT 0 // use the protocol-specific default
  38. #define INTERNET_DEFAULT_HTTP_PORT 80 // " " HTTP "
  39. #define INTERNET_DEFAULT_HTTPS_PORT 443 // " " HTTPS "
  40. // flags for WinHttpOpen():
  41. #define WINHTTP_FLAG_ASYNC 0x10000000 // this session is asynchronous (where supported)
  42. // flags for WinHttpOpenRequest():
  43. #define WINHTTP_FLAG_SECURE 0x00800000 // use SSL if applicable (HTTPS)
  44. #define WINHTTP_FLAG_ESCAPE_PERCENT 0x00000004 // if escaping enabled, escape percent as well
  45. #define WINHTTP_FLAG_NULL_CODEPAGE 0x00000008 // assume all symbols are ASCII, use fast convertion
  46. #define WINHTTP_FLAG_BYPASS_PROXY_CACHE 0x00000100 // add "pragma: no-cache" request header
  47. #define WINHTTP_FLAG_REFRESH WINHTTP_FLAG_BYPASS_PROXY_CACHE
  48. #define WINHTTP_FLAG_ESCAPE_DISABLE 0x00000040 // disable escaping
  49. #define WINHTTP_FLAG_ESCAPE_DISABLE_QUERY 0x00000080 // if escaping enabled escape path part, but do not escape query
  50. #define SECURITY_FLAG_IGNORE_UNKNOWN_CA 0x00000100
  51. #define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID 0x00002000 // expired X509 Cert.
  52. #define SECURITY_FLAG_IGNORE_CERT_CN_INVALID 0x00001000 // bad common name in X509 Cert.
  53. #define SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE 0x00000200
  54. //
  55. // WINHTTP_ASYNC_RESULT - this structure is returned to the application via
  56. // the callback with WINHTTP_CALLBACK_STATUS_REQUEST_COMPLETE. It is not sufficient to
  57. // just return the result of the async operation. If the API failed then the
  58. // app cannot call GetLastError() because the thread context will be incorrect.
  59. // Both the value returned by the async API and any resultant error code are
  60. // made available. The app need not check dwError if dwResult indicates that
  61. // the API succeeded (in this case dwError will be ERROR_SUCCESS)
  62. //
  63. typedef struct
  64. {
  65. DWORD_PTR dwResult; // indicates which async API has encountered an error
  66. DWORD dwError; // the error code if the API failed
  67. }
  68. WINHTTP_ASYNC_RESULT, * LPWINHTTP_ASYNC_RESULT;
  69. //
  70. // HTTP_VERSION_INFO - query or set global HTTP version (1.0 or 1.1)
  71. //
  72. typedef struct
  73. {
  74. DWORD dwMajorVersion;
  75. DWORD dwMinorVersion;
  76. }
  77. HTTP_VERSION_INFO, * LPHTTP_VERSION_INFO;
  78. //
  79. // INTERNET_SCHEME - URL scheme type
  80. //
  81. typedef int INTERNET_SCHEME, * LPINTERNET_SCHEME;
  82. #define INTERNET_SCHEME_HTTP (1)
  83. #define INTERNET_SCHEME_HTTPS (2)
  84. //
  85. // URL_COMPONENTS - the constituent parts of an URL. Used in WinHttpCrackUrl()
  86. // and WinHttpCreateUrl()
  87. //
  88. // For WinHttpCrackUrl(), if a pointer field and its corresponding length field
  89. // are both 0 then that component is not returned. If the pointer field is NULL
  90. // but the length field is not zero, then both the pointer and length fields are
  91. // returned if both pointer and corresponding length fields are non-zero then
  92. // the pointer field points to a buffer where the component is copied. The
  93. // component may be un-escaped, depending on dwFlags
  94. //
  95. // For WinHttpCreateUrl(), the pointer fields should be NULL if the component
  96. // is not required. If the corresponding length field is zero then the pointer
  97. // field is the address of a zero-terminated string. If the length field is not
  98. // zero then it is the string length of the corresponding pointer field
  99. //
  100. #pragma warning( disable : 4121 ) // disable alignment warning
  101. typedef struct
  102. {
  103. DWORD dwStructSize; // size of this structure. Used in version check
  104. LPWSTR lpszScheme; // pointer to scheme name
  105. DWORD dwSchemeLength; // length of scheme name
  106. INTERNET_SCHEME nScheme; // enumerated scheme type (if known)
  107. LPWSTR lpszHostName; // pointer to host name
  108. DWORD dwHostNameLength; // length of host name
  109. INTERNET_PORT nPort; // converted port number
  110. LPWSTR lpszUserName; // pointer to user name
  111. DWORD dwUserNameLength; // length of user name
  112. LPWSTR lpszPassword; // pointer to password
  113. DWORD dwPasswordLength; // length of password
  114. LPWSTR lpszUrlPath; // pointer to URL-path
  115. DWORD dwUrlPathLength; // length of URL-path
  116. LPWSTR lpszExtraInfo; // pointer to extra information (e.g. ?foo or #foo)
  117. DWORD dwExtraInfoLength; // length of extra information
  118. }
  119. URL_COMPONENTS, * LPURL_COMPONENTS;
  120. typedef URL_COMPONENTS URL_COMPONENTSW;
  121. typedef LPURL_COMPONENTS LPURL_COMPONENTSW;
  122. #pragma warning( default : 4121 ) // restore alignment warning
  123. //
  124. // WINHTTP_PROXY_INFO - structure supplied with WINHTTP_OPTION_PROXY to get/
  125. // set proxy information on a WinHttpOpen() handle
  126. //
  127. typedef struct
  128. {
  129. DWORD dwAccessType; // see WINHTTP_ACCESS_* types below
  130. LPWSTR lpszProxy; // proxy server list
  131. LPWSTR lpszProxyBypass; // proxy bypass list
  132. }
  133. WINHTTP_PROXY_INFO, * LPWINHTTP_PROXY_INFO;
  134. typedef WINHTTP_PROXY_INFO WINHTTP_PROXY_INFOW;
  135. typedef LPWINHTTP_PROXY_INFO LPWINHTTP_PROXY_INFOW;
  136. typedef struct
  137. {
  138. DWORD dwFlags;
  139. DWORD dwAutoDetectFlags;
  140. LPCWSTR lpszAutoConfigUrl;
  141. LPVOID lpvReserved;
  142. DWORD dwReserved;
  143. BOOL fAutoLogonIfChallenged;
  144. }
  145. WINHTTP_AUTOPROXY_OPTIONS;
  146. #define WINHTTP_AUTOPROXY_AUTO_DETECT 0x00000001
  147. #define WINHTTP_AUTOPROXY_CONFIG_URL 0x00000002
  148. #define WINHTTP_AUTOPROXY_HOST_KEEPCASE 0x00000004
  149. #define WINHTTP_AUTOPROXY_HOST_LOWERCASE 0x00000008
  150. #define WINHTTP_AUTOPROXY_RUN_INPROCESS 0x00010000
  151. #define WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY 0x00020000
  152. //
  153. // Flags for dwAutoDetectFlags
  154. //
  155. #define WINHTTP_AUTO_DETECT_TYPE_DHCP 0x00000001
  156. #define WINHTTP_AUTO_DETECT_TYPE_DNS_A 0x00000002
  157. //
  158. // WINHTTP_CERTIFICATE_INFO lpBuffer - contains the certificate returned from
  159. // the server
  160. //
  161. typedef struct
  162. {
  163. //
  164. // ftExpiry - date the certificate expires.
  165. //
  166. FILETIME ftExpiry;
  167. //
  168. // ftStart - date the certificate becomes valid.
  169. //
  170. FILETIME ftStart;
  171. //
  172. // lpszSubjectInfo - the name of organization, site, and server
  173. // the cert. was issued for.
  174. //
  175. LPWSTR lpszSubjectInfo;
  176. //
  177. // lpszIssuerInfo - the name of orgainzation, site, and server
  178. // the cert was issues by.
  179. //
  180. LPWSTR lpszIssuerInfo;
  181. //
  182. // lpszProtocolName - the name of the protocol used to provide the secure
  183. // connection.
  184. //
  185. LPWSTR lpszProtocolName;
  186. //
  187. // lpszSignatureAlgName - the name of the algorithm used for signing
  188. // the certificate.
  189. //
  190. LPWSTR lpszSignatureAlgName;
  191. //
  192. // lpszEncryptionAlgName - the name of the algorithm used for
  193. // doing encryption over the secure channel (SSL) connection.
  194. //
  195. LPWSTR lpszEncryptionAlgName;
  196. //
  197. // dwKeySize - size of the key.
  198. //
  199. DWORD dwKeySize;
  200. }
  201. WINHTTP_CERTIFICATE_INFO;
  202. #ifdef _WS2DEF_
  203. typedef struct
  204. {
  205. DWORD cbSize;
  206. SOCKADDR_STORAGE LocalAddress; // local ip, local port
  207. SOCKADDR_STORAGE RemoteAddress; // remote ip, remote port
  208. }WINHTTP_CONNECTION_INFO;
  209. #endif
  210. //
  211. // prototypes
  212. //
  213. //
  214. // constants for WinHttpTimeFromSystemTime
  215. //
  216. #define WINHTTP_TIME_FORMAT_BUFSIZE 62
  217. BOOLAPI
  218. WinHttpTimeFromSystemTime
  219. (
  220. __in CONST SYSTEMTIME *pst, // input GMT time
  221. __out_bcount(WINHTTP_TIME_FORMAT_BUFSIZE) LPWSTR pwszTime // output string buffer
  222. );
  223. BOOLAPI
  224. WinHttpTimeToSystemTime
  225. (
  226. __in_z LPCWSTR pwszTime, // NULL terminated string
  227. __out SYSTEMTIME *pst // output in GMT time
  228. );
  229. //
  230. // flags for CrackUrl() and CombineUrl()
  231. //
  232. #define ICU_NO_ENCODE 0x20000000 // Don't convert unsafe characters to escape sequence
  233. #define ICU_DECODE 0x10000000 // Convert %XX escape sequences to characters
  234. #define ICU_NO_META 0x08000000 // Don't convert .. etc. meta path sequences
  235. #define ICU_ENCODE_SPACES_ONLY 0x04000000 // Encode spaces only
  236. #define ICU_BROWSER_MODE 0x02000000 // Special encode/decode rules for browser
  237. #define ICU_ENCODE_PERCENT 0x00001000 // Encode any percent (ASCII25)
  238. // signs encountered, default is to not encode percent.
  239. BOOLAPI
  240. WinHttpCrackUrl
  241. (
  242. __in_ecount(dwUrlLength) LPCWSTR pwszUrl,
  243. __in DWORD dwUrlLength,
  244. __in DWORD dwFlags,
  245. __inout LPURL_COMPONENTS lpUrlComponents
  246. );
  247. BOOLAPI
  248. WinHttpCreateUrl
  249. (
  250. __in LPURL_COMPONENTS lpUrlComponents,
  251. __in DWORD dwFlags,
  252. __out_ecount_part_opt(*pdwUrlLength, *pdwUrlLength) LPWSTR pwszUrl,
  253. __inout LPDWORD pdwUrlLength
  254. );
  255. //
  256. // flags for WinHttpCrackUrl() and WinHttpCreateUrl()
  257. //
  258. #define ICU_ESCAPE 0x80000000 // (un)escape URL characters
  259. #define ICU_ESCAPE_AUTHORITY 0x00002000 //causes InternetCreateUrlA to escape chars in authority components (user, pwd, host)
  260. #define ICU_REJECT_USERPWD 0x00004000 // rejects usrls whick have username/pwd sections
  261. BOOLAPI
  262. WinHttpCheckPlatform(void);
  263. WINHTTPAPI BOOL WINAPI WinHttpGetDefaultProxyConfiguration( IN OUT WINHTTP_PROXY_INFO * pProxyInfo);
  264. WINHTTPAPI BOOL WINAPI WinHttpSetDefaultProxyConfiguration( IN WINHTTP_PROXY_INFO * pProxyInfo);
  265. WINHTTPAPI
  266. HINTERNET
  267. WINAPI
  268. WinHttpOpen
  269. (
  270. __in_z_opt LPCWSTR pszAgentW,
  271. __in DWORD dwAccessType,
  272. __in_z_opt LPCWSTR pszProxyW,
  273. __in_z_opt LPCWSTR pszProxyBypassW,
  274. __in DWORD dwFlags
  275. );
  276. // WinHttpOpen dwAccessType values (also for WINHTTP_PROXY_INFO::dwAccessType)
  277. #define WINHTTP_ACCESS_TYPE_DEFAULT_PROXY 0
  278. #define WINHTTP_ACCESS_TYPE_NO_PROXY 1
  279. #define WINHTTP_ACCESS_TYPE_NAMED_PROXY 3
  280. // WinHttpOpen prettifiers for optional parameters
  281. #define WINHTTP_NO_PROXY_NAME NULL
  282. #define WINHTTP_NO_PROXY_BYPASS NULL
  283. BOOLAPI
  284. WinHttpCloseHandle
  285. (
  286. IN HINTERNET hInternet
  287. );
  288. WINHTTPAPI
  289. HINTERNET
  290. WINAPI
  291. WinHttpConnect
  292. (
  293. IN HINTERNET hSession,
  294. IN LPCWSTR pswzServerName,
  295. IN INTERNET_PORT nServerPort,
  296. IN DWORD dwReserved
  297. );
  298. BOOLAPI
  299. WinHttpReadData
  300. (
  301. IN HINTERNET hRequest,
  302. __out_bcount_part(dwNumberOfBytesToRead, *lpdwNumberOfBytesRead) __out_data_source(NETWORK) LPVOID lpBuffer,
  303. IN DWORD dwNumberOfBytesToRead,
  304. OUT LPDWORD lpdwNumberOfBytesRead
  305. );
  306. BOOLAPI
  307. WinHttpWriteData
  308. (
  309. IN HINTERNET hRequest,
  310. __in_bcount_opt(dwNumberOfBytesToWrite) LPCVOID lpBuffer,
  311. IN DWORD dwNumberOfBytesToWrite,
  312. OUT LPDWORD lpdwNumberOfBytesWritten
  313. );
  314. BOOLAPI
  315. WinHttpQueryDataAvailable
  316. (
  317. IN HINTERNET hRequest,
  318. __out_data_source(NETWORK) LPDWORD lpdwNumberOfBytesAvailable
  319. );
  320. __success(return != FALSE)
  321. BOOLAPI
  322. WinHttpQueryOption
  323. (
  324. IN HINTERNET hInternet,
  325. IN DWORD dwOption,
  326. __out_bcount_part_opt(*lpdwBufferLength, *lpdwBufferLength) __out_data_source(NETWORK) LPVOID lpBuffer,
  327. IN OUT LPDWORD lpdwBufferLength
  328. );
  329. #define WINHTTP_NO_CLIENT_CERT_CONTEXT NULL
  330. BOOLAPI
  331. WinHttpSetOption
  332. (
  333. IN HINTERNET hInternet,
  334. IN DWORD dwOption,
  335. __in_awcount((dwOption != WINHTTP_OPTION_USERNAME &&
  336. dwOption != WINHTTP_OPTION_PASSWORD &&
  337. dwOption != WINHTTP_OPTION_PROXY_USERNAME &&
  338. dwOption != WINHTTP_OPTION_PROXY_PASSWORD &&
  339. dwOption != WINHTTP_OPTION_USER_AGENT),
  340. dwBufferLength)
  341. __typefix(LPCWSTR) LPVOID lpBuffer,
  342. IN DWORD dwBufferLength
  343. );
  344. BOOLAPI
  345. WinHttpSetTimeouts
  346. (
  347. IN HINTERNET hInternet, // Session/Request handle.
  348. IN int nResolveTimeout,
  349. IN int nConnectTimeout,
  350. IN int nSendTimeout,
  351. IN int nReceiveTimeout
  352. );
  353. WINHTTPAPI
  354. DWORD
  355. WINAPI
  356. WinHttpIsHostInProxyBypassList
  357. (
  358. __in const WINHTTP_PROXY_INFO *pProxyInfo,
  359. __in_z PCWSTR pwszHost,
  360. __in INTERNET_SCHEME tScheme,
  361. __in INTERNET_PORT nPort,
  362. __out BOOL *pfIsInBypassList
  363. );
  364. //
  365. // options manifests for WinHttp{Query|Set}Option
  366. //
  367. #define WINHTTP_FIRST_OPTION WINHTTP_OPTION_CALLBACK
  368. #define WINHTTP_OPTION_CALLBACK 1
  369. #define WINHTTP_OPTION_RESOLVE_TIMEOUT 2
  370. #define WINHTTP_OPTION_CONNECT_TIMEOUT 3
  371. #define WINHTTP_OPTION_CONNECT_RETRIES 4
  372. #define WINHTTP_OPTION_SEND_TIMEOUT 5
  373. #define WINHTTP_OPTION_RECEIVE_TIMEOUT 6
  374. #define WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT 7
  375. #define WINHTTP_OPTION_HANDLE_TYPE 9
  376. #define WINHTTP_OPTION_READ_BUFFER_SIZE 12
  377. #define WINHTTP_OPTION_WRITE_BUFFER_SIZE 13
  378. #define WINHTTP_OPTION_PARENT_HANDLE 21
  379. #define WINHTTP_OPTION_EXTENDED_ERROR 24
  380. #define WINHTTP_OPTION_SECURITY_FLAGS 31
  381. #define WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT 32
  382. #define WINHTTP_OPTION_URL 34
  383. #define WINHTTP_OPTION_SECURITY_KEY_BITNESS 36
  384. #define WINHTTP_OPTION_PROXY 38
  385. #define WINHTTP_OPTION_USER_AGENT 41
  386. #define WINHTTP_OPTION_CONTEXT_VALUE 45
  387. #define WINHTTP_OPTION_CLIENT_CERT_CONTEXT 47
  388. #define WINHTTP_OPTION_REQUEST_PRIORITY 58
  389. #define WINHTTP_OPTION_HTTP_VERSION 59
  390. #define WINHTTP_OPTION_DISABLE_FEATURE 63
  391. #define WINHTTP_OPTION_CODEPAGE 68
  392. #define WINHTTP_OPTION_MAX_CONNS_PER_SERVER 73
  393. #define WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER 74
  394. #define WINHTTP_OPTION_AUTOLOGON_POLICY 77
  395. #define WINHTTP_OPTION_SERVER_CERT_CONTEXT 78
  396. #define WINHTTP_OPTION_ENABLE_FEATURE 79
  397. #define WINHTTP_OPTION_WORKER_THREAD_COUNT 80
  398. #define WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT 81
  399. #define WINHTTP_OPTION_PASSPORT_COBRANDING_URL 82
  400. #define WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH 83
  401. #define WINHTTP_OPTION_SECURE_PROTOCOLS 84
  402. #define WINHTTP_OPTION_ENABLETRACING 85
  403. #define WINHTTP_OPTION_PASSPORT_SIGN_OUT 86
  404. #define WINHTTP_OPTION_PASSPORT_RETURN_URL 87
  405. #define WINHTTP_OPTION_REDIRECT_POLICY 88
  406. #define WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS 89
  407. #define WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE 90
  408. #define WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE 91
  409. #define WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE 92
  410. #define WINHTTP_OPTION_CONNECTION_INFO 93
  411. #define WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST 94
  412. #define WINHTTP_OPTION_SPN 96
  413. #define WINHTTP_OPTION_GLOBAL_PROXY_CREDS 97
  414. #define WINHTTP_OPTION_GLOBAL_SERVER_CREDS 98
  415. #define WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT 99
  416. #define WINHTTP_OPTION_REJECT_USERPWD_IN_URL 100
  417. #define WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS 101
  418. #define WINHTTP_OPTION_RECEIVE_PROXY_CONNECT_RESPONSE 103
  419. #define WINHTTP_OPTION_IS_PROXY_CONNECT_RESPONSE 104
  420. #define WINHTTP_OPTION_SERVER_SPN_USED 106
  421. #define WINHTTP_OPTION_PROXY_SPN_USED 107
  422. #define WINHTTP_OPTION_SERVER_CBT 108
  423. #define WINHTTP_LAST_OPTION WINHTTP_OPTION_SERVER_CBT
  424. #define WINHTTP_OPTION_USERNAME 0x1000
  425. #define WINHTTP_OPTION_PASSWORD 0x1001
  426. #define WINHTTP_OPTION_PROXY_USERNAME 0x1002
  427. #define WINHTTP_OPTION_PROXY_PASSWORD 0x1003
  428. // manifest value for WINHTTP_OPTION_MAX_CONNS_PER_SERVER and WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER
  429. #define WINHTTP_CONNS_PER_SERVER_UNLIMITED 0xFFFFFFFF
  430. // values for WINHTTP_OPTION_AUTOLOGON_POLICY
  431. #define WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM 0
  432. #define WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW 1
  433. #define WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH 2
  434. #define WINHTTP_AUTOLOGON_SECURITY_LEVEL_DEFAULT WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM
  435. // values for WINHTTP_OPTION_REDIRECT_POLICY
  436. #define WINHTTP_OPTION_REDIRECT_POLICY_NEVER 0
  437. #define WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP 1
  438. #define WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS 2
  439. #define WINHTTP_OPTION_REDIRECT_POLICY_LAST WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS
  440. #define WINHTTP_OPTION_REDIRECT_POLICY_DEFAULT WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP
  441. #define WINHTTP_DISABLE_PASSPORT_AUTH 0x00000000
  442. #define WINHTTP_ENABLE_PASSPORT_AUTH 0x10000000
  443. #define WINHTTP_DISABLE_PASSPORT_KEYRING 0x20000000
  444. #define WINHTTP_ENABLE_PASSPORT_KEYRING 0x40000000
  445. // values for WINHTTP_OPTION_DISABLE_FEATURE
  446. #define WINHTTP_DISABLE_COOKIES 0x00000001
  447. #define WINHTTP_DISABLE_REDIRECTS 0x00000002
  448. #define WINHTTP_DISABLE_AUTHENTICATION 0x00000004
  449. #define WINHTTP_DISABLE_KEEP_ALIVE 0x00000008
  450. // values for WINHTTP_OPTION_ENABLE_FEATURE
  451. #define WINHTTP_ENABLE_SSL_REVOCATION 0x00000001
  452. #define WINHTTP_ENABLE_SSL_REVERT_IMPERSONATION 0x00000002
  453. // values for WINHTTP_OPTION_SPN
  454. #define WINHTTP_DISABLE_SPN_SERVER_PORT 0x00000000
  455. #define WINHTTP_ENABLE_SPN_SERVER_PORT 0x00000001
  456. #define WINHTTP_OPTION_SPN_MASK WINHTTP_ENABLE_SPN_SERVER_PORT
  457. typedef struct tagWINHTTP_CREDS
  458. {
  459. LPSTR lpszUserName;
  460. LPSTR lpszPassword;
  461. LPSTR lpszRealm;
  462. DWORD dwAuthScheme;
  463. LPSTR lpszHostName;
  464. DWORD dwPort;
  465. } WINHTTP_CREDS, *PWINHTTP_CREDS;
  466. // structure for WINHTTP_OPTION_GLOBAL_SERVER_CREDS and
  467. // WINHTTP_OPTION_GLOBAL_PROXY_CREDS
  468. typedef struct tagWINHTTP_CREDS_EX
  469. {
  470. LPSTR lpszUserName;
  471. LPSTR lpszPassword;
  472. LPSTR lpszRealm;
  473. DWORD dwAuthScheme;
  474. LPSTR lpszHostName;
  475. DWORD dwPort;
  476. LPSTR lpszUrl;
  477. } WINHTTP_CREDS_EX, *PWINHTTP_CREDS_EX;
  478. //
  479. // winhttp handle types
  480. //
  481. #define WINHTTP_HANDLE_TYPE_SESSION 1
  482. #define WINHTTP_HANDLE_TYPE_CONNECT 2
  483. #define WINHTTP_HANDLE_TYPE_REQUEST 3
  484. //
  485. // values for auth schemes
  486. //
  487. #define WINHTTP_AUTH_SCHEME_BASIC 0x00000001
  488. #define WINHTTP_AUTH_SCHEME_NTLM 0x00000002
  489. #define WINHTTP_AUTH_SCHEME_PASSPORT 0x00000004
  490. #define WINHTTP_AUTH_SCHEME_DIGEST 0x00000008
  491. #define WINHTTP_AUTH_SCHEME_NEGOTIATE 0x00000010
  492. // WinHttp supported Authentication Targets
  493. #define WINHTTP_AUTH_TARGET_SERVER 0x00000000
  494. #define WINHTTP_AUTH_TARGET_PROXY 0x00000001
  495. //
  496. // values for WINHTTP_OPTION_SECURITY_FLAGS
  497. //
  498. // query only
  499. #define SECURITY_FLAG_SECURE 0x00000001 // can query only
  500. #define SECURITY_FLAG_STRENGTH_WEAK 0x10000000
  501. #define SECURITY_FLAG_STRENGTH_MEDIUM 0x40000000
  502. #define SECURITY_FLAG_STRENGTH_STRONG 0x20000000
  503. // Secure connection error status flags
  504. #define WINHTTP_CALLBACK_STATUS_FLAG_CERT_REV_FAILED 0x00000001
  505. #define WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CERT 0x00000002
  506. #define WINHTTP_CALLBACK_STATUS_FLAG_CERT_REVOKED 0x00000004
  507. #define WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA 0x00000008
  508. #define WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID 0x00000010
  509. #define WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID 0x00000020
  510. #define WINHTTP_CALLBACK_STATUS_FLAG_CERT_WRONG_USAGE 0x00000040
  511. #define WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR 0x80000000
  512. #define WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 0x00000008
  513. #define WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 0x00000020
  514. #define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 0x00000080
  515. #define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 0x00000200
  516. #define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 0x00000800
  517. #define WINHTTP_FLAG_SECURE_PROTOCOL_ALL (WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 | \
  518. WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | \
  519. WINHTTP_FLAG_SECURE_PROTOCOL_TLS1)
  520. //
  521. // callback function for WinHttpSetStatusCallback
  522. //
  523. typedef
  524. VOID
  525. (CALLBACK * WINHTTP_STATUS_CALLBACK)(
  526. IN HINTERNET hInternet,
  527. IN DWORD_PTR dwContext,
  528. IN DWORD dwInternetStatus,
  529. IN LPVOID lpvStatusInformation OPTIONAL,
  530. IN DWORD dwStatusInformationLength
  531. );
  532. typedef WINHTTP_STATUS_CALLBACK * LPWINHTTP_STATUS_CALLBACK;
  533. WINHTTPAPI
  534. WINHTTP_STATUS_CALLBACK
  535. WINAPI
  536. WinHttpSetStatusCallback
  537. (
  538. IN HINTERNET hInternet,
  539. IN WINHTTP_STATUS_CALLBACK lpfnInternetCallback,
  540. IN DWORD dwNotificationFlags,
  541. IN DWORD_PTR dwReserved
  542. );
  543. //
  544. // status manifests for WinHttp status callback
  545. //
  546. #define WINHTTP_CALLBACK_STATUS_RESOLVING_NAME 0x00000001
  547. #define WINHTTP_CALLBACK_STATUS_NAME_RESOLVED 0x00000002
  548. #define WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER 0x00000004
  549. #define WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER 0x00000008
  550. #define WINHTTP_CALLBACK_STATUS_SENDING_REQUEST 0x00000010
  551. #define WINHTTP_CALLBACK_STATUS_REQUEST_SENT 0x00000020
  552. #define WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE 0x00000040
  553. #define WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED 0x00000080
  554. #define WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION 0x00000100
  555. #define WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED 0x00000200
  556. #define WINHTTP_CALLBACK_STATUS_HANDLE_CREATED 0x00000400
  557. #define WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING 0x00000800
  558. #define WINHTTP_CALLBACK_STATUS_DETECTING_PROXY 0x00001000
  559. #define WINHTTP_CALLBACK_STATUS_REDIRECT 0x00004000
  560. #define WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE 0x00008000
  561. #define WINHTTP_CALLBACK_STATUS_SECURE_FAILURE 0x00010000
  562. #define WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE 0x00020000
  563. #define WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE 0x00040000
  564. #define WINHTTP_CALLBACK_STATUS_READ_COMPLETE 0x00080000
  565. #define WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE 0x00100000
  566. #define WINHTTP_CALLBACK_STATUS_REQUEST_ERROR 0x00200000
  567. #define WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE 0x00400000
  568. // API Enums for WINHTTP_CALLBACK_STATUS_REQUEST_ERROR:
  569. #define API_RECEIVE_RESPONSE (1)
  570. #define API_QUERY_DATA_AVAILABLE (2)
  571. #define API_READ_DATA (3)
  572. #define API_WRITE_DATA (4)
  573. #define API_SEND_REQUEST (5)
  574. #define WINHTTP_CALLBACK_FLAG_RESOLVE_NAME (WINHTTP_CALLBACK_STATUS_RESOLVING_NAME | WINHTTP_CALLBACK_STATUS_NAME_RESOLVED)
  575. #define WINHTTP_CALLBACK_FLAG_CONNECT_TO_SERVER (WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER | WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER)
  576. #define WINHTTP_CALLBACK_FLAG_SEND_REQUEST (WINHTTP_CALLBACK_STATUS_SENDING_REQUEST | WINHTTP_CALLBACK_STATUS_REQUEST_SENT)
  577. #define WINHTTP_CALLBACK_FLAG_RECEIVE_RESPONSE (WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE | WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED)
  578. #define WINHTTP_CALLBACK_FLAG_CLOSE_CONNECTION (WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION | WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED)
  579. #define WINHTTP_CALLBACK_FLAG_HANDLES (WINHTTP_CALLBACK_STATUS_HANDLE_CREATED | WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING)
  580. #define WINHTTP_CALLBACK_FLAG_DETECTING_PROXY WINHTTP_CALLBACK_STATUS_DETECTING_PROXY
  581. #define WINHTTP_CALLBACK_FLAG_REDIRECT WINHTTP_CALLBACK_STATUS_REDIRECT
  582. #define WINHTTP_CALLBACK_FLAG_INTERMEDIATE_RESPONSE WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE
  583. #define WINHTTP_CALLBACK_FLAG_SECURE_FAILURE WINHTTP_CALLBACK_STATUS_SECURE_FAILURE
  584. #define WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE
  585. #define WINHTTP_CALLBACK_FLAG_HEADERS_AVAILABLE WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE
  586. #define WINHTTP_CALLBACK_FLAG_DATA_AVAILABLE WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE
  587. #define WINHTTP_CALLBACK_FLAG_READ_COMPLETE WINHTTP_CALLBACK_STATUS_READ_COMPLETE
  588. #define WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE
  589. #define WINHTTP_CALLBACK_FLAG_REQUEST_ERROR WINHTTP_CALLBACK_STATUS_REQUEST_ERROR
  590. #define WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS (WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE \
  591. | WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE \
  592. | WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE \
  593. | WINHTTP_CALLBACK_STATUS_READ_COMPLETE \
  594. | WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE \
  595. | WINHTTP_CALLBACK_STATUS_REQUEST_ERROR)
  596. #define WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS 0xffffffff
  597. //
  598. // if the following value is returned by WinHttpSetStatusCallback, then
  599. // probably an invalid (non-code) address was supplied for the callback
  600. //
  601. #define WINHTTP_INVALID_STATUS_CALLBACK ((WINHTTP_STATUS_CALLBACK)(-1L))
  602. //
  603. // WinHttpQueryHeaders info levels. Generally, there is one info level
  604. // for each potential RFC822/HTTP/MIME header that an HTTP server
  605. // may send as part of a request response.
  606. //
  607. // The WINHTTP_QUERY_RAW_HEADERS info level is provided for clients
  608. // that choose to perform their own header parsing.
  609. //
  610. #define WINHTTP_QUERY_MIME_VERSION 0
  611. #define WINHTTP_QUERY_CONTENT_TYPE 1
  612. #define WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING 2
  613. #define WINHTTP_QUERY_CONTENT_ID 3
  614. #define WINHTTP_QUERY_CONTENT_DESCRIPTION 4
  615. #define WINHTTP_QUERY_CONTENT_LENGTH 5
  616. #define WINHTTP_QUERY_CONTENT_LANGUAGE 6
  617. #define WINHTTP_QUERY_ALLOW 7
  618. #define WINHTTP_QUERY_PUBLIC 8
  619. #define WINHTTP_QUERY_DATE 9
  620. #define WINHTTP_QUERY_EXPIRES 10
  621. #define WINHTTP_QUERY_LAST_MODIFIED 11
  622. #define WINHTTP_QUERY_MESSAGE_ID 12
  623. #define WINHTTP_QUERY_URI 13
  624. #define WINHTTP_QUERY_DERIVED_FROM 14
  625. #define WINHTTP_QUERY_COST 15
  626. #define WINHTTP_QUERY_LINK 16
  627. #define WINHTTP_QUERY_PRAGMA 17
  628. #define WINHTTP_QUERY_VERSION 18 // special: part of status line
  629. #define WINHTTP_QUERY_STATUS_CODE 19 // special: part of status line
  630. #define WINHTTP_QUERY_STATUS_TEXT 20 // special: part of status line
  631. #define WINHTTP_QUERY_RAW_HEADERS 21 // special: all headers as ASCIIZ
  632. #define WINHTTP_QUERY_RAW_HEADERS_CRLF 22 // special: all headers
  633. #define WINHTTP_QUERY_CONNECTION 23
  634. #define WINHTTP_QUERY_ACCEPT 24
  635. #define WINHTTP_QUERY_ACCEPT_CHARSET 25
  636. #define WINHTTP_QUERY_ACCEPT_ENCODING 26
  637. #define WINHTTP_QUERY_ACCEPT_LANGUAGE 27
  638. #define WINHTTP_QUERY_AUTHORIZATION 28
  639. #define WINHTTP_QUERY_CONTENT_ENCODING 29
  640. #define WINHTTP_QUERY_FORWARDED 30
  641. #define WINHTTP_QUERY_FROM 31
  642. #define WINHTTP_QUERY_IF_MODIFIED_SINCE 32
  643. #define WINHTTP_QUERY_LOCATION 33
  644. #define WINHTTP_QUERY_ORIG_URI 34
  645. #define WINHTTP_QUERY_REFERER 35
  646. #define WINHTTP_QUERY_RETRY_AFTER 36
  647. #define WINHTTP_QUERY_SERVER 37
  648. #define WINHTTP_QUERY_TITLE 38
  649. #define WINHTTP_QUERY_USER_AGENT 39
  650. #define WINHTTP_QUERY_WWW_AUTHENTICATE 40
  651. #define WINHTTP_QUERY_PROXY_AUTHENTICATE 41
  652. #define WINHTTP_QUERY_ACCEPT_RANGES 42
  653. #define WINHTTP_QUERY_SET_COOKIE 43
  654. #define WINHTTP_QUERY_COOKIE 44
  655. #define WINHTTP_QUERY_REQUEST_METHOD 45 // special: GET/POST etc.
  656. #define WINHTTP_QUERY_REFRESH 46
  657. #define WINHTTP_QUERY_CONTENT_DISPOSITION 47
  658. //
  659. // HTTP 1.1 defined headers
  660. //
  661. #define WINHTTP_QUERY_AGE 48
  662. #define WINHTTP_QUERY_CACHE_CONTROL 49
  663. #define WINHTTP_QUERY_CONTENT_BASE 50
  664. #define WINHTTP_QUERY_CONTENT_LOCATION 51
  665. #define WINHTTP_QUERY_CONTENT_MD5 52
  666. #define WINHTTP_QUERY_CONTENT_RANGE 53
  667. #define WINHTTP_QUERY_ETAG 54
  668. #define WINHTTP_QUERY_HOST 55
  669. #define WINHTTP_QUERY_IF_MATCH 56
  670. #define WINHTTP_QUERY_IF_NONE_MATCH 57
  671. #define WINHTTP_QUERY_IF_RANGE 58
  672. #define WINHTTP_QUERY_IF_UNMODIFIED_SINCE 59
  673. #define WINHTTP_QUERY_MAX_FORWARDS 60
  674. #define WINHTTP_QUERY_PROXY_AUTHORIZATION 61
  675. #define WINHTTP_QUERY_RANGE 62
  676. #define WINHTTP_QUERY_TRANSFER_ENCODING 63
  677. #define WINHTTP_QUERY_UPGRADE 64
  678. #define WINHTTP_QUERY_VARY 65
  679. #define WINHTTP_QUERY_VIA 66
  680. #define WINHTTP_QUERY_WARNING 67
  681. #define WINHTTP_QUERY_EXPECT 68
  682. #define WINHTTP_QUERY_PROXY_CONNECTION 69
  683. #define WINHTTP_QUERY_UNLESS_MODIFIED_SINCE 70
  684. #define WINHTTP_QUERY_PROXY_SUPPORT 75
  685. #define WINHTTP_QUERY_AUTHENTICATION_INFO 76
  686. #define WINHTTP_QUERY_PASSPORT_URLS 77
  687. #define WINHTTP_QUERY_PASSPORT_CONFIG 78
  688. #define WINHTTP_QUERY_MAX 78
  689. //
  690. // WINHTTP_QUERY_CUSTOM - if this special value is supplied as the dwInfoLevel
  691. // parameter of WinHttpQueryHeaders() then the lpBuffer parameter contains the name
  692. // of the header we are to query
  693. //
  694. #define WINHTTP_QUERY_CUSTOM 65535
  695. //
  696. // WINHTTP_QUERY_FLAG_REQUEST_HEADERS - if this bit is set in the dwInfoLevel
  697. // parameter of WinHttpQueryHeaders() then the request headers will be queried for the
  698. // request information
  699. //
  700. #define WINHTTP_QUERY_FLAG_REQUEST_HEADERS 0x80000000
  701. //
  702. // WINHTTP_QUERY_FLAG_SYSTEMTIME - if this bit is set in the dwInfoLevel parameter
  703. // of WinHttpQueryHeaders() AND the header being queried contains date information,
  704. // e.g. the "Expires:" header then lpBuffer will contain a SYSTEMTIME structure
  705. // containing the date and time information converted from the header string
  706. //
  707. #define WINHTTP_QUERY_FLAG_SYSTEMTIME 0x40000000
  708. //
  709. // WINHTTP_QUERY_FLAG_NUMBER - if this bit is set in the dwInfoLevel parameter of
  710. // HttpQueryHeader(), then the value of the header will be converted to a number
  711. // before being returned to the caller, if applicable
  712. //
  713. #define WINHTTP_QUERY_FLAG_NUMBER 0x20000000
  714. //
  715. // HTTP Response Status Codes:
  716. //
  717. #define HTTP_STATUS_CONTINUE 100 // OK to continue with request
  718. #define HTTP_STATUS_SWITCH_PROTOCOLS 101 // server has switched protocols in upgrade header
  719. #define HTTP_STATUS_OK 200 // request completed
  720. #define HTTP_STATUS_CREATED 201 // object created, reason = new URI
  721. #define HTTP_STATUS_ACCEPTED 202 // async completion (TBS)
  722. #define HTTP_STATUS_PARTIAL 203 // partial completion
  723. #define HTTP_STATUS_NO_CONTENT 204 // no info to return
  724. #define HTTP_STATUS_RESET_CONTENT 205 // request completed, but clear form
  725. #define HTTP_STATUS_PARTIAL_CONTENT 206 // partial GET fulfilled
  726. #define HTTP_STATUS_WEBDAV_MULTI_STATUS 207 // WebDAV Multi-Status
  727. #define HTTP_STATUS_AMBIGUOUS 300 // server couldn't decide what to return
  728. #define HTTP_STATUS_MOVED 301 // object permanently moved
  729. #define HTTP_STATUS_REDIRECT 302 // object temporarily moved
  730. #define HTTP_STATUS_REDIRECT_METHOD 303 // redirection w/ new access method
  731. #define HTTP_STATUS_NOT_MODIFIED 304 // if-modified-since was not modified
  732. #define HTTP_STATUS_USE_PROXY 305 // redirection to proxy, location header specifies proxy to use
  733. #define HTTP_STATUS_REDIRECT_KEEP_VERB 307 // HTTP/1.1: keep same verb
  734. #define HTTP_STATUS_BAD_REQUEST 400 // invalid syntax
  735. #define HTTP_STATUS_DENIED 401 // access denied
  736. #define HTTP_STATUS_PAYMENT_REQ 402 // payment required
  737. #define HTTP_STATUS_FORBIDDEN 403 // request forbidden
  738. #define HTTP_STATUS_NOT_FOUND 404 // object not found
  739. #define HTTP_STATUS_BAD_METHOD 405 // method is not allowed
  740. #define HTTP_STATUS_NONE_ACCEPTABLE 406 // no response acceptable to client found
  741. #define HTTP_STATUS_PROXY_AUTH_REQ 407 // proxy authentication required
  742. #define HTTP_STATUS_REQUEST_TIMEOUT 408 // server timed out waiting for request
  743. #define HTTP_STATUS_CONFLICT 409 // user should resubmit with more info
  744. #define HTTP_STATUS_GONE 410 // the resource is no longer available
  745. #define HTTP_STATUS_LENGTH_REQUIRED 411 // the server refused to accept request w/o a length
  746. #define HTTP_STATUS_PRECOND_FAILED 412 // precondition given in request failed
  747. #define HTTP_STATUS_REQUEST_TOO_LARGE 413 // request entity was too large
  748. #define HTTP_STATUS_URI_TOO_LONG 414 // request URI too long
  749. #define HTTP_STATUS_UNSUPPORTED_MEDIA 415 // unsupported media type
  750. #define HTTP_STATUS_RETRY_WITH 449 // retry after doing the appropriate action.
  751. #define HTTP_STATUS_SERVER_ERROR 500 // internal server error
  752. #define HTTP_STATUS_NOT_SUPPORTED 501 // required not supported
  753. #define HTTP_STATUS_BAD_GATEWAY 502 // error response received from gateway
  754. #define HTTP_STATUS_SERVICE_UNAVAIL 503 // temporarily overloaded
  755. #define HTTP_STATUS_GATEWAY_TIMEOUT 504 // timed out waiting for gateway
  756. #define HTTP_STATUS_VERSION_NOT_SUP 505 // HTTP version not supported
  757. #define HTTP_STATUS_FIRST HTTP_STATUS_CONTINUE
  758. #define HTTP_STATUS_LAST HTTP_STATUS_VERSION_NOT_SUP
  759. //
  760. // prototypes
  761. //
  762. WINHTTPAPI
  763. HINTERNET
  764. WINAPI
  765. WinHttpOpenRequest
  766. (
  767. IN HINTERNET hConnect,
  768. IN LPCWSTR pwszVerb,
  769. IN LPCWSTR pwszObjectName,
  770. IN LPCWSTR pwszVersion,
  771. IN LPCWSTR pwszReferrer OPTIONAL,
  772. IN LPCWSTR FAR * ppwszAcceptTypes OPTIONAL,
  773. IN DWORD dwFlags
  774. );
  775. // WinHttpOpenRequest prettifers for optional parameters
  776. #define WINHTTP_NO_REFERER NULL
  777. #define WINHTTP_DEFAULT_ACCEPT_TYPES NULL
  778. BOOLAPI
  779. WinHttpAddRequestHeaders
  780. (
  781. IN HINTERNET hRequest,
  782. __in_ecount(dwHeadersLength) LPCWSTR pwszHeaders,
  783. IN DWORD dwHeadersLength,
  784. IN DWORD dwModifiers
  785. );
  786. //
  787. // values for dwModifiers parameter of WinHttpAddRequestHeaders()
  788. //
  789. #define WINHTTP_ADDREQ_INDEX_MASK 0x0000FFFF
  790. #define WINHTTP_ADDREQ_FLAGS_MASK 0xFFFF0000
  791. //
  792. // WINHTTP_ADDREQ_FLAG_ADD_IF_NEW - the header will only be added if it doesn't
  793. // already exist
  794. //
  795. #define WINHTTP_ADDREQ_FLAG_ADD_IF_NEW 0x10000000
  796. //
  797. // WINHTTP_ADDREQ_FLAG_ADD - if WINHTTP_ADDREQ_FLAG_REPLACE is set but the header is
  798. // not found then if this flag is set, the header is added anyway, so long as
  799. // there is a valid header-value
  800. //
  801. #define WINHTTP_ADDREQ_FLAG_ADD 0x20000000
  802. //
  803. // WINHTTP_ADDREQ_FLAG_COALESCE - coalesce headers with same name. e.g.
  804. // "Accept: text/*" and "Accept: audio/*" with this flag results in a single
  805. // header: "Accept: text/*, audio/*"
  806. //
  807. #define WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA 0x40000000
  808. #define WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON 0x01000000
  809. #define WINHTTP_ADDREQ_FLAG_COALESCE WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
  810. //
  811. // WINHTTP_ADDREQ_FLAG_REPLACE - replaces the specified header. Only one header can
  812. // be supplied in the buffer. If the header to be replaced is not the first
  813. // in a list of headers with the same name, then the relative index should be
  814. // supplied in the low 8 bits of the dwModifiers parameter. If the header-value
  815. // part is missing, then the header is removed
  816. //
  817. #define WINHTTP_ADDREQ_FLAG_REPLACE 0x80000000
  818. #define WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH 0
  819. BOOLAPI
  820. WinHttpSendRequest
  821. (
  822. IN HINTERNET hRequest,
  823. __in_ecount_opt(dwHeadersLength) LPCWSTR lpszHeaders,
  824. IN DWORD dwHeadersLength,
  825. __in_bcount_opt(dwOptionalLength) LPVOID lpOptional,
  826. IN DWORD dwOptionalLength,
  827. IN DWORD dwTotalLength,
  828. IN DWORD_PTR dwContext
  829. );
  830. // WinHttpSendRequest prettifiers for optional parameters.
  831. #define WINHTTP_NO_ADDITIONAL_HEADERS NULL
  832. #define WINHTTP_NO_REQUEST_DATA NULL
  833. BOOLAPI WinHttpSetCredentials
  834. (
  835. IN HINTERNET hRequest, // HINTERNET handle returned by WinHttpOpenRequest.
  836. IN DWORD AuthTargets, // Only WINHTTP_AUTH_TARGET_SERVER and
  837. // WINHTTP_AUTH_TARGET_PROXY are supported
  838. // in this version and they are mutually
  839. // exclusive
  840. IN DWORD AuthScheme, // must be one of the supported Auth Schemes
  841. // returned from WinHttpQueryAuthSchemes()
  842. IN LPCWSTR pwszUserName, // 1) NULL if default creds is to be used, in
  843. // which case pszPassword will be ignored
  844. IN LPCWSTR pwszPassword, // 1) "" == Blank Password; 2)Parameter ignored
  845. // if pszUserName is NULL; 3) Invalid to pass in
  846. // NULL if pszUserName is not NULL
  847. IN LPVOID pAuthParams
  848. );
  849. BOOLAPI WinHttpQueryAuthSchemes
  850. (
  851. IN HINTERNET hRequest, // HINTERNET handle returned by WinHttpOpenRequest
  852. OUT LPDWORD lpdwSupportedSchemes, // a bitmap of available Authentication Schemes
  853. OUT LPDWORD lpdwFirstScheme, // returns the first auth scheme returned by the server
  854. OUT LPDWORD pdwAuthTarget
  855. );
  856. BOOLAPI WinHttpQueryAuthParams(
  857. IN HINTERNET hRequest, // HINTERNET handle returned by WinHttpOpenRequest
  858. IN DWORD AuthScheme,
  859. OUT LPVOID* pAuthParams // Scheme-specific Advanced auth parameters
  860. );
  861. WINHTTPAPI
  862. BOOL
  863. WINAPI
  864. WinHttpReceiveResponse
  865. (
  866. IN HINTERNET hRequest,
  867. IN LPVOID lpReserved
  868. );
  869. __success(return != FALSE)
  870. BOOLAPI
  871. WinHttpQueryHeaders
  872. (
  873. IN HINTERNET hRequest,
  874. IN DWORD dwInfoLevel,
  875. IN LPCWSTR pwszName OPTIONAL,
  876. __out_bcount_part_opt(*lpdwBufferLength, *lpdwBufferLength) __out_data_source(NETWORK) LPVOID lpBuffer,
  877. IN OUT LPDWORD lpdwBufferLength,
  878. IN OUT LPDWORD lpdwIndex OPTIONAL
  879. );
  880. // WinHttpQueryHeaders prettifiers for optional parameters.
  881. #define WINHTTP_HEADER_NAME_BY_INDEX NULL
  882. #define WINHTTP_NO_OUTPUT_BUFFER NULL
  883. #define WINHTTP_NO_HEADER_INDEX NULL
  884. BOOLAPI
  885. WinHttpDetectAutoProxyConfigUrl
  886. (
  887. DWORD dwAutoDetectFlags,
  888. __deref_out_opt LPWSTR * ppwstrAutoConfigUrl
  889. );
  890. BOOLAPI
  891. WinHttpGetProxyForUrl
  892. (
  893. IN HINTERNET hSession,
  894. IN LPCWSTR lpcwszUrl,
  895. IN WINHTTP_AUTOPROXY_OPTIONS * pAutoProxyOptions,
  896. OUT WINHTTP_PROXY_INFO * pProxyInfo
  897. );
  898. typedef struct
  899. {
  900. BOOL fAutoDetect;
  901. LPWSTR lpszAutoConfigUrl;
  902. LPWSTR lpszProxy;
  903. LPWSTR lpszProxyBypass;
  904. } WINHTTP_CURRENT_USER_IE_PROXY_CONFIG;
  905. BOOLAPI
  906. WinHttpGetIEProxyConfigForCurrentUser
  907. (
  908. IN OUT WINHTTP_CURRENT_USER_IE_PROXY_CONFIG * pProxyConfig
  909. );
  910. //#if !defined(_WINERROR_)
  911. //
  912. // WinHttp API error returns
  913. //
  914. #define WINHTTP_ERROR_BASE 12000
  915. #define ERROR_WINHTTP_OUT_OF_HANDLES (WINHTTP_ERROR_BASE + 1)
  916. #define ERROR_WINHTTP_TIMEOUT (WINHTTP_ERROR_BASE + 2)
  917. #define ERROR_WINHTTP_INTERNAL_ERROR (WINHTTP_ERROR_BASE + 4)
  918. #define ERROR_WINHTTP_INVALID_URL (WINHTTP_ERROR_BASE + 5)
  919. #define ERROR_WINHTTP_UNRECOGNIZED_SCHEME (WINHTTP_ERROR_BASE + 6)
  920. #define ERROR_WINHTTP_NAME_NOT_RESOLVED (WINHTTP_ERROR_BASE + 7)
  921. #define ERROR_WINHTTP_INVALID_OPTION (WINHTTP_ERROR_BASE + 9)
  922. #define ERROR_WINHTTP_OPTION_NOT_SETTABLE (WINHTTP_ERROR_BASE + 11)
  923. #define ERROR_WINHTTP_SHUTDOWN (WINHTTP_ERROR_BASE + 12)
  924. #define ERROR_WINHTTP_LOGIN_FAILURE (WINHTTP_ERROR_BASE + 15)
  925. #define ERROR_WINHTTP_OPERATION_CANCELLED (WINHTTP_ERROR_BASE + 17)
  926. #define ERROR_WINHTTP_INCORRECT_HANDLE_TYPE (WINHTTP_ERROR_BASE + 18)
  927. #define ERROR_WINHTTP_INCORRECT_HANDLE_STATE (WINHTTP_ERROR_BASE + 19)
  928. #define ERROR_WINHTTP_CANNOT_CONNECT (WINHTTP_ERROR_BASE + 29)
  929. #define ERROR_WINHTTP_CONNECTION_ERROR (WINHTTP_ERROR_BASE + 30)
  930. #define ERROR_WINHTTP_RESEND_REQUEST (WINHTTP_ERROR_BASE + 32)
  931. #define ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED (WINHTTP_ERROR_BASE + 44)
  932. //
  933. // WinHttpRequest Component errors
  934. //
  935. #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN (WINHTTP_ERROR_BASE + 100)
  936. #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND (WINHTTP_ERROR_BASE + 101)
  937. #define ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND (WINHTTP_ERROR_BASE + 102)
  938. #define ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN (WINHTTP_ERROR_BASE + 103)
  939. //
  940. // HTTP API errors
  941. //
  942. #define ERROR_WINHTTP_HEADER_NOT_FOUND (WINHTTP_ERROR_BASE + 150)
  943. #define ERROR_WINHTTP_INVALID_SERVER_RESPONSE (WINHTTP_ERROR_BASE + 152)
  944. #define ERROR_WINHTTP_INVALID_HEADER (WINHTTP_ERROR_BASE + 153)
  945. #define ERROR_WINHTTP_INVALID_QUERY_REQUEST (WINHTTP_ERROR_BASE + 154)
  946. #define ERROR_WINHTTP_HEADER_ALREADY_EXISTS (WINHTTP_ERROR_BASE + 155)
  947. #define ERROR_WINHTTP_REDIRECT_FAILED (WINHTTP_ERROR_BASE + 156)
  948. //
  949. // additional WinHttp API error codes
  950. //
  951. //
  952. // additional WinHttp API error codes
  953. //
  954. #define ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR (WINHTTP_ERROR_BASE + 178)
  955. #define ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT (WINHTTP_ERROR_BASE + 166)
  956. #define ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT (WINHTTP_ERROR_BASE + 167)
  957. #define ERROR_WINHTTP_NOT_INITIALIZED (WINHTTP_ERROR_BASE + 172)
  958. #define ERROR_WINHTTP_SECURE_FAILURE (WINHTTP_ERROR_BASE + 175)
  959. //
  960. // Certificate security errors. These are raised only by the WinHttpRequest
  961. // component. The WinHTTP Win32 API will return ERROR_WINHTTP_SECURE_FAILE and
  962. // provide additional information via the WINHTTP_CALLBACK_STATUS_SECURE_FAILURE
  963. // callback notification.
  964. //
  965. #define ERROR_WINHTTP_SECURE_CERT_DATE_INVALID (WINHTTP_ERROR_BASE + 37)
  966. #define ERROR_WINHTTP_SECURE_CERT_CN_INVALID (WINHTTP_ERROR_BASE + 38)
  967. #define ERROR_WINHTTP_SECURE_INVALID_CA (WINHTTP_ERROR_BASE + 45)
  968. #define ERROR_WINHTTP_SECURE_CERT_REV_FAILED (WINHTTP_ERROR_BASE + 57)
  969. #define ERROR_WINHTTP_SECURE_CHANNEL_ERROR (WINHTTP_ERROR_BASE + 157)
  970. #define ERROR_WINHTTP_SECURE_INVALID_CERT (WINHTTP_ERROR_BASE + 169)
  971. #define ERROR_WINHTTP_SECURE_CERT_REVOKED (WINHTTP_ERROR_BASE + 170)
  972. #define ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE (WINHTTP_ERROR_BASE + 179)
  973. #define ERROR_WINHTTP_AUTODETECTION_FAILED (WINHTTP_ERROR_BASE + 180)
  974. #define ERROR_WINHTTP_HEADER_COUNT_EXCEEDED (WINHTTP_ERROR_BASE + 181)
  975. #define ERROR_WINHTTP_HEADER_SIZE_OVERFLOW (WINHTTP_ERROR_BASE + 182)
  976. #define ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW (WINHTTP_ERROR_BASE + 183)
  977. #define ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW (WINHTTP_ERROR_BASE + 184)
  978. #define ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY (WINHTTP_ERROR_BASE + 185)
  979. #define ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY (WINHTTP_ERROR_BASE + 186)
  980. #define WINHTTP_ERROR_LAST (WINHTTP_ERROR_BASE + 186)
  981. //#endif // !defined(_WINERROR_)
  982. #if defined(__cplusplus)
  983. }
  984. #endif
  985. /*
  986. * Return packing to whatever it was before we
  987. * entered this file
  988. */
  989. #include <poppack.h>
  990. #endif // !defined(_WINHTTPX_)