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.

365 lines
13 KiB

  1. #if !defined(_WINHTTPXEX_)
  2. #define _WINHTTPXEX_
  3. #if defined(__cplusplus)
  4. extern "C" {
  5. #endif
  6. #define INTERNETAPI
  7. // url-parsing flags added internally
  8. //#define WINHTTP_FLAG_DEFAULT_ESCAPE 0x00000010 //obloete because of WIHHTTP_FLAG_ESCAPE_DISABLE
  9. #define WINHTTP_FLAG_VALID_HOSTNAME 0x00000020 //only for server name; fast conversion is performed, no escaping
  10. // These flags are superseded by WINHTTP_OPTION_DISABLE_FEATURE
  11. #define INTERNET_FLAG_KEEP_CONNECTION 0x00400000 // use keep-alive semantics
  12. #define INTERNET_FLAG_NO_AUTO_REDIRECT 0x00200000 // don't handle redirections automatically
  13. #define INTERNET_FLAG_NO_COOKIES 0x00080000 // no automatic cookie handling
  14. #define INTERNET_FLAG_NO_AUTH 0x00040000 // no automatic authentication handling
  15. // WARNING: these flags may become unsupported or done in a different way.
  16. // Security Ignore Flags, Allow HttpOpenRequest to overide
  17. // Secure Channel (SSL) failures of the following types.
  18. #define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP 0x00008000 // ex: https:// to http://
  19. #define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS 0x00004000 // ex: http:// to https://
  20. #define SECURITY_INTERNET_MASK (SECURITY_FLAG_IGNORE_CERT_CN_INVALID | \
  21. SECURITY_FLAG_IGNORE_CERT_DATE_INVALID | \
  22. INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS | \
  23. INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP | \
  24. SECURITY_FLAG_IGNORE_UNKNOWN_CA | \
  25. SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE)
  26. // parameter validation masks
  27. #define WINHTTP_OPEN_FLAGS_MASK (WINHTTP_FLAG_ASYNC) // valid flags mask
  28. #define WINHTTP_CONNECT_FLAG_NO_INDICATION 0x00000001
  29. #define WINHTTP_CONNECT_FLAGS_MASK WINHTTP_CONNECT_FLAG_NO_INDICATION
  30. #define WINHTTP_OPEN_REQUEST_FLAGS_MASK (WINHTTP_FLAG_SECURE | \
  31. WINHTTP_FLAG_ESCAPE_PERCENT | \
  32. WINHTTP_FLAG_NULL_CODEPAGE | \
  33. WINHTTP_FLAG_BYPASS_PROXY_CACHE | \
  34. WINHTTP_FLAG_ESCAPE_DISABLE | \
  35. WINHTTP_FLAG_ESCAPE_DISABLE_QUERY)
  36. #define INTERNET_SCHEME_PARTIAL (-2)
  37. #define INTERNET_SCHEME_UNKNOWN (-1)
  38. #define INTERNET_SCHEME_DEFAULT (0)
  39. #define INTERNET_SCHEME_SOCKS (3)
  40. #define INTERNET_SCHEME_FIRST (INTERNET_SCHEME_HTTP)
  41. #define INTERNET_SCHEME_LAST (INTERNET_SCHEME_SOCKS)
  42. // WINHTTP_OPTION_VERSION is confusing, so we are killing it.
  43. #define WINHTTP_OPTION_VERSION 40
  44. #define WINHTTP_OPTION_ERROR_MASK 62
  45. // Pass in pointer to INTERNET_SECURITY_CONNECTION_INFO to be filled in.
  46. #define WINHTTP_OPTION_SECURITY_CONNECTION_INFO 66
  47. #define WINHTTP_LAST_OPTION_INTERNAL WINHTTP_LAST_OPTION
  48. #define WINHTTP_OPTION_MASK 0x0fff
  49. #define MAX_INTERNET_STRING_OPTION (WINHTTP_OPTION_PROXY_PASSWORD & WINHTTP_OPTION_MASK)
  50. #define NUM_INTERNET_STRING_OPTION (MAX_INTERNET_STRING_OPTION + 1)
  51. // values for WINHTTP_OPTION_ERROR_MASK
  52. #define INTERNET_ERROR_MASK_COMBINED_SEC_CERT 0x2
  53. #define WINHTTP_AUTH_SCHEME_KERBEROS 0x00000020
  54. // setable flags
  55. #define SECURITY_FLAG_CHECK_REVOCATION 0x00020000
  56. // Other than the define for all supported secure protocols in winhttp,
  57. // the single bit flags map directly to the SP_PROT_*_CLIENT flags
  58. // defined in schannel.h
  59. #define WINHTTP_CALLBACK_STATUS_BEGIN_PROXY_SCRIPT_RUN 0x00800000
  60. #define WINHTTP_CALLBACK_FLAG_BEGIN_PROXY_SCRIPT_RUN WINHTTP_CALLBACK_STATUS_BEGIN_PROXY_SCRIPT_RUN
  61. //ensure that WINHTTP_CALLBACK_FLAG_ALL always matches OR of all the CALLBACKFLAGS
  62. //
  63. // Note that adding any WINHTTP_QUERY_* codes here must be followed
  64. // by an equivlent line in wininet\http\hashgen\hashgen.cpp
  65. // please see that file for further information regarding
  66. // the addition of new HTTP headers
  67. //
  68. // These are not part of HTTP 1.1 yet. We will propose these to the
  69. // HTTP extensions working group. These are required for the client-caps support
  70. // we are doing in conjuntion with IIS.
  71. #define WINHTTP_QUERY_ECHO_REQUEST 71
  72. #define WINHTTP_QUERY_ECHO_REPLY 72
  73. // These are the set of headers that should be added back to a request when
  74. // re-doing a request after a RETRY_WITH response.
  75. #define WINHTTP_QUERY_ECHO_HEADERS 73
  76. #define WINHTTP_QUERY_ECHO_HEADERS_CRLF 74
  77. #define HTTP_QUERY_MODIFIER_FLAGS_MASK (WINHTTP_QUERY_FLAG_REQUEST_HEADERS \
  78. | WINHTTP_QUERY_FLAG_SYSTEMTIME \
  79. | WINHTTP_QUERY_FLAG_NUMBER \
  80. )
  81. #define HTTP_QUERY_HEADER_MASK (~HTTP_QUERY_MODIFIER_FLAGS_MASK)
  82. //
  83. // AR_TYPE - Asynchronous Request Type designator. Used as index into array of
  84. // ARB sizes, hence must start at 0
  85. //
  86. typedef enum {
  87. AR_INTERNET_CONNECT = 0, // 0
  88. AR_INTERNET_OPEN_URL, // 1
  89. AR_INTERNET_READ_FILE, // 2
  90. AR_INTERNET_WRITE_FILE, // 3
  91. AR_INTERNET_QUERY_DATA_AVAILABLE, // 4
  92. AR_INTERNET_FIND_NEXT_FILE, // 5
  93. AR_FTP_FIND_FIRST_FILE, // 6
  94. AR_FTP_GET_FILE, // 7
  95. AR_FTP_PUT_FILE, // 8
  96. AR_FTP_DELETE_FILE, // 9
  97. AR_FTP_RENAME_FILE, // 10
  98. AR_FTP_OPEN_FILE, // 11
  99. AR_FTP_CREATE_DIRECTORY, // 12
  100. AR_FTP_REMOVE_DIRECTORY, // 13
  101. AR_FTP_SET_CURRENT_DIRECTORY, // 14
  102. AR_FTP_GET_CURRENT_DIRECTORY, // 15
  103. AR_GOPHER_FIND_FIRST_FILE, // 16
  104. AR_GOPHER_OPEN_FILE, // 17
  105. AR_GOPHER_GET_ATTRIBUTE, // 18
  106. AR_HTTP_SEND_REQUEST, // 19
  107. AR_HTTP_BEGIN_SEND_REQUEST, // 20
  108. AR_HTTP_END_SEND_REQUEST, // 21
  109. AR_READ_PREFETCH, // 22
  110. AR_SYNC_EVENT, // 23
  111. AR_TIMER_EVENT, // 24
  112. AR_HTTP_REQUEST1, // 25
  113. AR_FILE_IO, // 26
  114. AR_INTERNET_READ_FILE_EX, // 27
  115. AR_MAX_REQUEST_TYPE
  116. } AR_TYPE;
  117. #define ERROR_WINHTTP_INCORRECT_PASSWORD (WINHTTP_ERROR_BASE + 14)
  118. #define ERROR_WINHTTP_NOT_REDIRECTED (WINHTTP_ERROR_BASE + 160)
  119. // WinHttp Auto-Proxy Svc event messages
  120. #define WINHTTP_AUTOPROXY_SVC_MSG_BASE (WINHTTP_ERROR_BASE + 500)
  121. #define MSG_WINHTTP_AUTOPROXY_SVC_DATA_CORRUPT (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 1)
  122. #define MSG_WINHTTP_AUTOPROXY_SVC_IDLE_TIMEOUT (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 3)
  123. #define MSG_WINHTTP_AUTOPROXY_SVC_WIN32_ERROR (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 6)
  124. #define MSG_WINHTTP_AUTOPROXY_SVC_FAILED_ALLOCATE_RESOURCE (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 7)
  125. #define MSG_WINHTTP_AUTOPROXY_SVC_NON_LRPC_REQUEST (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 9)
  126. #define MSG_WINHTTP_AUTOPROXY_SVC_TIMEOUT_GRACEFUL_SHUTDOWN (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 11)
  127. #define MSG_WINHTTP_AUTOPROXY_SVC_INVALID_PARAMETER (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 12)
  128. #define MSG_WINHTTP_AUTOPROXY_SVC_NOT_IN_SERVICE (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 13)
  129. #define MSG_WINHTTP_AUTOPROXY_SVC_WINHTTP_EXCEPTED (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 14)
  130. #define MSG_WINHTTP_AUTOPROXY_SVC_RETRY_REQUEST (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 16)
  131. #define MSG_WINHTTP_AUTOPROXY_SVC_SUSPEND_OPERATION (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 17)
  132. #define MSG_WINHTTP_AUTOPROXY_SVC_RESUME_OPERATION (WINHTTP_AUTOPROXY_SVC_MSG_BASE + 18)
  133. #if defined(INCLUDE_CACHE)
  134. // Cache control flags
  135. // Control expiry behaviour
  136. #define CACHE_FLAG_SYNC_MODE_AUTOMATIC 0x00000010
  137. #define CACHE_FLAG_SYNC_MODE_ALWAYS 0x00000020
  138. #define CACHE_FLAG_SYNC_MODE_ONCE_PER_SESSION 0x00000040
  139. #define CACHE_FLAG_SYNC_MODE_NEVER 0x00000080
  140. #define CACHE_FLAG_BGUPDATE 0x00000100
  141. #define CACHE_FLAG_ALWAYS_RESYNCHRONIZE 0x00000200
  142. #define CACHE_FLAG_DISABLE_CACHE_WRITE 0x00000400
  143. #define CACHE_FLAG_DISABLE_CACHE_READ 0x00000800
  144. #define CACHE_FLAG_DISABLE_SSL_CACHING 0x00001000
  145. #define CACHE_FLAG_MAKE_PERSISTENT 0x00002000
  146. #define CACHE_FLAG_FWD_BACK 0x00004000
  147. #define CACHE_FLAG_OFFLINE_BROWSING CACHE_FLAG_DISABLE_CACHE_READ | CACHE_FLAG_DISABLE_CACHE_WRITE
  148. #define CACHE_FLAG_DEFAULT_SETTING CACHE_FLAG_SYNC_MODE_AUTOMATIC
  149. #define WINHTTP_CACHE_FLAGS_MASK ( CACHE_FLAG_SYNC_MODE_AUTOMATIC | \
  150. CACHE_FLAG_SYNC_MODE_ALWAYS | \
  151. CACHE_FLAG_SYNC_MODE_ONCE_PER_SESSION | \
  152. CACHE_FLAG_SYNC_MODE_NEVER | \
  153. CACHE_FLAG_BGUPDATE | \
  154. CACHE_FLAG_ALWAYS_RESYNCHRONIZE | \
  155. CACHE_FLAG_DISABLE_CACHE_WRITE | \
  156. CACHE_FLAG_DISABLE_CACHE_READ | \
  157. CACHE_FLAG_MAKE_PERSISTENT | \
  158. CACHE_FLAG_FWD_BACK | \
  159. CACHE_FLAG_OFFLINE_BROWSING | \
  160. CACHE_FLAG_DEFAULT_SETTING)
  161. #undef WINHTTP_OPEN_FLAGS_MASK
  162. #define WINHTTP_OPEN_FLAGS_MASK (WINHTTP_CACHE_FLAGS_MASK | \
  163. WINHTTP_FLAG_ASYNC)
  164. WINHTTPAPI
  165. HINTERNET
  166. WINAPI
  167. WinHttpCacheOpen(
  168. IN LPCWSTR pszAgentW,
  169. IN DWORD dwAccessType,
  170. IN LPCWSTR pszProxyW OPTIONAL,
  171. IN LPCWSTR pszProxyBypassW OPTIONAL,
  172. IN DWORD dwFlags
  173. );
  174. WINHTTPAPI
  175. HINTERNET
  176. WINAPI
  177. WinHttpCacheConnect(
  178. HINTERNET hSession,
  179. LPCWSTR pswzServerName,
  180. INTERNET_PORT nServerPort,
  181. DWORD dwReserved
  182. );
  183. WINHTTPAPI
  184. HINTERNET
  185. WINAPI
  186. WinHttpCacheOpenRequest(
  187. IN HINTERNET hConnect,
  188. IN LPCWSTR lpszVerb,
  189. IN LPCWSTR lpszObjectName,
  190. IN LPCWSTR lpszVersion,
  191. IN LPCWSTR lpszReferrer OPTIONAL,
  192. IN LPCWSTR FAR * lplpszAcceptTypes OPTIONAL,
  193. IN DWORD dwFlags
  194. );
  195. BOOLAPI
  196. WinHttpCacheSendRequest(
  197. IN HINTERNET hRequest,
  198. IN LPCWSTR lpszHeaders,
  199. IN DWORD dwHeadersLength,
  200. IN LPVOID lpOptional,
  201. IN DWORD dwOptionalLength,
  202. IN DWORD dwTotalLength,
  203. IN DWORD_PTR dwContext
  204. );
  205. BOOLAPI
  206. WinHttpCacheReceiveResponse(
  207. IN HINTERNET hRequest,
  208. IN LPVOID lpBuffersOut
  209. );
  210. BOOLAPI
  211. WinHttpCacheQueryDataAvailable(
  212. IN HINTERNET hRequest,
  213. OUT LPDWORD lpdwNumberOfBytesAvailable
  214. );
  215. BOOLAPI
  216. WinHttpCacheReadData(
  217. IN HINTERNET hRequest,
  218. IN LPVOID lpBuffer,
  219. IN DWORD dwNumberOfBytesToRead,
  220. OUT LPDWORD lpdwNumberOfBytesRead
  221. );
  222. BOOLAPI
  223. WinHttpCacheCloseHandle(
  224. IN HINTERNET hInternet
  225. );
  226. BOOL
  227. WINAPI
  228. WinHttpCacheQueryOption(
  229. HINTERNET hInternet,
  230. DWORD dwOption,
  231. LPVOID lpBuffer,
  232. LPDWORD lpdwBufferLength
  233. );
  234. BOOL
  235. WINAPI
  236. WinHttpCacheSetOption(
  237. HINTERNET hInternet,
  238. DWORD dwOption,
  239. LPVOID lpBuffer,
  240. DWORD dwBufferLength
  241. );
  242. BOOL
  243. WINAPI
  244. WinHttpCacheQueryHeaders(
  245. IN HINTERNET hRequest,
  246. IN DWORD dwInfoLevel,
  247. IN LPCWSTR lpszName OPTIONAL,
  248. OUT LPVOID lpBuffer OPTIONAL,
  249. IN OUT LPDWORD lpdwBufferLength,
  250. IN OUT LPDWORD lpdwIndex OPTIONAL
  251. );
  252. BOOL
  253. WINAPI
  254. WinHttpCacheAddRequestHeaders(
  255. IN HINTERNET hRequest,
  256. IN LPCWSTR lpszHeaders,
  257. IN DWORD dwHeadersLength,
  258. IN DWORD dwModifiers
  259. );
  260. BOOL
  261. WINAPI
  262. WinHttpCacheQueryAuthSchemes(
  263. IN HINTERNET hRequest,
  264. OUT LPDWORD lpdwSupportedSchemes,
  265. OUT LPDWORD lpdwFirstScheme,
  266. OUT LPDWORD pdwAuthTarget
  267. );
  268. BOOL
  269. WINAPI
  270. WinHttpCacheSetCredentials(
  271. IN HINTERNET hRequest,
  272. IN DWORD AuthTargets,
  273. IN DWORD AuthScheme,
  274. IN LPCWSTR pwszUserName,
  275. IN LPCWSTR pwszPassword,
  276. IN LPVOID pAuthParams
  277. );
  278. BOOL
  279. WINAPI
  280. WinCacheHttpSetTimeouts(
  281. IN HINTERNET hInternet,
  282. IN int nResolveTimeout,
  283. IN int nConnectTimeout,
  284. IN int nSendTimeout,
  285. IN int nReceiveTimeout
  286. );
  287. BOOL
  288. WINAPI
  289. WinCacheHttpWriteData(
  290. IN HINTERNET hFile,
  291. IN LPCVOID lpBuffer,
  292. IN DWORD dwNumberOfBytesToWrite,
  293. OUT LPDWORD lpdwNumberOfBytesWritten
  294. );
  295. WINHTTP_STATUS_CALLBACK
  296. WINAPI
  297. WinHttpCacheSetStatusCallback(
  298. IN HINTERNET hInternet,
  299. IN WINHTTP_STATUS_CALLBACK lpfnInternetCallback,
  300. IN DWORD dwNotificationFlags,
  301. IN DWORD_PTR dwReserved
  302. );
  303. VOID
  304. WinHttpCacheStatusCallback(
  305. HINTERNET hInternet,
  306. DWORD_PTR dwContext,
  307. DWORD dwInternetStatus,
  308. LPVOID lpvStatusInformation,
  309. DWORD dwStatusInformationLength
  310. );
  311. #endif
  312. #if defined(__cplusplus)
  313. }
  314. #endif
  315. #endif // !define(_WINHTTPXEX_)