Source code of Windows XP (NT5)
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.

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