Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1167 lines
41 KiB

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